2008-06-26 Robert Millan <rmh@aybabtu.com>

* util/grub.d/10_linux.in: Avoid passing UUIDs to Linux when either
        "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" does not exist, or when a
        Linux image includes no initrd.
This commit is contained in:
robertmh 2008-06-26 07:03:26 +00:00
parent 25ff262a6c
commit 37aaf354c9
2 changed files with 23 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2008-06-26 Robert Millan <rmh@aybabtu.com>
* util/grub.d/10_linux.in: Avoid passing UUIDs to Linux when either
"/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" does not exist, or when a
Linux image includes no initrd.
2008-06-21 Javier Martín <lordhabbit@gmail.com>
* util/i386/pc/grub-setup.c (setup): Remove literal "core.img" in a

View file

@ -27,17 +27,17 @@ else
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
fi
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] ; then
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
LINUX_ROOT_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
;;
*)
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
;;
esac
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
;;
esac
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
@ -109,6 +109,7 @@ while [ "x$list" != "x" ] ; do
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \
@ -120,11 +121,14 @@ while [ "x$list" != "x" ] ; do
done
if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/${initrd}" >&2
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
fi
cat << EOF
menuentry "${OS}, linux ${version}" {
linux ${rel_dirname}/${basename} root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
EOF
if test -n "${initrd}" ; then
cat << EOF
@ -137,7 +141,7 @@ EOF
cat << EOF
menuentry "${OS}, linux ${version} (single-user mode)" {
linux ${rel_dirname}/${basename} root=${LINUX_ROOT_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro single ${GRUB_CMDLINE_LINUX}
EOF
if test -n "${initrd}" ; then
cat << EOF