X-Git-Url: https://iankelling.org/git/?p=automated-distro-installer;a=blobdiff_plain;f=dsfull;h=1fea3bce6a7b4cf49464a9715d8a73d1b0d39e1f;hp=5d50eab67da525f951d40f227c051d9a1c9d7baf;hb=c4337bdfa287cb3160b294d58c64b51f870117ea;hpb=23bf2f3666becf9d3c219af1eaea08b4cf843492 diff --git a/dsfull b/dsfull index 5d50eab..1fea3bc 100755 --- a/dsfull +++ b/dsfull @@ -1,10 +1,11 @@ #!/bin/bash -l # Copyright (C) 2016 Ian Kelling -# 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 -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 @@ -25,8 +26,20 @@ if $reboot; then ssh $host "touch /tmp/keyscript-off; sudo reboot" ||: 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 +if $timeout; then + echo "$0: error: timeout" + exit 1 +fi dsremote $host