Add bootloader setting for not loading the src initrd.
This commit is contained in:
parent
31e3a20bca
commit
432e5ddeaf
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2018 Jonas 'Sortie' Termansen.
|
# Copyright (c) 2018, 2022 Jonas 'Sortie' Termansen.
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and distribute this software for any
|
# Permission to use, copy, modify, and distribute this software for any
|
||||||
# purpose with or without fee is hereby granted, provided that the above
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -182,6 +182,7 @@ if [ -e /boot/random.seed ]; then
|
||||||
else
|
else
|
||||||
no_random_seed=--no-random-seed
|
no_random_seed=--no-random-seed
|
||||||
fi
|
fi
|
||||||
|
set enable_src=true
|
||||||
|
|
||||||
export version
|
export version
|
||||||
export machine
|
export machine
|
||||||
|
@ -190,6 +191,7 @@ export menu_title
|
||||||
export timeout
|
export timeout
|
||||||
export default
|
export default
|
||||||
export no_random_seed
|
export no_random_seed
|
||||||
|
export enable_src
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ -n "$ports" ]; then
|
if [ -n "$ports" ]; then
|
||||||
|
@ -285,13 +287,22 @@ cat << EOF
|
||||||
echo done
|
echo done
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
# TODO: Make loading of the /src initrd optional.
|
|
||||||
for initrd in $system_initrd $src_initrd $live_initrd $overlay_initrd; do
|
for initrd in $system_initrd $src_initrd $live_initrd $overlay_initrd; do
|
||||||
cat << EOF
|
if [ "$initrd" = "$src_initrd" ]; then
|
||||||
|
cat << EOF
|
||||||
|
if \$enable_src; then
|
||||||
|
echo -n "Loading /$initrd ($(human_size $initrd)) ... "
|
||||||
|
module /$initrd
|
||||||
|
echo done
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat << EOF
|
||||||
echo -n "Loading /$initrd ($(human_size $initrd)) ... "
|
echo -n "Loading /$initrd ($(human_size $initrd)) ... "
|
||||||
module /$initrd
|
module /$initrd
|
||||||
echo done
|
echo done
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
cat << EOF
|
cat << EOF
|
||||||
hook_initrd_post
|
hook_initrd_post
|
||||||
|
@ -393,6 +404,18 @@ menu_title="\$base_menu_title - Advanced Options"
|
||||||
|
|
||||||
hook_advanced_menu_pre
|
hook_advanced_menu_pre
|
||||||
|
|
||||||
|
if "\$enable_src"; then
|
||||||
|
menuentry "Disable loading source code" {
|
||||||
|
enable_src=false
|
||||||
|
configfile /boot/grub/advanced.cfg
|
||||||
|
}
|
||||||
|
else
|
||||||
|
menuentry "Enable loading source code" {
|
||||||
|
enable_src=true
|
||||||
|
configfile /boot/grub/advanced.cfg
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
menuentry "Select binary packages..." {
|
menuentry "Select binary packages..." {
|
||||||
configfile /boot/grub/tix.cfg
|
configfile /boot/grub/tix.cfg
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,6 +260,11 @@ If the selected menu option itself is a submenu, it can be appended with a
|
||||||
.Sy '>'
|
.Sy '>'
|
||||||
and another selection to pick a default menu option in that submenu, and so on.
|
and another selection to pick a default menu option in that submenu, and so on.
|
||||||
(Default: 0)
|
(Default: 0)
|
||||||
|
.It Sy enable_src
|
||||||
|
Whether to load the source code initrd containing
|
||||||
|
.Pa /src .
|
||||||
|
(Default:
|
||||||
|
.Sy true )
|
||||||
.It Sy machine
|
.It Sy machine
|
||||||
The machine type this release was built for.
|
The machine type this release was built for.
|
||||||
.It Sy menu_title
|
.It Sy menu_title
|
||||||
|
@ -346,7 +351,9 @@ command line.
|
||||||
.Pp
|
.Pp
|
||||||
Load
|
Load
|
||||||
.Pa /boot/system.initrd.xz ,
|
.Pa /boot/system.initrd.xz ,
|
||||||
.Pa /boot/src.initrd.xz ,
|
.Pa /boot/src.initrd.xz
|
||||||
|
(if
|
||||||
|
.Sy $enable_src ) ,
|
||||||
.Pa /boot/live.initrd.xz ,
|
.Pa /boot/live.initrd.xz ,
|
||||||
and
|
and
|
||||||
.Pa /boot/overlay.initrd.xz
|
.Pa /boot/overlay.initrd.xz
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2017, 2018 Jonas 'Sortie' Termansen.
|
# Copyright (c) 2017, 2018, 2022 Jonas 'Sortie' Termansen.
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and distribute this software for any
|
# Permission to use, copy, modify, and distribute this software for any
|
||||||
# purpose with or without fee is hereby granted, provided that the above
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -22,6 +22,7 @@ append_title="modified by $(id -un)@$(hostname)"
|
||||||
default=
|
default=
|
||||||
directory=
|
directory=
|
||||||
enable_append_title=true
|
enable_append_title=true
|
||||||
|
enable_src=
|
||||||
liveconfig=
|
liveconfig=
|
||||||
operand=1
|
operand=1
|
||||||
random_seed=false
|
random_seed=false
|
||||||
|
@ -49,7 +50,9 @@ for argument do
|
||||||
--default=*) default=$parameter ;;
|
--default=*) default=$parameter ;;
|
||||||
--default) previous_option=default ;;
|
--default) previous_option=default ;;
|
||||||
--disable-append-title) enable_append_title=false ;;
|
--disable-append-title) enable_append_title=false ;;
|
||||||
|
--disable-src) enable_src=false ;;
|
||||||
--enable-append-title) enable_append_title=true ;;
|
--enable-append-title) enable_append_title=true ;;
|
||||||
|
--enable-src) enable_src=true ;;
|
||||||
--liveconfig=*) liveconfig=$parameter ;;
|
--liveconfig=*) liveconfig=$parameter ;;
|
||||||
--liveconfig) previous_option=liveconfig ;;
|
--liveconfig) previous_option=liveconfig ;;
|
||||||
--random-seed) random_seed=true ;;
|
--random-seed) random_seed=true ;;
|
||||||
|
@ -121,6 +124,7 @@ mkdir -p -- "$directory/boot/grub"
|
||||||
if [ -n "$timeout" ]; then
|
if [ -n "$timeout" ]; then
|
||||||
printf 'timeout="%s"\n' "$timeout"
|
printf 'timeout="%s"\n' "$timeout"
|
||||||
fi
|
fi
|
||||||
|
print_enable_default_bool "$enable_src" src src
|
||||||
if $enable_append_title; then
|
if $enable_append_title; then
|
||||||
printf "base_menu_title=\"\$base_menu_title - \"'%s'\n" \
|
printf "base_menu_title=\"\$base_menu_title - \"'%s'\n" \
|
||||||
"$(printf '%s\n' "$append_title" | sed "s/'/'\\\\''/g")"
|
"$(printf '%s\n' "$append_title" | sed "s/'/'\\\\''/g")"
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
.Op Fl \-append-title Ns = Ns Ar text
|
.Op Fl \-append-title Ns = Ns Ar text
|
||||||
.Op Fl \-default Ns = Ns Ar default-boot-menu-option
|
.Op Fl \-default Ns = Ns Ar default-boot-menu-option
|
||||||
.Op Fl \-disable-append-title
|
.Op Fl \-disable-append-title
|
||||||
|
.Op Fl \-disable-src
|
||||||
.Op Fl \-enable-append-title
|
.Op Fl \-enable-append-title
|
||||||
|
.Op Fl \-enable-src
|
||||||
.Op Fl \-liveconfig Ns = Ns Ar liveconfig-directory
|
.Op Fl \-liveconfig Ns = Ns Ar liveconfig-directory
|
||||||
.Op Fl \-random-seed
|
.Op Fl \-random-seed
|
||||||
.Op Fl \-timeout Ns = Ns Ar boot-menu-timeout
|
.Op Fl \-timeout Ns = Ns Ar boot-menu-timeout
|
||||||
|
@ -86,6 +88,13 @@ GRUB variable.
|
||||||
Don't append anything to the bootloader menu title by appending to the
|
Don't append anything to the bootloader menu title by appending to the
|
||||||
.Sy base_menu_title
|
.Sy base_menu_title
|
||||||
GRUB variable.
|
GRUB variable.
|
||||||
|
.It Fl \-disable-src
|
||||||
|
Disable loading the source code in
|
||||||
|
.Pa /src
|
||||||
|
by setting
|
||||||
|
.Sy enable_src
|
||||||
|
GRUB variable to
|
||||||
|
.Sy false .
|
||||||
.It Fl \-enable-append-title
|
.It Fl \-enable-append-title
|
||||||
Enable appending " - " followed by the value set with
|
Enable appending " - " followed by the value set with
|
||||||
.Fl \-append-title
|
.Fl \-append-title
|
||||||
|
@ -94,6 +103,13 @@ to the bootloader menu title by appending to the
|
||||||
GRUB variable.
|
GRUB variable.
|
||||||
This option is on by default and can be disabled with
|
This option is on by default and can be disabled with
|
||||||
.Fl \-disable-append-title .
|
.Fl \-disable-append-title .
|
||||||
|
.It Fl \-enable-src
|
||||||
|
Enable loading the source code in
|
||||||
|
.Pa /src
|
||||||
|
by setting
|
||||||
|
.Sy enable_src
|
||||||
|
GRUB variable to
|
||||||
|
.Sy true .
|
||||||
.It Fl \-liveconfig Ns = Ns Ar liveconfig-directory
|
.It Fl \-liveconfig Ns = Ns Ar liveconfig-directory
|
||||||
Overlay the
|
Overlay the
|
||||||
.Ar liveconfig-directory
|
.Ar liveconfig-directory
|
||||||
|
|
Loading…
Reference in New Issue