diff --git a/xCAT-server/share/xcat/install/scripts/getinstdisk b/xCAT-server/share/xcat/install/scripts/getinstdisk index 6f6c85037..5520ab43b 100644 --- a/xCAT-server/share/xcat/install/scripts/getinstdisk +++ b/xCAT-server/share/xcat/install/scripts/getinstdisk @@ -24,6 +24,8 @@ mkdir -p $tmpdir has_awk=$(find / -name "awk") +utolcmd="sed -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" + tmpfile=$tmpdir"/getinstalldisk_" if [ -z "$install_disk" ]; then @@ -42,9 +44,9 @@ if [ -z "$install_disk" ]; then # Classify entries by DEVTYPE for entry in $entries; do if [ -z "$has_awk" ]; then - dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | cut -d "=" -f2 | tr A-Z a-z) + dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | cut -d "=" -f2 | $utolcmd) else - dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | awk -F = '{print $2}' | tr A-Z a-z) + dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | awk -F = '{print $2}' | $utolcmd) fi if [ "$dev_type" == "disk" ]; then @@ -129,10 +131,12 @@ if [ -z "$install_disk" ]; then for disk in $disks; do # Get disk's information: WWN, PATH and DRIVER disk_info=$(udevadm info --query=property --name=$disk) - disk_wwn=$(IFS= ;echo $disk_info | grep '\' | cut -d "=" -f2 | tr A-Z a-z) - disk_path=$(IFS= ;echo $disk_info | grep DEVPATH | cut -d "=" -f2 | tr A-Z a-z) + output_for_wwn=$(echo $disk_info | grep '\' | cut -d "=" -f2 | $utolcmd) + disk_wwn=$(IFS= ;echo $output_for_wwn) + output_for_path=$(echo $disk_info | grep DEVPATH | cut -d "=" -f2 | $utolcmd) + disk_path=$(IFS= ;echo $output_for_path) disk_driver=$(udevadm info --attribute-walk --name=$disk | grep DRIVERS| grep -v '""'| grep -v '"sd"'| - \head -n 1| sed -e 's/[^"]*"//' -e 's/"//' | tr A-Z a-z) + \head -n 1| sed -e 's/[^"]*"//' -e 's/"//' | $utolcmd) echo "[get_install_disk]The disk $disk information: " echo "[get_install_disk] disk_wwn=$disk_wwn" diff --git a/xCAT-server/share/xcat/install/scripts/pre.rh b/xCAT-server/share/xcat/install/scripts/pre.rh index 5eb3e8a77..2d798cbc0 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rh +++ b/xCAT-server/share/xcat/install/scripts/pre.rh @@ -184,45 +184,11 @@ fi #also, find first available block device (sda or vda likely) #TODO: pick a likely non-SAN target if possible 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"|"mpt3sas") #*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 +#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# +if [ -e "/tmp/install_disk" ]; then + instdisk=`cat /tmp/install_disk` fi # Could not determine the install disk for whatever reason,