]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
bootstrap: Condense and simplify LINGUAS generation
authorGlenn Washburn <development@efficientek.com>
Thu, 20 Nov 2025 18:56:47 +0000 (12:56 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 21 Nov 2025 19:31:55 +0000 (20:31 +0100)
Remove unnecessary subshells. Loop over autogenerated po files only once.
Use existing LINGUAS created by bootstrap instead of finding po files
again.

Add wget as a soft requirement now that we are using bootstrap's code
for updating translation files. This should only be needed if updated
translations are desired, which is the default. There should be older
translation files already, and wget is not necessary if those will
suffice.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
INSTALL
bootstrap.conf

diff --git a/INSTALL b/INSTALL
index c9bb0b88864ecd4fcf0afef2d394cc39df2f11c8..2767fd450e6c1c02517e34bd1957102ce2d87a5e 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -25,6 +25,7 @@ configuring the GRUB.
 * Flex 2.5.35 or later
 * pkg-config
 * GNU patch
+* wget (for downloading updated translations)
 * Other standard GNU/Unix tools
 * a libc with large file support (e.g. glibc 2.1 or later)
 
index 79d4248c84aa536f36bac55282d28527b923e4ab..40e0b0cf47bb6b1e3b36cd251907142bd0680e7a 100644 (file)
@@ -113,17 +113,16 @@ bootstrap_epilogue () {
     # languages.
     autogenerated="en@quot en@hebrew de@hebrew en@cyrillic en@greek en@arabic en@piglatin de_CH"
 
-    for x in $autogenerated; do
-      rm -f "po/$x.po";
-    done
-
-    (
-      (
-        cd po && ls *.po| cut -d. -f1
-        for x in $autogenerated; do
-            echo "$x";
-        done
-      ) | sort | uniq | xargs
-    ) >po/LINGUAS
+    {
+      # NOTE: xargs has no POSIX compliant way to avoid running the program
+      # given as an argument when there are no input lines. So ensure that
+      # basename is always run with at least one argument, the empty string,
+      # and ignore the first line of output.
+      ls po/*.po | xargs -L 100 basename -s .po -a "" | tail -n +2
+      for x in $autogenerated; do
+        rm -f "po/$x.po"
+        echo "$x"
+      done
+    } | sort | uniq | xargs >po/LINGUAS
   fi
 }