fix bug in turning off auto-decrypt
authorIan Kelling <ian@iankelling.org>
Tue, 9 Aug 2016 05:38:32 +0000 (22:38 -0700)
committerIan Kelling <ian@iankelling.org>
Mon, 6 Feb 2017 06:21:41 +0000 (22:21 -0800)
chboot
dsfull

diff --git a/chboot b/chboot
index 609b41dc758b1f49dd51736d58d570a6ef5a2104..884b2a55f80478fb6f0f0d47c489efc1b8bde5ab 100755 (executable)
--- a/chboot
+++ b/chboot
@@ -63,6 +63,6 @@ e umount $mount_point
 e rmdir $mount_point
 
 if $reboot; then
-    systemctl stop keyscriptoff.service
+    touch /tmp/keyscript-off
     reboot now
 fi
diff --git a/dsfull b/dsfull
index f141bc508a2f7a7012f96aaa06ea96f99cee8296..c5cb230546219ffd0d9198e0fcf6892ee07f905d 100755 (executable)
--- a/dsfull
+++ b/dsfull
@@ -7,6 +7,12 @@
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
+reboot=true
+if [[ $1 == -r ]]; then
+    reboot=false
+    shift
+fi
+
 host=$1
 
 if [[ ! $host || $host == -h ]]; then
@@ -15,14 +21,15 @@ if [[ ! $host || $host == -h ]]; then
 fi
 
 set -x
-ssh $host sudo bash <<'EOF'
-set -e
-systemctl stop keyscriptoff.service
+if $reboot; then
+    ssh $host sudo bash <<'EOF' || [[ $? == 255 ]]
+touch /tmp/keyscript-off
 reboot ||:
 EOF
+fi
 
 pxe-server fai $host
 while ! ssh $host :; do
-      sleep 5
+    sleep 5
 done
 dsremote $host