diff --git a/debian/apport/source_grub2.py b/debian/apport/source_grub2.py index 993137e1c..33fe6e66f 100644 --- a/debian/apport/source_grub2.py +++ b/debian/apport/source_grub2.py @@ -69,6 +69,15 @@ def add_info(report): attach_file(report, '/proc/cmdline','ProcCmdLine') _attach_file_filtered(report, '/etc/default/grub','EtcDefaultGrub') 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 = [] if not check_shell_syntax_harder('/etc/default/grub'): diff --git a/debian/changelog b/debian/changelog index f3c51a2a7..ace563d46 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ grub2 (2.00-10) UNRELEASED; urgency=low - 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 verifying module signatures). + - Read /etc/default/grub.d/*.cfg after /etc/default/grub (LP: #901600). -- Colin Watson Wed, 02 Jan 2013 08:58:20 +0000 diff --git a/debian/config.in b/debian/config.in index 3a6ab564b..8ef81419c 100644 --- a/debian/config.in +++ b/debian/config.in @@ -38,6 +38,11 @@ esac if test -e /etc/default/grub ; then . /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_default "$GRUB_CMDLINE_LINUX_DEFAULT" diff --git a/debian/patches/default_grub_d.patch b/debian/patches/default_grub_d.patch new file mode 100644 index 000000000..08834792c --- /dev/null +++ b/debian/patches/default_grub_d.patch @@ -0,0 +1,38 @@ +Description: Read /etc/default/grub.d/*.cfg after /etc/default/grub +Author: Colin Watson +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 diff --git a/debian/patches/series b/debian/patches/series index 030d2d7f3..30b480320 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -31,3 +31,4 @@ mount_readdir_symlink_failures.patch initrd_addr_min.patch gnulib_gets.patch no_insmod_on_sb.patch +default_grub_d.patch diff --git a/debian/postinst.in b/debian/postinst.in index ea6c0f04c..b5288f914 100644 --- a/debian/postinst.in +++ b/debian/postinst.in @@ -283,6 +283,11 @@ config_item() { if [ -f /etc/default/grub ]; then . /etc/default/grub || return + for x in /etc/default/grub.d/*.cfg; do + if [ -e "$x" ]; then + . "$x" + fi + done fi eval echo "\$$1" } diff --git a/util/grub-install.in b/util/grub-install.in index 00dc875ca..3a145563a 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -68,6 +68,11 @@ efi_quiet= 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 diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 64ec0dbd1..6d8b69b9e 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -150,6 +150,11 @@ GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo 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