Bug#590593: grub-common: patch to make grub_mkconfig more helpful
Marc Haber
mh+debian-bugs at zugschlus.de
Tue Jul 27 16:44:47 UTC 2010
Package: grub-common
Version: 1.98+20100720-1
Severity: wishlist
Hi,
this patch is from the grub bugtracker (item #30567) which modifies
grub_mkconfig to
- accept a --verbose command line option to give more information
about what grub-mkconfig does
- give information about grub-probe during its run
- allow to override the grub-probe calls from the environment.
The latter is important in chroots when one tests grub scripts or
prepares system images.
Please consider applying this patch to Debian even before upstream
(hopefully) does so. If you have more momentum inside upstream's
activities, you might also want to push for this patch to be applied
upstream.
Greetings
Marc
=== modified file 'util/grub-mkconfig.in'
--- util/grub-mkconfig.in 2010-06-29 15:20:49 +0000
+++ util/grub-mkconfig.in 2010-07-27 16:37:12 +0000
@@ -47,12 +47,21 @@
-o, --output=FILE output generated config to FILE [default=stdout]
-h, --help print this message and exit
+ -V, --verbose be verbose
-v, --version print the version information and exit
Report bugs to <bug-grub at gnu.org>.
EOF
}
+verbose() {
+ if [ -n "$VERBOSE" ]; then
+ echo >&2 $@
+ fi
+}
+
+VERBOSE=""
+
argument () {
opt=$1
shift
@@ -77,6 +86,10 @@
-v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
+ -V | --verbose)
+ shift
+ VERBOSE=1
+ ;;
-o | --output)
grub_cfg=`argument $option "$@"`; shift;;
--output=*)
@@ -149,16 +162,46 @@
fi
# Device containing our userland. Typically used for root= parameter.
-GRUB_DEVICE="`${grub_probe} --target=device /`"
-GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
+if [ -n "$GRUB_DEVICE" ]; then
+ verbose "using pre-defined GRUB_DEVICE $GRUB_DEVICE"
+else
+ verbose "GRUB_DEVICE=grub-probe --target=device /"
+ GRUB_DEVICE="`${grub_probe} --target=device /`"
+ verbose "using probed GRUB_DEVICE $GRUB_DEVICE"
+fi
+if [ -n "$GRUB_DEVICE_UUID" ]; then
+ verbose "using pre-defined GRUB_DEVICE_UUID $GRUB_DEVICE_UUID"
+else
+ verbose "GRUB_DEVICE_UUID=grub-probe --device ${GRUB_DEVICE} --target=fs_uuid"
+ GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
+ verbose "using probed GRUB_DEVICE_UUID $GRUB_DEVICE_UUID"
+fi
# Device containing our /boot partition. Usually the same as GRUB_DEVICE.
-GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
-GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
+if [ -n "$GRUB_DEVICE_BOOT" ]; then
+ verbose "using pre-defined GRUB_DEVICE_BOOT $GRUB_DEVICE_BOOT"
+else
+ verbose "GRUB_DEVICE_BOOT=grub-probe --target=device /boot"
+ GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
+ verbose "using probed GRUB_DEVICE_BOOT $GRUB_DEVICE_BOOT"
+fi
+if [ -n "$GRUB_DEVICE_BOOT_UUID" ]; then
+ verbose "using pre-defined GRUB_DEVICE_BOOT_UUID $GRUB_DEVICE_BOOT_UUID"
+else
+ verbose "GRUB_DEVICE_BOOT_UUID=grub-probe --device ${GRUB_DEVICE_BOOT} --target=fs_uuid"
+ GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
+ verbose "using probed GRUB_DEVICE_BOOT_UUID $GRUB_DEVICE_BOOT_UUID"
+fi
# Filesystem for the device containing our userland. Used for stuff like
# choosing Hurd filesystem module.
-GRUB_FS="`${grub_probe} --target=fs / 2> /dev/null || echo unknown`"
+if [ -n "$GRUB_FS" ]; then
+ verbose "using pre-defined GRUB_FS $GRUB_FS"
+else
+ verbose "GRUB_FS=grub-probe --target=fs /"
+ GRUB_FS="`${grub_probe} --target=fs / 2> /dev/null || echo unknown`"
+ verbose "using probed GRUB_FS $GRUB_FS"
+fi
if test -f ${sysconfdir}/default/grub ; then
. ${sysconfdir}/default/grub
More information about the Pkg-grub-devel
mailing list