DEBUG=""; + DEBUG= work_dir=/tmp/preload; + work_dir=/tmp/preload outfile=${work_dir}/install-disks; + outfile=/tmp/preload/install-disks touch ${outfile}; + touch /tmp/preload/install-disks # Get the location code for the install disk valid_lc_chars="U[[:alnum:]\.\*-]*"; + valid_lc_chars='U[[:alnum:]\.\*-]*' # installdisk=default is passed for virtual devices. lc_regex=$(grep -ow "installdisk=default" ${DEBUG}/proc/cmdline | \ cut -d '=' -f 2); grep -ow "installdisk=default" ${DEBUG}/proc/cmdline | cut -d '=' -f 2 ++ grep -ow installdisk=default /proc/cmdline ++ cut -d = -f 2 + lc_regex= if [ -z ${lc_regex} ] ; then lc_regex=$(grep -ow "installdisk=${valid_lc_chars}" ${DEBUG}/proc/cmdline | \ cut -d '=' -f 2 | \ tr "[:lower:]" "[:upper:]"); # Ensure that the location # code is all uppercase. else disk=sda; fi + '[' -z ']' grep -ow "installdisk=${valid_lc_chars}" ${DEBUG}/proc/cmdline | cut -d '=' -f 2 | tr "[:lower:]" "[:upper:]" ++ grep -ow 'installdisk=U[[:alnum:]\.\*-]*' /proc/cmdline ++ cut -d = -f 2 ++ tr '[:lower:]' '[:upper:]' + lc_regex='U78CB.001.WZS02UY-P2.*-D1' if [ -z ${lc_regex} ] ; then echo "No 'installdisk=' parameter specified. Exiting."; exit -1; fi + '[' -z 'U78CB.001.WZS02UY-P2.*-D1' ']' echo "Disk regex specified: ${lc_regex}"; + echo 'Disk regex specified: U78CB.001.WZS02UY-P2.*-D1' Disk regex specified: U78CB.001.WZS02UY-P2.*-D1 if [ -z "${disk}" ]; then # Remove ".* | *" characters lc_regex=$(echo ${lc_regex} | sed -e 's/\.*\*//g') diskA=$(iprconfig -c query-device ${lc_regex}); # Not JBOD disks. We do not format single RAID 0 for JBOD disks. if [[ "${diskA}" != /dev/sd* ]]; then for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl do iprconfig -c query-location $i done iprconfig -c show-config # Determine the logical disk(s) with the given location code diskA=$(iprconfig -c query-array ${lc_regex}); if [ -z "${diskA}" ]; then # Not found device with query-array command. # So find the device name for the given location code diskA=$(iprconfig -c query-device ${lc_regex}); if [ -z "${diskA}" ]; then echo "Invalid location ID passed!"; exit -1; fi # Create the RAID 0 array, using the device name # retriev earlier. echo "Formatting install disk with single RAID 0...."; iprconfig -c raid-create -r 0 ${diskA}; # Now query the device name for the new array. diskA=$(iprconfig -c query-array ${lc_regex}); if [ -z "${diskA}" ]; then echo "Can not find device after creating RAID 0 array!"; exit -1; fi fi fi disk=$(echo $diskA | cut -d "/" -f 3) fi + '[' -z '' ']' echo ${lc_regex} | sed -e 's/\.*\*//g' ++ echo 'U78CB.001.WZS02UY-P2.*-D1' ++ sed -e 's/\.*\*//g' + lc_regex=U78CB.001.WZS02UY-P2-D1 iprconfig -c query-device ${lc_regex} ++ iprconfig -c query-device U78CB.001.WZS02UY-P2-D1 + diskA= + [[ '' != /dev/sd* ]] + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sda U78CB.001.WZS02UY-P2-D9 + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdb U78CB.001.WZS02UY-P2-D8 + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdc U78CB.001.WZS02UY-P2-D10 + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdd U78CB.001.WZS02UY-P2-D11 + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sde U78CB.001.WZS02UY-P2-D12 + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdf U78CB.001.WZS02UY-P2-D7 + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdg + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdh + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdi + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdj + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdk + for i in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl + iprconfig -c query-location sdl + iprconfig -c show-config Name PCI/SCSI Location Description Status ------ ------------------------- ------------------------- ----------------- 0001:04:00.0/0: PCI-E SAS RAID Adapter Operational sda 0001:04:00.0/0:2:0:0 RAID 0 Array Optimized 0001:04:00.0/0:0:0:0 RAID 0 Array Member Active sdb 0001:04:00.0/0:2:1:0 RAID 0 Array Optimized 0001:04:00.0/0:0:1:0 RAID 0 Array Member Active sdc 0001:04:00.0/0:2:2:0 RAID 0 Array Optimized 0001:04:00.0/0:0:2:0 RAID 0 Array Member Active sdd 0001:04:00.0/0:2:3:0 RAID 0 Array Optimized 0001:04:00.0/0:0:3:0 RAID 0 Array Member Active sde 0001:04:00.0/0:2:4:0 RAID 0 Array Optimized 0001:04:00.0/0:0:4:0 RAID 0 Array Member Active sdf 0001:04:00.0/0:2:5:0 RAID 0 Array Optimized 0001:04:00.0/0:0:5:0 RAID 0 Array Member Active 0001:04:00.0/0:0:6:0 Enclosure Active iprconfig -c query-array ${lc_regex} ++ iprconfig -c query-array U78CB.001.WZS02UY-P2-D1 + diskA= + '[' -z '' ']' iprconfig -c query-device ${lc_regex} ++ iprconfig -c query-device U78CB.001.WZS02UY-P2-D1 + diskA= + '[' -z '' ']' + echo 'Invalid location ID passed!' Invalid location ID passed! + exit -1