iankelling.org
/
git
/
automated-distro-installer
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix pxe server leaving background procs
[automated-distro-installer]
/
dsfull
diff --git
a/dsfull
b/dsfull
index 44588bab377722cd45d102afa7492636bf929120..1fea3bce6a7b4cf49464a9715d8a73d1b0d39e1f 100755
(executable)
--- a/
dsfull
+++ b/
dsfull
@@
-1,11
+1,11
@@
#!/bin/bash -l
# Copyright (C) 2016 Ian Kelling
#!/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)
+# distro setup full
using fai
. (assuming we already synced data files to the host)
set -eE -o pipefail
set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+cleanup() { :; }
+trap 'cleanup; echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
reboot=true
if [[ $1 == -r ]]; then
reboot=true
if [[ $1 == -r ]]; then
@@
-22,14
+22,24
@@
fi
set -x
if $reboot; then
set -x
if $reboot; then
- ssh $host sudo bash <<'EOF' || [[ $? == 255 ]]
-touch /tmp/keyscript-off
-reboot
-EOF
+ # untested, this caused hang using here doc.
+ ssh $host "touch /tmp/keyscript-off; sudo reboot" ||:
fi
fi
-pxe-server fai $host
-while ! ssh $host :; do
+cleanup() { pxe-server :; }
+pxe-server -a fai $host
+cleanup() { :; }
+
+timedout=true
+for ((i=0; i<240; i++)); do
+ if timeout -s 9 10 ssh $host :; then
+ timedout=false
+ break
+ fi
sleep 5
done
sleep 5
done
+if $timeout; then
+ echo "$0: error: timeout"
+ exit 1
+fi
dsremote $host
dsremote $host