All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabian Greffrath <greffrath@leat.rub.de>
To: Robert Millan <rmh@aybabtu.com>
Cc: grub-devel@gnu.org, Otavio Salvador <otavio@debian.org>,
	461442@bugs.debian.org
Subject: Re: Bug#461442: please add support for os-prober to detect other OSes in update-grub
Date: Wed, 30 Jan 2008 11:48:32 +0100	[thread overview]
Message-ID: <47A05600.5050302@leat.rub.de> (raw)
In-Reply-To: <20080125132144.GA5142@thorin>

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

Robert Millan schrieb:
> You could try with qemu.
Update:
I tried with Knoppix on a computer that has Debian sid and Windows XP 
installed. The attached script did it's job well - of course except for 
the part when it has to convert Linux device names to GRUB drives (see 
#462218). Support for HURD is still outstanding, though.

Cheers,
Fabian

-- 
Dipl.-Phys. Fabian Greffrath

Ruhr-Universität Bochum
Lehrstuhl für Energieanlagen und Energieprozesstechnik (LEAT)
Universitätsstr. 150, IB 3/134
D-44780 Bochum

Telefon: +49 (0)234 / 32-26334
Fax:     +49 (0)234 / 32-14227
E-Mail:  greffrath@leat.ruhr-uni-bochum.de


[-- Attachment #2: 30_os-prober --]
[-- Type: text/plain, Size: 2014 bytes --]

#! /bin/sh -e

# update-grub helper script.
# <insert copyright and license blurb here>

convert_device_to_grub_drive () {
  # you know what's missing here...
  echo $1
}

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

    case "${BOOT}" in
      chain)
        CHAINROOT="`convert_device_to_grub_drive ${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="`convert_device_to_grub_drive ${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
  done
fi

      reply	other threads:[~2008-01-30 10:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-24 12:25 please add support for os-prober to detect other OSes in update-grub Fabian Greffrath
2008-01-24 15:47 ` Bug#461442: " Otavio Salvador
2008-01-25  9:39   ` Fabian Greffrath
2008-01-25 13:21     ` Robert Millan
2008-01-30 10:48       ` Fabian Greffrath [this message]

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=47A05600.5050302@leat.rub.de \
    --to=greffrath@leat.rub.de \
    --cc=461442@bugs.debian.org \
    --cc=grub-devel@gnu.org \
    --cc=otavio@debian.org \
    --cc=rmh@aybabtu.com \
    /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.