perf(build): leave out unused firmware and check every translation

About 90 MiB of firmware versions are never loaded by the ISO's kernel.
Any failure of that step only costs the saving, never the build.
This commit is contained in:
nocode committed 2026-11-26 18:18:26 +01:00
1 parent 768277b0ce
commit 0a2cbb8485
1 file changed
+33 -3
+33 -3
View File
@@ -202,9 +202,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
@@ -464,6 +464,36 @@ while IFS= read -r -d '' _f; do
echo " lien restauré : ${_f#"$_AIROOTFS"} -> $_target"
done < <(find "$_AIROOTFS" -type f -print0)
# ============================================================
# 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 "$WORK_DIR/out"
# mkarchiso fait un « rm » interne de l'ISO cible avant de la (ré)écrire ; si