From a2c571558997b1bd7c4a9a61a7769feacbfef486 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 19 Feb 2026 12:24:47 +0000 Subject: 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 --- util/grubpo/grubpo.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 util/grubpo/grubpo.sh (limited to 'util/grubpo') 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 + + -- cgit v1.2.1