summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdinstall/scripts
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-07-26 10:03:26 -0300
committerRenato Botelho <renato@netgate.com>2016-07-26 10:03:26 -0300
commitf235fecdc77c17505022bc5202d74f3d36b33359 (patch)
treed19bff28eecf5486a6b0f5fe735293776e870051 /usr.sbin/bsdinstall/scripts
parentd672f772561b19a87633a38b63c9b6b9ee457a3e (diff)
parentfab477420776a3080f08726a632aca5eb14eecba (diff)
downloadFreeBSD-src-f235fecdc77c17505022bc5202d74f3d36b33359.zip
FreeBSD-src-f235fecdc77c17505022bc5202d74f3d36b33359.tar.gz
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'usr.sbin/bsdinstall/scripts')
-rwxr-xr-xusr.sbin/bsdinstall/scripts/time38
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot12
2 files changed, 49 insertions, 1 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
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index d2de12b..9fbf5c9 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -224,6 +224,7 @@ ZFS_UNMOUNT='zfs unmount "%s"'
ZPOOL_CREATE_WITH_OPTIONS='zpool create %s "%s" %s %s'
ZPOOL_DESTROY='zpool destroy "%s"'
ZPOOL_EXPORT='zpool export "%s"'
+ZPOOL_EXPORT_F='zpool export -f "%s"'
ZPOOL_IMPORT_WITH_OPTIONS='zpool import %s "%s"'
ZPOOL_LABELCLEAR_F='zpool labelclear -f "%s"'
ZPOOL_SET='zpool set %s "%s"'
@@ -783,6 +784,14 @@ zfs_create_diskpart()
# NOTE: `-F' required to destroy if partitions still exist.
# NOTE: Failure is ok here, blank disk will have nothing to destroy.
#
+ f_dprintf "$funcname: Exporting ZFS pools..."
+ zpool list -Ho name | while read z_name; do
+ f_eval_catch -d $funcname zpool "$ZPOOL_EXPORT_F" $z_name
+ done
+ f_dprintf "$funcname: Detaching all GELI providers..."
+ geli status | tail -n +2 | while read g_name g_status g_component; do
+ f_eval_catch -d $funcname geli "$GELI_DETACH_F" $g_name
+ done
f_dprintf "$funcname: Destroying all data/layouts on \`%s'..." "$disk"
f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
f_eval_catch -d $funcname graid "$GRAID_DELETE" $disk
@@ -1384,8 +1393,9 @@ zfs_create_boot()
"-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" ||
return $FAILURE
if [ "$ZFSBOOT_BOOT_POOL" ]; then
+ # Import the bootpool, but do not mount it yet
f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
- "-o altroot=\"$BSDINSTALL_CHROOT\"" \
+ "-o altroot=\"$BSDINSTALL_CHROOT\" -N" \
"$bootpool_name" || return $FAILURE
fi
fi
OpenPOWER on IntegriCloud