MT#6253 Sync deployment.sh with what we have in deployment-iso.git as of commit 9aa7f

changes/02/2/1
Michael Prokop 11 years ago
parent 4222a91f98
commit ad4a3ab1a3

@ -59,17 +59,22 @@ ENABLE_VM_SERVICES=false
FILESYSTEM="ext4" FILESYSTEM="ext4"
SYSTEMD=false SYSTEMD=false
if [ -L /sys/block/vda ] ; then # if TARGET_DISK environment variable is set accept it
export DISK=vda # will be configured as /dev/vda if [ -n "$TARGET_DISK" ] ; then
else export DISK="${TARGET_DISK}"
# in some cases, sda is not the HDD, but the CDROM, else # otherwise try to find sane default
# so better walk through all devices. if [ -L /sys/block/vda ] ; then
for i in /sys/block/sd*; do export DISK=vda # will be configured as /dev/vda
if grep -q 0 ${i}/removable; then else
export DISK=$(basename $i) # in some cases, sda is not the HDD, but the CDROM,
break # so better walk through all devices.
fi for i in /sys/block/sd*; do
done if grep -q 0 ${i}/removable; then
export DISK=$(basename $i)
break
fi
done
fi
fi fi
### helper functions {{{ ### helper functions {{{
@ -754,24 +759,28 @@ check_for_supported_disk() {
} }
# run in according environment only # run in according environment only
if [[ $(imvirt 2>/dev/null) == "Physical" ]] ; then if [ -n "$TARGET_DISK" ] ; then
logit "Skipping check for supported disk as TARGET_DISK variable is set."
else
if [[ $(imvirt 2>/dev/null) == "Physical" ]] ; then
if ! check_for_supported_disk ; then if ! check_for_supported_disk ; then
die "Error: /dev/${DISK} does not look like a VirtIO, ServeRAID, LSILOGIC or PowerEdge disk/controller. Exiting to avoid possible data damage." die "Error: /dev/${DISK} does not look like a VirtIO, ServeRAID, LSILOGIC or PowerEdge disk/controller. Exiting to avoid possible data damage."
fi fi
else
# make sure it runs only within qemu/kvm
if [[ "$DISK" == "vda" ]] && readlink -f /sys/block/vda/device | grep -q 'virtio' ; then
echo "Looks like a virtio disk, ok."
elif grep -q 'QEMU HARDDISK' /sys/block/${DISK}/device/model ; then
echo "Looks like a QEMU harddisk, ok."
elif grep -q 'VBOX HARDDISK' /sys/block/${DISK}/device/model ; then
echo "Looks like a VBOX harddisk, ok."
elif grep -q 'Virtual disk' /sys/block/${DISK}/device/model && [[ $(imvirt) == "VMware ESX Server" ]] ; then
echo "Looks like a VMware ESX Server harddisk, ok."
else else
die "Error: /dev/${DISK} does not look like a virtual disk. Exiting to avoid possible data damage. Note: imvirt output is $(imvirt)" # make sure it runs only within qemu/kvm
if [[ "$DISK" == "vda" ]] && readlink -f /sys/block/vda/device | grep -q 'virtio' ; then
echo "Looks like a virtio disk, ok."
elif grep -q 'QEMU HARDDISK' /sys/block/${DISK}/device/model ; then
echo "Looks like a QEMU harddisk, ok."
elif grep -q 'VBOX HARDDISK' /sys/block/${DISK}/device/model ; then
echo "Looks like a VBOX harddisk, ok."
elif grep -q 'Virtual disk' /sys/block/${DISK}/device/model && [[ $(imvirt) == "VMware ESX Server" ]] ; then
echo "Looks like a VMware ESX Server harddisk, ok."
else
die "Error: /dev/${DISK} does not look like a virtual disk. Exiting to avoid possible data damage. Note: imvirt output is $(imvirt)"
fi
fi fi
fi fi

Loading…
Cancel
Save