summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-11-01 15:24:25 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-11-01 15:24:25 +0100
commitd4b0f4f47ad4a7c8398e3efd1f131895bdcc11b4 (patch)
treefe9a037c0f86606c033eeb7211560a3509113f14 /src
parent03e56ee6cccca7783ddf1da26bb2c70b8b454e0a (diff)
some lib-ui fixes and other stuff
Diffstat (limited to 'src')
-rw-r--r--src/lib/lib-ui.sh32
-rw-r--r--src/profiles/profile-base2
-rw-r--r--src/profiles/profile-interactive-DRAFT.sh10
3 files changed, 37 insertions, 7 deletions
diff --git a/src/lib/lib-ui.sh b/src/lib/lib-ui.sh
index 9962d84..aff5546 100644
--- a/src/lib/lib-ui.sh
+++ b/src/lib/lib-ui.sh
@@ -43,6 +43,7 @@ ask_string ()
}
+# TODO: we should have a wrapper around this function that keeps trying until the user entered a valid numeric?
# ask for a number.
# $1 question
# $2 lower limit (optional)
@@ -52,6 +53,8 @@ ask_string ()
ask_number ()
{
[ -z "$1" ] && die_error "ask_number needs a question!"
+ [ -n "$2" ] && [[ $2 = *[^0-9]* ]] && die_error "ask_number \$2 must be a number! not $2"
+ [ -n "$3" ] && [[ $3 = *[^0-9]* ]] && die_error "ask_number \$3 must be a number! not $3"
[ "$var_UI_TYPE" = dia ] && { _dia_ask_number $@ ; return $? }
[ "$var_UI_TYPE" = cli ] && { _cli_ask_number $@ ; return $? }
}
@@ -195,16 +198,41 @@ _cli_ask_yesno ()
_cli_ask_string ()
{
+ echo "$@"
+ read answ
+ echo "$answ"
+ [ -z "$answ" ] && return 1
+ return 0
}
_cli_ask_number ()
{
-}
-
+ #TODO: i'm not entirely sure this works perfectly. what if user doesnt give anything or wants to abort?
+ while true
+ do
+ str="$1"
+ [ -n "$2" ] && str2="min $2"
+ [ -n "$3" ] && str2="$str2 max $3"
+ [ -n "$str2" ] && str="$str ( $str2 )"
+ echo "$str"
+ read answ
+ if [[ $answ = *[^0-9]* ]]
+ then
+ show_warning "$answ is not a number! try again."
+ else
+ break
+ fi
+ done
+ echo "$answ"
+ [ -z "$answ" ] && return 1
+ return 0
+}
+
_cli_ask_option ()
{
+ die_error "_cli_ask_option Not yet implemented"
}
diff --git a/src/profiles/profile-base b/src/profiles/profile-base
index 72df3b1..2acab59 100644
--- a/src/profiles/profile-base
+++ b/src/profiles/profile-base
@@ -75,7 +75,7 @@ worker_install_packages ()
worker_install_bootlader ()
{
- #TODO: autodetection or whatever
+ #TODO: ask which disk, install grub on it
true
}
diff --git a/src/profiles/profile-interactive-DRAFT.sh b/src/profiles/profile-interactive-DRAFT.sh
index b4f281d..b7644e3 100644
--- a/src/profiles/profile-interactive-DRAFT.sh
+++ b/src/profiles/profile-interactive-DRAFT.sh
@@ -28,10 +28,12 @@ S_CONFIG=0 # configuration editing
S_GRUB=0 # TODO: kill this - if using grub
S_BOOT="" # bootloader installed (set to loader name instead of 1)
-
-DIALOG --infobox "Generating GRUB device map...\nThis could take a while.\n\n Please be patient." 0 0
-get_grub_map
-
+phase_preparation ()
+{
+ execute worker runtime_packages
+ notify "Generating GRUB device map...\nThis could take a while.\n\n Please be patient."
+ get_grub_map
+}
mainmenu()
{