* util/grub.d/10_linux.in: Refactor search for initrd. Add

support for initrd names used in Fedora.
This commit is contained in:
proski 2007-12-29 20:53:20 +00:00
parent fc6e896cc5
commit 942391998a
2 changed files with 23 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2007-12-19 Pavel Roskin <proski@gnu.org>
* util/grub.d/10_linux.in: Refactor search for initrd. Add
support for initrd names used in Fedora.
2007-12-26 Bean <bean123ch@gmail.com> 2007-12-26 Bean <bean123ch@gmail.com>
* conf/common.rmk (pkgdata_MODULES): Add cpio.mod. * conf/common.rmk (pkgdata_MODULES): Add cpio.mod.

View file

@ -84,30 +84,43 @@ while [ "x$list" != "x" ] ; do
dirname=`dirname $linux` dirname=`dirname $linux`
grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"` grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done
if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/${initrd}" >&2
fi
cat << EOF cat << EOF
menuentry "${OS}, linux ${version}" { menuentry "${OS}, linux ${version}" {
linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX} linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX}
EOF EOF
if test -e ${dirname}/initrd.img-${version} ; then if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/initrd.img-${version}" >&2
cat << EOF cat << EOF
initrd ${grub_dirname}/initrd.img-${version} initrd ${grub_dirname}/${initrd}
EOF EOF
fi fi
cat << EOF cat << EOF
} }
EOF EOF
cat << EOF cat << EOF
menuentry "${OS}, linux ${version} (single-user mode)" { menuentry "${OS}, linux ${version} (single-user mode)" {
linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX} linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
EOF EOF
if test -e ${dirname}/initrd.img-${version} ; then if test -n "${initrd}" ; then
cat << EOF cat << EOF
initrd ${grub_dirname}/initrd.img-${version} initrd ${grub_dirname}/${initrd}
EOF EOF
fi fi
cat << EOF cat << EOF
} }
EOF EOF
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
done done