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
This commit is contained in:
daniceexi 2010-06-28 13:53:31 +00:00
parent 0e479d94e3
commit 503292503f

View File

@ -658,6 +658,24 @@ EOS1
print $inifile <<EOMS;
# check and see if debug is specified on command line
grep '\(debug\)' /proc/cmdline > /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