summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdinstall
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bsdinstall')
-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