bunch of etiona updates
[automated-distro-installer] / pxe-server
index c46c72eb34c1141433f9e8c3c177ab448f034d14..e6680883201c5f11d4a096120a779e4dfb25c852 100755 (executable)
@@ -61,6 +61,11 @@ EOF
   exit $1
 }
 
+pre="${0##*/}:"
+m() { printf "$pre %s\n"  "$*"; "$@"; }
+e() { printf "$pre %s\n"  "$*"; }
+err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $pre: $*" >&2; }
+
 ##### begin command line parsing ########
 
 dhcp=true
@@ -125,11 +130,6 @@ fi
 
 ##### end command line parsing ########
 
-e() {
-  echo "$@"
-  "$@"
-}
-
 archlike() {
   cat <<EOF
 dhcp-option-force=209,boot/syslinux/${type}iso.cfg
@@ -154,7 +154,7 @@ EOF
 
 ack-wait() {
   if $fsf; then
-    wait_cmd="ssh tarantula tail -n0 -f /var/log/syslog"
+    wait_cmd="ssh tarantula.office.fsf.org tail -n0 -f /var/log/syslog"
   else
     wait_cmd="ssh wrt logread -f"
   fi
@@ -174,28 +174,28 @@ ack-wait() {
       echo $line
     fi
   done < <($wait_cmd ||:) # tail returns 2 it seems
-  e sleep 20
+  m sleep 20
 }
 
 set-pxe() {
   $dhcp || return 0
   if $fsf; then
     if [[ ! $cmd ]]; then
-      echo "$0: removing pxe for $host on tarantula"
-      ssh tarantula bash -e <<EOF
+      e "removing pxe for $host on tarantula"
+      ssh tarantula.office.fsf.org bash -e <<EOF
 sed -ri 's/^( *host +$host *\{).*/\1/' /etc/dhcp3/dhcpd.conf
 /etc/init.d/dhcp3-server restart
 EOF
     elif [[ $cmd == fai ]]; then
-      echo "$0: adding pxe for $host on tarantula"
-      ssh tarantula bash -e <<EOF
+      e "adding pxe for $host on tarantula"
+      ssh tarantula.office.fsf.org bash -e <<EOF
 sed -ri 's/^( *host +$host *\{).*/\1 next-server faiserver.office.fsf.org; filename "pxelinux.0";/' /etc/dhcp3/dhcpd.conf
 /etc/init.d/dhcp3-server restart
 EOF
     fi
   else
-    echo "$0: updating dnsmasq.conf:"
-    $cmd
+    e "updating dnsmasq.conf:"
+    $cmd
     ${cmd:-:}|ssh wrt "cedit pxe /etc/dnsmasq.conf || /etc/init.d/dnsmasq restart
 $([[ $type == arch || $type == parabola ]] && echo archlike-pxe-mount)"
   fi
@@ -205,9 +205,9 @@ $([[ $type == arch || $type == parabola ]] && echo archlike-pxe-mount)"
 if $set; then
   set-pxe
   if [[ $type == fai ]]; then
-    e myfai-chboot ${chboot_args[@]} $host
+    m myfai-chboot ${chboot_args[@]} $host
     if $redep; then
-      e fai-redep
+      m fai-redep
     fi
   else
     # This will fail if faiserver is not setup, so ignore any