Read /etc/default/grub.d/*.cfg after /etc/default/grub (LP: #901600).

This commit is contained in:
Colin Watson 2013-01-02 16:58:49 +00:00
parent 32783d0799
commit 257ad9f328
8 changed files with 69 additions and 0 deletions

View File

@ -69,6 +69,15 @@ def add_info(report):
attach_file(report, '/proc/cmdline','ProcCmdLine') attach_file(report, '/proc/cmdline','ProcCmdLine')
_attach_file_filtered(report, '/etc/default/grub','EtcDefaultGrub') _attach_file_filtered(report, '/etc/default/grub','EtcDefaultGrub')
attach_file_if_exists(report, '/boot/grub/device.map', 'DeviceMap') attach_file_if_exists(report, '/boot/grub/device.map', 'DeviceMap')
try:
grub_d = '/etc/default/grub.d'
for name in sorted(os.listdir(grub_d)):
if name.endswith('.cfg'):
key = 'EtcDefaultGrubD.' + path_to_key(name)
attach_file_if_exists(
report, os.path.join(grub_d, name), key)
except OSError:
pass
invalid_grub_script = [] invalid_grub_script = []
if not check_shell_syntax_harder('/etc/default/grub'): if not check_shell_syntax_harder('/etc/default/grub'):

1
debian/changelog vendored
View File

@ -8,6 +8,7 @@ grub2 (2.00-10) UNRELEASED; urgency=low
- Don't permit loading modules on UEFI Secure Boot (since in such a - Don't permit loading modules on UEFI Secure Boot (since in such a
setup the GRUB core image must be signed but it has no provision for setup the GRUB core image must be signed but it has no provision for
verifying module signatures). verifying module signatures).
- Read /etc/default/grub.d/*.cfg after /etc/default/grub (LP: #901600).
-- Colin Watson <cjwatson@debian.org> Wed, 02 Jan 2013 08:58:20 +0000 -- Colin Watson <cjwatson@debian.org> Wed, 02 Jan 2013 08:58:20 +0000

5
debian/config.in vendored
View File

@ -38,6 +38,11 @@ esac
if test -e /etc/default/grub ; then if test -e /etc/default/grub ; then
. /etc/default/grub . /etc/default/grub
for x in /etc/default/grub.d/*.cfg ; do
if [ -e "$x" ]; then
. "$x"
fi
done
db_set grub2/linux_cmdline "$GRUB_CMDLINE_LINUX" db_set grub2/linux_cmdline "$GRUB_CMDLINE_LINUX"
db_set grub2/linux_cmdline_default "$GRUB_CMDLINE_LINUX_DEFAULT" db_set grub2/linux_cmdline_default "$GRUB_CMDLINE_LINUX_DEFAULT"

38
debian/patches/default_grub_d.patch vendored Normal file
View File

@ -0,0 +1,38 @@
Description: Read /etc/default/grub.d/*.cfg after /etc/default/grub
Author: Colin Watson <cjwatson@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/901600
Forwarded: no
Last-Update: 2013-01-02
Index: b/util/grub-install.in
===================================================================
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -68,6 +68,11 @@
if test -f "${sysconfdir}/default/grub" ; then
. "${sysconfdir}/default/grub"
fi
+for x in "${sysconfdir}/default/grub.d"/*.cfg ; do
+ if [ -e "${x}" ]; then
+ . "${x}"
+ fi
+done
bootloader_id="$(echo "$GRUB_DISTRIBUTOR" | tr 'A-Z' 'a-z' | cut -d' ' -f1)"
if test -z "$bootloader_id"; then
Index: b/util/grub-mkconfig.in
===================================================================
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -150,6 +150,11 @@
if test -f ${sysconfdir}/default/grub ; then
. ${sysconfdir}/default/grub
fi
+for x in ${sysconfdir}/default/grub.d/*.cfg ; do
+ if [ -e "${x}" ]; then
+ . "${x}"
+ fi
+done
# XXX: should this be deprecated at some point?
if [ "x${GRUB_TERMINAL}" != "x" ] ; then

View File

@ -31,3 +31,4 @@ mount_readdir_symlink_failures.patch
initrd_addr_min.patch initrd_addr_min.patch
gnulib_gets.patch gnulib_gets.patch
no_insmod_on_sb.patch no_insmod_on_sb.patch
default_grub_d.patch

5
debian/postinst.in vendored
View File

@ -283,6 +283,11 @@ config_item()
{ {
if [ -f /etc/default/grub ]; then if [ -f /etc/default/grub ]; then
. /etc/default/grub || return . /etc/default/grub || return
for x in /etc/default/grub.d/*.cfg; do
if [ -e "$x" ]; then
. "$x"
fi
done
fi fi
eval echo "\$$1" eval echo "\$$1"
} }

View File

@ -68,6 +68,11 @@ efi_quiet=
if test -f "${sysconfdir}/default/grub" ; then if test -f "${sysconfdir}/default/grub" ; then
. "${sysconfdir}/default/grub" . "${sysconfdir}/default/grub"
fi fi
for x in "${sysconfdir}/default/grub.d"/*.cfg ; do
if [ -e "${x}" ]; then
. "${x}"
fi
done
bootloader_id="$(echo "$GRUB_DISTRIBUTOR" | tr 'A-Z' 'a-z' | cut -d' ' -f1)" bootloader_id="$(echo "$GRUB_DISTRIBUTOR" | tr 'A-Z' 'a-z' | cut -d' ' -f1)"
if test -z "$bootloader_id"; then if test -z "$bootloader_id"; then

View File

@ -150,6 +150,11 @@ GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo
if test -f ${sysconfdir}/default/grub ; then if test -f ${sysconfdir}/default/grub ; then
. ${sysconfdir}/default/grub . ${sysconfdir}/default/grub
fi fi
for x in ${sysconfdir}/default/grub.d/*.cfg ; do
if [ -e "${x}" ]; then
. "${x}"
fi
done
# XXX: should this be deprecated at some point? # XXX: should this be deprecated at some point?
if [ "x${GRUB_TERMINAL}" != "x" ] ; then if [ "x${GRUB_TERMINAL}" != "x" ] ; then