All of lore.kernel.org
 help / color / mirror / Atom feed
* grub-install for FreeBSD
@ 2009-09-23  2:01 Andrey Shuvikov
  2009-09-23  2:18 ` Seth Goldberg
  2009-09-23  6:36 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 10+ messages in thread
From: Andrey Shuvikov @ 2009-09-23  2:01 UTC (permalink / raw)
  To: grub-devel

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

Hello,

I tried to install Grub2 under FreeBSD but grub-install failed because readlink doesn't understand -f and stat doesn't have -c. I edited grub-mkconfig_lib.in to use different commands instead. I'm not sure it's the right way to handle this difference but it worked. The patch is attached.

Regards,
Andrey


      

[-- Attachment #2: freebsd.patch --]
[-- Type: application/octet-stream, Size: 1185 bytes --]

Index: util/grub-mkconfig_lib.in
===================================================================
--- util/grub-mkconfig_lib.in	(revision 2607)
+++ util/grub-mkconfig_lib.in	(working copy)
@@ -25,6 +25,17 @@
 
 grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
 
+case "`uname 2>/dev/null`" in
+  FreeBSD*)
+    grub_readlink=realpath
+    grub_getdevice="stat -f %d"
+    ;;
+  *)
+    grub_readlink="readlink -f"
+    grub_getdevice="stat -c %d"
+    ;;
+esac
+
 grub_warn ()
 {
   echo "Warning: $@" >&2
@@ -39,7 +50,7 @@
   fi
 
   # canonicalize
-  if path=`readlink -f $path` ; then : ; else
+  if path=`$grub_readlink $path` ; then : ; else
     return 1
   fi
 
@@ -50,12 +61,12 @@
     dir=`echo $path | sed -e "s,/[^/]*$,,g"`
   fi
 
-  num=`stat -c %d $dir`
+  num=`$grub_getdevice $dir`
 
   # this loop sets $dir to the root directory of the filesystem we're inspecting
   while : ; do
-    parent=`readlink -f $dir/..`
-    if [ "x`stat -c %d $parent`" = "x$num" ] ; then : ; else
+    parent=`$grub_readlink $dir/..`
+    if [ "x`$grub_getdevice $parent`" = "x$num" ] ; then : ; else
       # $parent is another filesystem; we found it.
       break
     fi

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-09-25  1:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-23  2:01 grub-install for FreeBSD Andrey Shuvikov
2009-09-23  2:18 ` Seth Goldberg
2009-09-23  6:36 ` Vladimir 'phcoder' Serbinenko
2009-09-24 12:09   ` Robert Millan
2009-09-24 18:01     ` Brian R. Jones
2009-09-24 18:12       ` Felix Zielcke
2009-09-24 18:53       ` Colin Watson
2009-09-24 19:30         ` Brian R. Jones
2009-09-24 20:18       ` Robert Millan
2009-09-25  1:18         ` Brian R. Jones

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.