[25806] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r25241 - trunk/debathena/scripts/installer/pxe/stage1/debathena

daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Sat Jul 16 10:54:21 2011

Date: Sat, 16 Jul 2011 10:54:15 -0400
From: Geoffrey Thomas <geofft@MIT.EDU>
Message-Id: <201107161454.p6GEsFdb004782@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: geofft
Date: 2011-07-16 10:54:14 -0400 (Sat, 16 Jul 2011)
New Revision: 25241

Modified:
   trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
Log:
installer: Quote moar

Modified: trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh	2011-07-16 14:20:24 UTC (rev 25240)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh	2011-07-16 14:54:14 UTC (rev 25241)
@@ -25,7 +25,7 @@
   # First make sure we're talking to who we think we are
   havedns=n
   ipprompt="Enter IP address:"
-  if [ "$(wget -qO - $dnscgi"/q")" = "Debathena DNS-CGI" ]; then
+  if [ "$(wget -qO - "$dnscgi/q")" = "Debathena DNS-CGI" ]; then
     havedns=y
     ipprompt="Enter IP address or hostname:"
   fi
@@ -44,24 +44,24 @@
 	continue
       fi
       echo "Looking up IP for $HOSTNAME..."
-      dig="$(wget -qO - $dnscgi"/a/$HOSTNAME")"
-      if echo $dig | grep -q '^OK:'; then
+      dig="$(wget -qO - "$dnscgi/a/$HOSTNAME")"
+      if echo "$dig" | grep -q '^OK:'; then
 	IPADDR="$(echo "$dig" | sed 's/^OK: //')"
 	echo "Found $IPADDR..."
       else
-	echo $dig
+	echo "$dig"
 	echo "Could not look up IP address for $HOSTNAME.  Try again."
       fi
     fi
   done
 
   if [ -z "$HOSTNAME" ] && [ "$havedns" = "y" ]; then
-    dig="$(wget -qO - $dnscgi"/ptr/$IPADDR")"
-    if echo $dig | grep -q '^OK:'; then
+    dig="$(wget -qO - "$dnscgi/ptr/$IPADDR")"
+    if echo "$dig" | grep -q '^OK:'; then
       HOSTNAME="$(echo "$dig" | sed 's/^OK: //')"
       echo "$IPADDR reverse-resolves to $HOSTNAME..."
     else
-      echo $dig
+      echo "$dig"
       echo "Could not look up hostname for $IPADDR.  Oh well..."
     fi
   fi
@@ -69,13 +69,13 @@
       HOSTNAME=install-target-host
   fi
   
-  HOSTNAME="$(echo $HOSTNAME | tr A-Z a-z | sed 's/\.MIT\.EDU$//')"
+  HOSTNAME="$(echo "$HOSTNAME" | tr A-Z a-z | sed 's/\.MIT\.EDU$//')"
 
-  NETMASK=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\  -f 1`
-  net=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\  -f 2`
-  bc=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\  -f 3`
-  GATEWAY=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\  -f 4`
-  maskbits=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\  -f 5`
+  NETMASK=`$mp/athena/netparams -f $mp/athena/masks "$IPADDR"|cut -d\  -f 1`
+  net=`$mp/athena/netparams -f $mp/athena/masks "$IPADDR"|cut -d\  -f 2`
+  bc=`$mp/athena/netparams -f $mp/athena/masks "$IPADDR"|cut -d\  -f 3`
+  GATEWAY=`$mp/athena/netparams -f $mp/athena/masks "$IPADDR"|cut -d\  -f 4`
+  maskbits=`$mp/athena/netparams -f $mp/athena/masks "$IPADDR"|cut -d\  -f 5`
 
   echo "Address: $IPADDR"
   echo
@@ -89,9 +89,9 @@
     case $response in
       y|Y|"") ;;
       *) 
-      echo -n "Netmask bits [$maskbits]: "; read r; if [ "$r" ] ; then maskbits=$r ; fi
-      echo -n "Broadcast [$bc]: "; read r; if [ "$r" ] ; then bc=$r ; fi
-      echo -n "Gateway [$GATEWAY]: "; read r; if [ "$r" ] ; then GATEWAY=$r ; fi
+      echo -n "Netmask bits [$maskbits]: "; read r; if [ -n "$r" ] ; then maskbits=$r ; fi
+      echo -n "Broadcast [$bc]: "; read r; if [ -n "$r" ] ; then bc=$r ; fi
+      echo -n "Gateway [$GATEWAY]: "; read r; if [ -n "$r" ] ; then GATEWAY=$r ; fi
     esac
   fi
 
@@ -104,11 +104,11 @@
   echo "Running: ip addr flush dev eth0"
   ip addr flush dev eth0
   echo "Running: ip addr add $IPADDR/$maskbits broadcast $bc dev eth0"
-  ip addr add $IPADDR/$maskbits broadcast $bc dev eth0
+  ip addr add "$IPADDR/$maskbits" broadcast "$bc" dev eth0
   echo "Flushing old default route."
   route delete default 2> /dev/null
   echo "Running: route add default gw $GATEWAY"
-  route add default gw $GATEWAY
+  route add default gw "$GATEWAY"
   echo "Replacing installer DHCP nameserver with MIT nameservers."
   sed -e '/nameserver/s/ .*/ 18.72.0.3/' < /etc/resolv.conf > /etc/resolv.conf.new
   echo "nameserver	18.70.0.160" >> /etc/resolv.conf.new
@@ -235,7 +235,7 @@
 
 
 # Consider setting a static IP address, especially if we can't reach the mirror.
-if [ cluster != $pxetype ]; then
+if [ cluster != "$pxetype" ]; then
   # We're at a point in the install process where we can be fairly sure
   # that nothing else is happening, so "killall wget" should be safe.
   (sleep 5; killall wget >/dev/null 2>&1) &
@@ -274,9 +274,9 @@
 # Network config now done above.
 if [ "$test" != "test" ]; then
   mkdir /h; cd /h
-  wget http://debathena.mit.edu/net-install/kexec
-  wget http://debathena.mit.edu/net-install/${distro}/${arch}/initrd.gz
-  wget http://debathena.mit.edu/net-install/${distro}/${arch}/linux
+  wget "http://debathena.mit.edu/net-install/kexec"
+  wget "http://debathena.mit.edu/net-install/${distro}/${arch}/initrd.gz"
+  wget "http://debathena.mit.edu/net-install/${distro}/${arch}/linux"
   chmod 755 kexec
 fi
 dkargs="DEBCONF_DEBUG=5"


home help back first fref pref prev next nref lref last post