From owner-svn-src-head@freebsd.org Mon May 23 17:04:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D28BB47B19; Mon, 23 May 2016 17:04:15 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBD1F1BBE; Mon, 23 May 2016 17:04:14 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NH4ETW004311; Mon, 23 May 2016 17:04:14 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NH4Etf004310; Mon, 23 May 2016 17:04:14 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605231704.u4NH4Etf004310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Mon, 23 May 2016 17:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300523 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 17:04:15 -0000 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..." \