mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-24 01:16:05 +01:00
26 lines
768 B
Bash
26 lines
768 B
Bash
#!/bin/sh
|
|
# stdin: default config
|
|
# stdout: modified config
|
|
|
|
# save stdin (content of /etc/mkinitcpio.conf) in variable
|
|
stdin=$(cat)
|
|
|
|
# MODULES is empty
|
|
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"|;
|
|
s|^HOOKS=(.*$|HOOKS=(base udev modconf block keyboard keymap encrypt lvm2 btrfs filesystems fsck resume)|
|
|
' <<< "$stdin"
|