X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=keyscript-off;h=1cf19b0d24e6c782216986421264c238ad1f1826;hb=6f1f8a104c9b38936ade2d27e835479523985133;hp=ed16201539d206d4feef442c32c685e846e636ad;hpb=aa5f34ec8f63eb7e893836f8c78890dbecf1373e;p=distro-setup diff --git a/keyscript-off b/keyscript-off index ed16201..1cf19b0 100755 --- a/keyscript-off +++ b/keyscript-off @@ -16,25 +16,27 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR -[[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE}" "$@" +[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" if [[ $- != *i* ]]; then exec &>/var/log/keyscript-off.log echo "$0: starting. $(date)" fi +sed="sed --follow-symlinks" -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=/#\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},#decrypt_keyctl,#" /etc/crypttab + update-initramfs -u fi fi # switch to easy or hard pass which is the same as luks f=/q/root/shadow/traci -[[ $HOSTNAME != tp ]] || usermod -p "$(cat $f)" ian +[[ $HOSTNAME != tpnew ]] || usermod -p "$(cat $f)" iank echo "$0: finished. $(date)"