summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorallanjude <allanjude@FreeBSD.org>2016-07-26 05:27:26 +0000
committerallanjude <allanjude@FreeBSD.org>2016-07-26 05:27:26 +0000
commit867fb41d0a96dc2da6fc48b485541786f6f65aeb (patch)
tree9c486f2b46e1c77100b15418fd1357065cbd1dc6 /usr.sbin
parente004d7b2a6cc8351712016d35e3f4aa5e9930431 (diff)
downloadFreeBSD-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-xusr.sbin/bsdinstall/scripts/time38
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
OpenPOWER on IntegriCloud