On Sat, May 12, 2007 at 05:41:09PM +0100, Paul Martin wrote:
> In shell:
> 
> if [ $( stat -c %d /boot ) -eq $( stat -c %d / ) ]

Thanks for the tip.  Please, can someone with separate /boot and/or separate
/boot/grub try this patch and tell if it works?

-- 
Robert Millan

My spam trap is [EMAIL PROTECTED]  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.
diff -ur grub2-1.95+20070507.old/util/grub.d/00_header.in grub2-1.95+20070507/util/grub.d/00_header.in
--- grub2-1.95+20070507.old/util/grub.d/00_header.in	2007-05-04 09:11:44.000000000 +0200
+++ grub2-1.95+20070507/util/grub.d/00_header.in	2007-05-13 01:01:33.000000000 +0200
@@ -29,7 +29,8 @@
 
 if test -e /boot/grub/unifont.pff ; then
   cat << EOF
-font /boot/grub/unifont.pff
+
+font ${GRUB_DRIVE_BOOT_GRUB}/unifont.pff
 set gfxmode=640x480x32
 insmod gfxterm
 insmod vbe
diff -ur grub2-1.95+20070507.old/util/grub.d/10_hurd.in grub2-1.95+20070507/util/grub.d/10_hurd.in
--- grub2-1.95+20070507.old/util/grub.d/10_hurd.in	2007-05-04 09:11:44.000000000 +0200
+++ grub2-1.95+20070507/util/grub.d/10_hurd.in	2007-05-13 00:46:42.000000000 +0200
@@ -23,11 +23,19 @@
   OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
 fi
 
+at_least_one=false
+all_of_them=true
+
 # FIXME: add l4 here?
 kernel=
 for i in /boot/gnumach.gz /boot/gnumach ; do
   if test -e $i ; then
-    kernel=$i
+    basename=`basename $i`
+    dirname=`dirname $i`
+    grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"`
+    echo "Found GNU Mach: $i" >&2
+    kernel=${grub_dirname}/${basename}
+    at_least_one=true
   fi
 done
 
@@ -37,10 +45,8 @@
   *)	hurd_fs="${GRUB_FS}fs" ;;
 esac
 
-at_least_one=false
-all_of_them=true
-for i in "${kernel}" /hurd/${hurd_fs}.static /hurd/exec ; do
-  if test -e "$i" ; then
+for i in /hurd/${hurd_fs}.static /hurd/exec ; do
+  if test -e "$i" ; then 
     echo "Found Hurd module: $i" >&2
     at_least_one=true
   else
diff -ur grub2-1.95+20070507.old/util/grub.d/10_linux.in grub2-1.95+20070507/util/grub.d/10_linux.in
--- grub2-1.95+20070507.old/util/grub.d/10_linux.in	2007-05-12 23:59:18.000000000 +0200
+++ grub2-1.95+20070507/util/grub.d/10_linux.in	2007-05-13 00:53:31.000000000 +0200
@@ -28,17 +28,19 @@
   if test -e ${linux} ; then : ; else
     continue
   fi
-  echo "Found linux image:  $linux" >&2
-  version=`echo $linux | sed -e "s,.*/[^0-9]*-,,g"`
-  basedir=`echo $linux | sed -e "s,/[^/]*$,,g"`
+  echo "Found linux image: $linux" >&2
+  basename=`basename $linux`
+  dirname=`dirname $linux`
+  grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"`
+  version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
   cat << EOF
 menuentry "${OS}, linux ${version}" {
-	linux	${linux} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX}
+	linux	${grub_dirname}/${basename} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX}
 EOF
-  if test -e ${basedir}/initrd.img-${version} ; then
-    echo "Found initrd image: ${basedir}/initrd.img-${version}" >&2
+  if test -e ${dirname}/initrd.img-${version} ; then
+    echo "Found initrd image: ${dirname}/initrd.img-${version}" >&2
     cat << EOF
-	initrd	${basedir}/initrd.img-${version}
+	initrd	${grub_dirname}/initrd.img-${version}
 EOF
   fi
   cat << EOF
@@ -46,11 +48,11 @@
 EOF
   cat << EOF
 menuentry "${OS}, linux ${version} (single-user mode)" {
-	linux	${linux} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
+	linux	${grub_dirname}/${basename} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
 EOF
-  if test -e ${basedir}/initrd.img-${version} ; then
+  if test -e ${dirname}/initrd.img-${version} ; then
     cat << EOF
-	initrd	${basedir}/initrd.img-${version}
+	initrd	${grub_dirname}/initrd.img-${version}
 EOF
   fi
   cat << EOF
diff -ur grub2-1.95+20070507.old/util/update-grub.in grub2-1.95+20070507/util/update-grub.in
--- grub2-1.95+20070507.old/util/update-grub.in	2007-05-12 23:59:18.000000000 +0200
+++ grub2-1.95+20070507/util/update-grub.in	2007-05-13 01:01:58.000000000 +0200
@@ -80,9 +80,29 @@
 #
 EOF
 
-export GRUB_DEVICE="`grub-probe --target=device ${grub_prefix}`"
-export GRUB_DRIVE="`grub-probe --target=drive ${grub_prefix}`"
-export GRUB_FS="`grub-probe --target=fs ${grub_prefix}`"
+# Device containing our userland.  Typicaly used for root= parameter.
+export GRUB_DEVICE="`grub-probe --target=device /`"
+
+# Filesystem for the device containing our userland.  Used for stuff like
+# choosing Hurd filesystem module.
+export GRUB_FS="`grub-probe --target=fs /`"
+
+# GRUB path to /
+export GRUB_DRIVE="`grub-probe --target=drive /`"
+
+# GRUB path to /boot
+if [ "x`stat -c %d /`" = "x`stat -c %d /boot/`" ] ; then
+  export GRUB_DRIVE_BOOT="${GRUB_DRIVE}/boot"
+else
+  export GRUB_DRIVE_BOOT="`grub-probe --target=drive /boot`"
+fi
+
+# GRUB path to /boot/grub
+if [ "x`stat -c %d /boot`" = "x`stat -c %d /boot/grub`" ] ; then
+  export GRUB_DRIVE_BOOT_GRUB="${GRUB_DRIVE_BOOT}/grub"
+else
+  export GRUB_DRIVE_BOOT_GRUB="`grub-probe --target=drive /boot/grub`"
+fi
 
 for i in ${update_grub_dir}/* ; do
   case $i in

Reply via email to