X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=keyscript-on;h=54a655cbec0eddc8ef83313b0d4d484ce24b72b4;hb=6a00cb7fd60392cb2aa1343af02b5d95a5e6241f;hp=71e19f0500f16d519a6997892b47bc25bf88e8d2;hpb=aa5f34ec8f63eb7e893836f8c78890dbecf1373e;p=distro-setup diff --git a/keyscript-on b/keyscript-on index 71e19f0..54a655c 100755 --- a/keyscript-on +++ b/keyscript-on @@ -23,16 +23,19 @@ if [[ $- != *i* ]]; then fi rootn=1 +sed="sed --follow-symlinks" + if [[ ! -e /tmp/keyscript-off ]]; then - if [[ $(sed -rn 's/^ID=(.*)/\1/p' /etc/os-release) == arch ]]; then + 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=.*)/\1/' /etc/mkinitcpio.conf # uncomment + $sed -ri 's/^#(\s*FILES=.*)/\1/' /etc/mkinitcpio.conf # uncomment mkinitcpio -p linux fi else - if grep -q '/root/keyscript,' /etc/crypttab; then - sed -i --follow-symlinks 's#/root/keyscript-manual,#/root/keyscript,#' /etc/crypttab - update-initramfs -u + x=/root/keyscript + if grep -q "${x}-manual," /etc/crypttab; then + $sed -i "s#${x}-manual,#${x},#" /etc/crypttab + update-initramfs -u fi fi fi