X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=pxe-server;h=bba53e6cbfbc462d7b824ef2454f413ad330bcef;hb=4029016168015c3aa0accc909c3cff28cf87b929;hp=0bdd13401e4238995ca0ccec985c0ca88d7ddf73;hpb=2eebb95531424e04797094d622eebdd7ece5b38b;p=automated-distro-installer diff --git a/pxe-server b/pxe-server index 0bdd134..bba53e6 100755 --- a/pxe-server +++ b/pxe-server @@ -28,22 +28,36 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR usage() { cat < tftpboot + + Note: Uses GNU getopt options parsing style EOF exit $1 @@ -51,7 +65,6 @@ EOF ##### begin command line parsing ######## -args=() redep=true acks=2 wait=false @@ -68,12 +81,16 @@ while true; do esac done -read type host <<<"$@" +read -r host type <<<"$@" -if [[ ! $type ]]; then - echo "$0: error: exptected 1 argument of type" - usage 1 -fi +case $# in + 0|2);; + *) + echo "$0: error: expected 0 or 2 arguments" + echo + usage 1 + ;; +esac if [[ $host ]]; then host_tag="tag:$host," @@ -104,8 +121,7 @@ EOF fai() { cat </dev/null ||: fi fi @@ -150,7 +168,8 @@ if $wait; then # bleh. echo "waiting for $acks dhcp acks then disabling pxe" ack-wait $acks - set-pxe : + type= + set-pxe # previously tried waiting for one more ack then disabling faiserver, # since it can contain sensitive info, so turn it off when not in use,