[23869] in Source-Commits

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

/svn/athena r23479 - trunk/debathena/scripts/installer

daemon@ATHENA.MIT.EDU (Andrew M Boardman)
Fri Feb 27 12:11:47 2009

Date: Fri, 27 Feb 2009 12:10:58 -0500
From: Andrew M Boardman <amb@MIT.EDU>
Message-Id: <200902271710.n1RHAwqa017633@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: amb
Date: 2009-02-27 12:10:57 -0500 (Fri, 27 Feb 2009)
New Revision: 23479

Modified:
   trunk/debathena/scripts/installer/install-athena10.sh
Log:
Fix some unlikely installer screw cases:

1) Conditionalize pxe cluster install network config on actually having
   the expected preseed file copy.
2) Running aptitude with DEBIAN_FRONTEND=noninteractive still sometimes
   prompts without also the -y arg, so added it for the install of
   the radeon driver for the gx745s.


Modified: trunk/debathena/scripts/installer/install-athena10.sh
===================================================================
--- trunk/debathena/scripts/installer/install-athena10.sh	2009-02-27 16:49:54 UTC (rev 23478)
+++ trunk/debathena/scripts/installer/install-athena10.sh	2009-02-27 17:10:57 UTC (rev 23479)
@@ -117,43 +117,48 @@
     # Preseed an answer to the java license query, which license was already accepted
     # at install time:
     echo "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true" |debconf-set-selections
-    # Switch to canonical hostname.
-    ohostname=`cat /etc/hostname`
-    # Hack to avoid installing debconf-get for just this.
-    ipaddr=`grep netcfg/get_ipaddress /root/athena10.preseed|sed -e 's/.* //'`
-    netmask=`grep netcfg/get_netmask /root/athena10.preseed|sed -e 's/.* //'`
-    gateway=`grep netcfg/get_gateway /root/athena10.preseed|sed -e 's/.* //'`
 
-    hostname=`host $ipaddr | \
+    # Configure network based on the preseed file settings, if present.
+    if test -f /root/athena10.preseed ; then
+      # Switch to canonical hostname.
+      ohostname=`cat /etc/hostname`
+      # Hack to avoid installing debconf-get for just this.
+      ipaddr=`grep netcfg/get_ipaddress /root/athena10.preseed|sed -e 's/.* //'`
+      netmask=`grep netcfg/get_netmask /root/athena10.preseed|sed -e 's/.* //'`
+      gateway=`grep netcfg/get_gateway /root/athena10.preseed|sed -e 's/.* //'`
+
+      hostname=`host $ipaddr | \
           sed 's#^.*domain name pointer \(.*\)$#\1#' | sed 's;\.*$;;' | \
           tr '[A-Z]' '[a-z]'`
-    if echo $hostname|grep -q "not found" ; then
-      hostname=""
-      printf "\a"; sleep 1 ; printf "\a"; sleep 1 ;printf "\a"
-      echo "The IP address you selected, $ipaddr, does not have an associated"
-      echo "hostname.  Please confirm that you're using the correct address."
-      while [ -z "$hostname" ] ; do
-        echo -n "Enter fully qualified hostname [no default]: "
-        read hostname
-      done
+      if echo $hostname|grep -q "not found" ; then
+	hostname=""
+	printf "\a"; sleep 1 ; printf "\a"; sleep 1 ;printf "\a"
+	echo "The IP address you selected, $ipaddr, does not have an associated"
+	echo "hostname.  Please confirm that you're using the correct address."
+	while [ -z "$hostname" ] ; do
+	  echo -n "Enter fully qualified hostname [no default]: "
+	  read hostname
+	done
+      fi
+      echo ${hostname%%.*} > /etc/hostname
+      sed -e 's/\(127\.0\.1\.1[ 	]*\).*/\1'"$hostname ${hostname%%.*}/" < /etc/hosts > /etc/hosts.new
+      mv -f /etc/hosts.new /etc/hosts
+      if grep -q dhcp /etc/network/interfaces ; then
+	sed -e s/dhcp/static/ < /etc/network/interfaces > /etc/network/interfaces.new
+	echo "	address $ipaddr" >> /etc/network/interfaces.new
+	echo "	netmask $netmask" >> /etc/network/interfaces.new
+	echo "	gateway $gateway" >> /etc/network/interfaces.new
+	mv -f /etc/network/interfaces.new /etc/network/interfaces
+      fi
+      hostname ${hostname%%.*}
     fi
-    echo ${hostname%%.*} > /etc/hostname
-    sed -e 's/\(127\.0\.1\.1[ 	]*\).*/\1'"$hostname ${hostname%%.*}/" < /etc/hosts > /etc/hosts.new
-    mv -f /etc/hosts.new /etc/hosts
-    if grep -q dhcp /etc/network/interfaces ; then
-      sed -e s/dhcp/static/ < /etc/network/interfaces > /etc/network/interfaces.new
-      echo "	address $ipaddr" >> /etc/network/interfaces.new
-      echo "	netmask $netmask" >> /etc/network/interfaces.new
-      echo "	gateway $gateway" >> /etc/network/interfaces.new
-      mv -f /etc/network/interfaces.new /etc/network/interfaces
-    fi
-    hostname ${hostname%%.*}
+
     # Free up designated LVM overhead.
     lvremove -f /dev/athena10/keep_2 || :
 
     # This makes gx755s suck less.
     if lspci -n|grep -q 1002:94c1 && ! grep -q radeonhd /etc/X11/xorg.conf ; then
-      DEBIAN_FRONTEND=noninteractive aptitude install xserver-xorg-video-radeonhd
+      DEBIAN_FRONTEND=noninteractive aptitude -y install xserver-xorg-video-radeonhd
       cat >> /etc/X11/xorg.conf <<EOF
 Section "Device"
 	Identifier "Configured Video Device"


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