Author: dteske
Date: Fri Dec 20 15:46:24 2013
New Revision: 259652
URL: http://svnweb.freebsd.org/changeset/base/259652

Log:
  MFS10 SVN r259621:
  
  MFC r259276,259468-259470,259472,259474,259476-259478,259480-259481,259570,
  259572, and 259597-259598...
  
  r259276: Fix bug in `services' script in adding dumpdev comment to rc.conf
  r259468: Ignore spurious escape generated by VMware's Ctrl-Cmd combination
  r259469: Mask errors in `config' script from newaliases(1) about non-FQHN
  r259470: Set atime=on for /var/mail zfsboot dataset to support mail server
  r259472: Accept NULL input for zfsboot SWAP to indicate SWAP of zero bytes
  r259474: Multiple changes, including bug-fixes and debugging improvements
  r259476: Change default ZFS disk layout, making it easier to resize
  r259477: fletcher4 is now the default (zfsboot related)
  r259478: De-uglify the geli(8)-setup infobox (zfsboot related)
  r259480: Fix ghosted zroot issue by always performing labelclear on swap
  r259481: Auto-enable 4k sector alignmet when geli(8) is enabled (zfsboot)
  r259570: Fix numerical comparison error (zfsboot)
  r259572: Mask spurious rm error in bsdinstall_log from `auto' script
  r259597: Fix zfsboot regression when installing to 3+ disks
  r259598: Set cachefile property of bootpool so it imports to new system
  
  Approved by:    re (gjb)

Modified:
  releng/10.0/usr.sbin/bsdinstall/scripts/auto
  releng/10.0/usr.sbin/bsdinstall/scripts/config
  releng/10.0/usr.sbin/bsdinstall/scripts/services
  releng/10.0/usr.sbin/bsdinstall/scripts/zfsboot
Directory Properties:
  releng/10.0/   (props changed)

Modified: releng/10.0/usr.sbin/bsdinstall/scripts/auto
==============================================================================
--- releng/10.0/usr.sbin/bsdinstall/scripts/auto        Fri Dec 20 15:45:22 
2013        (r259651)
+++ releng/10.0/usr.sbin/bsdinstall/scripts/auto        Fri Dec 20 15:46:24 
2013        (r259652)
@@ -49,6 +49,10 @@ error() {
 
 ############################################################ MAIN
 
+# Don't send ESC on function-key 62/63 (left/right command key)
+f_quietly kbdcontrol -f 62 ''
+f_quietly kbdcontrol -f 63 ''
+
 f_dprintf "Began Installation at %s" "$( date )"
 
 rm -rf $BSDINSTALL_TMPETC
@@ -99,7 +103,7 @@ if [ -n "$FETCH_DISTRIBUTIONS" ]; then
        export BSDINSTALL_DISTSITE
 fi
 
-rm $PATH_FSTAB
+rm -f $PATH_FSTAB
 touch $PATH_FSTAB
 
 PMODES="\
@@ -120,8 +124,7 @@ exec 3>&1
 PARTMODE=`echo $PMODES | xargs dialog --backtitle "FreeBSD Installer" \
        --title "Partitioning" \
        --menu "How would you like to partition your disk?" \
-       0 0 0 2>&1 1>&3`
-if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi
+       0 0 0 2>&1 1>&3` || exit 1
 exec 3>&-
 
 case "$PARTMODE" in

Modified: releng/10.0/usr.sbin/bsdinstall/scripts/config
==============================================================================
--- releng/10.0/usr.sbin/bsdinstall/scripts/config      Fri Dec 20 15:45:22 
2013        (r259651)
+++ releng/10.0/usr.sbin/bsdinstall/scripts/config      Fri Dec 20 15:46:24 
2013        (r259652)
@@ -42,7 +42,7 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHR
 [ "${debugFile#+}" ] && cp "${debugFile#+}" $BSDINSTALL_CHROOT/var/log/
 
 # Set up other things from installed config
-chroot $BSDINSTALL_CHROOT /usr/bin/newaliases
+chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1
 
 
################################################################################
 # END

Modified: releng/10.0/usr.sbin/bsdinstall/scripts/services
==============================================================================
--- releng/10.0/usr.sbin/bsdinstall/scripts/services    Fri Dec 20 15:45:22 
2013        (r259651)
+++ releng/10.0/usr.sbin/bsdinstall/scripts/services    Fri Dec 20 15:46:24 
2013        (r259652)
@@ -50,13 +50,12 @@ DAEMONS=$(dialog --backtitle "FreeBSD In
 2>&1 1>&3)
 exec 3>&-
 
-local havedump=
+havedump=
 for daemon in $DAEMONS; do
        if [ "$daemon" == "dumpdev" ]; then
                havedump=1
-               echo \# Set dumpdev to \"AUTO\" to enable crash dumps, \
-                       \"NO\" to disable >> \ 
-                       $BSDINSTALL_TMPETC/rc.conf.services
+               echo '# Set dumpdev to "AUTO" to enable crash dumps, "NO"' \
+                    'to disable' >> $BSDINSTALL_TMPETC/rc.conf.services
                echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services
                continue
        fi

Modified: releng/10.0/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- releng/10.0/usr.sbin/bsdinstall/scripts/zfsboot     Fri Dec 20 15:45:22 
2013        (r259651)
+++ releng/10.0/usr.sbin/bsdinstall/scripts/zfsboot     Fri Dec 20 15:46:24 
2013        (r259652)
@@ -66,23 +66,30 @@ f_include $BSDCFG_SHARE/variable.subr
 
 #
 # Should we use geli(8) to encrypt the drives?
+# NB: Automatically enables ZFSBOOT_BOOT_POOL
 #
 : ${ZFSBOOT_GELI_ENCRYPTION=}
 
 #
-# Default name the unencrypted pool when using geli(8) to encrypt the drives
+# Default path to the geli(8) keyfile used in drive encryption
 #
-: ${ZFSBOOT_GELI_POOL_NAME:=bootpool}
+: ${ZFSBOOT_GELI_KEY_FILE:=/boot/encryption.key}
 
 #
-# Default size for the unencrypted boot pool when using geli(8)
+# Create a separate boot pool?
+# NB: Automatically set when using geli(8) or MBR
 #
-: ${ZFSBOOT_GELI_BOOT_SIZE:=2g}
+: ${ZFSBOOT_BOOT_POOL=}
 
 #
