From 8235cf8d86639a1b42d33e8037cf189b725e1616 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 25 Sep 2008 19:08:40 +0000 Subject: do not ask if only one device is found (from Miura?) --- rescue/restore-image.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'rescue/restore-image.sh') diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh index 8e5567d0a..9336b50e6 100755 --- a/rescue/restore-image.sh +++ b/rescue/restore-image.sh @@ -76,20 +76,26 @@ function detect_root() dev=$(sed '/\/tmp\/media/!d;s/[0-9] .*$//;s/^.*\///' /proc/mounts) devices=$(grep "^ .*[^0-9]$" < /proc/partitions | grep -v ${dev} | awk '{ print $4,$3 }') - if [ ! -z ${dev} ]; then - opcao=$(dialog --backtitle "$BACKTITLE" --title "$TITLE" --stdout --menu 'Choose one of the detected devices to restore to (check the blocks size column first):' 8 50 0 $devices ) - if [ "$?" != "0" ]; then - _yesno "\nInterrupt installation?\n " - if [ "$?" = "0" ]; then - _shutdown - fi - else - root=$opcao - fi - - echo "$root" + devs_found=$(echo $devices | wc -w) + if [ "$devs_found" -gt "2" ]; then + if [ ! -z ${dev} ]; then + opcao=$(dialog --backtitle "$BACKTITLE" --title "$TITLE" --stdout --menu 'Choose one of the detected devices to restore to (check the blocks size column first):' 8 50 0 $devices ) + if [ "$?" != "0" ]; then + _yesno "\nInterrupt installation?\n " + if [ "$?" = "0" ]; then + _shutdown + fi + else + root=$opcao + fi + + echo "$root" + else + _msgbox "\nError writing image: disk device not detected\n" + fi else - _msgbox "\nError writing image: disk device not detected\n" + root=$(echo $devices | cut -d ' ' -f 1) + echo "$root" fi } -- cgit v1.2.1