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 ]]>