arch/pkg/de-p1st-mkinitcpio/mkinitcpio.conf.holoscript

26 lines
775 B
Plaintext
Raw Normal View History

#!/bin/sh
# stdin: default config
# stdout: modified config
2021-05-03 13:26:54 +02:00
# save stdin (content of /etc/mkinitcpio.conf) in variable
stdin=$(cat)
# assert MODULES is empty
2021-05-03 13:26:54 +02:00
echo "$stdin" | grep '^MODULES=()'
# assert HOOKS is as expected
echo "$stdin" | grep '^HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)'
# assert no COMPRESSION option is enabled yet
! echo "$stdin" | grep '^COMPRESSION='
# assert lz4 COMPRESSION is uncommented
echo "$stdin" | grep '^#COMPRESSION="lz4"'
# 1) add to MODULES; 2 replace HOOKS; 3) uncomment lz4 COMPRESSION
sed '
s|^MODULES=(|MODULES=(crc32c-intel |;
s|^#COMPRESSION="lz4".*$|COMPRESSION="lz4"|;
2021-05-03 22:17:59 +02:00
s|^HOOKS=(.*$|HOOKS=(base udev modconf block keyboard keymap encrypt lvm2 btrfs filesystems fsck resume)|
2021-05-03 13:26:54 +02:00
' <<< "$stdin"