X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=keyscript-off;h=c4ac8d52eeeab9e3109fa31070d31c76b6910026;hb=6839d9f20561f21d773dc17587c6b026bfebef5e;hp=ed16201539d206d4feef442c32c685e846e636ad;hpb=ed54781df7f0b6259c3b5d2cdc953f281b90b398;p=distro-setup diff --git a/keyscript-off b/keyscript-off index ed16201..c4ac8d5 100755 --- a/keyscript-off +++ b/keyscript-off @@ -22,15 +22,18 @@ if [[ $- != *i* ]]; then echo "$0: starting. $(date)" fi -if [[ $(sed -rn 's/^ID=(.*)/\1/p' /etc/os-release) == arch ]]; then +sed="sed --follow-symlinks" + +if [[ $($sed -rn 's/^ID=(.*)/\1/p' /etc/os-release) == arch ]]; then if grep -q '^\s*FILES=' /etc/mkinitcpio.conf; then - sed -ri --follow-symlinks 's/^\s*FILES=/#\0/' /etc/mkinitcpio.conf # comment out + $sed -ri 's/^\s*FILES=/#\0/' /etc/mkinitcpio.conf # comment out mkinitcpio -p linux fi else - if grep -q '/root/keyscript-manual' /etc/crypttab; then - sed -i --follow-symlinks 's#/root/keyscript,#/root/keyscript-manual,#' /etc/crypttab - update-initramfs -u + x=/root/keyscript + if grep -q "${x}," /etc/crypttab; then + $sed -i "s#${x},#${x}-manual,#" /etc/crypttab + update-initramfs -u fi fi