fix docker group, add public nfs
[automated-distro-installer] / pxe-server
index 9e74eeb757a030c9a367fabb3c8440597188d043..bba53e6cbfbc462d7b824ef2454f413ad330bcef 100755 (executable)
@@ -31,16 +31,10 @@ usage() {
 Usage: ${0##*/} [OPTIONS] [HOST TYPE]
 Configure dnsmasq pxe server options and fai-chboot if appropriate.
 
-
 Without HOST TYPE, disable pxe server and fai server.
-TYPE is one of arch, plain, fai.
-HOST is a hostname known to the dhcp server, or default for all
-Note, when switching between plain and arch, you will need to
-do something like:
-ssh wrt
-cd /mnt/usb
-rm tftpboot
-ln -s <arch/debian iso dir> tftpboot
+
+HOST       A hostname known to the dhcp server, or default for all.
+TYPE       One of arch, plain, fai.
 
 
 -r         Don't redeploy fai config. For example, if there is a different host
@@ -56,6 +50,14 @@ ln -s <arch/debian iso dir> tftpboot
 -h|--help  Print help and exit
 
 
+Note, when switching between plain and arch, you will need to
+do something like:
+ssh wrt
+cd /mnt/usb
+rm tftpboot
+ln -s <arch/debian iso dir> tftpboot
+
+
 Note: Uses GNU getopt options parsing style
 EOF
     exit $1
@@ -63,7 +65,6 @@ EOF
 
 ##### begin command line parsing ########
 
-args=()
 redep=true
 acks=2
 wait=false
@@ -80,7 +81,7 @@ while true; do
     esac
 done
 
-read host type <<<"$@"
+read -r host type <<<"$@"
 
 case $# in
     0|2);;
@@ -120,7 +121,6 @@ EOF
 
 fai() {
     cat <<EOF
-$set_host_tag
 dhcp-boot=${host_tag}pxelinux.0,faiserver.lan,faiserver.lan
 EOF
 }
@@ -132,8 +132,7 @@ ack-wait() {
     fi
     regex=".*DHCPACK.*$host_regex$"
     i=0
-    tmp=$(mktemp)
-    while (( i != wait_count )) && read line; do
+    while (( i != wait_count )) && read -r line; do
         if [[ $line =~ $regex ]]; then
             i=$((i+1))
             echo $line
@@ -156,7 +155,9 @@ if $set; then
             e fai-redep
         fi
     else
-        e myfai-chboot
+        # This will fail if faiserver is not setup, so ignore any
+        # failure and don't bother us about it.
+        myfai-chboot &>/dev/null ||:
     fi
 fi