Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112023698
D33330.id99697.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D33330.id99697.diff
View Options
Index: usr.sbin/bsdinstall/scripts/bootconfig
===================================================================
--- usr.sbin/bsdinstall/scripts/bootconfig
+++ usr.sbin/bsdinstall/scripts/bootconfig
@@ -32,6 +32,8 @@
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading_includes..." "$0"
+f_include $BSDCFG_SHARE/dialog.subr
: ${TMPDIR:="/tmp"}
@@ -40,6 +42,55 @@
exit 1
}
+dialog_uefi_entryname()
+{
+ local prompt="Please enter a name for the new entry"
+ local hline=
+ local value="$*"
+ local height width
+
+ f_dialog_inputbox_size height width \
+ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$prompt" "$value" "$hline"
+
+ $DIALOG \
+ --title "$DIALOG_TITLE" \
+ --backtitle "$DIALOG_BACKTITLE" \
+ --hline "$hline" \
+ --ok-label "Ok" \
+ --no-cancel \
+ --inputbox "$prompt" \
+ $height $width "$value" \
+ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
+}
+
+update_uefi_bootentry()
+{
+ nentries=$(efibootmgr | grep -c 'FreeBSD$')
+ # No entries so directly create one and return
+ if [ ${nentries} -eq 0 ]; then
+ f_dprintf "Creating UEFI boot entry"
+ efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null
+ return
+ fi
+
+ $DIALOG --backtitle 'FreeBSD Installer' --title 'Boot configuration' \
+ --yesno 'There is multiple "FreeBSD" efi boot entries, would you like to remove them all and add a new one?' 0 0
+ if [ $? -eq $DIALOG_OK ]; then
+ for entry in $(efibootmgr | awk '$NF == "FreeBSD" { sub(/.*Boot/,"", $1); sub(/\*/,"", $1); print $1 }'); do
+ efibootmgr -B -b ${entry}
+ done
+ efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null
+ return
+ fi
+
+ FREEBSD_BOOTLABEL=$(dialog_uefi_entryname "${FREEBSD_BOOTLABEL}")
+ [ $? -eq $DIALOG_CANCEL ] && exit 1
+ efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null
+}
+
+f_dialog_title "Boot configuration"
+f_dialog_backtitle "FreeBSD Installer"
+
if [ `uname -m` == powerpc ]; then
platform=`sysctl -n hw.platform`
if [ "$platform" == ps3 -o "$platform" == powernv ]; then
@@ -87,8 +138,7 @@
fi
if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
- f_dprintf "Creating UEFI boot entry"
- efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null
+ update_uefi_bootentry
fi
f_dprintf "Finished configuring ESP"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 12, 5:31 PM (7 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17123464
Default Alt Text
D33330.id99697.diff (2 KB)
Attached To
Mode
D33330: bsdinstall: bootconfig: Try to clean old efi boot entries
Attached
Detach File
Event Timeline
Log In to Comment