From owner-svn-src-head@FreeBSD.ORG Thu May 22 19:36:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 614CDCED; Thu, 22 May 2014 19:36:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4E296239F; Thu, 22 May 2014 19:36:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4MJaUrW032369; Thu, 22 May 2014 19:36:30 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4MJaUcq032368; Thu, 22 May 2014 19:36:30 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201405221936.s4MJaUcq032368@svn.freebsd.org> From: Devin Teske Date: Thu, 22 May 2014 19:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266555 - 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.18 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: Thu, 22 May 2014 19:36:30 -0000 Author: dteske Date: Thu May 22 19:36:29 2014 New Revision: 266555 URL: http://svnweb.freebsd.org/changeset/base/266555 Log: Fix syntax error thrown at the point of creating the root pool, caused by an embedded newline appearing within the options string surrounded by double-quotes. Rework the logic that goes into setting dataset options on the root pool dataset while we're here -- added two new variables (which can be altered via scripting) ZFSBOOT_POOL_CREATE_OPTIONS and also ZFSBOOT_BOOT_POOL_CREATE_OPTIONS for setting pool/dataset attributes at the time of pool creation. The former is for setting options on the root pool (zroot) and the latter is for setting options on the optional separate boot pool (bootpool) implicitly enabled when using either GELI or MBR. The default value for the root pool variable (ZFSBOOT_POOL_CREATE_OPTIONS) is "-O compress=lz4 -O atime=off" and the default value for separate boot pool variable (ZFSBOOT_BOOT_POOL_CREATE_OPTIONS) is NULL (no additional options for the separate boot pool dataset). Reviewed by: allanjude MFC after: 7 days X-MFC-with: r266107-266109 Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Thu May 22 19:25:41 2014 (r266554) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Thu May 22 19:36:29 2014 (r266555) @@ -45,6 +45,11 @@ f_include $BSDCFG_SHARE/variable.subr : ${ZFSBOOT_POOL_NAME:=zroot} # +# Default options to use when creating zroot pool +# +: ${ZFSBOOT_POOL_CREATE_OPTIONS:=-O compress=lz4 -O atime=off} + +# # Default name for the boot environment parent dataset # : ${ZFSBOOT_BEROOT_NAME:=ROOT} @@ -82,6 +87,11 @@ f_include $BSDCFG_SHARE/variable.subr : ${ZFSBOOT_BOOT_POOL=} # +# Options to use when creating separate boot pool (if any) +# +: ${ZFSBOOT_BOOT_POOL_CREATE_OPTIONS:=} + +# # Default name for boot pool when enabled (e.g., geli(8) or MBR) # : ${ZFSBOOT_BOOT_POOL_NAME:=bootpool} @@ -942,6 +952,7 @@ zfs_create_boot() local disks="$*" disk local isswapmirror local bootpart targetpart swappart # Set by zfs_create_diskpart() below + local create_options # # Pedantic checks; should never be seen @@ -1066,7 +1077,9 @@ zfs_create_boot() f_count nvdevs $boot_vdevs [ $nvdevs -gt 1 ] && bootpool_vdevtype=mirror + create_options="$ZFSBOOT_BOOT_POOL_CREATE_OPTIONS" bootpool_options="-o altroot=$BSDINSTALL_CHROOT" + bootpool_options="$bootpool_options $create_options" bootpool_options="$bootpool_options -m \"/$bootpool_name\" -f" f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \ "$bootpool_options" "$bootpool_name" \ @@ -1148,19 +1161,11 @@ zfs_create_boot() # Create the ZFS root pool with desired type and disk devices # f_dprintf "$funcname: Creating root pool..." + create_options="$ZFSBOOT_POOL_CREATE_OPTIONS" f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \ - "-o altroot=$BSDINSTALL_CHROOT -O compress=lz4 - -m none -f" \ - "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" || - return $FAILURE - - # Customize the zroot a bit... - local option - f_dprintf "$funcname: Setting miscellaneous options on root pool..." - for option in atime=off; do - f_eval_catch $funcname zfs "$ZFS_SET" $option "$zroot_name" || - return $FAILURE - done + "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \ + "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" || + return $FAILURE # # Create ZFS dataset layout within the new root pool