ks: %post --nochroot — multi-path overlay source detection (/work CI, /run/install/repo virt, kickstart-relative no-virt)

This commit is contained in:
veilor-org 2026-04-30 14:14:07 +01:00
parent c62a5489f2
commit 5f650d45d8

View file

@ -113,14 +113,38 @@ fira-code-fonts
# ── Post-install (nochroot): copy overlay tree into installed root ── # ── Post-install (nochroot): copy overlay tree into installed root ──
%post --nochroot %post --nochroot
set -eu set -eu
SRC=/run/install/repo/veilor
DEST=/mnt/sysimage DEST=/mnt/sysimage
if [[ -d $SRC/overlay ]]; then
cp -a $SRC/overlay/. $DEST/ # Try multiple source paths:
# /run/install/repo/veilor — boot ISO (--virt mode)
# /work — bind mount in CI container
# $(dirname kickstart)/.. — local --no-virt builds
SRC=""
for candidate in /run/install/repo/veilor /work /mnt/work; do
if [[ -d $candidate/overlay ]]; then
SRC=$candidate
break
fi
done
# Fallback: derive from kickstart path. Anaconda passes ks via --kickstart=<path>.
if [[ -z $SRC ]]; then
KS_PATH=$(ps -ef | grep -oP -- '--kickstart[= ]\K[^ ]+' | head -1)
if [[ -n $KS_PATH && -d $(dirname "$KS_PATH")/../overlay ]]; then
SRC=$(realpath "$(dirname "$KS_PATH")/..")
fi
fi fi
mkdir -p $DEST/usr/share/veilor-os
cp -a $SRC/assets $DEST/usr/share/veilor-os/ if [[ -z $SRC ]]; then
cp -a $SRC/scripts $DEST/usr/share/veilor-os/ echo "[ERR] cannot locate veilor-os repo source — overlay/scripts not copied" >&2
exit 1
fi
echo "[INFO] using SRC=$SRC"
cp -a "$SRC/overlay/." "$DEST/"
mkdir -p "$DEST/usr/share/veilor-os"
cp -a "$SRC/assets" "$DEST/usr/share/veilor-os/"
cp -a "$SRC/scripts" "$DEST/usr/share/veilor-os/"
%end %end
# ── Post-install (chroot): apply hardening, theme, branding ── # ── Post-install (chroot): apply hardening, theme, branding ──