On a blank UEFI disk the installed system only booted with the USB key
plugged in (HP OMEN MAX 16, see OMEN-demarrage-sans-cle-usb.md): Anaconda
had created /boot and the LVM PV but no EFI system partition.
The kickstart disables Anaconda's bootloader because Arch has no grub2-*
binaries and GRUB is installed by the %post. Anaconda then sets
skip_bootloader, and schedule_partitions() drops the "efi" request of the
automatic partitioning ("skipping unneeded stage1 efi request"). The
anaconda PKGBUILD now patches that condition so the ESP is still created
when no stage1 partition exists yet.
The first-boot log of that machine also showed fws-grub-finalize writing
GRUB to /dev/sda2, the Ventoy key's EFI partition, because it took the
first ESP of the system. The kickstart and fws-grub-finalize now look on
the disk carrying / first, then on internal disks only, and log a
CRITICAL line instead of borrowing a removable device's ESP.
250 lines
13 KiB
Bash
250 lines
13 KiB
Bash
# Maintainer: FWS
|
|
# ============================================================================
|
|
# anaconda — l'installateur Fedora (rhinstaller) PORTÉ sur Arch pour FWS.
|
|
# Build autotools : ./autogen.sh && ./configure && make && make install
|
|
# (le source compile aussi widgets/ via AC_CONFIG_SUBDIRS → on retire ces
|
|
# fichiers en package(), ils sont fournis par le paquet anaconda-widgets).
|
|
#
|
|
# ⚠️ SCAFFOLD À ITÉRER : ce PKGBUILD est un point de départ fidèle au spec
|
|
# amont, mais Anaconda est profondément couplé à Fedora. Il faudra très
|
|
# probablement itérer sur Arch RÉEL (via ./setup-aur.sh) pour :
|
|
# - des BuildRequires manquants au configure,
|
|
# - des chemins/macros Fedora (systemd-rpm-macros, find_lang…),
|
|
# - la compat Python 3.14 d'Arch (Anaconda vise le Python de Fedora).
|
|
#
|
|
# DÉVIATIONS FWS vs Requires du spec (justifiées) :
|
|
# - RETIRÉS car payload liveimg (jamais le payload DNF) : python3-libdnf5,
|
|
# python3-rpm. → cf. verdict « drop DNF » (libdnf5 importé seulement dans
|
|
# dnf_manager.py, chemin non pris avec liveimg).
|
|
# - RETIRÉ libselinux : Arch n'est pas SELinux (blivet/anaconda gèrent son
|
|
# absence). - RETIRÉS Fedora-only / N/A archiso : subscription-manager,
|
|
# s390utils-*, crypto-policies(-scripts), glibc-langpack-*, dracut-network,
|
|
# teamd/NetworkManager-team, flatpak(-libs). - grub2-common → grub (Arch).
|
|
# - RISQUE connu : python3-crypt-r (module `crypt` retiré de Python ≥ 3.13)
|
|
# n'a peut-être pas d'équivalent Arch → à packager si l'import casse.
|
|
# ============================================================================
|
|
pkgname=anaconda
|
|
pkgver=45.8
|
|
pkgrel=6
|
|
pkgdesc="The Anaconda installer (porté sur Arch pour FWS, payload liveimg)"
|
|
arch=('x86_64')
|
|
url="https://github.com/rhinstaller/anaconda"
|
|
license=('GPL-2.0-or-later')
|
|
depends=(
|
|
# — interface & widgets —
|
|
'anaconda-widgets' 'gtk3' 'python-gobject' 'gsettings-desktop-schemas'
|
|
'adwaita-icon-theme' 'librsvg' 'nm-connection-editor'
|
|
# — cœur Python Anaconda —
|
|
'python' 'python-meh' 'python-simpleline' 'pykickstart' 'python-dasbus'
|
|
'python-productmd' 'python-pid' 'python-langtable' 'python-iso639'
|
|
'python-requests' 'python-requests-file' 'python-requests-ftp'
|
|
# — stockage —
|
|
'python-blivet' 'libblockdev' 'python-pyparted' 'parted' 'util-linux'
|
|
'lvm2' 'cryptsetup' 'mdadm' 'dosfstools' 'e2fsprogs' 'xfsprogs' 'btrfs-progs'
|
|
# — rapport de crash (python-meh importe `report` en dur) —
|
|
'libreport'
|
|
# — système / réseau / boot —
|
|
'networkmanager' 'kbd' 'chrony' 'systemd' 'dbus' 'openssh' 'grub'
|
|
'libpwquality' 'python-systemd' 'python-xkbregistry' 'cracklib'
|
|
)
|
|
# NB : pas de 'glade' — module Glade désactivé au build (cf. build()).
|
|
makedepends=(
|
|
'autoconf' 'automake' 'libtool' 'gettext' 'intltool' 'gtk-doc'
|
|
'gobject-introspection' 'python' 'gdk-pixbuf2' 'libxml2'
|
|
'desktop-file-utils' 'glib2-devel' 'libarchive' 'rpm-tools'
|
|
)
|
|
# GCC 16 segfaults in lto1 while linking libAnacondaWidgets (internal compiler
|
|
# error in cl_optimization_restore). LTO buys nothing measurable here.
|
|
options=('!lto')
|
|
source=("anaconda-$pkgver.tar.gz::https://github.com/rhinstaller/anaconda/archive/refs/tags/anaconda-$pkgver.tar.gz")
|
|
sha256sums=('5ef1464bff7f28a4a09a821cbb0121f09ef504ec169288d742373f86807ec4ed')
|
|
_srcdir="anaconda-anaconda-$pkgver"
|
|
|
|
prepare() {
|
|
cd "$srcdir/$_srcdir"
|
|
# ── FWS : clavier par défaut selon le TERRITOIRE de la locale ──────────────
|
|
# set_layouts() amont fait « locale = get_language_id(self.language) » →
|
|
# get_language_id JETTE le territoire (fr_CH.UTF-8 → 'fr') → list_keyboards('fr')
|
|
# = 'fr(oss)' (France) au lieu de 'ch(fr)' (Suisse). On passe la LOCALE COMPLÈTE
|
|
# (self.language) : langtable.list_keyboards('fr_CH.UTF-8') = 'ch(fr)'. La
|
|
# validation l'accepte (is_valid_langcode → parse_locale().language non vide).
|
|
# → le clavier du GUI ET du système installé suivent enfin la locale choisie.
|
|
sed -i \
|
|
's/^\(\s*\)locale = get_language_id(self\.language)/\1locale = self.language # FWS: garder le territoire (fr_CH -> ch(fr))/' \
|
|
pyanaconda/modules/localization/localization.py
|
|
# Garde-fou : casse le build si le motif amont a changé (le patch silencieux).
|
|
grep -q 'locale = self.language # FWS' \
|
|
pyanaconda/modules/localization/localization.py
|
|
|
|
# ── FWS : champ « Nom de machine » dans le spoke Utilisateur ───────────────
|
|
# Anaconda ne propage PAS le hostname (le champ du spoke Réseau est perdu chez
|
|
# nous → /etc/hostname vide). Le nom de machine est désormais demandé PLUS TÔT,
|
|
# à l'écran « Réseau » (spoke fws_network.py de l'airootfs, qui écrit
|
|
# /tmp/fws-hostname). Le champ ci-dessous sert de RE-DEMANDE au moment de la
|
|
# création de compte : il est PRÉ-REMPLI depuis /tmp/fws-hostname (pour ne pas
|
|
# écraser le nom choisi à l'écran Réseau par une valeur vide) et user.py écrit
|
|
# la valeur (éventuellement modifiée) dans /tmp/fws-hostname, que le %post du
|
|
# kickstart applique à /etc/hostname.
|
|
python3 - <<'PYEOF'
|
|
import glob
|
|
|
|
# 1) user.glade : insérer label + entry "Host name" APRÈS le bloc username_entry.
|
|
glades = [p for p in glob.glob("pyanaconda/**/user.glade", recursive=True)
|
|
if 'username_entry' in open(p, encoding='utf-8').read()]
|
|
assert glades, "FWS: user.glade introuvable"
|
|
g = glades[0]
|
|
s = open(g, encoding='utf-8').read()
|
|
assert 'id="hostname_entry"' not in s, "FWS: glade déjà patché"
|
|
i = s.index('id="username_entry"')
|
|
k = s.index('</packing>', i) # fin du packing de username_entry
|
|
j = s.index('</child>', k) + len('</child>') # fin du <child> EXTERNE (pas l'accessible)
|
|
block = '''
|
|
<child>
|
|
<object class="GtkLabel" id="hostname_label">
|
|
<property name="visible">True</property>
|
|
<property name="can-focus">False</property>
|
|
<property name="xpad">10</property>
|
|
<property name="label" translatable="yes" context="GUI|User">_Host name</property>
|
|
<property name="use-underline">True</property>
|
|
<property name="mnemonic-widget">hostname_entry</property>
|
|
<property name="xalign">1</property>
|
|
<attributes>
|
|
<attribute name="weight" value="bold"/>
|
|
</attributes>
|
|
</object>
|
|
<packing>
|
|
<property name="left-attach">0</property>
|
|
<property name="top-attach">2</property>
|
|
</packing>
|
|
</child>
|
|
<child>
|
|
<object class="GtkEntry" id="hostname_entry">
|
|
<property name="visible">True</property>
|
|
<property name="can-focus">True</property>
|
|
<property name="width-chars">50</property>
|
|
<child internal-child="accessible">
|
|
<object class="AtkObject" id="hostname_entry-atkobject">
|
|
<property name="AtkObject::accessible-name" translatable="yes">Host Name</property>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
<packing>
|
|
<property name="left-attach">1</property>
|
|
<property name="top-attach">2</property>
|
|
</packing>
|
|
</child>'''
|
|
open(g, 'w', encoding='utf-8').write(s[:j] + block + s[j:])
|
|
|
|
# 2) user.py (GUI) : récupérer le widget + écrire /tmp/fws-hostname dans apply().
|
|
pys = glob.glob("pyanaconda/ui/gui/spokes/user.py")
|
|
assert pys, "FWS: user.py introuvable"
|
|
p = pys[0]
|
|
s = open(p, encoding='utf-8').read()
|
|
anchor = 'self._username_entry = self.builder.get_object("username_entry")'
|
|
assert anchor in s, "FWS: ancre username_entry absente"
|
|
s = s.replace(anchor,
|
|
anchor + '\n self._hostname_entry = self.builder.get_object("hostname_entry")' + '''
|
|
|
|
# FWS : pré-remplir depuis l'écran Réseau (fws_network.py) si un nom y a
|
|
# déjà été saisi — sinon apply() ci-dessous écraserait ce nom par une
|
|
# valeur vide (le champ démarre vide). initialize() relit le fichier à
|
|
# chaque entrée dans le spoke.
|
|
try:
|
|
with open("/tmp/fws-hostname") as _fh:
|
|
_hn0 = _fh.read().strip()
|
|
except OSError:
|
|
_hn0 = ""
|
|
if _hn0:
|
|
try:
|
|
self._hostname_entry.set_text(_hn0)
|
|
except Exception:
|
|
pass''',
|
|
1)
|
|
ap = 'set_user_list(self._users_module, self._user_list, remove_unset=True)'
|
|
assert ap in s, "FWS: ancre apply() absente"
|
|
s = s.replace(ap, ap + '''
|
|
|
|
# FWS : mémorise le nom de machine saisi (cible pas encore montée) pour
|
|
# le %post du kickstart, qui l'écrira dans /etc/hostname.
|
|
try:
|
|
_hn = self._hostname_entry.get_text().strip()
|
|
except Exception:
|
|
_hn = ""
|
|
try:
|
|
with open("/tmp/fws-hostname", "w") as _f:
|
|
_f.write(_hn)
|
|
except OSError:
|
|
pass''', 1)
|
|
open(p, 'w', encoding='utf-8').write(s)
|
|
print("FWS: champ Hostname ajouté au spoke Utilisateur (glade + user.py)")
|
|
PYEOF
|
|
|
|
# ── FWS : créer l'ESP même avec « bootloader --disabled » ─────────────────
|
|
# Le kickstart désactive le bootloader d'Anaconda (grub2-install n'existe pas
|
|
# sur Arch, GRUB est posé par le %post). Or execution.py met alors
|
|
# skip_bootloader=True, et schedule_partitions() SAUTE la requête « efi » du
|
|
# partitionnement automatique (« skipping unneeded stage1 efi request »).
|
|
# Résultat vu en réel (HP OMEN, NVMe vierge, UEFI) : /boot + LVM, AUCUNE
|
|
# partition EFI → grub-install n'avait nulle part où écrire, et la machine ne
|
|
# démarrait qu'avec la clé USB branchée. On ne garde que l'autre moitié de la
|
|
# condition : ne pas créer de 2e ESP si une partition stage1 existe déjà.
|
|
sed -i \
|
|
's/^\(\s*\)(storage\.bootloader\.skip_bootloader or stage1_device):$/\1stage1_device: # FWS: ESP créée même sans bootloader Anaconda/' \
|
|
pyanaconda/modules/storage/partitioning/automatic/utils.py
|
|
grep -q 'stage1_device: # FWS: ESP' \
|
|
pyanaconda/modules/storage/partitioning/automatic/utils.py
|
|
}
|
|
|
|
build() {
|
|
cd "$srcdir/$_srcdir"
|
|
# Glade désactivé (catalogue designer, inutile au runtime) → pas de dép glade.
|
|
# La variable d'env doit être posée AVANT autogen.sh (lue par m4 à l'autoreconf)
|
|
# EN PLUS du flag --disable-glade au configure.
|
|
export ANACONDA_DISABLE_GLADE=yes
|
|
# autogen.sh : autoreconf -vfi racine + (cd widgets && ./autogen.sh).
|
|
./autogen.sh
|
|
# ANACONDA_RELEASE=1 : release réelle, pas la date de création du tarball.
|
|
./configure \
|
|
--prefix=/usr --libdir=/usr/lib --sysconfdir=/etc \
|
|
--disable-glade --disable-gtk-doc ANACONDA_RELEASE=1
|
|
make
|
|
}
|
|
|
|
package() {
|
|
cd "$srcdir/$_srcdir"
|
|
make DESTDIR="$pkgdir" install
|
|
find "$pkgdir" -name '*.la' -delete
|
|
|
|
# Répertoires attendus par Anaconda (créés vides par le spec).
|
|
install -d "$pkgdir/usr/share/anaconda/addons" \
|
|
"$pkgdir/usr/share/anaconda/post-scripts"
|
|
|
|
# Fichiers widgets : fournis par le paquet anaconda-widgets → on les retire
|
|
# ici (le build principal recompile widgets/ via AC_CONFIG_SUBDIRS) pour
|
|
# éviter le conflit de fichiers à l'install. On enlève TOUT l'empreinte
|
|
# widgets : lib, typelib, pkgconfig, headers, .gir, doc, override gi.
|
|
rm -f "$pkgdir"/usr/lib/libAnacondaWidgets.so*
|
|
rm -f "$pkgdir"/usr/lib/girepository-*/AnacondaWidgets*.typelib
|
|
rm -f "$pkgdir"/usr/lib/pkgconfig/AnacondaWidgets.pc
|
|
rm -rf "$pkgdir"/usr/include/AnacondaWidgets
|
|
rm -f "$pkgdir"/usr/share/gir-1.0/AnacondaWidgets*.gir
|
|
rm -rf "$pkgdir"/usr/share/gtk-doc/html/AnacondaWidgets
|
|
rm -f "$pkgdir"/usr/lib/python*/site-packages/gi/overrides/AnacondaWidgets*
|
|
|
|
# interactive-defaults.ks : FWS le fournit via l'overlay airootfs
|
|
# (configs/*/airootfs/usr/share/anaconda/) avec le payload liveimg. mkarchiso
|
|
# copie l'overlay AVANT pacstrap → si le paquet livrait aussi ce fichier, pacman
|
|
# planterait (« exists in filesystem »). On retire donc la version amont : le
|
|
# fichier de l'overlay reste la seule à ce chemin, et anaconda le lit au runtime.
|
|
rm -f "$pkgdir"/usr/share/anaconda/interactive-defaults.ks
|
|
|
|
# usr-merge Arch : /usr/sbin est un LIEN → /usr/bin. Anaconda installe dans
|
|
# /usr/sbin (vrai dossier sur Fedora) → conflit avec le paquet 'filesystem'.
|
|
# On rapatrie le contenu dans /usr/bin et on supprime le dossier sbin.
|
|
if [ -d "$pkgdir/usr/sbin" ] && [ ! -L "$pkgdir/usr/sbin" ]; then
|
|
install -d "$pkgdir/usr/bin"
|
|
cp -aT "$pkgdir/usr/sbin" "$pkgdir/usr/bin"
|
|
rm -rf "$pkgdir/usr/sbin"
|
|
fi
|
|
}
|