From c28ba0b578cb72bd6606dd5afb465dd25f3be1be Mon Sep 17 00:00:00 2001
From: Dieter Plaetinck <dieter@plaetinck.be>
Date: Sat, 1 Aug 2009 18:46:51 +0200
Subject: optionally reuse existing $TMP_PARTITIONS if found + bugfix when
 reusing $TMP_BLOCKDEVICES

---
 src/core/libs/lib-ui-interactive.sh | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 48b4866..a9ac092 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -311,6 +311,16 @@ interactive_autoprepare()
 interactive_partition() {
     target_umountall
 
+	question_text="Select the disk you want to partition"
+	if [ -f "$TMP_PARTITIONS" ]
+	then
+		if ask_yesno "I've detected you already have partition definitions in place:\n`cat $TMP_PARTITIONS`\nDo you want apply these now?  Pick 'no' when in doubt to start from scratch" no
+		then
+			process_disks || die_error "Something went wrong while partitioning"
+			question_text="If you want to do further changes, you can (re)partition disks here"
+		fi
+	fi
+
     # Select disk to partition
     DISCS=$(finddisks 1 _)
     DISCS="$DISCS OTHER - DONE +"
@@ -318,7 +328,7 @@ interactive_partition() {
     DISC=""
     while true; do
         # Prompt the user with a list of known disks
-        ask_option no 'Disc selection' "Select the disk you want to partition (select DONE when finished)" required $DISCS || return 1
+        ask_option no 'Disc selection' "$question_text (select DONE when finished)" required $DISCS || return 1
         DISC=$ANSWER_OPTION
         if [ "$DISC" = "OTHER" ]; then
             ask_string "Enter the full path to the device you wish to partition" "/dev/sda" || return 1
@@ -573,7 +583,7 @@ interactive_filesystems() {
 	then
 		if ask_yesno "I've detected you already have blockdevice definitions in place:\n`cat $TMP_BLOCKDEVICES`\nDo you want to use these as a starting point?\nMake sure your disk(s) are partitioned correctly so your definitions can be applied on the disk. Pick 'no' when in doubt to start from scratch" no
 		then
-			new_blockdevices=0
+			renew_blockdevices=0
 		fi
 	fi
 	[ "$renew_blockdevices" = 1 ] && findpartitions 0 'no_fs' ' raw no_label' > $TMP_BLOCKDEVICES
-- 
cgit v1.2.3-54-g00ecf