Bug#473401: grub-installer: grub2 config for Windows partition does not boot
On Wed, Apr 30, 2008 at 11:38:56PM +0200, Robert Millan wrote:
>
> This patch gets rid of the problem [...]
argh. There was supposed to be a patch...
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
Index: grub-installer
===================================================================
--- grub-installer (revision 52970)
+++ grub-installer (working copy)
@@ -83,115 +83,7 @@
# Convert an OS device to the corresponding GRUB drive
# This part is OS-specific
convert () {
-## First, check if the device file exists
-# if test -e "$1"; then
-# :
-# else
-# echo "$1: Not found or not a block device." 1>&2
-# exit 1
-# fi
-
- host_os=$(uname -s | tr 'A-Z' 'a-z')
-
- # Break the device name into the disk part and the partition part
- case "$host_os" in
- linux*)
- tmp_disk=$(echo "$1" | sed -e 's%\(\(s\|h\|v\|xv\)d[a-z]\)[0-9]*$%\1%' \
- -e 's%\(fd[0-9]*\)$%\1%' \
- -e 's%/part[0-9]*$%/disc%' \
- -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
- -e 's%\(/mapper/mpath[0-9]\+\)-part[0-9]\+$%\1%')
- tmp_part=$(echo "$1" | sed -e 's%.*/\(s\|h\|v\|xv\)d[a-z]\([0-9]*\)$%\2%' \
- -e 's%.*/fd[0-9]*$%%' \
- -e 's%.*/floppy/[0-9]*$%%' \
- -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \
- -e 's%.*c[0-7]d[0-9]*p*%%' \
- -e 's%.*/mapper/mpath[0-9]\+-part\([0-9]\+\)%\1%')
- ;;
- gnu*)
- tmp_disk=$(echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%')
- tmp_part=$(echo "$1" | sed "s%$tmp_disk%%")
- ;;
- freebsd*)
- tmp_disk=$(echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' | \
- sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%')
- tmp_part=$(echo "$1" | \
- sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" | \
- sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%")
- ;;
- netbsd*)
- tmp_disk=$(echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%' | \
- sed 's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%')
- tmp_part=$(echo "$1" | \
- sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%")
- ;;
- *)
- echo "update-grub does not support your OS yet." 1>&2
- exit 1
- ;;
- esac
-
- # Get the drive name
- tmp_drive=$(grep -v '^#' $device_map | grep "$tmp_disk *$" | \
- sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%')
-
- # If not found, print an error message and exit
- if [ -z "$tmp_drive" ]; then
- echo "$1 does not have any corresponding BIOS drive." 1>&2
- exit 1
- fi
-
- if [ -n "$tmp_part" ]; then
- # If a partition is specified, we need to translate it into the
- # GRUB's syntax
- case "$host_os" in
- linux*)
- echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%"
- ;;
- gnu*)
- if echo $tmp_part | grep "^s" >/dev/null; then
- tmp_pc_slice=$(echo $tmp_part | \
- sed "s%s\([0-9]*\)[a-g]*$%\1%")
- tmp_drive=$(echo "$tmp_drive" | \
- sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%")
- fi
- if echo $tmp_part | grep "[a-g]$" >/dev/null; then
- tmp_bsd_partition=$(echo "$tmp_part" | \
- sed "s%[^a-g]*\([a-g]\)$%\1%")
- tmp_drive=$(echo "$tmp_drive" | \
- sed "s%)%,$tmp_bsd_partition)%")
- fi
- echo "$tmp_drive"
- ;;
- freebsd*)
- if echo $tmp_part | grep "^s" >/dev/null; then
- tmp_pc_slice=$(echo $tmp_part | \
- sed "s%s\([0-9]*\)[a-h]*$%\1%")
- tmp_drive=$(echo "$tmp_drive" | \
- sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%")
- fi
- if echo $tmp_part | grep "[a-h]$" >/dev/null; then
- tmp_bsd_partition=$(echo "$tmp_part" | \
- sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%")
- tmp_drive=$(echo "$tmp_drive" | \
- sed "s%)%,$tmp_bsd_partition)%")
- fi
- echo "$tmp_drive"
- ;;
- netbsd*)
- if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then
- tmp_bsd_partition=$(echo "$tmp_part" | \
- sed "s%\([a-p]\)$%\1%")
- tmp_drive=$(echo "$tmp_drive" | \
- sed "s%)%,$tmp_bsd_partition)%")
- fi
- echo "$tmp_drive"
- ;;
- esac
- else
- # If no partition is specified, just print the drive name
- echo "$tmp_drive"
- fi
+ $chroot $ROOT grub-probe --device-map=${device_map} -t drive -d "$1"
}
# Convert a linux non-devfs disk device name into the hurd's syntax
@@ -367,6 +259,7 @@
grub)
grub_version="grub"
menu_file="menu.lst"
+ export GRUB_LEGACY_0_BASED_PARTITIONS=1 # for grub-probe
;;
*)
grub_version="grub2"
Reply to: