Revert "MT#62787 Drop /sys/block autodetection code"

This reverts commit 2974f71127.

This breaks our automated VM builds which don't set the target disk.

Change-Id: Iad3c21ae69e983de651fedbc6d50633d2dde0a3b
mr13.4
Michael Prokop 1 year ago
parent 2974f71127
commit b6f8f4194b

@ -1794,11 +1794,24 @@ if [[ ${SP_VERSION} =~ ^trunk ]]; then
TRUNK_VERSION=true
fi
# iff environment variable TARGET_DISK is set, use it as main disk
if [ -n "${TARGET_DISK}" ] ; then
# if TARGET_DISK environment variable is set accept it
if [ -n "$TARGET_DISK" ] ; then
export DISK="${TARGET_DISK}"
else # otherwise try to find sane default
if [ -L /sys/block/vda ] ; then
export DISK=vda # will be configured as /dev/vda
else
# in some cases, sda is not the HDD, but the CDROM,
# so better walk through all devices.
for i in /sys/block/sd*; do
if grep -q 0 "${i}/removable"; then
DISK=$(basename "$i")
export DISK
break
fi
done
fi
fi
if [[ -n "${SWRAID_DISK1}" ]] && [[ -z "${SWRAID_DISK2}" ]] ; then
die "Error: swraiddisk1 is set, but swraiddisk2 is unset."
elif [[ -z "${SWRAID_DISK1}" ]] && [[ -n "${SWRAID_DISK2}" ]] ; then

Loading…
Cancel
Save