From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JOV3R-0006Yt-SU for mharc-grub-devel@gnu.org; Mon, 11 Feb 2008 04:34:26 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JOV3P-0006Xz-5T for grub-devel@gnu.org; Mon, 11 Feb 2008 04:34:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOV3N-0006XF-Pq for grub-devel@gnu.org; Mon, 11 Feb 2008 04:34:22 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOV3N-0006Wt-HF for grub-devel@gnu.org; Mon, 11 Feb 2008 04:34:21 -0500 Received: from mx2.rz.ruhr-uni-bochum.de ([134.147.64.30]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JOV3N-0008Ny-0Z for grub-devel@gnu.org; Mon, 11 Feb 2008 04:34:21 -0500 X-Queued: (qmail 16266 invoked by uid 281); 11 Feb 2008 09:34:19 -0000 X-Qmailscanner: from 134.147.252.214 by mx2.rz.ruhr-uni-bochum.de (envelope-from , uid 80) with qmail-scanner-2.01 (sophie: 3.05/2.52/4.24. Clear:RC:1(134.147.252.214):. Processed in 0.125888 secs); 11 Feb 2008 09:34:19 -0000 Received: from router.leat.ruhr-uni-bochum.de (134.147.252.214) by mx2.rz.ruhr-uni-bochum.de with SMTP; 11 Feb 2008 09:34:18 -0000 Received: from [134.147.55.45] (frodo.leat.ruhr-uni-bochum.de [134.147.55.45]) by router.leat.ruhr-uni-bochum.de (8.12.2/8.12.2/SuSE Linux 0.6) with ESMTP id m1B9dJ1l010048 for ; Mon, 11 Feb 2008 10:39:19 +0100 Message-ID: <47B016B0.4030309@leat.rub.de> Date: Mon, 11 Feb 2008 10:34:40 +0100 From: Fabian Greffrath User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="------------010808000308090006060205" X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Subject: Re: [PATCH] Use os-prober to detect other OSes during update-grub 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: Mon, 11 Feb 2008 09:34:23 -0000 This is a multi-part message in MIME format. --------------010808000308090006060205 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit I should not forget to say that this script *depends* on the patch I sent in for grub-probe in my previous mail. --------------010808000308090006060205 Content-Type: text/plain; name="30_os-prober" Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="30_os-prober" #! /bin/sh -e # update-grub helper script. # Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. # # GRUB is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GRUB is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GRUB. If not, see . if [ -x "`which os-prober 2>/dev/null`" ] ; then OSPROBED="`os-prober | tr ' ' '|' | paste -s -d ' '`" fi if [ -n "${OSPROBED}" ] ; then for OS in ${OSPROBED} ; do DEVICE="`echo ${OS} | cut -d ':' -f 1`" LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '|' ' '`" LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '|' ' '`" BOOT="`echo ${OS} | cut -d ':' -f 4`" if [ -z "${LONGNAME}" ] ; then LONGNAME="${LABEL}" fi echo "Found ${LONGNAME} on ${DEVICE}" >&2 TESTDEVICE="`grub-probe --target=device $0`" if [ -n "`grub-probe --target=drive --device ${TESTDEVICE} 2>/dev/null`" ] ; then case "${BOOT}" in chain) CHAINROOT="`grub-probe --target=drive --device ${DEVICE}`" cat << EOF menuentry "${LONGNAME} (on ${DEVICE})" { set root=${CHAINROOT} chainloader +1 } EOF ;; linux) if [ -x "`which linux-boot-prober 2>/dev/null`" ] ; then LINUXPROBED="`linux-boot-prober ${DEVICE} | tr ' ' '|' | paste -s -d ' '`" fi if [ -n "${LINUXPROBED}" ] ; then for LINUX in ${LINUXPROBED} ; do LROOT="`echo ${LINUX} | cut -d ':' -f 1`" LBOOT="`echo ${LINUX} | cut -d ':' -f 2`" LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '|' ' '`" LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`" LINITRD="`echo ${LINUX} | cut -d ':' -f 5`" LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '|' ' '`" LINUXROOT="`grub-probe --target=drive --device ${LBOOT}`" if [ -z "${LLABEL}" ] ; then LLABEL="${LONGNAME}" fi cat << EOF menuentry "${LLABEL} (on ${DEVICE})" { set root=${LINUXROOT} linux ${LKERNEL} ${LPARAMS} EOF if [ -n "${LINITRD}" ] ; then cat << EOF initrd ${LINITRD} EOF fi cat << EOF } EOF done fi ;; hurd) # not yet... ;; *) ;; esac fi done fi --------------010808000308090006060205--