summaryrefslogtreecommitdiff
path: root/util/grubpo/grubpo.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-02-19 12:24:47 +0000
committerLeah Rowe <leah@libreboot.org>2026-02-19 12:24:47 +0000
commita2c571558997b1bd7c4a9a61a7769feacbfef486 (patch)
tree0bb517daec60d0338ccfd045441c520c4a39c1c7 /util/grubpo/grubpo.sh
parent5a8ad2d311d7f02826110bba5a3e88ca6273620a (diff)
util/grubpo: new util, for grub PO files
this is the program I recently wrote, that generated the submodule entries for the GRUB PO file fix this utility is for reference only. i'll probably do away with the fix at some point, replacing it with my own git-based submodule repository, containing the PO files. this would make things easier, and then that repository would contain the utility instead. i'm just putting this in lbmk for now, so that we have it somewhere. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/grubpo/grubpo.sh')
-rwxr-xr-xutil/grubpo/grubpo.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/util/grubpo/grubpo.sh b/util/grubpo/grubpo.sh
new file mode 100755
index 00000000..87abc735
--- /dev/null
+++ b/util/grubpo/grubpo.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: MIT
+
+# Copyright (c) 2026 Leah Rowe
+
+set -u -e
+
+urlmain="https://www.mirrorservice.org/sites/libreboot.org/release/misc/grub"
+urlbkup="https://mirror.math.princeton.edu/pub/libreboot/misc/grub"
+
+# script to grab GNU gettext po files from translationproject.org -
+# i noticed that the grub bootstrap script grabs these at build time,
+# without actually checking signatures, and they could change on the
+# server upstream at any time
+
+# this means that the GRUB build process is currently non-deterministic,
+# which is a violation of libreboot policy.
+
+tmpdir="`mktemp -d`"
+tmpmod="`mktemp -d`"
+
+mkdir -p "$tmpdir" "$tmpmod" || exit 1
+
+(
+cd "$tmpdir" || exit 1
+wget --mirror --level=1 -nd -nv -A.po -P 'po/.reference' \
+ https://translationproject.org/latest/grub/ || \
+ exit 1
+find -type f > "$tmpmod/tmplist" || exit 1
+while read -r f; do
+ printf "%s\n" "${f#./}" >> "$tmpmod/module.list"
+
+ # now make the actual config files, but don't use
+ # the main upstream, because those files can change
+ # at any time. we will, over time, manually update
+ # our mirrors
+
+ pkgname="${f##*/}"
+ [ -z "$pkgname" ] && printf "ERR\n" && exit 1
+
+ pkgsum="`sha512sum "$f" | awk '{print $1}'`"
+
+ mkdir -p "$tmpmod/$pkgname" || exit 1
+
+ printf "# SPDX-License-Identifier: GPL-3.0-or-later\n\n" >> \
+ "$tmpmod/$pkgname/module.cfg" || exit 1
+
+ printf "subcurl=\"%s/%s\"\n" "$urlmain" "$pkgname" >> \
+ "$tmpmod/$pkgname/module.cfg" || exit 1
+ printf "subcurl_bkup=\"%s/%s\"\n" "$urlbkup" "$pkgname" >> \
+ "$tmpmod/$pkgname/module.cfg" || exit 1
+ printf "subhash=\"%s\"\n" "$pkgsum" >> "$tmpmod/$pkgname/module.cfg"
+
+done < "$tmpmod/tmplist" || exit 1; :
+mv "$tmpmod/tmplist" "$tmpdir" || exit 1
+)
+
+printf "tmpdir for modules: '%s'\n" "$tmpmod"
+
+rm -f "module.list" || exit 1
+
+printf "Check directory for lbmk files: '%s'\n" "$tmpmod"
+printf "This directory has the PO files: '%s'\n" "$tmpdir"
+
+exit 0
+
+