From: jezz@hkfree.org
To: grub-devel@gnu.org
Subject: Support for howmany option in grub2
Date: Sun, 27 Sep 2009 20:04:51 +0200 [thread overview]
Message-ID: <20090927180451.GA23688@titan> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1116 bytes --]
Hello,
I am using Debian GNU/Linux as my primary system. As a loader I am using GRUB.
Actually I have upgraded to GRUB2. I don't know, if it was feature of original
(legacy) GRUB or it was functionality provided by debian scripts (update-grub),
for generating menu.lst. There was feature - howmany. This option specifies
number of kernels, that user wants to have in boot menu. Script, that modifies
menu.lst, use this variable. I like this feature, because I have usually more
kernels, but I want to see only last two versions in GRUB menu. I have created
patch, that add support for this to /etc/grub.d/10_linux. I have created this
patch against version shipped with Debian (1.97~beta3-1) - I don't know if
there are some Debian specific modifications. Also there should be variable
GRUB_HOW_MANY propagated from /etc/default/grub (my patch don't do
this).
Kernel and it's rescue variant is counted as one kernel.
I have already reported this bug to Debian BTS:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548600
Regards
--
Jezz
mail: jezz@hkfree.org
jabber: jezz@njs.netlab.cz
[-- Attachment #1.2: howmany.patch --]
[-- Type: text/x-diff, Size: 861 bytes --]
--- 10_linux 2009-08-10 19:49:44.000000000 +0200
+++ 10_linux.new 2009-09-27 16:09:49.490014838 +0200
@@ -66,7 +66,17 @@
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
-while [ "x$list" != "x" ] ; do
+# Validate GRUB_HOW_MANY variable
+case "$GRUB_HOW_MANY" in
+ [0-9]|[0-9][0-9])
+ howmany=$GRUB_HOW_MANY
+ ;;
+ *)
+ howmany=99
+ ;;
+esac
+
+while [ "x$list" != "x" -a $howmany -gt 0 ] ; do
linux=`version_find_latest $list`
echo "Found linux image: $linux" >&2
basename=`basename $linux`
@@ -75,6 +85,7 @@
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}"
+ howmany=$((howmany-1))
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2009-09-27 18:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-27 18:04 jezz [this message]
2009-10-02 20:53 ` Support for howmany option in grub2 Robert Millan
2009-10-02 21:45 ` richardvoigt
2009-10-03 10:38 ` jezz
2009-10-02 22:00 ` Vladimir 'phcoder' Serbinenko
2009-10-02 23:01 ` Michal Suchanek
2009-10-03 12:49 ` Vladimir 'phcoder' Serbinenko
2009-10-03 15:21 ` Michal Suchanek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090927180451.GA23688@titan \
--to=jezz@hkfree.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.