diff options
author | allanjude <allanjude@FreeBSD.org> | 2016-07-26 05:27:26 +0000 |
---|---|---|
committer | allanjude <allanjude@FreeBSD.org> | 2016-07-26 05:27:26 +0000 |
commit | 867fb41d0a96dc2da6fc48b485541786f6f65aeb (patch) | |
tree | 9c486f2b46e1c77100b15418fd1357065cbd1dc6 /usr.sbin | |
parent | e004d7b2a6cc8351712016d35e3f4aa5e9930431 (diff) | |
download | FreeBSD-src-867fb41d0a96dc2da6fc48b485541786f6f65aeb.zip FreeBSD-src-867fb41d0a96dc2da6fc48b485541786f6f65aeb.tar.gz |
MFC: r302790, r302795
Add new menu to bsdinstall to allow user to set date and time after
selecting timezone. The 'skip' button is the default selection.
Submitted by: des
Approved by: re (gjb)
Diffstat (limited to 'usr.sbin')
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/time | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/usr.sbin/bsdinstall/scripts/time b/usr.sbin/bsdinstall/scripts/time index 74400b6..67e539b 100755 --- a/usr.sbin/bsdinstall/scripts/time +++ b/usr.sbin/bsdinstall/scripts/time @@ -26,4 +26,42 @@ # # $FreeBSD$ +# Select timezone chroot $BSDINSTALL_CHROOT tzsetup + +# Switch to target timezone +saved_TZ="$TZ" +TZ="${BSDINSTALL_CHROOT}/etc/localtime" +export TZ + +# Set date +exec 3>&1 +DATE=$(dialog --backtitle 'FreeBSD Installer' \ + --title 'Time & Date' \ + --ok-label 'Set Date' \ + --cancel-label 'Skip' \ + --defaultno \ + --date-format '%Y%m%d%H%M.%S' \ + --calendar '' 2 40 \ +2>&1 1>&3) && date $DATE +exec 3>&- + +# Set time +exec 3>&1 +TIME=$(dialog --backtitle 'FreeBSD Installer' \ + --title 'Time & Date' \ + --ok-label 'Set Time' \ + --cancel-label 'Skip' \ + --defaultno \ + --time-format '%H%M.%S' \ + --timebox '' 2 40 \ +2>&1 1>&3) && date $TIME +exec 3>&- + +# Switch back +if [ -n "$saved_TZ" ]; then + TZ="$saved_TZ" +else + unset TZ +fi +unset saved_TZ |