-# Default path to the geli(8) keyfile used in drive encryption
+# Default name for boot pool when enabled (e.g., geli(8) or MBR)
 #
-: ${ZFSBOOT_GELI_KEY_FILE:=/boot/encryption.key}
+: ${ZFSBOOT_BOOT_POOL_NAME:=bootpool}
+
+#
+# Default size for boot pool when enabled (e.g., geli(8) or MBR)
+#
+: ${ZFSBOOT_BOOT_POOL_SIZE:=2g}
 
 #
 # Default disks to use (always empty unless being scripted)
@@ -132,6 +139,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATA
        /var            mountpoint=/var
        /var/crash      compression=lz4,exec=off,setuid=off
        /var/log        compression=lz4,exec=off,setuid=off
+       /var/mail       compression=lz4,atime=on
        /var/tmp        compression=lz4,exec=on,setuid=off
 " # END-QUOTE
 
@@ -155,8 +163,10 @@ CHMOD_MODE='chmod %s "%s"'
 DD_WITH_OPTIONS='dd if="%s" of="%s" %s'
 ECHO_APPEND='echo "%s" >> "%s"'
 GELI_ATTACH='geli attach -j - -k "%s" "%s"'
+GELI_DETACH_F='geli detach -f "%s"'
 GELI_PASSWORD_INIT='geli init -b -B "%s" -e %s -J - -K "%s" -l 256 -s 4096 
"%s"'
 GNOP_CREATE='gnop create -S 4096 "%s"'
+GNOP_DESTROY='gnop destroy "%s"'
 GPART_ADD='gpart add -t %s "%s"'
 GPART_ADD_INDEX='gpart add -i %s -t %s "%s"'
 GPART_ADD_INDEX_WITH_SIZE='gpart add -i %s -t %s -s %s "%s"'
@@ -165,19 +175,23 @@ GPART_ADD_LABEL_WITH_SIZE='gpart add -l 
 GPART_BOOTCODE='gpart bootcode -b "%s" "%s"'
 GPART_BOOTCODE_PART='gpart bootcode -b "%s" -p "%s" -i %s "%s"'
 GPART_CREATE='gpart create -s %s "%s"'
+GPART_DESTROY_F='gpart destroy -F "%s"'
 GPART_SET_ACTIVE='gpart set -a active -i %s "%s"'
+GRAID_DELETE='graid delete "%s"'
 LN_SF='ln -sf "%s" "%s"'
 MKDIR_P='mkdir -p "%s"'
 MOUNT_TYPE='mount -t %s "%s" "%s"'
 PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\""
 PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"'
 SHELL_TRUNCATE=':> "%s"'
+UMOUNT='umount "%s"'
 ZFS_CREATE_WITH_OPTIONS='zfs create %s "%s"'
 ZFS_SET='zfs set "%s" "%s"'
 ZFS_UNMOUNT='zfs unmount "%s"'
 ZPOOL_CREATE_WITH_OPTIONS='zpool create %s "%s" %s %s'
 ZPOOL_EXPORT='zpool export "%s"'
 ZPOOL_IMPORT_WITH_OPTIONS='zpool import %s "%s"'
+ZPOOL_LABELCLEAR_F='zpool labelclear -f "%s"'
 ZPOOL_SET='zpool set %s "%s"'
 
 #
@@ -201,12 +215,12 @@ msg_force_4k_sectors="Force 4K Sectors?"
 msg_force_4k_sectors_help="Use gnop(8) to configure forced 4K sector alignment"
 msg_freebsd_installer="FreeBSD Installer"
 msg_geli_password="Enter a strong passphrase, used to protect your encryption 
keys. You will be required to enter this passphrase each time the system is 
booted"
-msg_geli_setup="Initializing encryption on the selected disks, this will take 
several seconds per disk"
+msg_geli_setup="Initializing encryption on selected disks,\n this will take 
several seconds per disk"
 msg_install="Install"
 msg_install_desc="Proceed with Installation"
 msg_install_help="Create ZFS boot pool with displayed options"
+msg_invalid_boot_pool_size="Invalid boot pool size \`%s'"
 msg_invalid_disk_argument="Invalid disk argument \`%s'"
-msg_invalid_geli_boot_size="Invalid geli(8) boot size \`%s'"
 msg_invalid_index_argument="Invalid index argument \`%s'"
 msg_invalid_swap_size="Invalid swap size \`%s'"
 msg_invalid_virtual_device_type="Invalid Virtual Device type \`%s'"
@@ -610,13 +624,13 @@ dialog_menu_layout()
 # so we can have some real swap. This also provides wiggle room incase your
 # replacement drivers do not have the exact same sector counts.
 #
