[SM-Commit] GIT changes to devel-flux cauldron by Karsten Behrmann (9faf68892a754ea3542ab44ccd62da0eb6a4828d)

Karsten Behrmann scm at sourcemage.org
Fri Aug 22 10:34:26 EDT 2008


GIT changes to devel-flux cauldron by Karsten Behrmann <BearPerson at sourcemage.org>:

 src/enchant/menu/libmenu             |   43 ++++++++++++++++++++++++++++++-----
 src/enchant/menu/modules/disk-format |   29 +++++++++++++++++++----
 2 files changed, 61 insertions(+), 11 deletions(-)

New commits:
commit 9faf68892a754ea3542ab44ccd62da0eb6a4828d
Author: Karsten Behrmann <BearPerson at sourcemage.org>
Commit: Karsten Behrmann <BearPerson at sourcemage.org>

    This removes most missing bits of the code, can actually start trying
    to test all this, after fixing up paths and stuff.

diff --git a/src/enchant/menu/libmenu b/src/enchant/menu/libmenu
index fe1cb22..de09f69 100644
--- a/src/enchant/menu/libmenu
+++ b/src/enchant/menu/libmenu
@@ -27,16 +27,21 @@ function die_cmd() {
   exit ${3:-$EXIT_BAIL}
 }
 
+function run_dialog() {
+  dialog --backtitle "Source Mage GNU/Linux Installer, menu interface" \
+         --stdout --cr-wrap "$@"
+}
+
 # Menu / checklist / whatever
 # If this returns 0, use result from dialog, otherwise the user cancelled
 function menu_step() {
-  "${DIALOG[@]}" "$@"
+  run_dialog --extra-button --extra-label "back" --cancel-label "abort" "$@"
   rc=$?
   if [[ $rc == 0 ]] ;then # OK
     return 0
-  elif [[ $rc == 1 ]] ;then # back
+  elif [[ $rc == 3 ]] ;then # back
     return 1
-  elif [[ $rc == 3 ]] ;then # abort/cancel
+  elif [[ $rc == 1 ]] ;then # abort/cancel
     exit $EXIT_MAINMENU
   else
     die_cmd "dialog" $rc
@@ -47,11 +52,12 @@ function menu_step() {
 # Displays the doc blurb at the start of a step
 # Buttons: OK, main menu, shell
 # Only returns normally if the user pressed "OK", otherwise exits
-function menu_docbox() {
-  "${DIALOG[@]}" "$@"
+function menu_intro() {
+  run_dialog --extra-button --extra-label "shell" --yes-label "start" \
+             --no-label "main menu" --title "$1" --yesno "$2" 0 0
   rc=$?
   if [[ $rc == 0 ]] ;then
-    ((STATE++))
+    return 0
   elif [[ $rc == 1 ]] ;then # main menu
     exit $EXIT_MAINMENU
   elif [[ $rc == 3 ]] ;then # shell
@@ -61,6 +67,31 @@ function menu_docbox() {
   fi
 }
 
+function menu_central_menu() {
+  local title=$1
+  local text=$2
+  shift 2
+  run_dialog --extra-button --extra-label "done" --cancel-label "back" \
+             --title "$title" --menu "$text" 0 0 0 "$@"
+  local rc=$?
+  if [[ $rc != 0 ]] && [[ $rc != 1 ]] && [[ $rc != 3 ]] ;then
+    die_cmd "dialog" $rc
+  fi
+
+  return $rc
+}
+
+function menu_menu() {
+  local title=$1
+  local text=$2
+  shift 2
+  menu_step --title "$title" --menu "$text" 0 0 0 "$@"
+}
+
+function menu_inputbox() {
+  menu_step --title "$1" --inputbox "$2" 0 0 "$3"
+}
+
 function menu_loop() {
   STATE=initial
   while [[ $STATE != mainmenu ]] ;do
diff --git a/src/enchant/menu/modules/disk-format b/src/enchant/menu/modules/disk-format
index f77936a..121f95f 100644
--- a/src/enchant/menu/modules/disk-format
+++ b/src/enchant/menu/modules/disk-format
@@ -33,14 +33,20 @@ mkfs_command() {
 }
 
 function initial() {
-  menu_docbox "Do the disk stuff"
+  menu_intro "Intro: disk-format" \
+"In this menu you will be formatting your disk.
+blah blah blather, ignorum ipsorum latin pretend
+more junk to get some test text creativity all
+gone and this should do"
   STATE=get_part
   return 0
 }
 
 function get_part() {
   load_partitions
-  RESULT=$(menu_central_menu "${PARTITIONS[@]}" custom "Enter one manually")
+  RESULT=$(menu_central_menu "Partition selection menu" \
+           "Select a partition to format or hit 'done'" \
+           "${PARTITIONS[@]}" custom "Enter one manually")
   rc=$?
   if [[ $rc == 1 ]] ;then
     STATE=initial
@@ -48,8 +54,6 @@ function get_part() {
   elif [[ $rc == 3 ]] ;then
     STATE=finish
     return 0
-  else
-    die_cmd "dialog" $?
   fi
 
   PARTITION=$RESULT
@@ -61,7 +65,9 @@ function get_part() {
 }
 
 function enter_part() {
-  RESULT=$(menu_txtbox "Enter partition") ||
+  RESULT=$(menu_inputbox "Enter partition" \
+           "Please enter a partition to be formatted (including /dev/)" \
+           "/dev/") ||
   {
     STATE=get_part
     return 0
@@ -106,6 +112,19 @@ $MKFSCMD"
   fi
 }
 
+function tunecmd() {
+  RESULT=$(menu_inputbox "Alter command" \
+           "Alter the command below whatever way you like.
+It will be executed as if typed on the command line." \
+           "$MKFSCMD") ||
+  {
+    STATE=get_fstype
+    return 0
+  }
+  MKFSCMD=$RESULT
+  STATE=confirm
+}
+
 function result() {
   echo "Creating filesystem..."
   eval "$MKFSCMD" 2>&1 | tee /tmp/mkfs.out



More information about the SM-Commit mailing list