From 504e54024274afd74a1b3995f17182c4010fdaa8 Mon Sep 17 00:00:00 2001 From: okuji Date: Sat, 30 Sep 2000 01:35:21 +0000 Subject: [PATCH] fix a bug in grub-install, which affected only GNU/Hurd. --- ChangeLog | 7 +++++++ util/grub-install.in | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac230f425..050cdb8d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-09-30 OKUJI Yoshinori + + * util/grub-install.in (convert): The code for gnu* (i.e. + GNU/Hurd) was rewritten, since it didn't work for BSD + partitions. + Use "$tmp_disk *$" instead of "$tmp_disk" to get the drive name. + 2000-09-30 OKUJI Yoshinori * stage2/fsys_reiserfs.c (reiserfs_mount): Check if the length diff --git a/util/grub-install.in b/util/grub-install.in index cf782cb0d..8ed097a7a 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -76,7 +76,7 @@ convert () { tmp_disk=`echo "$1" | sed 's%\([sh]d[a-z]\)[0-9]*$%\1%'` tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; gnu*) - tmp_disk=`echo "$1" | sed 's%s[0-9]*[a-g]?%%'` + tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'` tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; *) echo "grub-install does not support your OS yet." 1>&2 @@ -84,7 +84,7 @@ convert () { esac # Get the drive name. - tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk" \ + 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. @@ -100,14 +100,17 @@ convert () { linux*) echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;; gnu*) - tmp_pc_slice=`echo "$tmp_part" | sed "s%s\([0-9]*\)[a-g]?%\1%"` - tmp_bsd_partition=`echo "$tmp_part" \ - | sed "s%s[0-9]*\([a-g]?\)%\1%"` - tmp_drive=`echo "$tmp_drive" \ - | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` - if test "x$tmp_bsd_partition" != x; then + 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%)%,\`sed y%abcdefg%0123456%\`)%"` + | 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" ;; esac