2010-12-14 07:15:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#(C)IBM Corp
|
|
|
|
#
|
|
|
|
|
2010-12-16 09:36:17 +00:00
|
|
|
# create /etc/sysconfig/network-scripts/
|
|
|
|
for i in `/bin/cat /proc/cmdline`; do
|
|
|
|
KEY=`/bin/echo $i | /bin/awk -F= '{print $1}'`
|
|
|
|
if [ "$KEY" = "ifname" ]; then
|
|
|
|
ifname=`/bin/echo $i | /bin/awk -F= '{print $2}'`
|
|
|
|
MACX=${ifname#*:}
|
|
|
|
ETHX=${ifname%:$MACX*}
|
|
|
|
break
|
|
|
|
elif [ "$KEY" = "netdev" ]; then
|
2011-02-28 10:21:26 +00:00
|
|
|
ETHX=`/bin/echo $i | /bin/awk -F= '{print $2}'`
|
2010-12-16 09:36:17 +00:00
|
|
|
MACX=`/sbin/ip link show $netdev | /bin/grep ether | /bin/awk '{print $2}'`
|
|
|
|
break
|
|
|
|
elif [ "$KEY" = "BOOTIF" ]; then
|
2011-02-28 10:21:26 +00:00
|
|
|
MACX=`/bin/echo $i | /bin/awk -F= '{print $2}'`
|
|
|
|
ETHX=`/sbin/ifconfig | /bin/grep -i $MACX | /bin/awk '{print $1}'`
|
2010-12-16 09:36:17 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
|
|
|
if [ ! -e $MNTDIR/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then
|
|
|
|
/bin/touch $MNTDIR/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
|
|
|
fi
|
|
|
|
echo "DEVICE=$ETHX" > $MNTDIR/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
|
|
|
echo "BOOTPROTO=dhcp" >> $MNTDIR/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
|
|
|
echo "HWADDR=$MACX" >> $MNTDIR/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
|
|
|
echo "ONBOOT=yes" >> $MNTDIR/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2010-12-14 07:15:45 +00:00
|
|
|
for i in `cat /proc/cmdline`; do
|
|
|
|
KEY=`echo $i | awk -F= '{print $1}'`
|
|
|
|
if [ "$KEY" = "dump" ]; then
|
|
|
|
DUMP=`echo $i |awk -F= '{print $2}'`
|
|
|
|
if [ ! -z "$XCAT" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
elif [ "$KEY" = "XCAT" ]; then
|
|
|
|
XCAT=`echo $i |awk -F= '{print $2}'`
|
|
|
|
if [ ! -z "$DUMP" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ! -z "$DUMP" ]; then
|
|
|
|
# parse "dump=<proto>://<nfsserver_IP>/<directory>"
|
|
|
|
KDPATH=${DUMP#*:}
|
|
|
|
KDPROTO=${DUMP%:$KDPATH*}
|
|
|
|
|
|
|
|
KDPATH=${KDPATH/\/\//}
|
|
|
|
KDIP=`echo $KDPATH | cut -d'/' -f1`
|
|
|
|
KDPATH=${KDPATH/$KDIP/}
|
|
|
|
|
|
|
|
# if "dump=<proto>:///<directory>", use $xcatmaster as the default NFS server
|
|
|
|
if [ -z $KDIP ]; then
|
|
|
|
KDIP=${XCAT%:*}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$KDPROTO" = "nfs" ]; then
|
|
|
|
echo "net $KDIP:$KDPATH" > /etc/kdump.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
# workaround for RHEL6
|
|
|
|
KDTMPSERVER=${XCAT%:*}
|
|
|
|
/bin/mount $KDTMPSERVER:/install/kdump/tmp /var/tmp
|
|
|
|
|
|
|
|
/etc/init.d/kdump restart
|
|
|
|
|
|
|
|
/bin/umount /var/tmp
|
|
|
|
else
|
|
|
|
/bin/echo "The kdump server is not configured"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|