Add boot device probing to suse

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@14446 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2012-11-27 20:17:48 +00:00
parent e889ef17b1
commit 82b0440a02

View File

@ -113,11 +113,50 @@ chmod 755 /tmp/bar.awk
/tmp/bar.awk &
/tmp/foo.awk >/tmp/foo.log 2>&1 &
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
;;
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
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
if [ -d /sys/firmware/efi ]; then
sed -e 's!<device>XCATPARTITIONHOOK</device>!<device>/dev/sda</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
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
else
sed -e 's!<device>XCATPARTITIONHOOK</device>!<device>/dev/sda</device>!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml
sed -e 's!<device>XCATPARTITIONHOOK</device>!<device>'$instdisk'</device>!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml
fi
]]>