xcat-core/xCAT-server/share/xcat/install/scripts/chroot.sles

77 lines
1.9 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}'`
export PRINIC=${karg#*=01:}
export PRINIC=`ip -o link|grep -i "$PRINIC"|awk '{print $2}'|sed s/://`
fi
if [ "${karg%%=*}" = "netdevice" ]; then
export PRINIC="${karg#*=}";
if [ "${#PRINIC}" = "20" ]; then
export PRINIC=${PRINIC:3:21}
fi
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}'`
export PRINIC=`ip -o link|grep -i "$PRINIC"|awk '{print $2}'|sed s/://`
fi
echo 'export PRINIC='"$PRINIC" > /mnt/tmp/prinicsetting
]]>
</source>
</script>
</chroot-scripts>