various fixes and improvements
[distro-setup] / keyscript-off
index ed16201539d206d4feef442c32c685e846e636ad..9f6ab0f72e1eabe690db9339fd7386a3ed419d93 100755 (executable)
@@ -22,19 +22,22 @@ 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
 
 # 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)"