All of lore.kernel.org
 help / color / mirror / Atom feed
* Config file generation failure on Linux
@ 2009-12-30 15:01 Grégoire Sutre
  2010-01-01 12:03 ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Grégoire Sutre @ 2009-12-30 15:01 UTC (permalink / raw)
  To: The development of GNU GRUB

Hi,

Config file generation with grub-mkconfig fails on Linux when grub is 
not installed in the same prefix as gettext, since the script 
util/grub.d/10_linux.in contains:

. ${bindir}/gettext.sh

A possible patch is given below, but there are surely other ways to deal 
with it.  The patch simply falls back to echo instead of gettext if the 
gettext binary cannot be found.

Thanks for your time,

Grégoire

--- util/grub.d/10_linux.in.orig	2009-12-30 15:37:01.000000000 +0100
+++ util/grub.d/10_linux.in
@@ -22,7 +22,12 @@ bindir=@bindir@
  libdir=@libdir@
  . ${libdir}/grub/grub-mkconfig_lib

-. ${bindir}/gettext.sh
+if $(which gettext >/dev/null 2>/dev/null) ; then
+  gettext="gettext"
+else
+  gettext="echo"
+fi
+
  export TEXTDOMAIN=@PACKAGE@
  export TEXTDOMAINDIR=@localedir@

@@ -54,9 +59,9 @@ linux_entry ()
    recovery="$3"
    args="$4"
    if ${recovery} ; then
-    title="$(gettext "%s, with Linux %s (recovery mode)")"
+    title="$(${gettext} "%s, with Linux %s (recovery mode)")"
    else
-    title="$(gettext "%s, with Linux %s")"
+    title="$(${gettext} "%s, with Linux %s")"
    fi
    printf "menuentry \"${title}\" {\n" "${os}" "${version}"
    if [ -z "${prepare_boot_cache}" ]; then



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

* Re: Config file generation failure on Linux
  2009-12-30 15:01 Config file generation failure on Linux Grégoire Sutre
@ 2010-01-01 12:03 ` Robert Millan
  2010-01-02 14:05   ` Config file generation failure on Linux (gettext.sh) Grégoire Sutre
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2010-01-01 12:03 UTC (permalink / raw)
  To: The development of GNU GRUB

On Wed, Dec 30, 2009 at 04:01:01PM +0100, Grégoire Sutre wrote:
> Hi,
>
> Config file generation with grub-mkconfig fails on Linux when grub is  
> not installed in the same prefix as gettext, since the script  
> util/grub.d/10_linux.in contains:
>
> . ${bindir}/gettext.sh
>
> A possible patch is given below, but there are surely other ways to deal  
> with it.  The patch simply falls back to echo instead of gettext if the  
> gettext binary cannot be found.

It'd be better if this was an autoconf check.

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



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

* Re: Config file generation failure on Linux (gettext.sh)
  2010-01-01 12:03 ` Robert Millan
@ 2010-01-02 14:05   ` Grégoire Sutre
  2010-01-03 16:50     ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Grégoire Sutre @ 2010-01-02 14:05 UTC (permalink / raw)
  To: The development of GNU GRUB

Robert Millan wrote:

>> A possible patch is given below, but there are surely other ways to deal  
>> with it.  The patch simply falls back to echo instead of gettext if the  
>> gettext binary cannot be found.
> 
> It'd be better if this was an autoconf check.

You mean with an AC_PATH_PROG(GETTEXTBIN, gettext, echo) and substitute 
GETTEXTBIN in 10_linux?

But, in order to have a robust configuration script, it would still be 
desirable to check in 10_linux whether @GETTEXTBIN@ exists and revert to 
echo otherwise, wouldn't it?

Grégoire



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

* Re: Config file generation failure on Linux (gettext.sh)
  2010-01-02 14:05   ` Config file generation failure on Linux (gettext.sh) Grégoire Sutre
@ 2010-01-03 16:50     ` Robert Millan
  2010-01-03 16:55       ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2010-01-03 16:50 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sat, Jan 02, 2010 at 03:05:53PM +0100, Grégoire Sutre wrote:
> You mean with an AC_PATH_PROG(GETTEXTBIN, gettext, echo) and substitute  
> GETTEXTBIN in 10_linux?

Yes.

> But, in order to have a robust configuration script, it would still be  
> desirable to check in 10_linux whether @GETTEXTBIN@ exists and revert to  
> echo otherwise, wouldn't it?

As long as the script complains appropiately and exits non-zero if gettext
was installed, I would consider it robust (keep in mind grub.cfg isn't
touched at all unless all sub-scripts exit succesfuly).

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



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

