Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bsdinstall/scripts/zfsboot
| Show First 20 Lines • Show All 754 Lines • ▼ Show 20 Lines | |||||
| # | # | ||||
| # NOTE: $swapsize and $bootsize should be defined by the calling function. | # NOTE: $swapsize and $bootsize should be defined by the calling function. | ||||
| # NOTE: Sets $bootpart and $targetpart for the calling function. | # NOTE: Sets $bootpart and $targetpart for the calling function. | ||||
| # | # | ||||
| zfs_create_diskpart() | zfs_create_diskpart() | ||||
| { | { | ||||
| local funcname=zfs_create_diskpart | local funcname=zfs_create_diskpart | ||||
| local disk="$1" index="$2" | local disk="$1" index="$2" | ||||
| local efibootpart | |||||
| # Check arguments | # Check arguments | ||||
| if [ ! "$disk" ]; then | if [ ! "$disk" ]; then | ||||
| f_dprintf "$funcname: NULL disk argument" | f_dprintf "$funcname: NULL disk argument" | ||||
| msg_error="$msg_error: $funcname" \ | msg_error="$msg_error: $funcname" \ | ||||
| f_show_err "$msg_null_disk_argument" | f_show_err "$msg_null_disk_argument" | ||||
| return $FAILURE | return $FAILURE | ||||
| fi | fi | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o \ | ||||
| "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | ||||
| then | then | ||||
| f_eval_catch -k justaddedpart $funcname gpart \ | f_eval_catch -k justaddedpart $funcname gpart \ | ||||
| "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | ||||
| "$align_small" efiboot$index efi 260M \ | "$align_small" efiboot$index efi 260M \ | ||||
| $disk || return $FAILURE | $disk || return $FAILURE | ||||
| # We'll configure the ESP in bootconfig | # We'll configure the ESP in bootconfig | ||||
| if [ -z "$efibootpart" ]; then | # Note: This will always be p1 | ||||
| efibootpart="/dev/gpt/efiboot$index" | efibootpart="/dev/gpt/efiboot$index" | ||||
| f_dprintf "$funcname: configuring ESP at [%s]" \ | f_dprintf "$funcname: configuring ESP at [%s]" \ | ||||
| "${efibootpart}" | "${efibootpart}" | ||||
| f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\ | f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\ | ||||
| "$efibootpart" \ | "$efibootpart" \ | ||||
| || return $FAILURE | || return $FAILURE | ||||
| if [ $index -eq 0 ]; then | |||||
| f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | ||||
| $efibootpart /boot/efi msdosfs \ | $efibootpart /boot/efi msdosfs \ | ||||
| rw 2 2 "$BSDINSTALL_TMPETC/fstab" \ | rw 2 2 "$BSDINSTALL_TMPETC/fstab" \ | ||||
| || return $FAILURE | || return $FAILURE | ||||
| else | |||||
| # Record the extra ones | |||||
| echo "${efibootpart}" >> ${TMPDIR:-"/tmp"}/bsdinstall-esps | |||||
| fi | fi | ||||
| fi | fi | ||||
| if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \ | if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \ | ||||
| "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | ||||
| then | then | ||||
| f_eval_catch $funcname gpart \ | f_eval_catch $funcname gpart \ | ||||
| "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | ||||
| ▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | zfs_create_boot() | ||||
| local zroot_vdevs= # Calculated below | local zroot_vdevs= # Calculated below | ||||
| local swap_devs= # Calculated below | local swap_devs= # Calculated below | ||||
| local boot_vdevs= # Used for geli(8) layouts | local boot_vdevs= # Used for geli(8) layouts | ||||
| shift 2 # poolname vdev_type | shift 2 # poolname vdev_type | ||||
| local disks="$*" disk | local disks="$*" disk | ||||
| local isswapmirror | local isswapmirror | ||||
| local bootpart targetpart swappart # Set by zfs_create_diskpart() below | local bootpart targetpart swappart # Set by zfs_create_diskpart() below | ||||
| local create_options | local create_options | ||||
| local efibootpart | |||||
imp: This was stray, it seems, from earlier revs. | |||||
| # | # | ||||
| # Pedantic checks; should never be seen | # Pedantic checks; should never be seen | ||||
| # | # | ||||
| if [ ! "$zroot_name" ]; then | if [ ! "$zroot_name" ]; then | ||||
| f_dprintf "$funcname: NULL poolname" | f_dprintf "$funcname: NULL poolname" | ||||
| msg_error="$msg_error: $funcname" \ | msg_error="$msg_error: $funcname" \ | ||||
| f_show_err "$msg_null_poolname" | f_show_err "$msg_null_poolname" | ||||
| ▲ Show 20 Lines • Show All 717 Lines • Show Last 20 Lines | |||||
This was stray, it seems, from earlier revs.