From b97ce22691e1ffb34f2bc3638ea44a69baa052e4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 12 Mar 2010 08:12:04 -0800 Subject: Run partition editor with script flag to avoid prompting user Bug 5443 When running on HyperV, install-system appeared to hang because although hda existed, it had no information so parted was prompting for retry. Use the -s flag (never prompt) at all the places in install-system/install-image where we don't want to have user interaction. --- scripts/install-system | 20 ++++++++++---------- scripts/install/install-functions | 10 +++++----- scripts/install/install-get-partition | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/install-system b/scripts/install-system index b17ede78..d17f0c2e 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -139,16 +139,16 @@ get_drive_size () { ldrive=$1 # Make sure you can print disk info using parted - parted /dev/$ldrive p >/dev/null 2>&1 + parted --script /dev/$ldrive print >/dev/null 2>&1 # If unable to read disk, it's likely it needs a disklabel if [ "$?" != "0" ]; then echo "Creating a new disklabel on $ldrive" >> $INSTALL_LOG echo "parted /dev/$ldrive mklabel msdos" >> $INSTALL_LOG - output=$(parted /dev/$ldrive mklabel msdos) + output=$(parted -s /dev/$ldrive mklabel msdos) # Get the drive size from parted - lsize=$(parted /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') + lsize=$(parted -s /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') if [ $(echo $lsize | grep error) ]; then echo "Unable to read disk label. Exiting." @@ -157,7 +157,7 @@ get_drive_size () { fi # Get the drive size from parted - lsize=$(parted /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') + lsize=$(parted -s /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') # Get the reported units (mB, GB, kB) lmodifier=$(echo $lsize | sed 's/[0-9\.]//g') # remove the modifier @@ -187,7 +187,7 @@ probe_drives () { then output=$(mount | grep $drive) if [ -z "$output" ]; then - output=$(parted /dev/$drive p) + output=$(parted -s /dev/$drive p) fi fi done @@ -449,7 +449,7 @@ check_for_new_raid () { sfdisk --change-id /dev/$drive $data_dev 0xfd # mark data partition as bootable echo "Marking /dev/$drive partition $data_dev bootable" >> $INSTALL_LOG - parted /dev/$drive set $data_dev boot on >> $INSTALL_LOG 2>&1 + parted -s /dev/$drive set $data_dev boot on >> $INSTALL_LOG 2>&1 done # Must give partition device time to settle @@ -810,7 +810,7 @@ delete_partitions () { check_config_partition "$ldrive$part" echo "Removing partition $part on /dev/$ldrive" >> $INSTALL_LOG - output=$(parted /dev/$ldrive rm $part) + output=$(parted -s /dev/$ldrive rm $part) status=$? if [ "$status" != 0 ]; then echo -e "Warning: cannot delete partition $part on $ldrive.\nPlease see $INSTALL_LOG for more details." @@ -862,7 +862,7 @@ create_partitions() { echo "Creating root partition on /dev/$ldrive" >> $INSTALL_LOG # make the root partition - output=$(parted /dev/$ldrive mkpart primary $start_offset $root_part_size) + output=$(parted -s /dev/$ldrive mkpart primary $start_offset $root_part_size) status=$? if [ "$status" != 0 ]; then echo -e "Error creating primary partition on $ldrive.\nPlease see $INSTALL_LOG for more details.\nExiting..." @@ -1257,7 +1257,7 @@ setup_method_auto() { create_partitions "$INSTALL_DRIVE" "$ROOT_PARTITION_SIZE" 0 "yes" # mark data partition as bootable echo "Marking /dev/$INSTALL_DRIVE partition 1 as bootable" >> $INSTALL_LOG - parted /dev/$INSTALL_DRIVE set 1 boot on >> $INSTALL_LOG 2>&1 + parted -s /dev/$INSTALL_DRIVE set 1 boot on >> $INSTALL_LOG 2>&1 # Must give partition device time to settle sleep 5 } @@ -1519,7 +1519,7 @@ elif [ "$INSTALL_METHOD" == "vyatta" ]; then create_partitions "$INSTALL_DRIVE" "$ROOT_PARTITION_SIZE" 0 "yes" # mark data partition as bootable echo "Marking /dev/$INSTALL_DRIVE partition 1 as bootable" >> $INSTALL_LOG - parted /dev/$INSTALL_DRIVE set 1 boot on >> $INSTALL_LOG 2>&1 + parted -s /dev/$INSTALL_DRIVE set 1 boot on >> $INSTALL_LOG 2>&1 # Must give partition device time to settle sleep 5 fi diff --git a/scripts/install/install-functions b/scripts/install/install-functions index 07f385fa..ff4d6f48 100755 --- a/scripts/install/install-functions +++ b/scripts/install/install-functions @@ -132,16 +132,16 @@ get_drive_size () { ldrive=$1 # Make sure you can print disk info using parted - parted /dev/$ldrive p >/dev/null 2>&1 + parted --script /dev/$ldrive p >/dev/null 2>&1 # If unable to read disk, it's likely it needs a disklabel if [ "$?" != "0" ]; then lecho "Creating a new disklabel on $ldrive" lecho "parted /dev/$ldrive mklabel msdos" - output=$(parted /dev/$ldrive mklabel msdos) + output=$(parted -s /dev/$ldrive mklabel msdos) # Get the drive size from parted - lsize=$(parted /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') + lsize=$(parted -s /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') if [ $(echo $lsize | grep error) ]; then echo "Unable to read disk label. Exiting." @@ -150,7 +150,7 @@ get_drive_size () { fi # Get the drive size from parted - lsize=$(parted /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') + lsize=$(parted -s /dev/$ldrive p | grep "^Disk" | awk '{ print $3 }') # Get the reported units (mB, GB, kB) lmodifier=$(echo $lsize | sed 's/[0-9\.]//g') # remove the modifier @@ -177,7 +177,7 @@ probe_drives () { if [ $(cat /sys/block/$drive/ro) -ne 0 ]; then output=$(mount | grep $drive) if [ -z "$output" ]; then - output=$(parted /dev/$drive p) + output=$(parted -s /dev/$drive p) fi fi done diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index 250cec68..f010291e 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -290,7 +290,7 @@ check_for_new_raid () { sfdisk --change-id /dev/$drive $data_dev 0xfd # mark data partition as bootable lecho "Marking /dev/$drive partition $data_dev bootable" - output=$(parted /dev/$drive set $data_dev boot on 2>&1) + output=$(parted -s /dev/$drive set $data_dev boot on 2>&1) lecho "$output" done @@ -629,7 +629,7 @@ delete_partitions () { fi lecho "Removing partition $lpart on /dev/$ldrive" - output=$(parted /dev/$ldrive rm $lpart) + output=$(parted -s /dev/$ldrive rm $lpart) status=$? if [ "$status" != 0 ]; then echo -e "Warning: cannot delete partition $lpart on $ldrive.\n" @@ -683,7 +683,7 @@ create_partitions() { lecho "Creating root partition on /dev/$ldrive" # make the root partition - output=$(parted /dev/$ldrive mkpart primary $start_offset $root_part_size) + output=$(parted -s /dev/$ldrive mkpart primary $start_offset $root_part_size) status=$? if [ "$status" != 0 ]; then echo -e "Error creating primary partition on $ldrive.\nPlease see $INSTALL_LOG for more details.\nExiting..." @@ -842,7 +842,7 @@ setup_method_auto () { create_partitions "$INSTALL_DRIVE" "$root_part_size" 0 "yes" # mark data partition as bootable lecho "Marking /dev/$INSTALL_DRIVE partition 1 as bootable" - output=$(parted /dev/$INSTALL_DRIVE set 1 boot on 2>&1) + output=$(parted -s /dev/$INSTALL_DRIVE set 1 boot on 2>&1) lecho "$output" # Must give partition device time to settle sleep 5 -- cgit v1.2.3