From 503292503f26577f942fd8ce6297f98c70a890d7 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 28 Jun 2010 13:53:31 +0000 Subject: [PATCH] move to make the IFACE variable to be set at the beginning of the init script so that the scope can cover the whole script; and export this variable to make sure netstart script can use it git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6614 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/rh/genimage | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index dd5814c7e..44f9a6506 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -658,6 +658,24 @@ EOS1 print $inifile < /dev/null && export DEBUG=1 + +IFACE=$prinic +if [ -z "\$IFACE" ]; then + for i in `cat /proc/cmdline`; do + KEY=`echo \$i |awk -F= '{print \$1}'` + if [ "\$KEY" == 'netdev' ]; then + IFACE=`echo \$i |awk -F= '{print \$2}'` + break + fi + if [ "\$KEY" == 'BOOTIF' ]; then + VALUE=`echo \$i |awk -F= '{print \$2}'` + IFACE=`ifconfig -a|grep -i "hwaddr $VALUE"|awk '{print $1}'` + fi + done +fi + +export IFACE=\$IFACE + netstart while ! ifconfig | grep inet; do echo -e "\${RED}Failed to acquire address, retrying \${RESET}" @@ -805,21 +823,6 @@ if [ "\$NFSROOT" = "1" ]; then then mkdir -p \$NEWROOT/\$RWDIR/tmpfs/var/lib/dhcp fi - IFACE=$prinic - if [ -z "\$IFACE" ]; then - for i in `cat /proc/cmdline`; do - KEY=`echo \$i |awk -F= '{print \$1}'` - if [ "\$KEY" == 'netdev' ]; then - IFACE=`echo \$i |awk -F= '{print \$2}'` - break - fi - if [ "\$KEY" == 'BOOTIF' ]; then - VALUE=`echo \$i |awk -F= '{print \$2}'` - IFACE=`ifconfig -a|grep -i "hwaddr $VALUE"|awk '{print $1}'` - fi - done - fi - cp -fp /var/lib/dhclient/dhclient.leases \${NEWROOT}/\${RWDIR}/tmpfs/var/lib/dhclient/dhclient-\$IFACE.leases cp -fp /var/lib/dhclient/dhclient.leases \${NEWROOT}/\${RWDIR}/tmpfs/var/lib/dhcp/dhclient-\$IFACE.leases