From: Marcin Krol Date: Sun, 27 Apr 2025 15:52:24 +0000 (+0200) Subject: - don't force unrestricted boot in OS prober X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=e0ace2ab5dfa10e71a405343c2e34d4741bed108;p=packages%2Fgrub2.git - don't force unrestricted boot in OS prober --- diff --git a/restricted.patch b/restricted.patch index 9f5b20a..ff496a5 100644 --- a/restricted.patch +++ b/restricted.patch @@ -1,105 +1,35 @@ -diff -ur grub-2.06.orig/util/grub.d/10_linux.in grub-2.06/util/grub.d/10_linux.in ---- grub-2.06.orig/util/grub.d/10_linux.in 2022-08-30 02:18:01.042920967 +0200 -+++ grub-2.06/util/grub.d/10_linux.in 2022-08-30 02:18:53.263002735 +0200 -@@ -28,6 +28,12 @@ - - CLASS="--class gnu-linux --class gnu --class os" +diff -ur grub-2.12.orig/util/grub.d/10_linux.in grub-2.12/util/grub.d/10_linux.in +--- grub-2.12.orig/util/grub.d/10_linux.in 2025-04-27 17:47:18.122797143 +0200 ++++ grub-2.12/util/grub.d/10_linux.in 2025-04-27 17:47:43.810873653 +0200 +@@ -35,6 +35,10 @@ + CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" + fi -+if [ "x${GRUB_RESTRICTED}" = "xtrue" ] ; then -+ GRUB_UNRESTRICTED_OPTION="" -+else -+ GRUB_UNRESTRICTED_OPTION="--unrestricted" ++if [ "x${GRUB_RESTRICTED}" != "xtrue" ] ; then ++ CLASS="${CLASS} --unrestricted" +fi + - if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS="$(. /etc/os-release ; echo "$NAME $VERSION")" - else -@@ -102,9 +108,9 @@ - title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" - grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" - fi -- echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" - else -- echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" - fi - if [ x$type != xrecovery ] ; then - save_default_entry | grub_add_tab -diff -ur grub-2.06.orig/util/grub.d/30_os-prober.in grub-2.06/util/grub.d/30_os-prober.in ---- grub-2.06.orig/util/grub.d/30_os-prober.in 2022-08-30 02:18:01.035920956 +0200 -+++ grub-2.06/util/grub.d/30_os-prober.in 2022-08-30 02:20:26.805149188 +0200 -@@ -31,6 +31,12 @@ - exit 0 + # loop-AES arranges things so that /dev/loop/X can be our root device, but + # the initrds that Linux uses don't like that. + case ${GRUB_DEVICE} in +diff -ur grub-2.12.orig/util/grub.d/20_linux_xen.in grub-2.12/util/grub.d/20_linux_xen.in +--- grub-2.12.orig/util/grub.d/20_linux_xen.in 2025-04-27 17:47:18.122797143 +0200 ++++ grub-2.12/util/grub.d/20_linux_xen.in 2025-04-27 17:51:45.263592919 +0200 +@@ -35,6 +35,10 @@ + CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" fi -+if [ "x${GRUB_RESTRICTED}" = "xtrue" ] ; then -+ GRUB_UNRESTRICTED_OPTION="" -+else -+ GRUB_UNRESTRICTED_OPTION="--unrestricted" ++if [ "x${GRUB_RESTRICTED}" != "xtrue" ] ; then ++ CLASS="${CLASS} --unrestricted" +fi + - if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/null ; then - # missing os-prober and/or linux-boot-prober - exit 0 -@@ -55,7 +61,7 @@ - # TRANSLATORS: it refers on the OS residing on device %s - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" - cat << EOF --menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' { -+menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' { - EOF - save_default_entry | grub_add_tab - prepare_grub_to_access_device ${DEVICE} | grub_add_tab -@@ -151,7 +157,7 @@ - - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" - cat << EOF --menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { -+menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { - EOF - save_default_entry | grub_add_tab - prepare_grub_to_access_device ${DEVICE} | grub_add_tab -@@ -183,7 +189,7 @@ - DEVICE=${DEVICE%@*} - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" - cat << EOF --menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' { -+menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' { - EOF - save_default_entry | sed -e "s/^/\t/" - prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" -@@ -247,7 +253,7 @@ - - if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then - cat << EOF --menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' { -+menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' { - EOF - save_default_entry | grub_add_tab - printf '%s\n' "${prepare_boot_cache}" -@@ -267,7 +273,7 @@ - fi - title="${LLABEL} $onstr" - cat << EOF -- menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' { -+ menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' { - EOF - save_default_entry | sed -e "s/^/$grub_tab$grub_tab/" - printf '%s\n' "${prepare_boot_cache}" | grub_add_tab -@@ -304,7 +310,7 @@ - hurd) - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" - cat << EOF --menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' { -+menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' { - EOF - save_default_entry | grub_add_tab - prepare_grub_to_access_device ${DEVICE} | grub_add_tab -diff -ur grub-2.06.orig/util/grub-mkconfig.in grub-2.06/util/grub-mkconfig.in ---- grub-2.06.orig/util/grub-mkconfig.in 2022-08-30 02:18:01.036920957 +0200 -+++ grub-2.06/util/grub-mkconfig.in 2022-08-30 02:18:53.264002736 +0200 -@@ -267,7 +267,8 @@ + # loop-AES arranges things so that /dev/loop/X can be our root device, but + # the initrds that Linux uses don't like that. + case ${GRUB_DEVICE} in +diff -ur grub-2.12.orig/util/grub-mkconfig.in grub-2.12/util/grub-mkconfig.in +--- grub-2.12.orig/util/grub-mkconfig.in 2025-04-27 17:47:18.118797131 +0200 ++++ grub-2.12/util/grub-mkconfig.in 2025-04-27 17:47:43.810873653 +0200 +@@ -271,7 +271,8 @@ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \