[26772] in Source-Commits

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

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

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Aug 29 16:32:03 2012

Date: Wed, 29 Aug 2012 16:32:02 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201208292032.q7TKW2Id031370@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2012-08-29 16:32:02 -0400 (Wed, 29 Aug 2012)
New Revision: 25742

Modified:
   trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
Log:
Don't hardcode eth0, pick the first non-loopback interface

Modified: trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh	2012-08-29 18:15:44 UTC (rev 25741)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh	2012-08-29 20:32:02 UTC (rev 25742)
@@ -125,10 +125,11 @@
   # also fails, as the DHCP values override it.
   echo "Killing dhcp client."
   killall dhclient
-  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
+  ETH0="$(ip -o link show | grep -v loopback | cut -d: -f 2 | tr -d ' ')"
+  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
   echo "Flushing old default route."
   route delete default 2> /dev/null
   echo "Running: route add default gw $GATEWAY"
@@ -281,8 +282,8 @@
 debug "*** Main menu complete"
 debug "Mirror: $mirrorsite Type: $installertype Part: $partitioning"
 debug "Arch: $arch Distro: $distro Pxetype: $pxetype"
-debug "eth0:"
-debug "$(ip address show eth0)"
+debug "$ETH0:"
+debug "$(ip address show $ETH0)"
 debug "routing:"
 debug "$(route)"
 debug "resolv.conf:"
@@ -417,7 +418,7 @@
 debug "About to run kexec with these args: $dkargs $kargs"
 ./kexec -l linux --append="$dkargs $kargs" --initrd=initrd.gz \
 	  && sleep 3 && chvt 1 && sleep 2 && ./kexec -e
-curaddr="$(ip address show eth0 | grep inet | sed -e 's/^[ ]*inet //' | cut -d/ -f 1)"
+curaddr="$(ip address show $ETH0 | grep inet | sed -e 's/^[ ]*inet //' | cut -d/ -f 1)"
 echo "Secondary installed failed; please contact release-team@mit.edu"
 echo "with the circumstances of your install attempt.  Here's a shell for debugging."
 echo "You can type 'httpd' to start an HTTP server which will make"


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