bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use of df in grub-install


From: Han Holl
Subject: Use of df in grub-install
Date: Mon, 11 Feb 2002 13:07:30 +0100

Hi,

In grub-install df is used to get the devicename for a file or directory.
Because df basically uses /etc/mtab to obtain this information,
it's quite useless in a chrooted environment.
I always used 'chroot /hard-disk-mount lilo' for installation
or restore disks, to avoid version mismatches between the
installation floppy/cd and the lilo and/or shared libraries
on the hard disk.
With grub-install in it's current form, that's impossible.
Maybe grub-install could somehow recognize the fact that
it's chrooted, and then avoid df. /etc/fstab may be the
better choice in this circumstance? I use somehting like this
in a script with roughly the same purpose as grub-install:
#!/bin/ksh
if [ -f /proc/mounts ]
then
        rootdev=$(df /| sed -n \$p | awk '{print $1}')
        bootdev=$(df /boot| sed -n \$p | awk '{print $1}')
else
        rootdev=$(awk '{if ($2 == "/") print $1}' /etc/fstab)
        bootdev=$(awk '{if ($2 == "/boot") print $1}' /etc/fstab)
        [ "$bootdev" ] || bootdev=$rootdev
fi

but of course there are other possible reasons for /proc
not being mounted. The above works for me though.

Han Holl

(Another case where /etc/mtab becomes unreliable is with a
read-only root filesystem).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]