$OpenBSD: patch-util_grub-install_in,v 1.1.1.1 2007/04/13 08:29:17 sturm Exp $
--- util/grub-install.in.orig	Sat Jul 24 20:57:31 2004
+++ util/grub-install.in	Wed Apr 11 00:06:12 2007
@@ -124,6 +124,12 @@ convert () {
 	tmp_part=`echo "$1" \
 	    | sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%"`
 	;;
+    openbsd*)
+	tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1c%' \
+	    | 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 "grub-install does not support your OS yet." 1>&2
 	exit 1 ;;
@@ -173,7 +179,7 @@ convert () {
 		    | sed "s%)%,$tmp_bsd_partition)%"`
 	    fi
 	    echo "$tmp_drive" ;;
-	netbsd* | knetbsd*-gnu)
+	netbsd* | knetbsd*-gnu | openbsd*)
 	    if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then
 		tmp_bsd_partition=`echo "$tmp_part" \
 		    | sed "s%\([a-p]\)$%\1%"`
@@ -321,7 +327,7 @@ fi
 # Stage 1.5 does not exist.
 
 # Create the GRUB directory if it is not present.
-test -d "$bootdir" || mkdir "$bootdir" || exit 1
+test -z "$bootdir" || test -d "$bootdir" || mkdir "$bootdir" || exit 1
 test -d "$grubdir" || mkdir "$grubdir" || exit 1
 
 # If --recheck is specified, remove the device map, if present.
