From 07a3d23197d60b357f3b42e0cc2e490d07702982 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 21 Nov 2008 22:06:44 +0100 Subject: porting of interactive_filesystems WIP --- src/core/procedures/interactive | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/procedures') diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 1fb3378..d912091 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -165,7 +165,7 @@ worker_prepare_disks() if [ "$DISK_CONFIG_TYPE" = "auto" ]; then notify "You have already prepared your filesystems with Auto-prepare" #TODO: allow user to do this anyway. he can change his mind. else - interactive_mountpoints && ret=0 && NEXTITEM=4 && DISK_CONFIG_TYPE=manual + interactive_filesystems && ret=0 && NEXTITEM=4 && DISK_CONFIG_TYPE=manual fi ;; *) -- cgit v1.2.3-54-g00ecf From 55d02e8eac1abf142e71dbefd80dd9afc5cf25b5 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 3 Dec 2008 22:48:13 +0100 Subject: clearer step name --- src/core/procedures/interactive | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/procedures') diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index d912091..66efaec 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -147,7 +147,7 @@ worker_prepare_disks() ask_option $default "Prepare Hard Drive" \ "1" "Auto-Prepare (erases the ENTIRE hard drive and sets up partitions and filesystems)" \ "2" "Partition Hard Drives" \ - "3" "Set Filesystem Mountpoints" \ + "3" "Configure block devices, filesystems and mountpoints" \ "4" "Return to Main Menu" case $ANSWER_OPTION in -- cgit v1.2.3-54-g00ecf From 7500ef53598f2ee2c128bd9b93d5c94b1aa7b6e9 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 7 Dec 2008 15:55:55 +0100 Subject: refactored/cleanup datetime/timezone stuff --- src/core/libs/lib-ui-interactive.sh | 63 +++++++++++++++++-------------------- src/core/libs/lib-ui.sh | 28 +++++++++++++++++ src/core/procedures/base | 10 +----- src/core/procedures/interactive | 12 +------ 4 files changed, 58 insertions(+), 55 deletions(-) (limited to 'src/core/procedures') diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index dd3f495..0725644 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -62,45 +62,38 @@ interactive_configure_system() # returns: 1 on failure interactive_set_clock() { - # utc or local? - ask_option no "Is your hardware clock in UTC or local time?" \ - "UTC" " " \ - "local" " " \ - || return 1 - HARDWARECLOCK=$ANSWER_OPTION + # utc or local? + ask_option no "Is your hardware clock in UTC or local time?" "UTC" " " "local" " " || return 1 + HARDWARECLOCK=$ANSWER_OPTION - # timezone? - TIMEZONE=`tzselect` || return 1 + # timezone? + ask_timezone || return 1 + TIMEZONE=$ANSWER_TIMEZONE + # 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 - # 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 - dialog --calendar "Set the date.\nUse to navigate and arrow keys to change values." 0 0 0 0 0 2> $ANSWER || return 1 - local _date="$(cat $ANSWER)" - dialog --timebox "Set the time.\nUse to navigate and up/down to change values." 0 0 2> $ANSWER || return 1 - local _time="$(cat $ANSWER)" - echo "date: $_date time: $_time" >$LOG - - # save the time - # DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss - local _datetime="$(echo "$_date" "$_time" | sed 's#\(..\)/\(..\)/\(....\) \(..\):\(..\):\(..\)#\3-\2-\1 \4:\5:\6#g')" - echo "setting date to: $_datetime" >$LOG - date -s "$_datetime" 2>&1 >$LOG - /sbin/hwclock --systohc $HWCLOCK_PARAMS --noadjfile + 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 - return 0 + # 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 } diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index 1ca87d5..9191998 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -137,6 +137,28 @@ ask_checklist () +ask_datetime () +{ + if [ "$var_UI_TYPE" = dia ] + then + # display and ask to set date/time + dialog --calendar "Set the date.\nUse to navigate and arrow keys to change values." 0 0 0 0 0 2> $ANSWER || return 1 + local _date="$(cat $ANSWER)" # form like: 07/12/2008 + dialog --timebox "Set the time.\nUse to navigate and up/down to change values." 0 0 2> $ANSWER || return 1 + local _time="$(cat $ANSWER)" # form like: 15:26:46 + echo "date: $_date time: $_time" >$LOG + + # DD/MM/YYYY hh:mm:ss -> MMDDhhmmYYYY.ss (date default format, set like date $ANSWER_DATETIME) Not enabled because there is no use for it i think. + # ANSWER_DATETIME=$(echo "$_date" "$_time" | sed 's#\(..\)/\(..\)/\(....\) \(..\):\(..\):\(..\)#\2\1\4\5\3\6#g') + # DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss ( date string format, set like date -s $ANSWER_DATETIME) + ANSWER_DATETIME="$(echo "$_date" "$_time" | sed 's#\(..\)/\(..\)/\(....\) \(..\):\(..\):\(..\)#\3-\2-\1 \4:\5:\6#g')" + elif [ "$var_UI_TYPE" = cli ] + ask_string "Enter date [YYYY-MM-DD hh:mm:ss]" + ANSWER_DATETIME=$ANSWER_STRING + fi +} + + # TODO: we should have a wrapper around this function that keeps trying until the user entered a valid numeric?, maybe a wrapper that wraps all functions # ask for a number. # $1 question @@ -191,6 +213,12 @@ ask_string () } +ask_timezone () # TODO: how to do this in dia? +{ + ANSWER_TIMEZONE=`tzselect` +} + + # ask a yes/no question. # $1 question # $2 default answer yes/no (optional) diff --git a/src/core/procedures/base b/src/core/procedures/base index 7af1452..8a586fb 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -62,15 +62,7 @@ worker_runtime_packages () worker_set_clock () { - HARDWARECLOCK=utc - TIMEZONE=`tzselect` - HWCLOCK_PARAMS=" --utc" - if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ] - then - cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime - fi - /sbin/hwclock --hctosys $HWCLOCK_PARAMS --noadjfile - #TODO: user must set date/time and store it + interactive_set_clock } diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 66efaec..ce63bd1 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -1,5 +1,5 @@ #!/bin/sh -depend_procedure core base # esp for auto_{network,locale,fstab} workers +depend_procedure core base # esp for auto_{network,locale,fstab} and set_clock workers # This is a port of the original /arch/setup script. It doesn't use aif phases but uses it's own menu-based flow (phase) control @@ -176,16 +176,6 @@ worker_prepare_disks() } -# set_clock() -# prompts user to set hardware clock and timezone -# -# params: none -set_clock() -{ - interactive_set_clock -} - - worker_select_source () { #TODO: how to handle user going here again? discard previous settings, warn him that he already done it? -- cgit v1.2.3-54-g00ecf