diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-03-30 20:56:39 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-03-30 20:56:39 +0200 |
commit | a6052f5c0739b5acdba0e736b7e320f339df126d (patch) | |
tree | 29e13b83171c03e410ab01066fda93c94119dc6c /src/core/libs | |
parent | 238c38a9ac14e0bc2f891a51b8a2f1a3bbc66aa3 (diff) |
no need for tzselect anymore. yeay
Diffstat (limited to 'src/core/libs')
-rw-r--r-- | src/core/libs/lib-ui.sh | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index d3c3948..59a04bc 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -160,6 +160,30 @@ _getavaildisks() } +# ask for a timezone. +# this is pretty similar to how tzselect looks, but we support dia+cli + we don't actually change the clock +ask_timezone () +{ + REGIONS="" + for i in $(grep '^[A-Z]' /usr/share/zoneinfo/zone.tab | cut -f 3 | sed -e 's#/.*##g'| sort -u); do + REGIONS="$REGIONS $i -" + done + while true; do + ask_option no "Please select a region" '' required $REGIONS + region=$ANSWER_OPTION + if [ $? -eq 0 ]; then + ZONES="" + for i in $(grep '^[A-Z]' /usr/share/zoneinfo/zone.tab | grep $region/ | cut -f 3 | sed -e "s#$region/##g"| sort -u); do + ZONES="$ZONES $i -" + done + ask_option no "Please select a timezone" '' required $ZONES + zone=$ANSWER_OPTION + [ $? -eq 0 ] && ANSWER_TIMEZONE="$region/$zone" && return + fi + done +} + + # ask the user to make a selection from a certain group of things # $1 question # shift;shift; $@ list of options. first tag, then item then ON/OFF. if item == ^ or - it will not be shown in cli mode. @@ -237,13 +261,6 @@ ask_string () } -ask_timezone () -{ - [ "$var_UI_TYPE" = dia ] && { _dia_ask_timezone "$@" ; return $? ; } - [ "$var_UI_TYPE" = cli ] && { _cli_ask_timezone "$@" ; return $? ; } -} - - # ask a yes/no question. # $1 question # $2 default answer yes/no (optional) @@ -419,27 +436,6 @@ _dia_ask_string () } -_dia_ask_timezone () -{ - REGIONS="" - for i in $(grep '^[A-Z]' /usr/share/zoneinfo/zone.tab | cut -f 3 | sed -e 's#/.*##g'| sort -u); do - REGIONS="$REGIONS $i -" - done - while true; do - ask_option no "Please select a region" '' required $REGIONS - region=$ANSWER_OPTION - if [ $? -eq 0 ]; then - ZONES="" - for i in $(grep '^[A-Z]' /usr/share/zoneinfo/zone.tab | grep $region/ | cut -f 3 | sed -e "s#$region/##g"| sort -u); do - ZONES="$ZONES $i -" - done - ask_option no "Please select a timezone" '' required $ZONES - zone=$ANSWER_OPTION - [ $? -eq 0 ] && ANSWER_TIMEZONE="$region/$zone" && return - fi - done -} - _dia_ask_yesno () { @@ -609,12 +605,6 @@ _cli_ask_string () } -_cli_ask_timezone () -{ - ANSWER_TIMEZONE=`tzselect` -} - - _cli_ask_yesno () { [ -z "$2" ] && echo -n "$1 (y/n): " |