From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1QffJR-0005g4-8W for mharc-grub-devel@gnu.org; Sat, 09 Jul 2011 17:43:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QffJN-0005fm-2P for grub-devel@gnu.org; Sat, 09 Jul 2011 17:43:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QffJM-00078N-0I for grub-devel@gnu.org; Sat, 09 Jul 2011 17:43:41 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:35006) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QffJL-000785-Jk for grub-devel@gnu.org; Sat, 09 Jul 2011 17:43:39 -0400 Received: (qmail invoked by alias); 09 Jul 2011 21:43:36 -0000 Received: from p54953131.dip.t-dialin.net (EHLO [192.168.1.23]) [84.149.49.49] by mail.gmx.net (mp026) with SMTP; 09 Jul 2011 23:43:36 +0200 X-Authenticated: #1002206 X-Provags-ID: V01U2FsdGVkX19rHSocB+9rdU9BAmAVuywphm3NkYLh7sVvb8ta3m KyNXIfCTvm9qep Message-ID: <4E18CB86.8040806@gmx.de> Date: Sat, 09 Jul 2011 23:43:34 +0200 From: Axel Kellermann User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: [PATCH] Skip partitions during OS probing X-Enigmail-Version: 1.1.2 Content-Type: multipart/mixed; boundary="------------050508030206070201050707" X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.22 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2011 21:43:42 -0000 This is a multi-part message in MIME format. --------------050508030206070201050707 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello devels, I attached a patch I use on my machine to skip certain predefined partitions during OS probing by grub-mkconfig/30_os-prober. I started to work on this as grub2 adds the Win7 system partition of my dual-booted laptop to the boot menu, although only Win7s boot partition is actually needed. Not a big error, but it bugged me... ;) But apart from this special case on my machine, I think it is handy to have a standardized way to exclude certain partitions from being auto-probed during execution of update-grub. The patch updates two files. grub-mkconfig.in now exports an additional user variable called GRUB_SKIP_PARTITIONS, 30_os-prober.in adds a few lines to check whether the currently probed partition is contained in GRUB_SKIP_PARTITIONS, and if so, skips addition of the boot menu entry. To skip one ore more partitions during OS probing, the user has to add the variable GRUB_SKIP_PARTITIONS to the grub config file (/etc/default/grub) and provide it with a space delimited list of partition names (e.g. GRUB_SKIP_PARTITIONS="sda2 sdb3"). I created the patch with the command 'bzr patch -p1'. If that is not the correct way, please let me know. I'm also open for suggestions on improving the patch. Please let me know what you think, thanks for the good work, Axel --------------050508030206070201050707 Content-Type: text/x-diff; name="skip_partitions.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="skip_partitions.patch" === modified file 'util/grub-mkconfig.in' --- old/util/grub-mkconfig.in 2011-07-07 21:52:58 +0000 +++ new/util/grub-mkconfig.in 2011-07-09 21:08:25 +0000 @@ -257,7 +257,8 @@ GRUB_INIT_TUNE \ GRUB_SAVEDEFAULT \ GRUB_ENABLE_CRYPTODISK \ - GRUB_BADRAM + GRUB_BADRAM \ + GRUB_SKIP_PARTITIONS if test "x${grub_cfg}" != "x"; then rm -f ${grub_cfg}.new === modified file 'util/grub.d/30_os-prober.in' --- old/util/grub.d/30_os-prober.in 2011-07-02 19:22:19 +0000 +++ new/util/grub.d/30_os-prober.in 2011-07-09 21:06:32 +0000 @@ -94,6 +94,12 @@ LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`" LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`" BOOT="`echo ${OS} | cut -d ':' -f 4`" + PARTITION="`echo ${DEVICE} | grep -o '[^\/]\+$'`" + + if [ "x${GRUB_SKIP_PARTITIONS}" != "x" -a "x`echo ${GRUB_SKIP_PARTITIONS} | grep -e '\b'${PARTITION}'\b'`" != "x" ] ; then + echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 + continue + fi if [ -z "${LONGNAME}" ] ; then LONGNAME="${LABEL}" --------------050508030206070201050707--