From b99e150b6023758133ff6114bd431c8ea1c6a576 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 26 Apr 2012 19:00:30 +0000 Subject: [PATCH] Add boot device probing to suse git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12361 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/install/scripts/pre.sles | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.sles b/xCAT-server/share/xcat/install/scripts/pre.sles index e6e77ec47..768734cb7 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.sles +++ b/xCAT-server/share/xcat/install/scripts/pre.sles @@ -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!XCATPARTITIONHOOK!/dev/sdavfat/boot/efi128mbswapauto/auto!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml + sed -e 's!XCATPARTITIONHOOK!'$instdisk'vfat/boot/efi128mbswapauto/auto!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml else - sed -e 's!XCATPARTITIONHOOK!/dev/sda!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml + sed -e 's!XCATPARTITIONHOOK!'$instdisk'!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml fi ]]>