feat(installer): install PacManager on the target system only

PacManager (FWS-PacManage 1.2.1) is packaged like fws-dnd: a local PKGBUILD
with the sources vendored in the repository, because the upstream Gitea is
private and makepkg cannot fetch from it during the build.

It is deliberately absent from packages.x86_64. On a live system one is about
to replace, a package manager serves no purpose, and it would drag qt6-base
into the squashfs for nothing. build.sh drops the built package into the image
instead, and the kickstart %post installs it into the target, then deletes the
file. Two conditions there: only when a desktop was chosen (it is a GUI
application, nothing could launch it on a command-line install), and never
blocking -- "pacman -U" resolves qt6-base over the network, and no PacManager
is not a failed installation.

The binary goes to /usr/lib/fws-pacmanage rather than /usr/bin: PluginManager
looks for its plugins in applicationDirPath()/plugins, so /usr/bin would mean a
/usr/bin/plugins directory polluting a PATH entry. Binary and plugins stay
together in a private directory and /usr/bin/fws-pacmanage is a symlink -- Qt
resolves /proc/self/exe, so the plugins are still found. Upstream ships no
.desktop file, so one is provided here.

build.sh also gains a guard: it now checks, before any lengthy step, that every
package only local-repo can provide is actually built. Until now a missing one
surfaced as a bare "target not found" from pacman, after the mirror refresh,
the full upgrade and the whole mkarchiso setup -- several minutes for an error
detectable in one second.

Signed-off-by: nocode <suzuku295@gmail.com>
This commit is contained in:
nocode committed 2026-09-09 16:06:15 +02:00
1 parent c7607b3f37
commit 213ff2d47d
6 files changed
+183 -1

No files matched your search

+54
View File
@@ -320,6 +320,60 @@ else
echo "==> Aucun repo local détecté."
fi
# ============================================================
# Garde-fou : les paquets FWS doivent EXISTER dans local-repo
#
# packages.x86_64 liste des paquets que seul le dépôt local fournit (fws-*,
# anaconda, winboat-bin, deps python…). S'ils n'ont pas encore été construits,
# pacman ne le découvre qu'à la toute fin — après le -Syu, les miroirs et
# toute la préparation de mkarchiso — avec un « target not found » sec et
# plusieurs minutes de perdues. On vérifie donc AVANT de lancer quoi que ce
# soit de long, et on dit quoi faire.
# ============================================================
echo "==> Vérification des paquets fournis par local-repo..."
_missing=()
# Paquets construits depuis les PKGBUILD du dépôt (le nom du dossier est le
# pkgname), plus la liste AUR lue dans setup-aur.sh — sa seule source de vérité.
_local_pkgs=()
for _d in "$WORK_DIR"/pkgbuilds/*/; do
[ -f "$_d/PKGBUILD" ] || continue
_local_pkgs+=("$(basename "$_d")")
done
# shellcheck disable=SC2207
_local_pkgs+=($(sed -n 's/^AUR_PACKAGES=(\(.*\))[[:space:]]*$//p' "$WORK_DIR/setup-aur.sh" 2>/dev/null))
for _p in "${_local_pkgs[@]}"; do
grep -qx "$_p" /tmp/fws-build/releng/packages.x86_64 || continue
ls "$WORK_DIR/local-repo/$_p"-[0-9]*.pkg.tar.* >/dev/null 2>&1 || _missing+=("$_p")
done
if [ "${#_missing[@]}" -gt 0 ]; then
echo -e "\e[31m[ERR] Ces paquets sont demandés par packages.x86_64 mais absents de local-repo :\e[0m" >&2
printf ' - %s\n' "${_missing[@]}" >&2
echo "" >&2
echo " Construis-les d'abord : ./setup-aur.sh" >&2
echo " (incrémental : il saute ce qui est déjà à jour dans local-repo/)" >&2
exit 1
fi
echo " ${#_local_pkgs[@]} paquets locaux attendus, tous présents ✔"
# ============================================================
# PacManager : embarqué dans l'image, installé seulement sur la CIBLE
#
# Volontairement absent de packages.x86_64 : sur un live qu'on s'apprête à
# remplacer, un gestionnaire de paquets n'a aucun sens (et il tirerait qt6-base
# dans le squashfs pour rien). On dépose donc le .pkg dans l'airootfs et c'est
# le %post du kickstart qui fait « pacman -U » dans le système installé, puis
# supprime le fichier.
# ============================================================
_PM_PKG="$(ls "$WORK_DIR/local-repo"/fws-pacmanage-[0-9]*.pkg.tar.* 2>/dev/null | head -1)"
if [ -n "$_PM_PKG" ]; then
install -Dm644 "$_PM_PKG" \
"/tmp/fws-build/releng/airootfs/usr/local/share/fws/packages/$(basename "$_PM_PKG")"
echo "==> PacManager embarqué pour l'installation : $(basename "$_PM_PKG")"
else
echo -e "\e[33m[!] fws-pacmanage absent de local-repo — PacManager ne sera pas installé.\e[0m" >&2
echo " Lance ./setup-aur.sh pour le construire." >&2
fi
echo "==> Correction des retours à la ligne Windows (dos2unix)..."
pacman -S --needed --noconfirm dos2unix
find /tmp/fws-build/releng -type f -exec dos2unix {} + 2>/dev/null