Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bsdinstall/scripts/bootconfig
Show All 22 Lines | |||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
# SUCH DAMAGE. | # SUCH DAMAGE. | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
FREEBSD_BOOTLABEL="FreeBSD" | |||||
BSDCFG_SHARE="/usr/share/bsdconfig" | BSDCFG_SHARE="/usr/share/bsdconfig" | ||||
. $BSDCFG_SHARE/common.subr || exit 1 | . $BSDCFG_SHARE/common.subr || exit 1 | ||||
f_dprintf "%s: loading_includes..." "$0" | f_dprintf "%s: loading_includes..." "$0" | ||||
f_include $BSDCFG_SHARE/dialog.subr | f_include $BSDCFG_SHARE/dialog.subr | ||||
: ${TMPDIR:="/tmp"} | : ${TMPDIR:="/tmp"} | ||||
die() { | die() { | ||||
Show All 19 Lines | $DIALOG \ | ||||
--no-cancel \ | --no-cancel \ | ||||
--inputbox "$prompt" \ | --inputbox "$prompt" \ | ||||
$height $width "$value" \ | $height $width "$value" \ | ||||
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD | 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD | ||||
} | } | ||||
update_uefi_bootentry() | update_uefi_bootentry() | ||||
{ | { | ||||
nentries=$(efibootmgr | grep -c 'FreeBSD$') | nentries=$(efibootmgr | grep -c "${EFI_LABEL_NAME}$") | ||||
# No entries so directly create one and return | # No entries so directly create one and return | ||||
if [ ${nentries} -eq 0 ]; then | if [ ${nentries} -eq 0 ]; then | ||||
f_dprintf "Creating UEFI boot entry" | f_dprintf "Creating UEFI boot entry" | ||||
efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null | efibootmgr --create --activate --label "$EFI_LABEL_NAME" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null | ||||
return | return | ||||
fi | fi | ||||
$DIALOG --backtitle 'FreeBSD Installer' --title 'Boot configuration' \ | $DIALOG --backtitle "$OSNAME Installer" --title 'Boot configuration' \ | ||||
--yesno 'There are multiple "FreeBSD" EFI boot entries. Would you like to remove them all and add a new one?' 0 0 | --yesno "There are multiple \"$OSNAME\" EFI boot entries. Would you like to remove them all and add a new one?" 0 0 | ||||
if [ $? -eq $DIALOG_OK ]; then | if [ $? -eq $DIALOG_OK ]; then | ||||
for entry in $(efibootmgr | awk '$NF == "FreeBSD" { sub(/.*Boot/,"", $1); sub(/\*/,"", $1); print $1 }'); do | for entry in $(efibootmgr | awk "\$NF == \"$EFI_LABEL_NAME\" { sub(/.*Boot/,\"\", \$1); sub(/\*/,\"\", \$1); print \$1 }"); do | ||||
efibootmgr -B -b ${entry} | efibootmgr -B -b ${entry} | ||||
done | done | ||||
efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null | efibootmgr --create --activate --label "$EFI_LABEL_NAME" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null | ||||
return | return | ||||
fi | fi | ||||
FREEBSD_BOOTLABEL=$(dialog_uefi_entryname "${FREEBSD_BOOTLABEL}") | FREEBSD_BOOTLABEL=$(dialog_uefi_entryname "${EFI_LABEL_NAME}") | ||||
[ $? -eq $DIALOG_CANCEL ] && exit 1 | [ $? -eq $DIALOG_CANCEL ] && exit 1 | ||||
efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null | efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null | ||||
} | } | ||||
f_dialog_title "Boot configuration" | f_dialog_title "Boot configuration" | ||||
f_dialog_backtitle "FreeBSD Installer" | f_dialog_backtitle "$OSNAME Installer" | ||||
if [ `uname -m` == powerpc ]; then | if [ `uname -m` == powerpc ]; then | ||||
platform=`sysctl -n hw.platform` | platform=`sysctl -n hw.platform` | ||||
if [ "$platform" == ps3 -o "$platform" == powernv ]; then | if [ "$platform" == ps3 -o "$platform" == powernv ]; then | ||||
rootpart=$(awk '{ if($2 == "/") printf("%s:%s\n", $3, $1); }' $PATH_FSTAB) | rootpart=$(awk '{ if($2 == "/") printf("%s:%s\n", $3, $1); }' $PATH_FSTAB) | ||||
kboot_conf=$BSDINSTALL_CHROOT/boot/etc/kboot.conf | kboot_conf=$BSDINSTALL_CHROOT/boot/etc/kboot.conf | ||||
mkdir -p $BSDINSTALL_CHROOT/boot/etc/ | mkdir -p $BSDINSTALL_CHROOT/boot/etc/ | ||||
echo default=$FREEBSD_BOOTLABEL > $kboot_conf | echo default=$FREEBSD_BOOTLABEL > $kboot_conf | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |