From 867fb41d0a96dc2da6fc48b485541786f6f65aeb Mon Sep 17 00:00:00 2001 From: allanjude Date: Tue, 26 Jul 2016 05:27:26 +0000 Subject: 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) --- usr.sbin/bsdinstall/scripts/time | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'usr.sbin/bsdinstall') 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 -- cgit v1.1