Lines Matching +full:slice +full:- +full:per +full:- +full:line

2 #-
3 # Copyright (c) 2013-2016 Allan Jude
4 # Copyright (c) 2013-2018 Devin Teske
42 # Default name of the boot-pool
54 : ${ZFSBOOT_POOL_CREATE_OPTIONS:=-O compress=lz4 -O atime=off}
174 " # END-QUOTE
185 # Format of a line in printf(1) syntax to add to fstab(5)
197 GELI_ATTACH='geli attach -j - -k "%s" "%s"'
198 GELI_ATTACH_NOKEY='geli attach -j - "%s"'
199 GELI_DETACH_F='geli detach -f "%s"'
200 GELI_PASSWORD_INIT='geli init -b -B "%s" -e %s -J - -K "%s" -l 256 -s 4096 "%s"'
201 GELI_PASSWORD_GELIBOOT_INIT='geli init -bg -e %s -J - -l 256 -s 4096 "%s"'
202 GPART_ADD_ALIGN='gpart add %s -t %s "%s"'
203 GPART_ADD_ALIGN_INDEX='gpart add %s -i %s -t %s "%s"'
204 GPART_ADD_ALIGN_INDEX_WITH_SIZE='gpart add %s -i %s -t %s -s %s "%s"'
205 GPART_ADD_ALIGN_LABEL='gpart add %s -l %s -t %s "%s"'
206 GPART_ADD_ALIGN_LABEL_WITH_SIZE='gpart add %s -l %s -t %s -s %s "%s"'
207 GPART_BOOTCODE='gpart bootcode -b "%s" "%s"'
208 GPART_BOOTCODE_PART='gpart bootcode -b "%s" -p "%s" -i %s "%s"'
209 GPART_CREATE='gpart create -s %s "%s"'
210 GPART_DESTROY_F='gpart destroy -F "%s"'
211 GPART_SET_ACTIVE='gpart set -a active -i %s "%s"'
212 GPART_SET_LENOVOFIX='gpart set -a lenovofix "%s"'
213 GPART_SET_PMBR_ACTIVE='gpart set -a active "%s"'
216 LN_SF='ln -sf "%s" "%s"'
217 MKDIR_P='mkdir -p "%s"'
218 MOUNT_TYPE='mount -t %s "%s" "%s"'
233 ZPOOL_EXPORT_F='zpool export -f "%s"'
235 ZPOOL_LABELCLEAR_F='zpool labelclear -f "%s"'
261 msg_geli_setup="Initializing encryption on selected disks,\n this will take several seconds per disk"
273 msg_mirror_desc="Mirror - n-Way Mirroring"
289 msg_please_enter_amount_of_swap_space="Please enter amount of swap space (SI-Unit suffixes\nrecommended; e.g., \`2g' for 2 Gigabytes):"
297 msg_raid10_desc="RAID 1+0 - n x 2-Way Mirrors"
299 msg_raidz1_desc="RAID-Z1 - Single Redundant RAID"
301 msg_raidz2_desc="RAID-Z2 - Double Redundant RAID"
303 msg_raidz3_desc="RAID-Z3 - Triple Redundant RAID"
310 msg_stripe_desc="Stripe - No Redundancy"
334 # Display the dialog(1)-based application main menu.
351 { [ $n -eq 1 ] && disks_grammar=$msg_disk_singular; } ||
359 '- $msg_rescan_devices' '*'
361 '- $msg_disk_info' '*'
381 " # END-QUOTE
389 # Obtain default-item from previously stored selection
394 --title \"\$title\" \
395 --backtitle \"\$btitle\" \
396 --hline \"\$hline\" \
397 --item-help \
398 --ok-label \"\$msg_select\" \
399 --cancel-label \"\$msg_cancel\" \
400 --default-item \"\$defaultitem\" \
401 --menu \"\$prompt\" \
403 ${USE_DIALOG:+--} $menu_list \
410 # Only update default-item on success
411 [ $retval -eq $DIALOG_OK ] && f_dialog_default_store "$menu_choice"
419 # action is to return error status unless the user explicitly (non-default)
430 local plen=${#prefix} list= line=
431 local max_width=$(( $width - 3 - $plen ))
435 yes=ok no=cancel defaultno=default-no
436 extra_args="--wrap --left"
440 extra_args="--colors --cr-wrap"
446 if [ "$line" ]; then
447 line_width=${#line}
453 if [ $line_width -gt $max_width ]; then
454 list="$list$line\n"
455 line="$prefix"
459 line="$line $disk"
461 # Append the left-overs
462 if [ "${line#$prefix}" ]; then
463 list="$list$line"
473 --title "$title" \
474 --backtitle "$btitle" \
475 --hline "$hline" \
476 --$defaultno \
477 --$yes-label "$msg_yes" \
478 --$no-label "$msg_no" \
480 --yesno "$prompt" $height $width
502 " # END-QUOTE
533 md[0-9]*) f_mounted -b "/dev/$name" && continue ;;
544 [ $? -eq 0 ] && avail_disks="$avail_disks $disk"
570 # back-up to the previous menu.
580 --title \"\$title\" \
581 --backtitle \"\$btitle\" \
582 --hline \"\$vdev_hline\" \
583 --ok-label \"\$msg_ok\" \
584 --cancel-label \"\$msg_cancel\" \
585 --item-help \
586 --default-item \"\$ZFSBOOT_VDEV_TYPE\" \
587 --menu \"\$vdev_prompt\" \
616 if debug= f_device_find -1 \
639 # Short-circuit if we're running non-interactively
643 [ $ndisks -ge $want_disks ] && break # to success
669 # locals to map statuses onto up-to-date list of disks
671 debug= f_device_find -1 \
685 f_getvar _${disk}_status:-off onoff
695 --title \"\$DIALOG_TITLE\" \
696 --backtitle \"\$DIALOG_BACKTITLE\" \
697 --separate-output \
698 --hline \"\$disk_hline\" \
699 --ok-label \"\$msg_ok\" \
700 --cancel-label \"\$msg_back\" \
701 --checklist \"\$disk_prompt\" \
716 [ $(( $ndisks % 2 )) -ne 0 ]; then
729 [ $ndisks -ge $want_disks ] &&
805 # NOTE: `-F' required to destroy if partitions still exist.
809 zpool list -Ho name | while read z_name; do
810 f_eval_catch -d $funcname zpool "$ZPOOL_EXPORT_F" $z_name
813 geli status | tail -n +2 | while read g_name g_status g_component; do
814 f_eval_catch -d $funcname geli "$GELI_DETACH_F" $g_name
817 f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
818 f_eval_catch -d $funcname graid "$GRAID_DELETE" $disk
819 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" /dev/$disk
821 # Make doubly-sure backup GPT is destroyed
822 f_eval_catch -d $funcname gpart "$GPART_CREATE" gpt $disk
823 f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
838 align_small="-a 4k"
839 align_big="-a 1m"
862 # 2. Add small freebsd-boot and/or efi partition
864 if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o \
867 f_eval_catch -k justaddedpart $funcname gpart \
873 if [ -z "$efibootpart" ]; then
888 if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \
894 freebsd-boot 512k $disk || return $FAILURE
912 [ ${swapsize:-0} -gt 0 ] && targetpart=p5
916 [ ${swapsize:-0} -gt 0 ] && targetpart=p4
921 [ ${swapsize:-0} -gt 0 ] && targetpart=p4
925 [ ${swapsize:-0} -gt 0 ] && targetpart=p3
935 "$align_big" boot$index freebsd-zfs \
938 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
942 f_eval_catch -d $funcname geli \
949 # 3. Add freebsd-swap partition labeled `swap#'
951 if [ ${swapsize:-0} -gt 0 ]; then
954 "$align_big" swap$index freebsd-swap \
957 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
962 # 4. Add freebsd-zfs partition labeled `zfs#' for zroot
966 "$align_big" zfs$index freebsd-zfs $ZFSBOOT_POOL_SIZE $disk ||
970 "$align_big" zfs$index freebsd-zfs $disk ||
973 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
991 # 2. Add freebsd slice with all available space
998 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
1001 f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" ${disk}s1
1004 # 3. Write BSD scheme to the freebsd slice
1019 "" 1 freebsd-zfs ${bootsize}b ${disk}s1 ||
1022 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
1026 f_eval_catch -d $funcname geli \
1032 # 4. Add freebsd-swap partition
1034 if [ ${swapsize:-0} -gt 0 ]; then
1037 "$align_small" 2 freebsd-swap \
1040 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
1045 # 5. Add freebsd-zfs partition for zroot
1049 "$align_small" $mbrindex freebsd-zfs $ZFSBOOT_POOL_SIZE ${disk}s1 || return $FAILURE
1052 "$align_small" $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE
1054 f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
1068 elif [ ${swapsize:-0} -eq 0 ]; then
1070 elif [ "$ZFSBOOT_SWAP_ENCRYPTION" -a "$ZFSBOOT_SWAP_MIRROR" ]; then
1122 if [ $# -lt 1 ]; then
1175 # Destroy the pool in-case this is our second time 'round (case of
1182 f_eval_catch -d $funcname zpool "$ZPOOL_DESTROY" "$zroot_name"
1227 f_eval_catch -d $funcname umount "$UMOUNT" "$BSDINSTALL_CHROOT"
1234 [ $nvdevs -gt 1 ] && bootpool_vdevtype=mirror
1237 bootpool_options="-o altroot=$BSDINSTALL_CHROOT"
1239 bootpool_options="$bootpool_options -m \"/$bootpool_name\" -f"
1254 go-wrx "$bootpool/$zroot_key" ||
1265 # Load the AES-NI kernel module to accelerate encryption
1267 f_eval_catch -d $funcname kldload "$KLDLOAD" "aesni"
1285 AES-XTS "$bootpool/$zroot_key" \
1306 AES-XTS $disk$targetpart
1330 f_eval_catch -d $funcname umount "$UMOUNT" "$BSDINSTALL_CHROOT"
1336 if [ ${swapsize:-0} -gt 0 -a "$ZFSBOOT_SWAP_MIRROR" ]; then
1353 if [ $(( $nvdev % 3 )) -eq 0 ]; then
1359 "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \
1363 "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \
1385 # Replace both commas and spaces with ` -o '
1386 f_replaceall "$options" "[ ,]" " -o " options
1389 "${options:+-o $options}" "$zroot_name$dataset" ||
1418 # MBR boot loader touch-up
1438 # Re-import the ZFS pool(s)
1439 f_dprintf "$funcname: Re-importing ZFS pool(s)..."
1441 "-o altroot=\"$BSDINSTALL_CHROOT\"" \
1447 "-o altroot=\"$BSDINSTALL_CHROOT\" -N" \
1522 # Configure geli(8)-based encryption
1550 # Set cachefile for boot pool so it auto-imports at system start
1609 --title "$DIALOG_TITLE" \
1610 --backtitle "$DIALOG_BACKTITLE" \
1611 --hline "$hline" \
1612 --ok-label "Ok" \
1613 --no-cancel \
1614 --inputbox "$prompt" \
1627 # User may have specifically requested ZFS-related operations be interactive
1650 case $(uname -m) in
1658 bootmethod=$( sysctl -n machdep.bootmethod )
1684 [ $retval -eq $DIALOG_OK ] || f_die
1701 # NB: dialog_menu_layout supports running non-interactively
1717 debug= f_device_find -1 \
1720 [ ${disksize:-0} -ge 0 ] || disksize=0
1721 [ $disksize -lt $minsize ] &&
1759 echo "$ZFSBOOT_DISKS" > ${TMPDIR:-"/tmp"}/bsdinstall-zfsboot
1769 "- $msg_rescan_devices") f_device_rescan ;;
1770 "- $msg_disk_info") dialog_menu_diskinfo ;;
1797 if [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" -a \
1802 elif [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" -a \
1827 ZFSBOOT_SWAP_SIZE="${input:-0}"
1830 if [ $swapsize -ne 0 -a $swapsize -lt 104857600 ]; then