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

* Re: grub-install for FreeBSD
  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
  1 sibling, 0 replies; 10+ messages in thread
From: Seth Goldberg @ 2009-09-23  2:18 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,


Quoting Andrey Shuvikov, who wrote the following on Tue, 22 Sep 2009:

> 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
>

  Solaris has similar problems as well.  The configure script needs to do a 
better job with finding alternatives and substituting those alternatives in 
the script library.

  --S



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

* Re: grub-install for FreeBSD
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-09-23  6:36 UTC (permalink / raw)
  To: The development of GRUB 2

Andrey Shuvikov wrote:
> 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.
>
>   
We're aware of this problem. Felix Zielcke has a solution but at this
point it's deemed too intrusive. We'll probably commit it once feature
freeze is over
> Regards,
> Andrey
>
>
>       
> ------------------------------------------------------------------------
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>   




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

* Re: grub-install for FreeBSD
  2009-09-23  6:36 ` Vladimir 'phcoder' Serbinenko
@ 2009-09-24 12:09   ` Robert Millan
  2009-09-24 18:01     ` Brian R. Jones
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Millan @ 2009-09-24 12:09 UTC (permalink / raw)
  To: The development of GRUB 2

On Wed, Sep 23, 2009 at 08:36:01AM +0200, Vladimir 'phcoder' Serbinenko wrote:
> Andrey Shuvikov wrote:
> > 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.
> >
> >   
> We're aware of this problem. Felix Zielcke has a solution but at this
> point it's deemed too intrusive. We'll probably commit it once feature
> freeze is over

Alternatively, I could also allow a patch that checks the capabilities of
those commands.  It should try readlink first, and fallback to greadlink
if necessary.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



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

* Re: grub-install for FreeBSD
  2009-09-24 12:09   ` Robert Millan
@ 2009-09-24 18:01     ` Brian R. Jones
  2009-09-24 18:12       ` Felix Zielcke
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Brian R. Jones @ 2009-09-24 18:01 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Wed, Sep 23, 2009 at 08:36:01AM +0200, Vladimir 'phcoder' Serbinenko wrote:
>> Andrey Shuvikov wrote:
>>> 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.
>>>
>>>   
>> We're aware of this problem. Felix Zielcke has a solution but at this
>> point it's deemed too intrusive. We'll probably commit it once feature
>> freeze is over
> 
> Alternatively, I could also allow a patch that checks the capabilities of
> those commands.  It should try readlink first, and fallback to greadlink
> if necessary.
> 


Not sure if Felix's patch covers it, but there is also a problem with the 
'sed' syntax in 10_freebsd and 30_os-prober.  It turns out that freebsd 
'sed' is quite retarded (at least in 7.2) and doesn't know that '\t' is 
supposed to be tab.  Replacing 'sed' with 'gsed' or 'perl -p' fixes this issue.

Where would I go to view Felix's path?  I am concerned because freebsd also 
has a 'gstat' command that does not work either.  Only by installing the 
coreutils and pointing explicitly at the coreutils version of gstat did I 
get this to work.

-- 
--Brian



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

