Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 May 2016 17:04:14 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300523 - head/usr.sbin/bsdinstall/scripts
Message-ID:  <201605231704.u4NH4Etf004310@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: allanjude
Date: Mon May 23 17:04:13 2016
New Revision: 300523
URL: https://svnweb.freebsd.org/changeset/base/300523

Log:
  Only export and re-import the root pool if installing on MBR
  
  This step is required in order to dd the boot2 bits into the ZFS partition
  
  Sponsored by:	ScaleEngine Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot	Mon May 23 16:59:05 2016	(r300522)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot	Mon May 23 17:04:13 2016	(r300523)
@@ -1310,10 +1310,6 @@ zfs_create_boot()
 		"mountpoint=/$zroot_name" "$zroot_name" ||
 		return $FAILURE
 
-	f_dprintf "$funcname: Set canmount=noauto for the root of the pool..."
-	f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
-		"$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
-
 	# Touch up permissions on the tmp directories
 	f_dprintf "$funcname: Modifying directory permissions..."
 	local dir
@@ -1338,17 +1334,17 @@ zfs_create_boot()
 		"bootfs=\"$zroot_name/$zroot_bootfs\"" "$zroot_name" ||
 		return $FAILURE
 
-	# Export the pool(s)
-	f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..."
-	f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" ||
-	             return $FAILURE
-	if [ "$ZFSBOOT_BOOT_POOL" ]; then
-		f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \
-		             "$bootpool_name" || return $FAILURE
-	fi
-
 	# MBR boot loader touch-up
 	if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then
+		# Export the pool(s)
+		f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..."
+		f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" ||
+			     return $FAILURE
+		if [ "$ZFSBOOT_BOOT_POOL" ]; then
+			f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \
+				     "$bootpool_name" || return $FAILURE
+		fi
+
 		f_dprintf "$funcname: Updating MBR boot loader on disks..."
 		# Stick the ZFS boot loader in the "convenient hole" after
 		# the ZFS internal metadata
@@ -1357,17 +1353,17 @@ zfs_create_boot()
 			             /boot/zfsboot /dev/$disk$bootpart \
 			             "skip=1 seek=1024" || return $FAILURE
 		done
-	fi
 
-	# Re-import the ZFS pool(s)
-	f_dprintf "$funcname: Re-importing ZFS pool(s)..."
-	f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
-	             "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" ||
-	             return $FAILURE
-	if [ "$ZFSBOOT_BOOT_POOL" ]; then
+		# Re-import the ZFS pool(s)
+		f_dprintf "$funcname: Re-importing ZFS pool(s)..."
 		f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
-		             "-o altroot=\"$BSDINSTALL_CHROOT\"" \
-		             "$bootpool_name" || return $FAILURE
+			     "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" ||
+			     return $FAILURE
+		if [ "$ZFSBOOT_BOOT_POOL" ]; then
+			f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
+				     "-o altroot=\"$BSDINSTALL_CHROOT\"" \
+				     "$bootpool_name" || return $FAILURE
+		fi
 	fi
 
 	# While this is apparently not needed, it seems to help MBR
@@ -1378,6 +1374,14 @@ zfs_create_boot()
 	             "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \
 	             "$zroot_name" || return $FAILURE
 
+	#
+	# Set canmount=noauto so that the default Boot Environment (BE) does not
+	# get mounted if a different BE is selected from the beastie menu
+	#
+	f_dprintf "$funcname: Set canmount=noauto for the root of the pool..."
+	f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
+		"$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
+
 	# Last, but not least... required lines for rc.conf(5)/loader.conf(5)
 	# NOTE: We later concatenate these into their destination
 	f_dprintf "%s: Configuring rc.conf(5)/loader.conf(5) additions..." \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605231704.u4NH4Etf004310>