diff --git a/ChangeLog b/ChangeLog index 9097f25..ddf1c3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-05-01 Andreas Born + + * util/grub.d/10_linux.in: Prevent duplicated entries because both + symlink and symlinked kernel are detected, only use the symlink + then. Detect also kernels without a hyphen in a name and use an + empty version for those kernels. Don't display linux in + the menuentry title if version is empty. Detect more initrds e.g. + initrd.gz. + 2009-04-30 David S. Miller * util/hostdisk.c (device_is_wholedisk): New function. diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index c2da413..66768eb 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -112,9 +112,18 @@ EOF EOF } -list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do +list=`for i in /boot/vmlinu[xz]* /vmlinu[xz]* ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` +for i in $list ; do + if test -h $i ; then + target="`readlink -f $i`" + list=`echo $list | tr ' ' '\n' | grep -vx $target | tr '\n' ' '` + if test ! -f $target ; then + list=`echo $list | tr ' ' '\n' | grep -vx $i | tr '\n' ' '` + fi + fi +done while [ "x$list" != "x" ] ; do linux=`find_latest $list` @@ -122,13 +131,16 @@ while [ "x$list" != "x" ] ; do basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` + version=`echo $basename | sed -e "s,^[^\-]*-*,,"` 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" \ - "initrd.img-${alt_version}" "initrd-${alt_version}.img"; do + "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ + "initrd.gz-${version}" "initrd-${version}.gz" \ + "initrd.gz-${alt_version}" "initrd-${alt_version}.gz" \ + "initrd.img" "initrd.gz" "initrd.splash"; do if test -e "${dirname}/${i}" ; then initrd="$i" break @@ -140,10 +152,16 @@ while [ "x$list" != "x" ] ; do # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. linux_root_device_thisversion=${GRUB_DEVICE} fi + + if test -n "${version}" ; then + title="${OS}, linux ${version}" + else + title="${OS}" + fi - linux_entry "${OS}, linux ${version}" \ + linux_entry "${title}" \ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - linux_entry "${OS}, linux ${version} (recovery mode)" \ + linux_entry "${title} (recovery mode)" \ "single ${GRUB_CMDLINE_LINUX}" list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`