xcat-core/xCAT-server/share/xcat/install/scripts/chroot.sles
jbjohnso efb11951b4 -Actually fix things
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8726 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2011-01-21 21:35:09 +00:00

68 lines
1.5 KiB
Plaintext

<chroot-scripts config:type="list">
<script>
<filename>boot.sh</filename>
<interpreter>shell</interpreter>
<source>
<![CDATA[
#!/bin/sh
AWK=`find / -name awk | head -1`
#old awk /mounts/instsys/bin/awk -f
cat >/tmp/updateflag.awk <<EOF
#!$AWK -f
BEGIN {
xcatdport = #TABLE:site:key=xcatiport:value#
xcatdhost = "#XCATVAR:XCATMASTER#"
ns = "/inet/tcp/0/" xcatdhost "/" xcatdport
while(1) {
if((ns |& getline) > 0)
print \$0
if(\$0 == "ready")
print "next" |& ns
if(\$0 == "done")
break
}
close(ns)
exit 0
}
EOF
chmod 755 /tmp/updateflag.awk
/tmp/updateflag.awk
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
if [ "$PRINIC" == "mac" ]
then
export PRINIC='#TABLE:mac:THISNODE:mac#'
fi
if [ -z "$PRINIC" ]
then
for karg in $(cat /proc/cmdline |sed -e 's/-/:/g' -e 's/ /\n/g'); do
if [ "${karg%%=*}" = "BOOTIF" ]; then
export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'`
fi
done
if [ -z "$PRINIC" ]; then
export PRINIC=eth0
fi
fi
if [ -z "$PRINIC" ]
then
export PRINIC=eth0
elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then
export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`
fi
echo 'export PRINIC='"$PRINIC" > /mnt/tmp/prinicsetting
]]>
</source>
</script>
</chroot-scripts>