Package: grub-installer
Severity: grave
Tags: patch

Using absolute paths can have horrid consequences as you've seen in #361929.
Now grub commands are "trapped" into violating FHS and being unable to move at
the same time.

Please find attached patch to switch to relative paths when invoking
grub-install or update-grub.

Note: The patch assumes that PATH env variable is properly set during execution
of these scripts.  If that's not the case, you'll have to export it explicitly,
either in grub-installer or whereever you find appropiate.

As for /etc/kernel-img.conf generation, it cannot yet be done using relative
paths, but I expect that we'll be able to fix this automaticaly from
kernel-package (see #380338).

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-amd64-k8
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
diff -ur grub-installer-1.17.old/grub-installer 
grub-installer-1.17/grub-installer
--- grub-installer-1.17.old/grub-installer      2006-06-06 00:53:14.000000000 
+0200
+++ grub-installer-1.17/grub-installer  2006-07-29 14:20:02.000000000 +0200
@@ -173,7 +173,7 @@
 
 # Run update-grub in $ROOT.
 update_grub () {
-       if ! log-output -t grub-installer $chroot $ROOT /sbin/update-grub -y ; 
then
+       if ! log-output -t grub-installer $chroot $ROOT update-grub -y ; then
                error "Running 'update-grub -y' failed." 1>&2
                db_input critical grub-installer/update-grub-failed || [ $? -eq 
30 ]
                db_go || true
@@ -338,7 +338,7 @@
 update_mtab
 
 if ! is_floppy "$bootdev"; then
-       if $chroot $ROOT /sbin/grub-install -h 2>&1 | grep -q no-floppy; then
+       if $chroot $ROOT grub-install -h 2>&1 | grep -q no-floppy; then
                info "grub-install supports --no-floppy"
                floppyparam="--no-floppy"
        else
@@ -346,8 +346,8 @@
        fi
 fi
 
-info "Running $chroot $ROOT /sbin/grub-install --recheck $floppyparam 
\"$bootdev\""
-if log-output -t grub-installer $chroot $ROOT /sbin/grub-install --recheck 
$floppyparam "$bootdev"; then
+info "Running $chroot $ROOT grub-install --recheck $floppyparam \"$bootdev\""
+if log-output -t grub-installer $chroot $ROOT grub-install --recheck 
$floppyparam "$bootdev"; then
        info "grub-install ran successfully"
 else
        error "Running 'grub-install --recheck $floppyparam \"$bootdev\"' 
failed."
diff -ur grub-installer-1.17.old/rescue.d/80grub-reinstall 
grub-installer-1.17/rescue.d/80grub-reinstall
--- grub-installer-1.17.old/rescue.d/80grub-reinstall   2006-01-17 
00:04:04.000000000 +0100
+++ grub-installer-1.17/rescue.d/80grub-reinstall       2006-07-29 
14:19:23.000000000 +0200
@@ -30,12 +30,12 @@
 update_mtab
 
 if ! is_floppy "$bootdev"; then
-       if chroot /target /sbin/grub-install -h 2>&1 | grep -q no-floppy; then
+       if chroot /target grub-install -h 2>&1 | grep -q no-floppy; then
                floppyparam="--no-floppy"
        fi
 fi
 
-if ! log-output -t grub-installer chroot /target /sbin/grub-install --recheck 
$floppyparam "$bootdev"; then
+if ! log-output -t grub-installer chroot /target grub-install --recheck 
$floppyparam "$bootdev"; then
        db_subst grub-installer/grub-install-failed BOOTDEV "$bootdev"
        db_input critical grub-installer/grub-install-failed BOOTDEV "$bootdev"
        db_go || true

Reply via email to