* Re: Config file generation failure on Linux (gettext.sh)
  2010-01-03 16:50     ` Robert Millan
@ 2010-01-03 16:55       ` Robert Millan
  2010-01-03 23:16         ` Grégoire Sutre
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2010-01-03 16:55 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sun, Jan 03, 2010 at 05:50:08PM +0100, Robert Millan wrote:
> As long as the script complains appropiately and exits non-zero if gettext
> was installed, I would consider it robust (keep in mind grub.cfg isn't
    ^^^

I meant "wasn't" of course.

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



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

* Re: Config file generation failure on Linux (gettext.sh)
  2010-01-03 16:55       ` Robert Millan
@ 2010-01-03 23:16         ` Grégoire Sutre
  0 siblings, 0 replies; 6+ messages in thread
From: Grégoire Sutre @ 2010-01-03 23:16 UTC (permalink / raw)
  To: The development of GNU GRUB

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

Robert Millan wrote:
> On Sun, Jan 03, 2010 at 05:50:08PM +0100, Robert Millan wrote:
>> As long as the script complains appropiately and exits non-zero if gettext
>> was installed, I would consider it robust (keep in mind grub.cfg isn't
>     ^^^
> 
> I meant "wasn't" of course.

Ok, here is the new patch.  This one also takes care of 10_kfreebsd, as 
it uses gettext in the same way as 10_linux.  Please let me know if I 
missed something.

Thanks,

Grégoire

[-- Attachment #2: patch-10_linux-gettext --]
[-- Type: text/plain, Size: 2098 bytes --]

--- configure.ac.orig	2010-01-03 23:34:44.000000000 +0100
+++ configure.ac
@@ -179,6 +179,7 @@ test "x$GCC" = xyes || AC_MSG_ERROR([GCC
 
 AC_GNU_SOURCE
 AM_GNU_GETTEXT([external])
+AC_PATH_PROG([GETTEXTBIN], [gettext], [echo])
 AC_SYS_LARGEFILE
 
 # Identify characteristics of the host architecture.
--- util/grub.d/10_kfreebsd.in.orig	2010-01-02 14:42:38.000000000 +0100
+++ util/grub.d/10_kfreebsd.in
@@ -20,9 +20,14 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 bindir=@bindir@
 libdir=@libdir@
+gettext=@GETTEXTBIN@
 . ${libdir}/grub/grub-mkconfig_lib
 
-. ${bindir}/gettext.sh
+if [ "x${gettext}" != "xecho" ] && ! test -x "${gettext}" ; then
+  echo "10_kfreebsd: error: \`${gettext}' is missing." >&2
+  exit 1
+fi
+
 export TEXTDOMAIN=@PACKAGE@
 export TEXTDOMAINDIR=@localedir@
 
@@ -37,7 +42,7 @@ kfreebsd_entry ()
   version="$2"
   recovery="$3"	# not used yet
   args="$4"	# not used yet
-  title="$(gettext "%s, with kFreeBSD %s")"
+  title="$(${gettext} "%s, with kFreeBSD %s")"
   printf "menuentry \"${title}\" {\n" "${os}" "${version}"
   if [ -z "${prepare_boot_cache}" ]; then
     prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
--- util/grub.d/10_linux.in.orig	2010-01-02 14:42:38.000000000 +0100
+++ util/grub.d/10_linux.in
@@ -20,9 +20,14 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 bindir=@bindir@
 libdir=@libdir@
+gettext=@GETTEXTBIN@
 . ${libdir}/grub/grub-mkconfig_lib
 
-. ${bindir}/gettext.sh
+if [ "x${gettext}" != "xecho" ] && ! test -x "${gettext}" ; then
+  echo "10_linux: error: \`${gettext}' is missing." >&2
+  exit 1
+fi
+
 export TEXTDOMAIN=@PACKAGE@
 export TEXTDOMAINDIR=@localedir@
 
@@ -54,9 +59,9 @@ linux_entry ()
   recovery="$3"
   args="$4"
   if ${recovery} ; then
-    title="$(gettext "%s, with Linux %s (recovery mode)")"
+    title="$(${gettext} "%s, with Linux %s (recovery mode)")"
   else
-    title="$(gettext "%s, with Linux %s")"
+    title="$(${gettext} "%s, with Linux %s")"
   fi
   printf "menuentry \"${title}\" {\n" "${os}" "${version}"
   if [ -z "${prepare_boot_cache}" ]; then

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

end of thread, other threads:[~2010-01-03 23:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-30 15:01 Config file generation failure on Linux Grégoire Sutre
2010-01-01 12:03 ` Robert Millan
2010-01-02 14:05   ` Config file generation failure on Linux (gettext.sh) Grégoire Sutre
2010-01-03 16:50     ` Robert Millan
2010-01-03 16:55       ` Robert Millan
2010-01-03 23:16         ` Grégoire Sutre

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.