* Re: grub-install for FreeBSD
  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 20:18       ` Robert Millan
  2 siblings, 0 replies; 10+ messages in thread
From: Felix Zielcke @ 2009-09-24 18:12 UTC (permalink / raw)
  To: The development of GRUB 2

Am Donnerstag, den 24.09.2009, 11:01 -0700 schrieb Brian R. Jones:
> Robert Millan wrote:
> > On Wed, Sep 23, 2009 at 08:36:01AM +0200, Vladimir 'phcoder' Serbinenko wrote:
> >> Andrey Shuvikov wrote:
> >>> 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.
> >>>
> >>>   
> >> We're aware of this problem. Felix Zielcke has a solution but at this
> >> point it's deemed too intrusive. We'll probably commit it once feature
> >> freeze is over
> > 
> > Alternatively, I could also allow a patch that checks the capabilities of
> > those commands.  It should try readlink first, and fallback to greadlink
> > if necessary.
> > 
> 
> 
> Not sure if Felix's patch covers it, but there is also a problem with the 
> 'sed' syntax in 10_freebsd and 30_os-prober.  It turns out that freebsd 
> 'sed' is quite retarded (at least in 7.2) and doesn't know that '\t' is 
> supposed to be tab.  Replacing 'sed' with 'gsed' or 'perl -p' fixes this issue.

No it doestn't.
Autoconf has an AC_PROG_SED macro which checks for a POSIX sed.
http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Usual-Tools.html#sed
Portable sed regular expressions should use ‘\’ only to escape
characters in the string ‘$()*.0123456789[\^n{}’

If I understand that right, POSIX doestn't mandate \t so it wouldn't
help us.

> Where would I go to view Felix's path?  I am concerned because freebsd also 
> has a 'gstat' command that does not work either.  Only by installing the 
> coreutils and pointing explicitly at the coreutils version of gstat did I 
> get this to work.

http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00749.html


-- 
Felix Zielcke
Proud Debian Maintainer




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

* Re: grub-install for FreeBSD
  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
  2 siblings, 1 reply; 10+ messages in thread
From: Colin Watson @ 2009-09-24 18:53 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Sep 24, 2009 at 11:01:16AM -0700, Brian R. Jones wrote:
> Not sure if Felix's patch covers it, but there is also a problem with the 
> 'sed' syntax in 10_freebsd and 30_os-prober.  It turns out that freebsd  
> 'sed' is quite retarded (at least in 7.2) and doesn't know that '\t' is  
> supposed to be tab.  Replacing 'sed' with 'gsed' or 'perl -p' fixes this 
> issue.

Does putting a hard tab in the source file fix this? It's not pretty,
but we could do that.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



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

* Re: grub-install for FreeBSD
  2009-09-24 18:53       ` Colin Watson
@ 2009-09-24 19:30         ` Brian R. Jones
  0 siblings, 0 replies; 10+ messages in thread
From: Brian R. Jones @ 2009-09-24 19:30 UTC (permalink / raw)
  To: The development of GRUB 2

Colin Watson wrote:
> On Thu, Sep 24, 2009 at 11:01:16AM -0700, Brian R. Jones wrote:
>> Not sure if Felix's patch covers it, but there is also a problem with the 
>> 'sed' syntax in 10_freebsd and 30_os-prober.  It turns out that freebsd  
>> 'sed' is quite retarded (at least in 7.2) and doesn't know that '\t' is  
>> supposed to be tab.  Replacing 'sed' with 'gsed' or 'perl -p' fixes this 
>> issue.
> 
> Does putting a hard tab in the source file fix this? It's not pretty,
> but we could do that.
> 

Yeah, hard tab works. But you're right, it's ugly.

-- 
--Brian



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

* Re: grub-install for FreeBSD
  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 20:18       ` Robert Millan
  2009-09-25  1:18         ` Brian R. Jones
  2 siblings, 1 reply; 10+ messages in thread
From: Robert Millan @ 2009-09-24 20:18 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Sep 24, 2009 at 11:01:16AM -0700, Brian R. Jones wrote:
> Not sure if Felix's patch covers it, but there is also a problem with the 
> 'sed' syntax in 10_freebsd and 30_os-prober.  It turns out that freebsd  
> 'sed' is quite retarded (at least in 7.2) and doesn't know that '\t' is  
> supposed to be tab.  Replacing 'sed' with 'gsed' or 'perl -p' fixes this 
> issue.

Would you like to write a patch that makes autoconf check for a working
option?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



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

* Re: grub-install for FreeBSD
  2009-09-24 20:18       ` Robert Millan
@ 2009-09-25  1:18         ` Brian R. Jones
  0 siblings, 0 replies; 10+ messages in thread
From: Brian R. Jones @ 2009-09-25  1:18 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Thu, Sep 24, 2009 at 11:01:16AM -0700, Brian R. Jones wrote:
>> Not sure if Felix's patch covers it, but there is also a problem with the 
>> 'sed' syntax in 10_freebsd and 30_os-prober.  It turns out that freebsd  
>> 'sed' is quite retarded (at least in 7.2) and doesn't know that '\t' is  
>> supposed to be tab.  Replacing 'sed' with 'gsed' or 'perl -p' fixes this 
>> issue.
> 
> Would you like to write a patch that makes autoconf check for a working
> option?
> 

I could give it a shot, as long as you accept that I don't have the 
slightest clue as to what I'm doing.

-- 
--Brian



^ 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.