xcat-core/xCAT-server-2.0/share/xcat/install/scripts/pre.sles

99 lines
1.5 KiB
Plaintext
Raw Normal View History

<pre-scripts config:type="list">
<script>
<filename>foo.sh</filename>
<interpreter>shell</interpreter>
<source>
<![CDATA[
#!/bin/sh
AWK=`find / -name awk | tail -1`
#old awk /mounts/instsys/bin/awk -f
cat >/tmp/bar.awk <<EOF
#!$AWK -f
BEGIN {
xcatdport = "#TABLE:site:key=xcatiport:value#"
xcatdhost = "#XCATVAR:XCATMASTER#"
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
print "xCAT_xcatd" |& ns
while(1) {
ns |& getline
if(\$0 == "ready")
print "installmonitor" |& ns
if(\$0 == "done")
break
}
close(ns)
exit 0
}
EOF
if [ ! -c /dev/vcs ]; then
mknod /dev/vcs c 7 0
fi
cat >/tmp/foo.awk <<EOF
#!$AWK -f
BEGIN {
ns = "/inet/tcp/3001/0/0"
while(1) {
ns |& getline
# if(\$1 == "sh") { #TODO: ENABLE IF DEBUG
# sub(/^sh +/,"",\$0)
# output = \$0
# while((output | getline) > 0)
# print \$0 |& ns
# print "EOO" |& ns
# close(output)
# }
if(\$1 == "screendump") {
output = "chvt " \$2 ";cat /dev/vcs"
while((output | getline) > 0)
print \$0 |& ns
close(output)
}
if(\$1 == "stat") {
while((getline < "/mnt/var/log/YaST2/y2logRPM") > 0) {
line = \$0
}
close("/mnt/var/log/YaST2/y2logRPM")
if(line ~ /\.rpm /) {
sub(/\.[^\.]+\.rpm .*$/,"",line)
sub(/^.* /,"",line)
}
else {
line = "prep"
}
print ("installing " line) |& ns
}
close(ns)
}
}
EOF
chmod 755 /tmp/foo.awk
chmod 755 /tmp/bar.awk
/tmp/bar.awk &
/tmp/foo.awk >/tmp/foo.log 2>&1 &
]]>
</source>
</script>
</pre-scripts>