summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-ui-interactive.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-02-25 22:09:05 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2009-02-25 22:09:05 +0100
commit5cd407fbb9b44b476ae7c9d460594322f465c24f (patch)
treeb4da65dd041a70fcc9409c5c3de9dc547f43d08d /src/core/libs/lib-ui-interactive.sh
parente65d1175c2c6e4156280d2ee5980f65e2794f776 (diff)
adding refactored/reordered date/time setting logic into aif. based on tpowa's tz script. this also means an ncurses implementation of timezone selection
Diffstat (limited to 'src/core/libs/lib-ui-interactive.sh')
-rw-r--r--src/core/libs/lib-ui-interactive.sh60
1 files changed, 32 insertions, 28 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 804d3c3..f99518e 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -57,48 +57,52 @@ interactive_configure_system()
}
-# set_clock()
-# prompts user to set hardware clock and timezone
-#
-# params: none
-# returns: 1 on failure
-interactive_set_clock()
-{
- # utc or localtime?
- ask_option no "Clock configuration" "Is your hardware clock in UTC or local time?" "UTC" " " "localtime" " " || return 1
- HARDWARECLOCK=$ANSWER_OPTION
-
- # timezone?
+interactive_timezone () {
ask_timezone || return 1
- TIMEZONE=$ANSWER_TIMEZONE
+ TIMEZONE=$ANSWER_TIMEZONE
+ infofy "Setting Timezone to $TIMEZONE"
+ [ -e /etc/localtime ] && rm -f /etc/localtime #why do we do this?? tpowa?
+ dohwclock
+}
+
+
+
+interactive_time () {
+ # utc or localtime?
+ ask_option no "Clock configuration" "Is your hardware clock in UTC or local time?" "UTC" " " "localtime" " " || return 1
+ HARDWARECLOCK=$ANSWER_OPTION
+
+ dohwclock
+
+ which ntpdate >/dev/null && ask_option yes "'ntpdate' was detected on your system.\n\nDo you want to use 'ntpdate' for syncing your clock,\nby using the internet clock pool?" "(You need a working internet connection for doing this!)" #TODO: only propose if network ok.
+ if [ $? -eq 0 ]; then
+ if ntpdate pool.ntp.org >/dev/null
+ then
+ notify "Synced clock with internet pool successfully.\n\nYour current time is now:\n$(date)"
+ else
+ show_warning 'Ntp failure' "An error has occured, time was not changed!"
+ fi
+ else
+
+ # display and ask to set date/time
+ ask_datetime
- # set system clock from hwclock - stolen from rc.sysinit
- local HWCLOCK_PARAMS=""
- if [ "$HARDWARECLOCK" = "UTC" ]
- then
- HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
- else
- HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
- fi
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]
then
/bin/rm -f /etc/localtime
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
fi
- /sbin/hwclock --hctosys $HWCLOCK_PARAMS --noadjfile
-
- # display and ask to set date/time
- ask_datetime
# save the time
date -s "$ANSWER_DATETIME" || show_warning "Date/time setting failed" "Something went wrong when doing date -s $ANSWER_DATETIME"
- /sbin/hwclock --systohc $HWCLOCK_PARAMS --noadjfile
-
- return 0
+ dohwclock
}
+
+
+
interactive_autoprepare()
{
DISCS=$(finddisks)