fixup initial faiserver bootstrap & small bugs
[automated-distro-installer] / dsfull
diff --git a/dsfull b/dsfull
index f141bc508a2f7a7012f96aaa06ea96f99cee8296..5d50eab67da525f951d40f227c051d9a1c9d7baf 100755 (executable)
--- a/dsfull
+++ b/dsfull
@@ -1,12 +1,17 @@
 #!/bin/bash -l
 # Copyright (C) 2016 Ian Kelling
-# This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
 
 # distro setup full. (assuming we already synced data files to the host)
 
 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 +20,13 @@ if [[ ! $host || $host == -h ]]; then
 fi
 
 set -x
-ssh $host sudo bash <<'EOF'
-set -e
-systemctl stop keyscriptoff.service
-reboot ||:
-EOF
+if $reboot; then
+    # untested, this caused hang using here doc.
+    ssh $host "touch /tmp/keyscript-off; sudo reboot" ||:
+fi
 
 pxe-server fai $host
 while ! ssh $host :; do
-      sleep 5
+    sleep 5
 done
 dsremote $host