Helper scripts for not-so-common but still regularly occuring tasks on FreeBSD.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
freebsd-helpers/bootstick-uefi.sh

46 lines
1.5 KiB

. util.sh
helpers.help(){
echo "This script creates a UEFI-compatible bootstick containing /boot."
echo "This is used for installations where the built-in hardware *only*"
echo "contains encrypted data."
echo "This script takes no parameters."
}
helpers.checkhelp $1
echo "Loading config"
. config.sh
echo "NOTICE:"
echo " This will make destructive changes to $config_bootstick_device!"
echo " This will also mount and write over $config_bootstick_constructionsite!"
echo " Please make sure that:"
echo " * The USB stick you want to write to is $config_bootstick_device"
echo " * Nothing is currently mounted at /mnt"
echo ""
echo "Continue?"
if helpers.yesno
then
set -x
gpart destroy -F $config_bootstick_device
gpart create -s gpt $config_bootstick_device
gpart add -t efi -s 40M $config_bootstick_device
gpart add -t freebsd-ufs -s 1G $config_bootstick_device
newfs_msdos -F 32 -c 1 /dev/${config_bootstick_device}p1
mount -t msdosfs /dev/${config_bootstick_device}p1 $config_bootstick_constructionsite
mkdir -p ${config_bootstick_constructionsite}/EFI/BOOT
cp /boot/loader.efi ${config_bootstick_constructionsite}/EFI/BOOT/BOOTX64.efi
umount $config_bootstick_constructionsite
newfs -U /dev/${config_bootstick_device}p2
mount /dev/${config_bootstick_device}p2 $config_bootstick_constructionsite
cp -av /boot $config_bootstick_constructionsite
umount $config_bootstick_constructionsite
set +x
echo "Done!"
fi