-# NOTE: The MBR layout is more complicated (GPT is preferred).
+# NOTE: $swapsize and $bootsize should be defined by the calling function.
+# NOTE: Sets $bootpart and $targetpart for the calling function.
 #
 zfs_create_diskpart()
 {
        local funcname=zfs_create_diskpart
        local disk="$1" index="$2"
-       local disksize partsize
 
        # Check arguments
        if [ ! "$disk" ]; then
@@ -663,26 +677,18 @@ zfs_create_diskpart()
        # NOTE: Failure is ok here, blank disk will have nothing to destroy.
        #
        f_dprintf "$funcname: Destroying all data/layouts on \`%s'..." "$disk"
-       f_quietly gpart destroy -F $disk
-       f_quietly graid destroy $disk
-       f_quietly zpool labelclear -f /dev/$disk # Kill it with fire
+       f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
+       f_eval_catch -d $funcname graid "$GRAID_DELETE" $disk
+       f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" /dev/$disk
 
        # Make doubly-sure backup GPT is destroyed
-       f_quietly gpart create -s gpt $disk
-       f_quietly gpart destroy -F $disk
+       f_eval_catch -d $funcname gpart "$GPART_CREATE" gpt $disk
+       f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
 
-       # Calculate partition size given desired amount of swap
-       f_dprintf "$funcname: Getting disk capactiy for \`%s'" "$disk"
-       if ! device_$disk get capacity disksize; then
-               f_dprintf "$funcname: Unable to get disk capacity of \`%s'" \
-                         "$disk"
-               msg_error="$msg_error: $funcname" \
-                       f_show_err "$msg_unable_to_get_disk_capacity" "$disk"
-               return $FAILURE
-       fi
-       partsize=$(( $disksize - $swapsize ))
-       f_dprintf "$funcname: disksize=[%s] partsize=[%s]" \
-                 "$disksize" "$partsize"
+       #
+       # Enable boot pool if encryption is desired
+       #
+       [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
 
        #
        # Lay down the desired type of partition scheme
@@ -693,147 +699,148 @@ zfs_create_diskpart()
                #
                # 1. Create GPT layout using labels
                #
-               f_eval_catch $funcname gpart "$GPART_CREATE" gpt \$disk ||
+               f_eval_catch $funcname gpart "$GPART_CREATE" gpt $disk ||
                             return $FAILURE
 
                #
                # 2. Add small freebsd-boot partition labeled `boot#'
                #
                f_eval_catch $funcname gpart "$GPART_ADD_LABEL_WITH_SIZE" \
-                            gptboot\$index freebsd-boot 512k \$disk ||
+                            gptboot$index freebsd-boot 512k $disk ||
                             return $FAILURE
                f_eval_catch $funcname gpart "$GPART_BOOTCODE_PART" \
-                            /boot/pmbr /boot/gptzfsboot 1 \$disk ||
+                            /boot/pmbr /boot/gptzfsboot 1 $disk ||
                             return $FAILURE
 
-               # zpool will use the `zfs#' GPT labels
+               # NB: zpool will use the `zfs#' GPT labels
                bootpart=p2 targetpart=p2
+               [ ${swapsize:-0} -gt 0 ] && targetpart=p3
 
-               # Change things around if we are using geli(8)
-               if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+               #
+               # Prepare boot pool if enabled (e.g., for geli(8))
+               #
+               if [ "$ZFSBOOT_BOOT_POOL" ]; then
                        bootpart=p2 targetpart=p3
-                       partsize=$(( $partsize - $gelisize ))
-                       f_dprintf "$funcname: gelisize=[%s]" \
-                                 "gelisize=[$gelisize]"
+                       [ ${swapsize:-0} -gt 0 ] && targetpart=p4
                        f_eval_catch $funcname gpart \
-                                    "$GPART_ADD_LABEL_WITH_SIZE" boot\$index \
-                                    freebsd-zfs \${gelisize}b \$disk ||
+                                    "$GPART_ADD_LABEL_WITH_SIZE" boot$index \
+                                    freebsd-zfs ${bootsize}b $disk ||
                                     return $FAILURE
-
-                       # Pedantically nuke any old labels, stop geli
-                       f_quietly zpool labelclear -f "/dev/$disk$bootpart"
-                       f_quietly geli detach -f "/dev/$disk$targetpart"
+                       # Pedantically nuke any old labels
+                       f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+                                       /dev/$disk$bootpart
+                       if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+                               # Pedantically detach targetpart for later
+                               f_eval_catch -d $funcname geli \
+                                               "$GELI_DETACH_F" \
+                                               /dev/$disk$targetpart
+                       fi
                fi
 
                #
-               # 3. Add freebsd-zfs partition labeled `zfs#' for zpool
-               # NOTE: Using above calculated partsize to leave room for swap.
+               # 3. Add freebsd-swap partition labeled `swap#'
                #
                if [ ${swapsize:-0} -gt 0 ]; then
-                       f_dprintf "$funcname: partsize=[%s]" \
-                                 "partsize=[$partsize]"
                        f_eval_catch $funcname gpart \
-                                    "$GPART_ADD_LABEL_WITH_SIZE" zfs\$index \
-                                    freebsd-zfs \${partsize}b \$disk ||
+                                    "$GPART_ADD_LABEL_WITH_SIZE" swap$index \
+                                    freebsd-swap ${swapsize}b $disk ||
                                     return $FAILURE
-               else
-                       f_eval_catch $funcname gpart "$GPART_ADD_LABEL" \
-                                    zfs\$index freebsd-zfs \$disk ||
+                       # Pedantically nuke any old labels on the swap
+                       f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+                                       /dev/gpt/swap$index
+                       # Update fstab(5)
+                       f_eval_catch $funcname printf "$PRINTF_FSTAB" \
+                                    /dev/gpt/swap$index none swap sw 0 0 \
+                                    $BSDINSTALL_TMPETC/fstab ||
                                     return $FAILURE
                fi
-               f_quietly zpool labelclear -f "/dev/$disk$targetpart"
 
                #
-               # 4. Add freebsd-swap partition labeled `swap#'
+               # 4. Add freebsd-zfs partition labeled `zfs#' for zroot
                #
-               if [ $swapsize -gt 0 ]; then
-                       f_eval_catch $funcname gpart "$GPART_ADD_LABEL" \
-                                    swap\$index freebsd-swap \$disk ||
-                                    return $FAILURE
-                       # Update fstab(5)
-                       f_eval_catch $funcname printf "$PRINTF_FSTAB" \
-                                    /dev/gpt/swap\$index none swap sw 0 0 \
-                                    \$BSDINSTALL_TMPETC/fstab ||
-                                    return $FAILURE
-               fi
+               f_eval_catch $funcname gpart "$GPART_ADD_LABEL" \
+                            zfs$index freebsd-zfs $disk || return $FAILURE
+               f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+                               /dev/$disk$targetpart
                ;;
 
        MBR) f_dprintf "$funcname: Creating MBR layout..."
                #
                # 1. Create MBR layout (no labels)
                #
-               f_eval_catch $funcname gpart "$GPART_CREATE" mbr \$disk ||
+               f_eval_catch $funcname gpart "$GPART_CREATE" mbr $disk ||
                             return $FAILURE
                f_eval_catch $funcname gpart "$GPART_BOOTCODE" /boot/mbr \
-                            \$disk || return $FAILURE
+                            $disk || return $FAILURE
 
                #
                # 2. Add freebsd slice with all available space
                #
-               f_eval_catch $funcname gpart "$GPART_ADD" freebsd \$disk ||
+               f_eval_catch $funcname gpart "$GPART_ADD" freebsd $disk ||
                             return $FAILURE
-               f_eval_catch $funcname gpart "$GPART_SET_ACTIVE" 1 \$disk ||
+               f_eval_catch $funcname gpart "$GPART_SET_ACTIVE" 1 $disk ||
                             return $FAILURE
-               f_quietly zpool labelclear -f /dev/${disk}s1 # Pedantic
-               f_quietly gpart destroy -F ${disk}s1 # Pedantic
+               # Pedantically nuke any old labels
+               f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+                               /dev/${disk}s1
+               # Pedantically nuke any old scheme
+               f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" ${disk}s1
 
                #
                # 3. Write BSD scheme to the freebsd slice
                #
-               f_eval_catch $funcname gpart "$GPART_CREATE" BSD \${disk}s1 ||
+               f_eval_catch $funcname gpart "$GPART_CREATE" BSD ${disk}s1 ||
                             return $FAILURE
 
-               # zpool will use s1a (no labels)
-               bootpart=s1a targetpart=s1a mbrindex=1
+               # NB: zpool will use s1a (no labels)
+               bootpart=s1a targetpart=s1d mbrindex=4
 
-               # Change things around if we are using geli(8)
+               #
+               # Always prepare a boot pool on MBR
+               #
+               ZFSBOOT_BOOT_POOL=1
+               f_eval_catch $funcname gpart \
+                            "$GPART_ADD_INDEX_WITH_SIZE" \
+                            1 freebsd-zfs ${bootsize}b ${disk}s1 ||
+                            return $FAILURE
+               # Pedantically nuke any old labels
+               f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+                               /dev/$disk$bootpart
                if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
-                       bootpart=s1a targetpart=s1d
-                       partsize=$(( $partsize - $gelisize ))
-                       mbrindex=4 # If this is s1a then make the zpool s1d
-                       f_dprintf "$funcname: mbrindex=[%s] gelisize=[%s]" \
-                                 "$mbrindex" "$gelisize"
-                       f_eval_catch $funcname gpart \
-                                    "$GPART_ADD_INDEX_WITH_SIZE" \
-                                    1 freebsd-zfs \${gelisize}b \${disk}s1 ||
-                                    return $FAILURE
-                       # Pedantically nuke any old labels, stop geli
-                       f_quietly zpool labelclear -f "/dev/$disk$bootpart"
-                       f_quietly geli detach -f "/dev/$disk$targetpart"
+                       # Pedantically detach targetpart for later
+                       f_eval_catch -d $funcname geli \
+                                       "$GELI_DETACH_F" \
+                                       /dev/$disk$targetpart
                fi
 
                #
-               # 4. Partition the BSD slice for ZFS
-               # NOTE: Using above calculated partsize to leave room for swap.
+               # 4. Add freebsd-swap partition
                #
                if [ ${swapsize:-0} -gt 0 ]; then
-                       f_dprintf "$funcname: mbrindex=[%s] partsize=[%s]" \
-                                 "$mbrindex" "$partsize"
                        f_eval_catch $funcname gpart \
-                                    "$GPART_ADD_INDEX_WITH_SIZE" \
-                                    \$mbrindex freebsd-zfs \${partsize}b \
-                                    \${disk}s1 || return $FAILURE
-               else
-                       f_dprintf "$funcname: mbrindex=[%s]" "$mbrindex"
-                       f_eval_catch $funcname gpart "$GPART_ADD_INDEX" \
-                                    \$mbrindex freebsd-zfs \${disk}s1 ||
-                                    return $FAILURE
-               fi
-               f_quietly zpool labelclear -f /dev/$disk$targetpart # Pedantic
-
-               #
-               # 5. Add freebsd-swap partition
-               #
-               if [ $swapsize -gt 0 ]; then
-                       f_eval_catch $funcname gpart "$GPART_ADD_INDEX" \
-                                    2 freebsd-swap \${disk}s1 ||
+                                    "$GPART_ADD_INDEX_WITH_SIZE" 2 \
+                                    freebsd-swap ${swapsize}b ${disk}s1 ||
                                     return $FAILURE
+                       # Pedantically nuke any old labels on the swap
+                       f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+                                       /dev/${disk}s1b
                        # Update fstab(5)
                        f_eval_catch $funcname printf "$PRINTF_FSTAB" \
-                                    /dev/\${disk}s1b none swap sw 0 0 \
-                                    \$BSDINSTALL_TMPETC/fstab ||
+                                    /dev/${disk}s1b none swap sw 0 0 \
+                                    $BSDINSTALL_TMPETC/fstab ||
                                     return $FAILURE
                fi
+
+               #
+               # 5. Add freebsd-zfs partition for zroot
+               #
+               f_eval_catch $funcname gpart "$GPART_ADD_INDEX" \
+                            $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE
+               f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+                               /dev/$disk$targetpart # Pedantic
+               f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
+                            /boot/zfsboot /dev/${disk}s1 count=1 ||
+                            return $FAILURE
                ;;
 
        esac # $ZFSBOOT_PARTITION_SCHEME
@@ -849,16 +856,18 @@ zfs_create_diskpart()
 zfs_create_boot()
 {
        local funcname=zfs_create_boot
-       local poolname="$1" vdev_type="$2"
-       local bootpart targetpart
-
-       shift 2 # name vdev_type
-
-       # We may need this later
-       local disks="$*"
+       local zroot_name="$1"
+       local zroot_vdevtype="$2"
+       local zroot_vdevs= # Calculated below
+       local boot_vdevs= # Used for geli(8) and/or MBR layouts
+       shift 2 # poolname vdev_type
+       local disks="$*" disk
+       local bootpart targetpart # Set by zfs_create_diskpart() below
 
+       #
        # Pedantic checks; should never be seen
-       if [ ! "$poolname" ]; then
+       #
+       if [ ! "$zroot_name" ]; then
                f_dprintf "$funcname: NULL poolname"
                msg_error="$msg_error: $funcname" \
                        f_show_err "$msg_null_poolname"
@@ -871,132 +880,130 @@ zfs_create_boot()
                return $FAILURE
        fi
        f_dprintf "$funcname: poolname=[%s] vdev_type=[%s]" \
-                 "$poolname" "$vdev_type"
+                 "$zroot_name" "$zroot_vdevtype"
 
+       #
        # Initialize fstab(5)
+       #
        f_dprintf "$funcname: Initializing temporary fstab(5) file..."
-       f_eval_catch $funcname sh \
-                    "$SHELL_TRUNCATE" \$BSDINSTALL_TMPETC/fstab ||
+       f_eval_catch $funcname sh "$SHELL_TRUNCATE" $BSDINSTALL_TMPETC/fstab ||
                     return $FAILURE
        f_eval_catch $funcname printf "$PRINTF_FSTAB" \
                     "# Device" Mountpoint FStype Options Dump "Pass#" \
-                    \$BSDINSTALL_TMPETC/fstab || return $FAILURE
+                    $BSDINSTALL_TMPETC/fstab || return $FAILURE
 
+       #
        # Expand SI units in desired sizes
-       f_dprintf "$funcname: Expanding supplied swapsize/gelisize values..."
-       local swapsize gelisize
+       #
+       f_dprintf "$funcname: Expanding supplied size values..."
+       local swapsize bootsize
        if ! f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize; then
                f_dprintf "$funcname: Invalid swap size \`%s'" \
                          "$ZFSBOOT_SWAP_SIZE"
                f_show_err "$msg_invalid_swap_size" "$ZFSBOOT_SWAP_SIZE"
                return $FAILURE
        fi
-       if ! f_expand_number "$ZFSBOOT_GELI_BOOT_SIZE" gelisize; then
-               f_dprintf "$funcname: Invalid geli(8) boot size \`%s'" \
-                         "$ZFSBOOT_GELI_BOOT_SIZE"
-               f_show_err "$msg_invalid_geli_boot_size" \
-                          "$ZFSBOOT_GELI_BOOT_SIZE"
+       if ! f_expand_number "$ZFSBOOT_BOOT_POOL_SIZE" bootsize; then
+               f_dprintf "$funcname: Invalid boot pool size \`%s'" \
+                         "$ZFSBOOT_BOOT_POOL_SIZE"
+               f_show_err "$msg_invalid_boot_pool_size" \
+                          "$ZFSBOOT_BOOT_POOL_SIZE"
                return $FAILURE
        fi
        f_dprintf "$funcname: ZFSBOOT_SWAP_SIZE=[%s] swapsize=[%s]" \
                  "$ZFSBOOT_SWAP_SIZE" "$swapsize"
-       f_dprintf "$funcname: ZFSBOOT_GELI_BOOT_SIZE=[%s] gelisize=[%s]" \
-                 "$ZFSBOOT_GELI_BOOT_SIZE" "$gelisize"
+       f_dprintf "$funcname: ZFSBOOT_BOOT_POOL_SIZE=[%s] bootsize=[%s]" \
+                 "$ZFSBOOT_BOOT_POOL_SIZE" "$bootsize"
 
-       # Prepare the disks
+       #
+       # Prepare the disks and build pool device list(s)
+       #
        f_dprintf "$funcname: Preparing disk partitions for ZFS pool..."
+       [ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ] &&
+               f_dprintf "$funcname: With 4k alignment using gnop(8)..."
        local n=0
-       for disk in $*; do
+       for disk in $disks; do
                zfs_create_diskpart $disk $n || return $FAILURE
-               n=$(( $n + 1 ))
-       done
-
-       # MBR boot loader hack part 1
-       # We have to do this early because geli gets in the way later
-       if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then
-               f_dprintf "$funcname: Copying MBR boot loader to disks..."
-               f_dprintf "$funcname: disks=[%s]" "$disks"
-               for disk in $disks; do
-                       f_dprintf "$funcname: disk=[%s]" "$disk"
-                       f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
-                                    /boot/zfsboot /dev/\${disk}s1 count=1 ||
-                                    return $FAILURE
-               done
-       fi
-
-       # Forced 4k alignment support provided by Geom NOP (see gnop(8))
-       local unenc_list=
-       if [ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ]; then
-               local part="$targetpart" new_list=
-
-               # We don't gnop the encrypted partition because geli will do
-               # this for us gnop the unencrypted disk
-               [ "$ZFSBOOT_GELI_ENCRYPTION" ] && part="$bootpart"
-
-               f_dprintf "$funcname: Applying 4k alignment with gnop(8)..."
-               f_dprintf "$funcname: *=[%s]" "$*"
-               for disk in $*; do
-                       f_dprintf "$funcname: disk=[%s] part=[%s]" \
-                                 "$disk" "$part"
-                       f_eval_catch $funcname gnop "$GNOP_CREATE" \
-                                    \$disk\$part || return $FAILURE
+               # Now $bootpart and $targetpart are set (suffix for $disk)
+               
+               # Forced 4k alignment support using Geom NOP (see gnop(8))
+               if [ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ]; then
+                       if [ "$ZFSBOOT_BOOT_POOL" ]; then
+                               boot_vdevs="$boot_vdevs $disk$bootpart.nop"
+                               f_eval_catch $funcname gnop "$GNOP_CREATE" \
+                                            $disk$bootpart || return $FAILURE
+                       fi
+                       # Don't gnop encrypted partition
                        if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
-                               unenc_list="$unenc_list $disk$part.nop"
+                               zroot_vdevs="$zroot_vdevs $disk$targetpart.eli"
                        else
-                               new_list="$new_list $disk$targetpart.nop"
+                               zroot_vdevs="$zroot_vdevs $disk$targetpart.nop"
+                               f_eval_catch $funcname gnop "$GNOP_CREATE" \
+                                            $disk$targetpart ||
+                                            return $FAILURE
                        fi
-               done
-               set -- $new_list
-       else
-               local new_list=
-               for disk in $*; do
-                       new_list="$new_list $disk$targetpart"
-                       [ "$ZFSBOOT_GELI_ENCRYPTION" ] &&
-                               unenc_list="$unenc_list $disk$bootpart"
-               done
-               set -- $new_list
-       fi
+               else
+                       if [ "$ZFSBOOT_BOOT_POOL" ]; then
+                               boot_vdevs="$boot_vdevs $disk$bootpart"
+                       fi
+                       zroot_vdevs="$zroot_vdevs $disk$targetpart"
+               fi
+
+               n=$(( $n + 1 ))
+       done # disks
 
        #
-       # If encryption is enabled, we need to create the GEOMs
+       # If we need/want a boot pool, create it
        #
-       if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
-               local bootvdev= options=
-               local geli_pool="$BSDINSTALL_CHROOT/$ZFSBOOT_GELI_POOL_NAME"
-               local key="$ZFSBOOT_GELI_KEY_FILE"
-
-               f_dprintf "$funcname: Setting up disk encryption..."
+       if [ "$ZFSBOOT_BOOT_POOL" ]; then
+               local bootpool_vdevtype= # Calculated below
+               local bootpool_options= # Calculated below
+               local bootpool_name="$ZFSBOOT_BOOT_POOL_NAME"
+               local bootpool="$BSDINSTALL_CHROOT/$bootpool_name"
+               local zroot_key="${ZFSBOOT_GELI_KEY_FILE#/}"
+
+               f_dprintf "$funcname: Setting up boot pool..."
+               [ "$ZFSBOOT_GELI_ENCRYPTION" ] &&
+                       f_dprintf "$funcname: For encrypted root disk..."
 
-               # Create the parent directories for our unencrypted pool
-               f_quietly umount /mnt
+               # Create parent directory for boot pool
+               f_eval_catch -d $funcname umount "$UMOUNT" /mnt
                f_eval_catch $funcname mount "$MOUNT_TYPE" tmpfs none \
-                            \$BSDINSTALL_CHROOT || return $FAILURE
+                            $BSDINSTALL_CHROOT || return $FAILURE
 
-               # Create mirror across the unencrypted partition on all disks
-               [ $( set -- $unenc_list; echo $# ) -gt 1 ] && bootvdev=mirror
+               # Create mirror across the boot partition on all disks
+               [ $( set -- $boot_vdevs; echo $# ) -gt 1 ] &&
+                       bootpool_vdevtype=mirror
 
-               f_dprintf "$funcname: %s %s %s" \
-                         "ZFSBOOT_GELI_POOL_NAME=[$ZFSBOOT_GELI_POOL_NAME]" \
-                         "bootvdev=[$bootvdev]" "unenc_list=[$unenc_list]"
-               options="-o altroot=\"\$BSDINSTALL_CHROOT\""
-               options="$options -m \"/\$ZFSBOOT_GELI_POOL_NAME\""
-               options="$options -f"
+               bootpool_options="-o altroot=$BSDINSTALL_CHROOT"
+               bootpool_options="$bootpool_options -m \"/$bootpool_name\" -f"
                f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
-                            "$options" \$ZFSBOOT_GELI_POOL_NAME \$bootvdev \
-                            \$unenc_list || return $FAILURE
-
-               f_dprintf "$funcname: geli_pool=[%s]" "$geli_pool"
-               f_eval_catch $funcname mkdir "$MKDIR_P" \$geli_pool/boot ||
+                            "$bootpool_options" "$bootpool_name" \
+                            "$bootpool_vdevtype" "$boot_vdevs" ||
                             return $FAILURE
 
-               # Generate an encryption key using random(4)
-               f_dprintf "$funcname: key=[%s]" "$key"
-               f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
-                            /dev/random \$geli_pool/\$key "bs=4096 count=1" ||
+               f_eval_catch $funcname mkdir "$MKDIR_P" "$bootpool/boot" ||
                             return $FAILURE
 
-               # Create the geli(8) GEOMS
-               local geli_list
+               if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+                       # Generate an encryption key using random(4)
+                       f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
+                                    /dev/random "$bootpool/$zroot_key" \
+                                    "bs=4096 count=1" || return $FAILURE
+               else
+                       # Clean up
+                       f_eval_catch $funcname zfs "$ZFS_UNMOUNT" \
+                                    "$bootpool_name" || return $FAILURE
+                       f_eval_catch -d $funcname umount "$UMOUNT" /mnt # tmpfs
+               fi
+
+       fi
+
+       #
+       # Create the geli(8) GEOMS
+       #
+       if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+               # Prompt user for password (twice)
                if ! msg_enter_new_password="$msg_geli_password" \
                        f_dialog_input_password
                then
@@ -1004,57 +1011,57 @@ zfs_create_boot()
                        f_show_err "$msg_user_cancelled"
                        return $FAILURE
                fi
-               f_dprintf "$funcname: disks=[%s]" "$disks"
+
+               # Initialize geli(8) on each of the target partitions
                for disk in $disks; do
-                       f_dprintf "$funcname: disk=[%s] targetpart=[%s]" \
-                                 "$disk" "$targetpart"
                        f_dialog_info "$msg_geli_setup" \
                                2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
-                       if ! echo "$pw_password" | f_eval_catch $funcname \
-                               geli "$GELI_PASSWORD_INIT" \
-                               \$geli_pool/boot/\$disk\$targetpart.eli \
-                               AES-XTS \$geli_pool/\$key \$disk\$targetpart
+                       if ! echo "$pw_password" | f_eval_catch \
+                               $funcname geli "$GELI_PASSWORD_INIT" \
+                               "$bootpool/boot/$disk$targetpart.eli" \
+                               AES-XTS "$bootpool/$zroot_key" \
+                               $disk$targetpart
                        then
                                f_interactive || f_die
+                               unset pw_password # Sensitive info
                                return $FAILURE
                        fi
-                       if ! echo "$pw_password" | f_eval_catch $funcname \
-                               geli "$GELI_ATTACH" \$geli_pool/\$key \
-                               \$disk\$targetpart
+                       if ! echo "$pw_password" | f_eval_catch \
+                               $funcname geli "$GELI_ATTACH" \
+                               "$bootpool/$zroot_key" $disk$targetpart
                        then
                                f_interactive || f_die
+                               unset pw_password # Sensitive info
                                return $FAILURE
                        fi
-                       geli_list="$geli_list $disk$targetpart.eli"
                done
-               set -- $geli_list
-               f_eval_catch $funcname zfs "$ZFS_UNMOUNT" \
-                            \$ZFSBOOT_GELI_POOL_NAME || return $FAILURE
-               f_quietly umount /mnt # done with tmpfs
+               unset pw_password # Sensitive info
+
+               # Clean up
+               f_eval_catch $funcname zfs "$ZFS_UNMOUNT" "$bootpool_name" ||
+                       return $FAILURE
+               f_eval_catch -d $funcname umount "$UMOUNT" /mnt # tmpfs
        fi
 
        #
-       # Create the ZFS pool with desired type and disk devices
+       # Create the ZFS root pool with desired type and disk devices
        #
-       local vdevs="$*"
-       f_dprintf "$funcname: Creating boot pool..."
-       f_dprintf "poolname=[%s] vdev_type=[%s] vdevs=[%s]" \
-                 "$poolname" "$vdev_type" "$vdevs"
+       f_dprintf "$funcname: Creating root pool..."
        f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
-                    "-o altroot=\"\$BSDINSTALL_CHROOT\" -m none -f" \
-                    \$poolname \$vdev_type \$vdevs
+                    "-o altroot=$BSDINSTALL_CHROOT -m none -f" \
+                    "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" ||
+                    return $FAILURE
 
-       # Customize the zpool a bit...
+       # Customize the zroot a bit...
        local option
-       f_dprintf "$funcname: Setting miscellaneous options on boot pool..."
-       for option in checksum=fletcher4 atime=off; do
-               f_dprintf "$funcname: option=[%s]" "$option"
-               f_eval_catch $funcname zfs "$ZFS_SET" \$option \$poolname ||
-                            return $FAILURE
+       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
 
        #
-       # Create ZFS dataset layout within the new boot pool
+       # Create ZFS dataset layout within the new root pool
        #
        f_dprintf "$funcname: Creating ZFS datasets..."
        echo "$ZFSBOOT_DATASETS" | while read dataset options; do
@@ -1073,10 +1080,8 @@ zfs_create_boot()
                # Replace both commas and spaces with ` -o '
                f_replaceall "$options" "[ ,]" " -o " options
                # Create the dataset with desired options
-               f_dprintf "$funcname: dataset=[%s] options=[%s]" \
-                         "$dataset" "$options"
                f_eval_catch $funcname zfs "$ZFS_CREATE_WITH_OPTIONS" \
-                            "\${options:+-o \$options}" \$poolname\$dataset ||
+                            "${options:+-o $options}" "$zroot_name$dataset" ||
                             return $FAILURE
        done
 
@@ -1084,57 +1089,53 @@ zfs_create_boot()
        f_dprintf "$funcname: Modifying directory permissions..."
        local dir
        for dir in /tmp /var/tmp; do
-               f_dprintf "$funcname: dir=[%s]" "$dir"
                f_eval_catch $funcname chmod "$CHMOD_MODE" 1777 \
-                            \$BSDINSTALL_CHROOTDIR\$dir || return $FAILURE
+                            $BSDINSTALL_CHROOTDIR$dir || return $FAILURE
        done
 
        # Create symlink(s)
-       if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
-               f_dprintf "$funcname: Creating /boot symlink for GELI..."
-               f_eval_catch $funcname ln "$LN_SF" \
-                            \$ZFSBOOT_GELI_POOL_NAME/boot \
-                            \$BSDINSTALL_CHROOT/boot || return $FAILURE
+       if [ "$ZFSBOOT_BOOT_POOL" ]; then
+               f_dprintf "$funcname: Creating /boot symlink for boot pool..."
+               f_eval_catch $funcname ln "$LN_SF" "$bootpool_name/boot" \
+                            $BSDINSTALL_CHROOT/boot || return $FAILURE
        fi
 
        # Set bootfs property
+       local zroot_bootfs="$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
        f_dprintf "$funcname: Setting bootfs property..."
-       f_dprintf "$funcname: %s %s" \
-                 "ZFSBOOT_BEROOT_NAME=[$ZFSBOOT_BEROOT_NAME]" \
-                 "ZFSBOOT_BOOTFS_NAME=[$ZFSBOOT_BOOTFS_NAME]"
        f_eval_catch $funcname zpool "$ZPOOL_SET" \
-           bootfs=\"\$poolname/\$ZFSBOOT_BEROOT_NAME/\$ZFSBOOT_BOOTFS_NAME\" \
-           \$poolname || return $FAILURE
+               "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" \$poolname ||
+       f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" ||
                     return $FAILURE
-       if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+       if [ "$ZFSBOOT_BOOT_POOL" ]; then
                f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \
-                            \$ZFSBOOT_GELI_POOL_NAME || return $FAILURE
+                            "$bootpool_name" || return $FAILURE
        fi
 
        # Destroy the gnop devices (if enabled)
        for disk in ${ZFSBOOT_GNOP_4K_FORCE_ALIGN:+$disks}; do
-               if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
-                       f_quietly gnop destroy $disk$bootpart.nop
-               else
-                       f_quietly gnop destroy $disk$targetpart.nop
+               if [ "$ZFSBOOT_BOOT_POOL" ]; then
+                       f_eval_catch -d $funcname gnop "$GNOP_DESTROY" \
+                                       $disk$bootpart.nop
+               fi
+               if [ ! "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+                       f_eval_catch -d $funcname gnop "$GNOP_DESTROY" \
+                                       $disk$targetpart.nop
                fi
        done
 
-       # MBR boot loader hack part 2
+       # MBR boot loader touch-up
        if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then
                f_dprintf "$funcname: Updating MBR boot loader on disks..."
-               f_dprintf "$funcname: disks=[%s]"
                # Stick the ZFS boot loader in the "convienient hole" after 
                # the ZFS internal metadata
                for disk in $disks; do
-                       f_dprintf "$funcname: disk=[%s] bootpart=[%s]" \
-                                 "$disk" "$bootpart"
                        f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
-                                    /boot/zfsboot /dev/\$disk\$bootpart \
+                                    /boot/zfsboot /dev/$disk$bootpart \
                                     "skip=1 seek=1024" || return $FAILURE
                done
        fi
@@ -1142,74 +1143,79 @@ zfs_create_boot()
        # 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\"" \$poolname ||
+                    "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" ||
                     return $FAILURE
-       if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+       if [ "$ZFSBOOT_BOOT_POOL" ]; then
                f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
-                            "-o altroot=\"\$BSDINSTALL_CHROOT\"" \
-                            \$ZFSBOOT_GELI_POOL_NAME || return $FAILURE
+                            "-o altroot=\"$BSDINSTALL_CHROOT\"" \
+                            "$bootpool_name" || return $FAILURE
        fi
 
        # While this is apparently not needed, it seems to help MBR
-       f_dprintf "$funcname: Configuring zpool.cache..."
-       f_eval_catch $funcname mkdir "$MKDIR_P" \$BSDINSTALL_CHROOT/boot/zfs ||
+       f_dprintf "$funcname: Configuring zpool.cache for zroot..."
+       f_eval_catch $funcname mkdir "$MKDIR_P" $BSDINSTALL_CHROOT/boot/zfs ||
                     return $FAILURE
        f_eval_catch $funcname zpool "$ZPOOL_SET" \
-                    cachefile=\"\$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\" \
-                    \$poolname || return $FAILURE
+                    "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \
+                    "$zroot_name" || return $FAILURE
 
        # 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..." \
                  "$funcname"
        f_eval_catch $funcname echo "$ECHO_APPEND" 'zfs_enable=\"YES\"' \
-                    \$BSDINSTALL_TMPETC/rc.conf.zfs || return $FAILURE
+                    $BSDINSTALL_TMPETC/rc.conf.zfs || return $FAILURE
        f_eval_catch $funcname echo "$ECHO_APPEND" 'zfs_load=\"YES\"' \
-                    \$BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE
+                    $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE
 
-       # We're all done unless we should go on to do encryption
-       [ "$ZFSBOOT_GELI_ENCRYPTION" ] || return $SUCCESS
+       # We're all done unless we should go on for boot pool
+       [ "$ZFSBOOT_BOOT_POOL" ] || return $SUCCESS
+
+       # Set cachefile for boot pool so it auto-imports at system start
+       f_dprintf "$funcname: Configuring zpool.cache for boot pool..."
+       f_eval_catch $funcname zpool "$ZPOOL_SET" \
+                    "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \
+                    "$bootpool_name" || return $FAILURE
 
        # Some additional geli(8) requirements for loader.conf(5)
        for option in \
-               zpool_cache_load=\"YES\" \
-               zpool_cache_type=\"/boot/zfs/zpool.cache\" \
-               zpool_cache_name=\"/boot/zfs/zpool.cache\" \
+               'zpool_cache_load=\"YES\"' \
+               'zpool_cache_type=\"/boot/zfs/zpool.cache\"' \
+               'zpool_cache_name=\"/boot/zfs/zpool.cache\"' \
        ; do
-               f_eval_catch $funcname echo "$ECHO_APPEND" \$option \
-                            \$BSDINSTALL_TMPBOOT/loader.conf.zfs ||
+               f_eval_catch $funcname echo "$ECHO_APPEND" "$option" \
+                            $BSDINSTALL_TMPBOOT/loader.conf.zfs ||
                             return $FAILURE
        done
+       f_eval_catch $funcname printf "$PRINTF_CONF" vfs.root.mountfrom \
+           "\"zfs:$zroot_name/$zroot_bootfs\"" \
+           $BSDINSTALL_TMPBOOT/loader.conf.root || return $FAILURE
+
+       # We're all done unless we should go on to do encryption
+       [ "$ZFSBOOT_GELI_ENCRYPTION" ] || return $SUCCESS
 
        #
        # Configure geli(8)-based encryption
        #
        f_dprintf "$funcname: Configuring disk encryption..."
        f_eval_catch $funcname echo "$ECHO_APPEND" 'aesni_load=\"YES\"' \
-           \$BSDINSTALL_TMPBOOT/loader.conf.aesni || return $FAILURE
+           $BSDINSTALL_TMPBOOT/loader.conf.aesni || return $FAILURE
        f_eval_catch $funcname echo "$ECHO_APPEND" 'geom_eli_load=\"YES\"' \
-           \$BSDINSTALL_TMPBOOT/loader.conf.geli || return $FAILURE
-       f_eval_catch $funcname printf "$PRINTF_CONF" vfs.root.mountfrom \
-           '"zfs:$poolname/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"' \
-           \$BSDINSTALL_TMPBOOT/loader.conf.root || return $FAILURE
-       f_dprintf "$funcname: disks=[%s]" "$disks"
+           $BSDINSTALL_TMPBOOT/loader.conf.geli || return $FAILURE
        for disk in $disks; do
-               f_dprintf "$funcname: %s %s %s" \
-                         "disk=[$disk]" "targetpart=[$targetpart]" \
-                         "ZFSBOOT_GELI_KEY_FILE=[$ZFSBOOT_GELI_KEY_FILE]"
                f_eval_catch $funcname printf "$PRINTF_CONF" \
-                       geli_%s_keyfile0_load '"$disk$targetpart" YES' \
-                       \$BSDINSTALL_TMPBOOT/loader.conf.\$disk\$targetpart ||
+                       geli_%s_keyfile0_load "$disk$targetpart YES" \
+                       $BSDINSTALL_TMPBOOT/loader.conf.$disk$targetpart ||
                        return $FAILURE
                f_eval_catch $funcname printf "$PRINTF_CONF" \
                        geli_%s_keyfile0_type \
-                       '"$disk$targetpart" "$disk$targetpart:geli_keyfile0"' \
-                       \$BSDINSTALL_TMPBOOT/loader.conf.\$disk\$targetpart ||
+                       "$disk$targetpart $disk$targetpart:geli_keyfile0" \
+                       $BSDINSTALL_TMPBOOT/loader.conf.$disk$targetpart ||
                        return $FAILURE
                f_eval_catch $funcname printf "$PRINTF_CONF" \
                        geli_%s_keyfile0_name \
-                       '"$disk$targetpart" "$ZFSBOOT_GELI_KEY_FILE"' \
-                       \$BSDINSTALL_TMPBOOT/loader.conf.\$disk\$targetpart ||
+                       "$disk$targetpart \"$ZFSBOOT_GELI_KEY_FILE\"" \
+                       $BSDINSTALL_TMPBOOT/loader.conf.$disk$targetpart ||
                        return $FAILURE
        done
 
@@ -1258,7 +1264,7 @@ f_dialog_backtitle "$msg_freebsd_install
 #
 f_dprintf "BSDINSTALL_CHROOT=[%s]" "$BSDINSTALL_CHROOT"
 f_dprintf "BSDINSTALL_TMPETC=[%s]" "$BSDINSTALL_TMPETC"
-f_dprintf "PRINTF_FSTAB=[%s]" "$PRINTF_FSTAB"
+f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT"
 
 #
 # Loop over the main menu until we've accomplished what we came here to do
@@ -1296,11 +1302,11 @@ while :; do
 
                # Make sure each disk will be at least 50% ZFS
                if f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize &&
-                  f_expand_number "$ZFSBOOT_GELI_BOOT_SIZE" gelisize
+                  f_expand_number "$ZFSBOOT_BOOT_POOL_SIZE" bootsize
                then
                        minsize=$swapsize teeny_disks=
-                       [ "$ZFSBOOT_GELI_ENCRYPTION" ] &&
-                               minsize=$(( $minsize + $gelisize ))
+                       [ "$ZFSBOOT_BOOT_POOL" ] &&
+                               minsize=$(( $minsize + $bootsize ))
                        for disk in $ZFSBOOT_DISKS; do
                                device_$disk get capacity disksize || continue

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to