Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bsdinstall/scripts/zfsboot
Show First 20 Lines • Show All 1,053 Lines • ▼ Show 20 Lines | f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \ | ||||
/boot/zfsboot /dev/${disk}s1 count=1 || | /boot/zfsboot /dev/${disk}s1 count=1 || | ||||
return $FAILURE | return $FAILURE | ||||
;; | ;; | ||||
esac # $ZFSBOOT_PARTITION_SCHEME | esac # $ZFSBOOT_PARTITION_SCHEME | ||||
# Update fstab(5) | # Update fstab(5) | ||||
local swapsize | local swapsize | ||||
local suffix | |||||
f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize | f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize | ||||
if [ "$ZFSBOOT_SWAP_ENCRYPTION" ]; then | |||||
suffix=".eli" | |||||
fi | |||||
if [ "$isswapmirror" ]; then | if [ "$isswapmirror" ]; then | ||||
# This is not the first disk in the mirror, do nothing | # This is not the first disk in the mirror, do nothing | ||||
elif [ ${swapsize:-0} -eq 0 ]; then | elif [ ${swapsize:-0} -eq 0 ]; then | ||||
# If swap is 0 sized, don't add it to fstab | # If swap is 0 sized, don't add it to fstab | ||||
elif [ "$ZFSBOOT_SWAP_ENCRYPTION" -a "$ZFSBOOT_SWAP_MIRROR" ]; then | |||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | |||||
/dev/mirror/swap.eli none swap sw 0 0 \ | |||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE | |||||
isswapmirror=1 | |||||
elif [ "$ZFSBOOT_SWAP_MIRROR" ]; then | elif [ "$ZFSBOOT_SWAP_MIRROR" ]; then | ||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | ||||
/dev/mirror/swap none swap sw 0 0 \ | /dev/mirror/swap$suffix none swap sw 0 0 \ | ||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE | $BSDINSTALL_TMPETC/fstab || return $FAILURE | ||||
isswapmirror=1 | isswapmirror=1 | ||||
elif [ "$ZFSBOOT_SWAP_ENCRYPTION" ]; then | else | ||||
case "$ZFSBOOT_PARTITION_SCHEME" in | |||||
GPT*) | |||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | ||||
/dev/$disk${swappart}.eli none swap sw 0 0 \ | /dev/gpt/swap$index$suffix none swap sw 0 0 \ | ||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE | $BSDINSTALL_TMPETC/fstab || return $FAILURE | ||||
else | ;; | ||||
*) | |||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | f_eval_catch $funcname printf "$PRINTF_FSTAB" \ | ||||
/dev/$disk$swappart none swap sw 0 0 \ | /dev/$disk$swappart$suffix none swap sw 0 0 \ | ||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE | $BSDINSTALL_TMPETC/fstab || return $FAILURE | ||||
;; | |||||
esac | |||||
kevans: It looks like we can use the gpt label for encrypted swap, too; how would you feel about… | |||||
Not Done Inline Actions(well, local suffix="") kevans: (well, `local suffix=""`) | |||||
Done Inline ActionsYeah, I follow your suggestion, it seems we can simplify the logic here. I still need to build a test iso and for testing. Maybe this is what you mean? wanpengqian_gmail.com: Yeah, I follow your suggestion, it seems we can simplify the logic here.
Here is the new patch. | |||||
Not Done Inline ActionsYeah, this looks reasonable (though, is GELI + MIRROR a valid and functional configuration?), thanks! kevans: Yeah, this looks reasonable (though, is GELI + MIRROR a valid and functional configuration?)… | |||||
Done Inline ActionsYes, GELI + MIRROR is a valid and functional configuration. I remove following code elif [ "$ZFSBOOT_SWAP_ENCRYPTION" -a "$ZFSBOOT_SWAP_MIRROR" ]; then f_eval_catch $funcname printf "$PRINTF_FSTAB" \ /dev/mirror/swap.eli none swap sw 0 0 \ $BSDINSTALL_TMPETC/fstab || return $FAILURE isswapmirror=1 because this condition will process here elif [ "$ZFSBOOT_SWAP_MIRROR" ]; then f_eval_catch $funcname printf "$PRINTF_FSTAB" \ /dev/mirror/swap$suffix none swap sw 0 0 \ $BSDINSTALL_TMPETC/fstab || return $FAILURE isswapmirror=1 else since we have set the suffix before wanpengqian_gmail.com: Yes, GELI + MIRROR is a valid and functional configuration. I remove following code
```
elif… | |||||
Done Inline ActionsOops, indeed, I had missed that removed branch. Excellent! kevans: Oops, indeed, I had missed that removed branch. Excellent! | |||||
fi | fi | ||||
return $SUCCESS | return $SUCCESS | ||||
} | } | ||||
# zfs_create_boot $poolname $vdev_type $disks ... | # zfs_create_boot $poolname $vdev_type $disks ... | ||||
# | # | ||||
# Creates boot pool and dataset layout. Returns error if something goes wrong. | # Creates boot pool and dataset layout. Returns error if something goes wrong. | ||||
▲ Show 20 Lines • Show All 772 Lines • Show Last 20 Lines |
It looks like we can use the gpt label for encrypted swap, too; how would you feel about absorbing the $ZFSBOOT_SWAP_ENCRYPTION branch just above with something like: