bsdinstall: Prompt user to set the date and time after selecting timezone

Not having the correct date and time makes many PKI based things not work

In 10 and 11, it can mean that Unbound, ntpd, and sshd won't start

Submitted by:	des (original patch)
MFC after:	7 days
This commit is contained in:
Allan Jude 2016-07-13 23:49:45 +00:00
parent 07b8a57120
commit 09c4000afe

View File

@ -26,4 +26,40 @@
#
# $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' \
--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' \
--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