From c2ff2d43607322aa0b81b29ab14ac9b8634ec887 Mon Sep 17 00:00:00 2001 From: fkDead Date: Thu, 26 Nov 2026 18:18:26 +0100 Subject: [PATCH] perf(build): leave out unused firmware and check every translation in build-offi.sh --- build-offi.sh | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/build-offi.sh b/build-offi.sh index ab355d7..6d6086a 100755 --- a/build-offi.sh +++ b/build-offi.sh @@ -243,9 +243,9 @@ echo "==> Dossier de travail : $WORK_DIR" # A broken translations file only shows once the ISO boots: check it now, # before anything long. A bare Arch container may lack python3: skip then. if command -v python3 >/dev/null 2>&1; then - echo "==> Vérification des traductions de l'installateur..." - python3 -I "$WORK_DIR/scripts/check-installer-translations.py" \ - || { echo -e "\e[31m[ERR] Traductions de l'installateur invalides (détail ci-dessus).\e[0m" >&2; exit 1; } + echo "==> Vérification des traductions FWS..." + python3 -I "$WORK_DIR/scripts/check-translations.py" \ + || { echo -e "\e[31m[ERR] Traductions FWS invalides (détail ci-dessus).\e[0m" >&2; exit 1; } else echo "==> python3 absent : vérification des traductions sautée." fi @@ -385,6 +385,36 @@ if [ -n "$MISSING" ]; then fi echo "==> Pré-vol OK : ${#PROFILE_PKGS[@]} paquets résolus." +# ============================================================ +# Firmware versions the ISO's kernel never loads +# +# iwlwifi (Intel Wi-Fi) and nouveau (NVIDIA GSP) ship several versions of +# the same firmware and load only one: the older ones stay out of the image +# (~90 MiB, scripts/firmware-noextract.py explains the rule). The packages +# land in the host cache, which mkarchiso's pacstrap reuses: nothing is +# downloaded twice. Any failure only costs the saving, never the build. +# ============================================================ +echo "==> Firmwares que le noyau ne charge jamais..." +_FW_CONF=/tmp/fws-build/releng/pacman.conf +_FW_NAMES="linux linux-firmware-intel linux-firmware-nvidia" +_FW_CACHE="$(pacman-conf CacheDir 2>/dev/null | head -1)" +# shellcheck disable=SC2086 +if command -v python3 >/dev/null 2>&1 && [ -n "$_FW_CACHE" ] \ + && pacman -Sw --noconfirm $_FW_NAMES >/dev/null \ + && _FW_FILES="$(pacman -Sp --print-format '%f' $_FW_NAMES)" \ + && (cd "$_FW_CACHE" && python3 -I "$WORK_DIR/scripts/firmware-noextract.py" $_FW_FILES) > "$_FW_CONF.noextract" \ + && [ -s "$_FW_CONF.noextract" ]; then + # Right after the first NoExtract line, so inside [options]. + awk -v list="$_FW_CONF.noextract" \ + '{ print } /^NoExtract/ && !done { while ((getline l < list) > 0) print l; done = 1 }' \ + "$_FW_CONF" > "$_FW_CONF.new" && mv -f "$_FW_CONF.new" "$_FW_CONF" + echo " $(grep -o 'usr/' "$_FW_CONF.noextract" | wc -l) fichiers de firmware exclus de l'image" + rm -f "$_FW_CONF.noextract" +else + rm -f "$_FW_CONF.noextract" + echo -e "\e[33m[!] Calcul des firmwares inutiles impossible : l'ISO les garde (≈ 90 Mio de plus).\e[0m" >&2 +fi + echo "==> Lancement de mkarchiso..." mkdir -p "$OUT_DIR" # mkarchiso fait un « rm » interne de l'ISO cible avant de la (ré)écrire ; si