[Voyage-linux] [PATCH] voyage-install: allow "Select Target Profile" to keep current settings

Jim Cromie jim.cromie at gmail.com
Tue Aug 21 23:43:15 HKT 2012


When using voyage.update, I have always just <enter>d thru all the
steps, but I repeatedly have to change the serial speed to match the
speed set in my 4801's bios.

I finally went straight to step 5, and found setting correct (as set
by me previously), so I worked backwards to find that step 2 is
changing it to the profile default.

Since select-profile.sh explicitly says its overriding current
settings (and I presume theres a reason for that), this patch adds a
warning, to remind me (and others) not to do that anymore, unless they
mean it.

What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile - this overwrites current settings
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=2 [Select Target Profile - this overwrites current settings]): 3

If you (by habit) hit enter to accept the default, you have a 2nd
chance to undo it (besides ^C and starting over); patch prepends an
additional option 1 - to keep existing settings, which exits early
without overwriting settings from the profile.

Please select Voyage profile:
  1 - Keep existing settings
  2 - 4501
  3 - 4511/4521
  4 - 4801
  5 - 5501
  6 - 6501
  7 - ALIX
  8 - Generic PC
  9 - Notebook (pcmcia)
  10 - WRAP
      (default=4 [4801]): 1

keeping existing settings

Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
 usr/local/sbin/select-profile.sh | 11 +++++++++++
 usr/local/sbin/voyage-install.sh |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/usr/local/sbin/select-profile.sh b/usr/local/sbin/select-profile.sh
index f6f296d..910f5f2 100755
--- a/usr/local/sbin/select-profile.sh
+++ b/usr/local/sbin/select-profile.sh
@@ -42,6 +42,10 @@ for filename in *; do
 	fi
 done
 
+# prepend an early escape option
+prolist="Keep existing settings%$prolist"
+filelist="none%$filelist"
+
 # restore our directory
 cd $RUNDIR
 # Get current setting of $VOYAGE_PROFILE to use as user's default
@@ -55,6 +59,13 @@ if [ "$2" != "run" ] ; then
     ask_setting "Please select Voyage profile:" "$prolist" $v
 fi
 
+# maybe quit early without loading profile and overwriting current settings
+if [ $v = 1 ] ; then
+    echo "keeping existing settings"
+    echo
+    w=none # expected non-null by caller: voyage-install
+    return
+fi
 # save the user's choice - we'll need it when we fetch the file contents
 proix=$v
 list_str "$prolist" "$VOYAGE_PROFILE"
diff --git a/usr/local/sbin/voyage-install.sh b/usr/local/sbin/voyage-install.sh
index 9f65229..b9d5e4a 100755
--- a/usr/local/sbin/voyage-install.sh
+++ b/usr/local/sbin/voyage-install.sh
@@ -443,7 +443,7 @@ if [ "$run_dialog" = 1 ]; then
 	# here we define the different choices which can be made by the user
 	# OPTIONS-Format: option "%" option "%" option
 	# option-Format:  number ":" description ":" preset (here: by command line)
-	OPTIONS="1:Specify Distribution Directory:$CLA_DISTDIR%2:Select Target Profile:$CLA_VOYAGE_PROFILE%3:Select Target Disk:$CLA_TARGET_DISK%4:Select Target Bootstrap Loader:$CLA_SYSTEM_BOOTSTRAP%5:Configure Target Console:$CLA_VOYAGE_SYSTEM_CONSOLE%6:Partition and Create Filesystem:$CLA_MAKEFS%7:Copy Distribution to Target:1%8:Exit:1"
+	OPTIONS="1:Specify Distribution Directory:$CLA_DISTDIR%2:Select Target Profile - this overwrites current settings:$CLA_VOYAGE_PROFILE%3:Select Target Disk:$CLA_TARGET_DISK%4:Select Target Bootstrap Loader:$CLA_SYSTEM_BOOTSTRAP%5:Configure Target Console:$CLA_VOYAGE_SYSTEM_CONSOLE%6:Partition and Create Filesystem:$CLA_MAKEFS%7:Copy Distribution to Target:1%8:Exit:1"
 	
 	opt=1
 	while true
-- 
1.7.11.4




More information about the Voyage-linux mailing list