Files
FWS-ISO/configs/baseline/airootfs/root/customize_airootfs.sh
T
nocode 4db22a5974 build(iso): apply the Anaconda and static translations in the image
A failure stops the build, since the login screen would show keys.
2026-11-26 18:18:25 +01:00

63 lines
3.5 KiB
Bash

#!/usr/bin/env bash
# ============================================================================
# FWS — script de customisation de l'airootfs.
# Exécuté par mkarchiso DANS le chroot airootfs, APRÈS le pacstrap
# (cf. fws/mkarchiso _make_customize_airootfs), puis supprimé : il n'apparaît
# donc PAS dans l'ISO finale. C'est le seul endroit fiable pour lancer des
# commandes dans l'image (les hooks pacman ne tournent pas sous pacstrap).
# ============================================================================
set -euo pipefail
# Génère les locales déclarées dans /etc/locale.gen. en_US.UTF-8 est REQUIS par
# Anaconda (ses modules DBus font setlocale(LC_ALL, "en_US.UTF-8") au démarrage,
# sinon « locale.Error: unsupported locale setting » → le module Boss plante).
# ~3 Mo générés, vs 222 Mo pour le paquet glibc-locales complet.
#
# The installer must also be able to switch to ANY of Anaconda's languages: a
# locale that is not generated makes Anaconda fall back to English on every
# screen (pyanaconda/localization.py, setup_locale). So the live gets every
# UTF-8 locale of glibc (~190 MiB in the image, ~10 MiB once compressed), while
# /etc/locale.gen keeps its short list: the installed system is a copy of the
# live, and its %post runs locale-gen from that file, which rebuilds the
# archive with the chosen language only.
cp /etc/locale.gen /etc/locale.gen.fws
grep -E '[[:space:]]UTF-8$' /usr/share/i18n/SUPPORTED > /etc/locale.gen
locale-gen
mv -f /etc/locale.gen.fws /etc/locale.gen
# --- Overlays pyanaconda (écran de progression FWS, journal en direct) ---------------------------
# mkarchiso copie l'airootfs AVANT le pacstrap (cf. fws/mkarchiso :
# _make_custom_airootfs puis _make_packages) : un fichier de l'airootfs qui
# remplace un fichier du paquet « anaconda » fait échouer pacman (« exists in
# filesystem ») et donc tout le build. Ces deux fichiers vivent donc hors des
# chemins du paquet, et on les pose ICI, après l'installation : c'est le seul
# moment où écraser un fichier de paquet est légitime (et le script est
# supprimé après exécution, il ne part pas dans l'ISO).
if [ -d /usr/local/share/fws/anaconda-overlay/pyanaconda ]; then
cp -a /usr/local/share/fws/anaconda-overlay/. /usr/lib/python3.14/site-packages/
rm -rf /usr/local/share/fws/anaconda-overlay
# Le build doit s'arrêter net si l'overlay n'a pas atterri : sans lui, plus
# d'écran de progression détaillé (mais l'installateur fonctionne quand même).
for _f in modules/runtime/scripts/runtime.py modules/boss/installation.py \
ui/gui/spokes/installation_progress.py; do
if [ ! -f "/usr/lib/python3.14/site-packages/pyanaconda/${_f}" ]; then
echo "[FWS] overlay pyanaconda manquant : ${_f}" >&2
exit 1
fi
done
fi
# --- Anaconda's own texts missing from its catalogs ---------------------------
# Some languages get parts of Anaconda's screens in English (Bulgarian lacked
# most of the root account screen): anaconda-translations.toml fills those
# gaps, never overriding a translation Anaconda has. After the anaconda
# package is installed, which is now.
python3 /usr/local/lib/fws/merge-anaconda-translations.py
# --- FWS translations written into files that cannot look them up -------------
# Menu entries, the SDDM theme and the polkit policy are read by programs that
# know nothing of system-translations.toml: every language is written into them
# here. A failure stops the build, since the login screen would show keys.
python3 /usr/local/lib/fws/translate-static-files.py