From 3d8a473b65a476f576c5b639dc60a69c1031d01d Mon Sep 17 00:00:00 2001 From: Lewis Kang Date: Thu, 12 May 2016 18:20:31 +0800 Subject: [PATCH] support installing NOS to where ONIE image resides while block device is not specified this fixes the issue when an external USB disk is inserted before powering on the switch that may change the device name of the expected installation destination (e.g. /dev/sdb becomes /dev/sdc) --- builds/amd64/installer/legacy/builds/amd64-installer.sh | 9 +++++++++ .../r0/src/lib/install/x86-64-accton-as7712-32x-r0.sh | 2 +- .../r0/src/lib/install/x86-64-accton-as7716-32x-r0.sh | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/builds/amd64/installer/legacy/builds/amd64-installer.sh b/builds/amd64/installer/legacy/builds/amd64-installer.sh index 86accc8f..6a92de78 100644 --- a/builds/amd64/installer/legacy/builds/amd64-installer.sh +++ b/builds/amd64/installer/legacy/builds/amd64-installer.sh @@ -275,6 +275,15 @@ partition_gpt() installer_standard_gpt_install() { DEV=$1; shift + + if [ -z $DEV ]; then + # Install on the same block device as ONIE + DEV=$(blkid | grep ONIE-BOOT | awk '{print $1}' | sed -e 's/[1-9][0-9]*:.*$//' | sed -e 's/\([0-9]\)\(p\)/\1/' | head -n 1) + [ -b "$DEV" ] || { + echo "Error: Unable to determine block device of ONIE install" + return 1 + } + fi visit_parted $DEV do_handle_disk do_handle_partitions || return 1 partition_gpt $(get_free_space) || return 1 diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7712-32x/platform-config/r0/src/lib/install/x86-64-accton-as7712-32x-r0.sh b/packages/platforms/accton/x86-64/x86-64-accton-as7712-32x/platform-config/r0/src/lib/install/x86-64-accton-as7712-32x-r0.sh index b964838f..f30823a2 100644 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7712-32x/platform-config/r0/src/lib/install/x86-64-accton-as7712-32x-r0.sh +++ b/packages/platforms/accton/x86-64/x86-64-accton-as7712-32x/platform-config/r0/src/lib/install/x86-64-accton-as7712-32x-r0.sh @@ -11,5 +11,5 @@ platform_installer() { # Standard isntallation to an available GPT partition - installer_standard_gpt_install /dev/sdb + installer_standard_gpt_install } diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7716-32x/platform-config/r0/src/lib/install/x86-64-accton-as7716-32x-r0.sh b/packages/platforms/accton/x86-64/x86-64-accton-as7716-32x/platform-config/r0/src/lib/install/x86-64-accton-as7716-32x-r0.sh index b964838f..f30823a2 100644 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7716-32x/platform-config/r0/src/lib/install/x86-64-accton-as7716-32x-r0.sh +++ b/packages/platforms/accton/x86-64/x86-64-accton-as7716-32x/platform-config/r0/src/lib/install/x86-64-accton-as7716-32x-r0.sh @@ -11,5 +11,5 @@ platform_installer() { # Standard isntallation to an available GPT partition - installer_standard_gpt_install /dev/sdb + installer_standard_gpt_install }