From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Mry7X-0003g3-4q for mharc-grub-devel@gnu.org; Sun, 27 Sep 2009 14:05:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mry7W-0003fx-1y for grub-devel@gnu.org; Sun, 27 Sep 2009 14:05:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mry7U-0003eY-VK for grub-devel@gnu.org; Sun, 27 Sep 2009 14:05:13 -0400 Received: from [199.232.76.173] (port=60181 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mry7U-0003eP-R9 for grub-devel@gnu.org; Sun, 27 Sep 2009 14:05:12 -0400 Received: from relay.hkfree.org ([89.248.240.5]:43318 helo=mail.hades.hkfree.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mry7U-0002hA-5M for grub-devel@gnu.org; Sun, 27 Sep 2009 14:05:12 -0400 Received: from jezz-ipv6.hivenew.hkfree.org (jezz-pc1.hive.hkfree.org [10.107.31.218]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.hades.hkfree.org (Postfix) with ESMTP id 236F0B63C4 for ; Sun, 27 Sep 2009 20:04:51 +0200 (CEST) Received: from jezberam by jezz-ipv6.hivenew.hkfree.org with local (Exim 4.69) (envelope-from ) id 1Mry79-0006Tn-T6 for grub-devel@gnu.org; Sun, 27 Sep 2009 20:04:51 +0200 Date: Sun, 27 Sep 2009 20:04:51 +0200 From: jezz@hkfree.org To: grub-devel@gnu.org Message-ID: <20090927180451.GA23688@titan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DKU6Jbt7q3WqK7+M" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Support for howmany option in grub2 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2009 18:05:14 -0000 --DKU6Jbt7q3WqK7+M Content-Type: multipart/mixed; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, I am using Debian GNU/Linux as my primary system. As a loader I am using GR= UB. Actually I have upgraded to GRUB2. I don't know, if it was feature of origi= nal (legacy) GRUB or it was functionality provided by debian scripts (update-gr= ub), for generating menu.lst. There was feature - howmany. This option specifies number of kernels, that user wants to have in boot menu. Script, that modif= ies menu.lst, use this variable. I like this feature, because I have usually mo= re kernels, but I want to see only last two versions in GRUB menu. I have crea= ted patch, that add support for this to /etc/grub.d/10_linux. I have created th= is 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=3D548600 Regards --=20 Jezz mail: jezz@hkfree.org jabber: jezz@njs.netlab.cz --Nq2Wo0NMKNjxTN9z Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="howmany.patch" Content-Transfer-Encoding: quoted-printable --- 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` =20 -while [ "x$list" !=3D "x" ] ; do +# Validate GRUB_HOW_MANY variable +case "$GRUB_HOW_MANY" in + [0-9]|[0-9][0-9]) + howmany=3D$GRUB_HOW_MANY + ;; + *) + howmany=3D99 + ;; +esac + +while [ "x$list" !=3D "x" -a $howmany -gt 0 ] ; do linux=3D`version_find_latest $list` echo "Found linux image: $linux" >&2 basename=3D`basename $linux` @@ -75,6 +85,7 @@ version=3D`echo $basename | sed -e "s,^[^0-9]*-,,g"` alt_version=3D`echo $version | sed -e "s,\.old$,,g"` linux_root_device_thisversion=3D"${LINUX_ROOT_DEVICE}" + howmany=3D$((howmany-1)) =20 initrd=3D for i in "initrd.img-${version}" "initrd-${version}.img" \ --Nq2Wo0NMKNjxTN9z-- --DKU6Jbt7q3WqK7+M Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkq/qUMACgkQqyAtJTO7yRJEugCgk2Cvlz1GFn8leG/7OXEfA0TZ AXgAnj0IJ7wTz0JyPUVCsDS1Ys8LzGm1 =M3fw -----END PGP SIGNATURE----- --DKU6Jbt7q3WqK7+M--