Page MenuHomeFreeBSD

D19992.id56443.diff
No OneTemporary

D19992.id56443.diff

Index: tools/boot/install-boot.sh
===================================================================
--- tools/boot/install-boot.sh
+++ tools/boot/install-boot.sh
@@ -134,29 +134,31 @@
echo "Copying loader to /EFI/freebsd on ESP"
cp "${file}" "${mntpt}/EFI/freebsd/loader.efi"
- existingbootentryloaderfile=$(efibootmgr -v | grep "${mntpt}//EFI/freebsd/loader.efi")
+ if [ -n "${updatesystem}" ]; then
+ existingbootentryloaderfile=$(efibootmgr -v | grep "${mntpt}//EFI/freebsd/loader.efi")
- if [ -z "$existingbootentryloaderfile" ]; then
- # Try again without the double forward-slash in the path
- existingbootentryloaderfile=$(efibootmgr -v | grep "${mntpt}/EFI/freebsd/loader.efi")
- fi
-
- if [ -z "$existingbootentryloaderfile" ]; then
- echo "Creating UEFI boot entry for FreeBSD"
- efibootmgr --create --label FreeBSD --loader "${mntpt}/EFI/freebsd/loader.efi" > /dev/null
- if [ $? -ne 0 ]; then
- die "Failed to create new boot entry"
+ if [ -z "$existingbootentryloaderfile" ]; then
+ # Try again without the double forward-slash in the path
+ existingbootentryloaderfile=$(efibootmgr -v | grep "${mntpt}/EFI/freebsd/loader.efi")
fi
- # When creating new entries, efibootmgr doesn't mark them active, so we need to
- # do so. It doesn't make it easy to find which entry it just added, so rely on
- # the fact that it places the new entry first in BootOrder.
- bootorder=$(efivar --name 8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOrder --print --no-name --hex | head -1)
- bootentry=$(echo "${bootorder}" | cut -w -f 3)$(echo "${bootorder}" | cut -w -f 2)
- echo "Marking UEFI boot entry ${bootentry} active"
- efibootmgr --activate "${bootentry}" > /dev/null
- else
- echo "Existing UEFI FreeBSD boot entry found: not creating a new one"
+ if [ -z "$existingbootentryloaderfile" ]; then
+ echo "Creating UEFI boot entry for FreeBSD"
+ efibootmgr --create --label FreeBSD --loader "${mntpt}/EFI/freebsd/loader.efi" > /dev/null
+ if [ $? -ne 0 ]; then
+ die "Failed to create new boot entry"
+ fi
+
+ # When creating new entries, efibootmgr doesn't mark them active, so we need to
+ # do so. It doesn't make it easy to find which entry it just added, so rely on
+ # the fact that it places the new entry first in BootOrder.
+ bootorder=$(efivar --name 8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOrder --print --no-name --hex | head -1)
+ bootentry=$(echo "${bootorder}" | cut -w -f 3)$(echo "${bootorder}" | cut -w -f 2)
+ echo "Marking UEFI boot entry ${bootentry} active"
+ efibootmgr --activate "${bootentry}" > /dev/null
+ else
+ echo "Existing UEFI FreeBSD boot entry found: not creating a new one"
+ fi
fi
umount "${mntpt}"
@@ -362,6 +364,8 @@
printf ' -f fs filesystem type: ufs or zfs\n'
printf ' -g geli yes or no\n'
printf ' -h this help/usage text\n'
+ printf ' -u Run commands such as efibootmgr to update the\n'
+ printf ' currently running system\n'
printf ' -o optargs optional arguments\n'
printf ' -s scheme mbr or gpt\n'
exit 0
@@ -372,7 +376,7 @@
# Note: we really don't support geli boot in this script yet.
geli=nogeli
-while getopts "b:d:f:g:ho:s:" opt; do
+while getopts "b:d:f:g:ho:s:u" opt; do
case "$opt" in
b)
bios=${OPTARG}
@@ -389,6 +393,9 @@
*) geli=nogeli ;;
esac
;;
+ u)
+ updatesystem=1
+ ;;
o)
opts=${OPTARG}
;;
Index: tools/boot/rootgen.sh
===================================================================
--- tools/boot/rootgen.sh
+++ tools/boot/rootgen.sh
@@ -27,6 +27,8 @@
# vars should likely be conditionally set to allow better automation.
#
+. $(dirname $0)/install-boot.sh
+
cpsys() {
src=$1
dst=$2

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 24, 2:09 AM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35424877
Default Alt Text
D19992.id56443.diff (3 KB)

Event Timeline