2007-10-26 22:44:33 +00:00
|
|
|
<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 {
|
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
xcatiport = "#TABLE:site:key=xcatiport:value#"
|
|
|
|
xcatdhost = "#XCATVAR:XCATMASTER#"
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
|
|
|
print ARGV[1]
|
|
|
|
print "xCAT_xcatd" |& ns
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
while(1) {
|
|
|
|
ns |& getline
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
if(\$0 == "ready")
|
|
|
|
print ARGV[1] |& ns
|
|
|
|
if(\$0 == "done")
|
|
|
|
break
|
|
|
|
}
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
close(ns)
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
exit 0
|
2007-10-26 22:44:33 +00:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
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") {
|
2011-11-22 01:28:14 +00:00
|
|
|
if( system( "[ -f /mnt/var/log/YaST2/y2logRPM ]" ) == 0 ) {
|
2007-10-26 22:44:33 +00:00
|
|
|
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
|
2011-11-22 01:28:14 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
# The format of /var/log/zypp/history is documented at
|
|
|
|
# http://en.opensuse.org/Libzypp/Package_History
|
|
|
|
|
|
|
|
lastrpm = "prep"
|
|
|
|
|
|
|
|
oldFS = FS
|
|
|
|
FS="|"
|
|
|
|
|
|
|
|
while((getline < "/mnt/var/log/zypp/history") > 0) {
|
|
|
|
if (\$0 !~ /#/ && \$2 == "install") {
|
|
|
|
lastrpm = (\$3 "-" \$4)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close("/mnt/var/log/zypp/history")
|
|
|
|
|
|
|
|
FS = oldFS
|
|
|
|
|
|
|
|
print ("installing " lastrpm) |& ns
|
|
|
|
}
|
|
|
|
}
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2011-11-22 01:28:14 +00:00
|
|
|
close(ns)
|
2007-10-26 22:44:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod 755 /tmp/foo.awk
|
|
|
|
chmod 755 /tmp/bar.awk
|
|
|
|
|
2013-08-16 03:24:34 +00:00
|
|
|
|
|
|
|
/tmp/bar.awk "installmonitor" &
|
|
|
|
|
|
|
|
NODESTATUS=#TABLEBLANKOKAY:site:key=nodestatus:value#
|
|
|
|
|
|
|
|
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
|
|
|
|
/tmp/bar.awk "installstatus installing" &
|
|
|
|
fi
|
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
/tmp/foo.awk >/tmp/foo.log 2>&1 &
|
2013-08-16 03:24:34 +00:00
|
|
|
|
2012-04-26 19:00:30 +00:00
|
|
|
shopt -s nullglob
|
|
|
|
for disk in /dev/vd*[^0-9];do
|
|
|
|
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
|
|
|
eddname=$(/lib/udev/edd_id $disk 2> /dev/null)
|
|
|
|
if [ ! -z "$eddname" -a "$eddname" = "int13_dev80" ]; then
|
|
|
|
instdisk=$disk
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "$instdisk" ]; then
|
|
|
|
for disk in /dev/sd*[^0-9]; do
|
|
|
|
eddname=$(/lib/udev/edd_id $disk 2> /dev/null)
|
|
|
|
if [ ! -z "$eddname" -a "$eddname" = "int13_dev80" ]; then
|
|
|
|
instdisk=$disk
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
currdriver=`udevadm info --attribute-walk --name $disk |grep DRIVERS|grep -v '""'|grep -v '"sd"'|head -n 1|sed -e 's/[^"]*"//' -e 's/"//'`
|
|
|
|
case "$currdriver" in
|
|
|
|
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
|
|
|
|
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
|
|
|
;;
|
2014-04-18 14:50:58 +00:00
|
|
|
"mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
2012-04-26 19:00:30 +00:00
|
|
|
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -z "$firstdisk" ]; then firstdisk=$disk; fi #remember first disk as a guess of medium resort
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
if [ -z "$instdisk" ]; then
|
|
|
|
if [ ! -z "$firstdirectdisk" ]; then
|
|
|
|
instdisk=$firstdirectdisk
|
|
|
|
elif [ ! -z "$probablyfirstdirectdisk" ]; then
|
|
|
|
instdisk=$probablyfirstdirectdisk
|
|
|
|
elif [ ! -z "$firstdisk" ]; then
|
|
|
|
instdisk=$firstdisk
|
|
|
|
fi
|
|
|
|
fi
|
2011-09-26 15:12:11 +00:00
|
|
|
|
|
|
|
if [ -d /sys/firmware/efi ]; then
|
2012-04-26 19:00:30 +00:00
|
|
|
sed -e 's!<device>XCATPARTITIONHOOK</device>!<device>'$instdisk'</device><partitions config:type="list"><partition><filesystem config:type="symbol">vfat</filesystem><mount>/boot/efi</mount><size>128mb</size></partition><partition><mount>swap</mount><size>auto</size></partition><partition><mount>/</mount><size>auto</size></partition></partitions>!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml
|
2011-09-26 15:12:11 +00:00
|
|
|
else
|
2012-04-26 19:00:30 +00:00
|
|
|
sed -e 's!<device>XCATPARTITIONHOOK</device>!<device>'$instdisk'</device>!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml
|
2011-09-26 15:12:11 +00:00
|
|
|
fi
|
2012-07-10 06:02:20 +00:00
|
|
|
#XCA_PARTITION_SCRIPT#
|
2012-07-12 10:27:21 +00:00
|
|
|
#add the following part for replace the partition definition in /tmp/profile/autoinst.xml
|
|
|
|
if [ -r "/tmp/partitionfile" ]; then
|
|
|
|
while read line
|
|
|
|
do
|
|
|
|
con="${con}${line}"
|
|
|
|
done < /tmp/partitionfile
|
|
|
|
con=${con//>\s+</><}
|
|
|
|
con=${con// /xcattempspace}
|
|
|
|
sed -e '/<drive>/{N;N;s!.*!'$con'!}' /tmp/profile/autoinst.xml > /tmp/profile/modified1.xml
|
|
|
|
sed -e 's!xcattempspace! !g' /tmp/profile/modified1.xml > /tmp/profile/modified.xml
|
|
|
|
fi
|
2013-06-04 07:54:52 +00:00
|
|
|
|
2013-07-10 09:07:11 +00:00
|
|
|
export nextserver=`cat /proc/cmdline | grep http | awk -F'autoyast=http://' {'print \$2'} | awk -F':' {'print \$1'}`
|
2013-06-04 07:54:52 +00:00
|
|
|
cp /tmp/profile/modified.xml /tmp/profile/modified1.xml
|
|
|
|
sed -e 's!<software>!<add-on><add_on_products config:type="list">#INSTALL_SOURCES_IN_PRE#</add_on_products></add-on><software>!' /tmp/profile/modified1.xml > /tmp/profile/modified.xml
|
2007-10-26 22:44:33 +00:00
|
|
|
]]>
|
|
|
|
|
|
|
|
</source>
|
|
|
|
</script>
|
|
|
|
</pre-scripts>
|