From 41b6375324067264ab89a1eac8b4aa5a2ac7e171 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Tue, 10 May 2016 12:04:31 +0200 Subject: [PATCH] MT#19613 Add grml boot option targetdisk to perform disaster recovery on non-RAID drives Otherwise deployment.sh abort disaster recovery installation if we have 1 drive only: > Error: /dev/sdb does not look like a VirtIO, ServeRAID, LSILOGIC or PowerEdge disk/controller. > Exiting to avoid possible data damage. Change-Id: I4de4d0de75964fc6f09b8f0b1ae3104a6bdfc6ee --- deployment.sh | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/deployment.sh b/deployment.sh index 9559541..393c120 100755 --- a/deployment.sh +++ b/deployment.sh @@ -88,24 +88,6 @@ VLAN_SIP_INT=1720 VLAN_HA_INT=1721 VLAN_RTP_EXT=1722 -# 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 - export DISK=$(basename $i) - break - fi - done - fi -fi - ### helper functions {{{ get_deploy_status() { if [ -r "${STATUS_DIRECTORY}/status" ] ; then @@ -347,9 +329,6 @@ logit "host-IP: $(ip-screen)" logit "deployment-version: $SCRIPT_VERSION" # }}} -test -z "${DISK}" \ - && die "Error: No non-removable disk suitable for installation found" - enable_deploy_status_server set_deploy_status "checkBootParam" @@ -359,6 +338,30 @@ if checkBootParam debugmode ; then enable_trace fi +if checkBootParam targetdisk ; then + TARGET_DISK=$(getBootParam targetdisk) +fi + +# 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 + export DISK=$(basename "$i") + break + fi + done + fi +fi + +[ -z "${DISK}" ] && die "Error: No non-removable disk suitable for installation found" + if checkBootParam ngcpstatus ; then STATUS_WAIT=$(getBootParam ngcpstatus || true) [ -n "$STATUS_WAIT" ] || STATUS_WAIT=30