Skip to contentSkip to conversation

Abort grub-install if prefix cannot be determined

PATCH In review Christian Franke 3 participants 4 messages Jul 24, 2008 – Jul 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Abort grub-install if prefix cannot be determined

grub-install does not check error return from make_system_path_relative_to_its_root() fails.

BTW: Unlike the other scripts, grub-install does not 'set -e'. Is this intentional or historic ?-)

Christian

2008-07-24 Christian Franke <[email protected]>

* util/i386/pc/grub-install.in: If --debug' is specified, pass --verbose' to grub-setup.
Abort script if make_system_path_relative_to_its_root() fails.

util/i386/pc/grub-install.in +6 -4
index 1b2bccb..d7966d5 100644
@@ -127,8 +127,10 @@ if test "x$install_device" = x; then
 fi
 
 # If the debugging feature is enabled, print commands.
+setup_verbose=
 if test $debug = yes; then
     set -x
+    setup_verbose="--verbose"
 fi
 
 # Initialize these directories here, since ROOTDIR was initialized.
@@ -240,12 +242,12 @@ fi
 # The order in this list is critical.  Be careful when modifying it.
 modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module"
 
-$grub_mkimage --output=${grubdir}/core.img \
-    --prefix=${prefix_drive}`make_system_path_relative_to_its_root ${grubdir}`/ \
-    $modules || exit 1
+grub_prefix="${prefix_drive}`make_system_path_relative_to_its_root ${grubdir}`" || exit 1
+
+$grub_mkimage --output=${grubdir}/core.img --prefix=${grub_prefix}/ $modules || exit 1
 
 # Now perform the installation.
-$grub_setup --directory=${grubdir} --device-map=${device_map} \
+$grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
     ${install_device} || exit 1
 
 # Prompt the user to check if the device map is correct.
#1 lore raw
Quoted 4 lines · Christian Franke

grub-install does not check error return from make_system_path_relative_to_its_root() fails.

BTW: Unlike the other scripts, grub-install does not 'set -e'. Is this intentional or historic ?-)

Quoted 10 lines

Christian

2008-07-24 Christian Franke <[email protected]>

* util/i386/pc/grub-install.in: If --debug' is specified, pass --verbose' to grub-setup.
Abort script if make_system_path_relative_to_its_root() fails.

Committed.

Christian

#2 lore raw
In reply to Christian Franke
Quoted 5 lines · Christian Franke

grub-install does not check error return from
make_system_path_relative_to_its_root() fails.

BTW: Unlike the other scripts, grub-install does not 'set -e'. Is this intentional or historic ?-)

I think it's historic. Wouldn't mind moving it to 'set -e' (although one would have to check which grub-probe calls are allowed to fail). What do others think?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
#3 lore raw
Quoted 10 lines · Robert Millan
Quoted 5 lines · Christian Franke

grub-install does not check error return from
make_system_path_relative_to_its_root() fails.

BTW: Unlike the other scripts, grub-install does not 'set -e'. Is this intentional or historic ?-)

I think it's historic. Wouldn't mind moving it to 'set -e' (although one would have to check which grub-probe calls are allowed to fail). What do others think?

I agree with you. It's better to add explicit "|| :" to a few commands that can fail than to allow every command to fail.

Signature · 2 lines
Regards,
Pavel Roskin