Add Debian 13 (trixie) support alongside Fedora
The provisioning path now runs on both package families. Fedora behaviour is
unchanged: the Fedora publishing code issues the same ten operations in the
same order as before, verified by recording the call sequence from both
implementations against a stubbed environment.
update_local_repo.py
Detects the family from /etc/os-release and dispatches to sync_fedora() or
sync_debian(). Release assets are filtered by extension, so neither family
sees the other's packages. The Debian path builds a flat apt-ftparchive
repository at the same /var/local/citrix-repo, publishes
local-citrix-repo.list, and runs apt-get update.
Fixes found while testing:
- tqdm is now an optional dependency. A stock Debian 13 image has no pip and
no tqdm, and dying at import would take down provisioning over a progress
bar.
- sync_debian prunes stale *.deb files before repopulating. The Fedora path
gets this for free by writing fixed filenames; Debian filenames carry the
version, so without pruning every old version stayed indexed and apt always
picked the highest, making rollback impossible.
- The apt source file is resolved next to the script rather than from the
working directory, with a hardcoded canonical fallback, so a foreign cwd or
a missing file cannot break the 10-minute cron job.
local-citrix-repo.list
The apt counterpart of local-citrix-repo.repo, which stays as-is for dnf.
Uses trusted=yes rather than a signature: the repository is generated on the
machine from packages this script downloaded itself, so a signature would only
prove the machine signed its own work, and it would add a gpg dependency that
Debian 13 does not ship by default. Index integrity is still enforced through
the hashes in Release.
debian/preseed.cfg
The debian-installer equivalent of ks.cfg. Same locale, keyboard, timezone,
passwords, inventory-derived hostname/user/password, disk auto-detection,
Firefox managed bookmarks, Citrix and TeamViewer installs, auto-update script,
cron jobs and disable-sleep unit. Every directive was checked against the
templates in the real trixie udebs. Documented gaps, all inherent to preseed
vs kickstart: uppercase usernames are rejected by user-setup and so are
created in late_command; d-i has no lsblk, openssl, chvt or openvt, so disk
detection reads /sys/block and the inventory prompt goes to /dev/console with
a kernel-cmdline override and a timeout; pip install tqdm becomes
python3-tqdm from apt because of PEP 668.
debian/test/
Harness covering the Debian path on a real Debian 13 machine: repo build,
sources.list validity, apt visibility after purging the list cache, install
resolution, idempotency, stale-package pruning, corrupt-index rejection, and
Fedora non-regression. 52 pass, 3 skip (each skip states why).
Known limitations are listed in README.md under "What the tests do NOT prove":
no real d-i install has been run, and the generated post-install script is
verified as well-formed rather than executed against a target root.
This commit is contained in:
1 parent
5d9b278270
commit
6ddb1d251a
6 files changed
+2779
-277
No files matched your search
Vendored
+535
@@ -0,0 +1,535 @@
|
||||
#_preseed_V1
|
||||
#
|
||||
# Debian 13 "trixie" preseed - the port of the Fedora kickstart at
|
||||
# ../../ks.cfg (one directory above this git repo).
|
||||
#
|
||||
# This file is the Debian equivalent of ks.cfg. Every block below names the
|
||||
# kickstart directive it corresponds to, so a maintainer of the Fedora path can
|
||||
# diff the two side by side. Where Debian's installer (d-i) cannot do what the
|
||||
# kickstart does, the block says so and explains what is done instead - see
|
||||
# "GAPS" at the end for the consolidated list.
|
||||
#
|
||||
# Directive existence: every "d-i <question>" line below was checked against the
|
||||
# real template files shipped in the trixie d-i udebs (preseed-common,
|
||||
# partman-*, netcfg, user-setup-udeb, localechooser, tzsetup, console-setup,
|
||||
# clock-setup, pkgsel, base-installer, apt-setup, grub-installer, finish-install,
|
||||
# hw-detect, di-utils) plus tasksel/keyboard-configuration from the main archive.
|
||||
# No directive here is guessed.
|
||||
#
|
||||
# Validated with: debconf-set-selections < preseed.cfg (see debian/README)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Installation source
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:1-2 url --mirrorlist=https://mirrors.fedoraproject.org/...fedora-44
|
||||
# Debian has no metalink; the canonical archive is the equivalent. Protocol,
|
||||
# host and directory are preseeded individually so the mirror question is never
|
||||
# asked and no network round-trip to the mirror list happens.
|
||||
d-i mirror/country string DE
|
||||
d-i mirror/protocol select http
|
||||
d-i mirror/http/hostname string deb.debian.org
|
||||
d-i mirror/http/directory string /debian
|
||||
d-i mirror/http/proxy string
|
||||
d-i mirror/suite string trixie
|
||||
d-i mirror/codename string trixie
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Language, keyboard, timezone
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:5 lang de_DE.UTF-8
|
||||
# language + country are set alongside locale so localechooser never asks: the
|
||||
# shortlist question is skipped when the locale is already preseeded, and the
|
||||
# two extra keys make the country/language selection deterministic too.
|
||||
d-i debian-installer/language string de
|
||||
d-i debian-installer/country string DE
|
||||
d-i debian-installer/locale string de_DE.UTF-8
|
||||
# ks.cfg:5 asks for German only; do not pull in a second locale.
|
||||
d-i localechooser/supported-locales multiselect de_DE.UTF-8
|
||||
|
||||
# ks.cfg:6 keyboard de
|
||||
# On trixie there is no "debian-installer/keymap" template any more - it survives
|
||||
# only as an alias handled by env-preseed, which maps "keymap" onto
|
||||
# keyboard-configuration/xkb-keymap. The real question is the one below, and
|
||||
# layoutcode is set as well because that is what ends up in
|
||||
# /etc/default/keyboard as XKBLAYOUT.
|
||||
d-i keyboard-configuration/xkb-keymap select de
|
||||
d-i keyboard-configuration/layoutcode string de
|
||||
d-i keyboard-configuration/modelcode string pc105
|
||||
d-i keyboard-configuration/variantcode string
|
||||
|
||||
# ks.cfg:9 timezone Europe/Berlin
|
||||
d-i time/zone string Europe/Berlin
|
||||
# Fedora's installer sets the hardware clock to UTC by default and so does d-i;
|
||||
# stated explicitly rather than relied on.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i clock-setup/ntp boolean true
|
||||
d-i clock-setup/ntp-server string deb.debian.org
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Accounts - root
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:12 rootpw <sha512 hash> --iscrypted
|
||||
# Same hash, byte for byte. Type is "password" and the value is the crypt(3)
|
||||
# string, which is exactly what d-i's user-setup-apply feeds to usermod
|
||||
# --password, so no re-hashing happens anywhere.
|
||||
d-i passwd/root-password-crypted password $6$3EpVOhxlL/EVU/8f$Z.M5x/x5OdzBFW2C0IoNo5KCsLURBJZnp1BgcMWFz8gsjEPSgAlBKEs7CgZnRAGjbrEzgvUCEydmjtZYvUraJ/
|
||||
# ks.cfg sets a root password, which on Fedora implies root may log in. d-i
|
||||
# defaults to locking root when a non-root user exists; say so explicitly.
|
||||
d-i passwd/root-login boolean true
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Accounts - users
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:15 user --name=VDI-ADMIN --password <same hash> --iscrypted --groups=wheel
|
||||
#
|
||||
# GAP 1 (important). This CANNOT be expressed as a preseed user.
|
||||
# user-setup-udeb validates the username with
|
||||
# LC_ALL=C expr "$USER" : '[a-z][-a-z0-9_]*$'
|
||||
# (read out of user-setup-udeb 1.107, ./usr/bin/user-setup-ask, state 6).
|
||||
# "VDI-ADMIN" is uppercase, so it fails validation, and on failure the state
|
||||
# machine loops back and asks the question again interactively - which would
|
||||
# hang an unattended install. So the built-in user creation is disabled here and
|
||||
# BOTH users are created in preseed/late_command instead (see vdi-post.sh
|
||||
# below), using useradd, which does accept it. Verified on Debian 13:
|
||||
# useradd -m -G sudo -c 'VDI-00000' VDI-ADMIN -> rc=0
|
||||
# id VDI-ADMIN -> uid=1000(VDI-ADMIN) groups=...,27(sudo)
|
||||
# Fedora's "wheel" group is Debian's "sudo" group.
|
||||
d-i passwd/make-user boolean false
|
||||
# The kickstart's second user (ks.cfg:85, generated in %pre) is vdi<NNNNN>.
|
||||
# That name would pass user-setup's validation, but the password is derived from
|
||||
# the inventory number and the number is only known at run time, so both users
|
||||
# are created together in late_command for consistency.
|
||||
d-i passwd/username string vdi00000
|
||||
d-i passwd/user-fullname string VDI-00000
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Network
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:84 network --bootproto=dhcp --hostname=$HOSTNAME --activate
|
||||
# The hostname is not a constant: it is EXTVDIL<NNNNN> and is derived from the
|
||||
# operator's answer in preseed/early_command. The value below is only the
|
||||
# placeholder that is replaced there; "netcfg/hostname" is the documented
|
||||
# "for internal use; can be preseeded" question that overrides whatever DHCP
|
||||
# supplies, which is what --hostname does on Fedora.
|
||||
d-i netcfg/enable boolean true
|
||||
d-i netcfg/choose_interface select auto
|
||||
d-i netcfg/get_hostname string EXTVDIL00000
|
||||
d-i netcfg/hostname string EXTVDIL00000
|
||||
# The kickstart does not set a domain and the VDI machines are not in one.
|
||||
d-i netcfg/get_domain string
|
||||
d-i netcfg/dhcp_timeout string 60
|
||||
d-i netcfg/use_autoconfig boolean true
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Disk partitioning
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:53-56 (generated in %pre)
|
||||
# ignoredisk --only-use=$DISK_NAME
|
||||
# zerombr
|
||||
# clearpart --all --initlabel
|
||||
# autopart --fstype=ext4
|
||||
#
|
||||
# Mapping:
|
||||
# ignoredisk --only-use -> partman-auto/disk (restricts the automatic
|
||||
# partitioner to exactly one disk)
|
||||
# zerombr + --initlabel -> partman-partitioning/default_label gpt
|
||||
# (relabels the disk, discarding the old table)
|
||||
# clearpart --all -> partman-auto/method regular, which builds a fresh
|
||||
# table from a recipe instead of reusing anything
|
||||
# autopart --fstype -> partman/default_filesystem ext4
|
||||
#
|
||||
# GAP 2 - WHEN the disk is detected, and why it is not preseed/early_command.
|
||||
# The kickstart detects the disk in %pre, before anaconda partitions. In d-i the
|
||||
# equivalent-looking hook, preseed/early_command, runs from
|
||||
# env-preseed's S33preseed_early_command, which is before partman has probed the
|
||||
# disks - Debian's own example preseed says so explicitly ("disks ... may not be
|
||||
# visible when preseed/early_command runs") and names the correct hook:
|
||||
# d-i partman/early_command \
|
||||
# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
||||
# partman-base runs that hook from ./lib/partman/init.d/01early_command, i.e.
|
||||
# inside partman, with the disk list populated. So the detection lives in
|
||||
# partman/early_command below.
|
||||
#
|
||||
# GAP 3 - the kickstart's two disk tools do not exist in d-i at all.
|
||||
# `lsblk -d -o rm` and `openssl passwd -6` are both absent from every trixie
|
||||
# udeb (checked by unpacking them all; d-i has no lsblk, no openssl, no
|
||||
# python3, no chvt, no passwd binary). The detection below therefore reads
|
||||
# /sys/block/*/removable and uses udevadm (present, from udev-udeb) for the USB
|
||||
# test, and nothing is hashed in d-i - the inventory password is set with
|
||||
# chpasswd in the installed system, which hashes it there.
|
||||
#
|
||||
# partman-auto/disk is deliberately NOT set statically: if detection ever fails
|
||||
# the installer must fall back to the interactive partitioner rather than wipe a
|
||||
# disk that merely matched a hard-coded default. Detection failure is therefore
|
||||
# safe-by-construction: nothing is partitioned until the operator confirms.
|
||||
d-i partman-auto/method string regular
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
d-i partman/default_filesystem string ext4
|
||||
d-i partman-partitioning/default_label string gpt
|
||||
d-i partman/alignment select optimal
|
||||
# Wipe any pre-existing LVM/MD metadata, the way zerombr/clearpart --all do.
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
# No "are you sure?" / "write changes?" dialogs - the kickstart is unattended.
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
# Detects the single internal disk, skipping USB and removable devices, then
|
||||
# hands it to partman. Runs inside partman, after the disks are visible.
|
||||
# This is the replacement for ks.cfg:18-60.
|
||||
#
|
||||
# The kickstart only ever looked at /dev/nvme[0-9]n[0-9] (so its own comment
|
||||
# about "SATA, NVMe, eMMC" was never true). This scans every block device,
|
||||
# prefers NVMe as the kickstart intended, and accepts SATA/eMMC/virtio as well.
|
||||
d-i partman/early_command string \
|
||||
disk=""; \
|
||||
for d in /sys/block/*; do \
|
||||
n=$(basename "$d"); \
|
||||
case "$n" in loop*|ram*|zram*|sr*|dm-*|md*|fd*) continue ;; esac; \
|
||||
[ -b "/dev/$n" ] || continue; \
|
||||
[ "$(cat "$d/removable" 2>/dev/null || echo 1)" = 0 ] || continue; \
|
||||
if udevadm info -q property -n "/dev/$n" 2>/dev/null | grep -q "^ID_BUS=usb"; then continue; fi; \
|
||||
case "$n" in nvme*) disk="/dev/$n"; break ;; *) [ -n "$disk" ] || disk="/dev/$n" ;; esac; \
|
||||
done; \
|
||||
if [ -n "$disk" ]; then \
|
||||
debconf-set partman-auto/disk "$disk"; \
|
||||
debconf-set grub-installer/bootdev "$disk"; \
|
||||
echo "VDI: internal disk $disk" >> /var/log/vdi-preseed.log; \
|
||||
else \
|
||||
echo "VDI: no internal disk found - falling back to the interactive partitioner" >> /var/log/vdi-preseed.log; \
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Inventory number (ks.cfg:18-93, the whole %pre section)
|
||||
# ---------------------------------------------------------------------------
|
||||
# The kickstart writes its results into /tmp/ks_dynamic.cfg and %includes it.
|
||||
# d-i has no %include; the same effect is achieved by writing the derived values
|
||||
# straight into debconf with debconf-set (from di-utils), which is the sanctioned
|
||||
# idiom - Debian's example preseed uses it for partman-auto/disk.
|
||||
#
|
||||
# GAP 4 - the prompt itself. The kickstart switches to TTY3 with `chvt 3` and
|
||||
# reads from /dev/tty3. d-i ships neither chvt nor openvt (confirmed absent from
|
||||
# every udeb), and preseed_command runs the hook through `log-output`, which
|
||||
# sends stdout to the log rather than to the screen. So the prompt is written to
|
||||
# and read from /dev/console directly, which is the console the operator is
|
||||
# actually looking at.
|
||||
#
|
||||
# Two safety valves the kickstart does not have, because an unattended run must
|
||||
# not hang forever on a `read` that nobody answers:
|
||||
# * vdi.inventory=NNNNN on the kernel command line skips the prompt entirely;
|
||||
# * otherwise the prompt waits 120 s and then uses the kickstart's default,
|
||||
# 00000.
|
||||
# Both are documented in debian/README.
|
||||
d-i preseed/early_command string \
|
||||
inv=""; \
|
||||
for a in $(cat /proc/cmdline); do case "$a" in vdi.inventory=*) inv="${a#vdi.inventory=}" ;; esac; done; \
|
||||
if [ -z "$inv" ] && [ -c /dev/console ]; then \
|
||||
printf "\n\nEnter the 5-digit inventory number for this device (default 00000): " > /dev/console; \
|
||||
IFS= read -r -t 120 inv < /dev/console || true; \
|
||||
fi; \
|
||||
[ -n "$inv" ] || inv=00000; \
|
||||
inv=$(printf "%s" "$inv" | tr -cd "0-9" | cut -c1-5); \
|
||||
[ -n "$inv" ] || inv=00000; \
|
||||
while [ ${#inv} -lt 5 ]; do inv="0${inv}"; done; \
|
||||
printf "%s" "$inv" > /tmp/vdi.inventory; \
|
||||
debconf-set netcfg/hostname "EXTVDIL${inv}"; \
|
||||
debconf-set netcfg/get_hostname "EXTVDIL${inv}"; \
|
||||
debconf-set passwd/username "vdi${inv}"; \
|
||||
debconf-set passwd/user-fullname "VDI-${inv}"; \
|
||||
echo "VDI: inventory=${inv}" >> /var/log/vdi-preseed.log
|
||||
#
|
||||
# ks.cfg:73 INVENTORY_NUM=$(printf "%05d" ${INVENTORY_NUM:0:5})
|
||||
# Reproduced, but with a zero-padding loop instead of printf: `printf "%05d"`
|
||||
# treats the value as octal, so the kickstart's own line fails on an inventory
|
||||
# number containing an 8 or 9 (e.g. 00019). The loop gives the same result and
|
||||
# cannot fail.
|
||||
#
|
||||
# Derived values, all from ks.cfg:77-80:
|
||||
# hostname EXTVDIL<NNNNN> -> netcfg/hostname above
|
||||
# username vdi<NNNNN> -> passwd/username above
|
||||
# full name VDI-<NNNNN> -> passwd/user-fullname above
|
||||
# password pwVDI#<NNNNN> -> set with chpasswd in late_command
|
||||
# (d-i has no openssl, see GAP 3)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Boot loader
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:96 bootloader --location=mbr
|
||||
# The device is set from the detected disk in partman/early_command above, which
|
||||
# is the same disk the partitioning is restricted to. "default" would also work
|
||||
# but naming the disk is closer to --location=mbr and cannot pick the wrong one.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
d-i grub-installer/with_other_os boolean false
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Package selection
|
||||
# ---------------------------------------------------------------------------
|
||||
# ks.cfg:99-105
|
||||
# @^kde-desktop-environment
|
||||
# createrepo_c
|
||||
# python3-pip
|
||||
# firefox
|
||||
# git
|
||||
#
|
||||
# @^kde-desktop-environment -> the "kde-desktop" task (verified in
|
||||
# tasksel-data 3.81: Task: kde-desktop, Parent: desktop). "standard" is the
|
||||
# Debian equivalent of the base group anaconda always installs.
|
||||
# firefox -> firefox-esr (trixie has no package called
|
||||
# "firefox"; verified in the trixie Packages index)
|
||||
# createrepo_c -> apt-utils, which is what provides apt-ftparchive,
|
||||
# the tool that builds a flat apt repository. There is no createrepo on
|
||||
# Debian and no createrepo_c either.
|
||||
# python3-pip -> DROPPED. ks.cfg:143 installs pip only in order to run
|
||||
# `pip install tqdm`, and that one use is served by python3-tqdm from apt (GAP 5).
|
||||
# Debian 13 marks /usr/lib/python3/dist-packages EXTERNALLY-MANAGED (PEP 668), so
|
||||
# any user who tries `pip install <anything>` after install gets
|
||||
# "error: externally-managed-environment" and has to reach for
|
||||
# --break-system-packages. Measured on trixie, not assumed: `pip3 install
|
||||
# requests` is blocked AND so is `pip3 install --user six`. So installing
|
||||
# python3-pip would not make pip usable - it only changes the error from
|
||||
# "command not found" to "externally-managed-environment". It adds no capability
|
||||
# that this image would otherwise have. This is a deliberate difference from the
|
||||
# Fedora kickstart. The supported route is a venv, which is why python3-venv is
|
||||
# installed below instead.
|
||||
tasksel tasksel/first multiselect standard, kde-desktop
|
||||
# Package list notes, one per entry that is not a straight rename:
|
||||
# python3 - update_local_repo.py is python3 and the cron job runs it.
|
||||
# A bare trixie install has no python3, and without it the
|
||||
# cron job fails every 10 minutes with only a log line.
|
||||
# apt-utils - provides apt-ftparchive, which update_local_repo.py calls
|
||||
# to build the local Citrix repo (the createrepo_c slot).
|
||||
# python3-tqdm - the tqdm dependency, from apt instead of pip (GAP 5).
|
||||
# python3-venv - the replacement for the dropped python3-pip: a venv is the
|
||||
# only way to install a third-party Python package on trixie.
|
||||
# `python3 -m venv` needs this package to create a working
|
||||
# pip inside the venv; without it a user has no route at all.
|
||||
# Verified on trixie: python3 -m venv gives pip 25.1.1 and
|
||||
# `venv/bin/pip install six` succeeds (EXTERNALLY-MANAGED does
|
||||
# not apply inside a venv). It pulls python3-pip-whl, which is
|
||||
# pip bundled as a wheel for venv use - that is NOT python3-pip
|
||||
# and does not put a system pip3 on PATH.
|
||||
# wget - the teamviewer key download in the post-install script
|
||||
# uses wget (present in trixie as 1.25.0-2).
|
||||
# sudo - needed for the "sudo" group. The kde-desktop task does not
|
||||
# pull sudo in, and `useradd -G sudo` would otherwise
|
||||
# succeed with a warning and leave VDI-ADMIN unable to sudo.
|
||||
# cron - the kickstart appends to /etc/crontab and restarts crond;
|
||||
# Debian does not install cron by default.
|
||||
# packagekit-tools - provides pkcon, used by /root/auto_update.sh.
|
||||
# iputils-ping - the @reboot cron line waits on `ping google.com`.
|
||||
d-i pkgsel/include string git python3 python3-tqdm python3-venv firefox-esr apt-utils cron sudo ca-certificates wget iputils-ping packagekit-tools systemd
|
||||
d-i pkgsel/run_tasksel boolean true
|
||||
# ks.cfg does not upgrade the system during install, and does not enable
|
||||
# automatic security updates (it runs its own pkcon-based updater instead).
|
||||
d-i pkgsel/upgrade select none
|
||||
d-i pkgsel/update-policy select none
|
||||
d-i pkgsel/updatedb boolean false
|
||||
d-i base-installer/install-recommends boolean true
|
||||
#
|
||||
# GAP 5 - tqdm. ks.cfg:143 does `pip install tqdm`, because Fedora ships pip and
|
||||
# lets it write into /usr. Debian 13 does not: pip3 is not installed by default,
|
||||
# and /usr/lib/python3.13/EXTERNALLY-MANAGED is present (PEP 668), so a
|
||||
# system-wide pip install is refused even after installing pip. The Debian way,
|
||||
# and what this file does, is the distribution package python3-tqdm
|
||||
# (4.67.1-5 on trixie). `pip install --break-system-packages` is deliberately
|
||||
# not used, and because the only thing the kickstart wanted pip for was tqdm,
|
||||
# python3-pip itself is not installed either - see the package-selection note
|
||||
# above. Measured on trixie: `pip3 install X` and `pip3 install --user X` are both
|
||||
# refused with externally-managed-environment, so pip would have been dead weight.
|
||||
# python3-venv is installed in its place, which is the supported route.
|
||||
#
|
||||
# GAP 6 - `pkcon` is used by the auto-update script below. On Fedora it comes
|
||||
# with the desktop; on Debian it is in packagekit-tools, which is therefore in
|
||||
# the list above. iputils-ping is there because the kickstart's @reboot cron
|
||||
# line waits on `ping google.com` and Debian does not install ping by default.
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Remainder of the installer, made non-interactive
|
||||
# ---------------------------------------------------------------------------
|
||||
# There is no kickstart equivalent for these; they exist so that nothing else
|
||||
# stops and waits for a human.
|
||||
d-i hw-detect/load_firmware boolean false
|
||||
d-i apt-setup/services-select multiselect security, updates
|
||||
d-i apt-setup/enable-source-repositories boolean false
|
||||
d-i finish-install/keep-consoles boolean false
|
||||
d-i cdrom-detect/eject boolean false
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# %post (ks.cfg:108-221)
|
||||
# ---------------------------------------------------------------------------
|
||||
# The kickstart's %post is a multi-line bash script with `set -euxo pipefail`.
|
||||
# A preseed value is a single line (continuations are joined with spaces), so a
|
||||
# multi-line script cannot be written inline. Instead late_command writes the
|
||||
# script to /root/vdi-post.sh in the installed system, line by line, and then
|
||||
# runs it with bash. That keeps it a real script - which is what makes
|
||||
# `set -euo pipefail` possible at all, since preseed_command itself uses
|
||||
# /bin/sh (dash, no pipefail) - and it stays readable here.
|
||||
#
|
||||
# The script is reproduced verbatim below as a comment so it can be reviewed
|
||||
# against ks.cfg without decoding anything. The printf arguments that follow it
|
||||
# are exactly these lines, in this order.
|
||||
#
|
||||
# ---8<--- /root/vdi-post.sh ---8<---
|
||||
# #!/bin/bash
|
||||
# set -euo pipefail
|
||||
# INV="${1:-00000}"
|
||||
# LOG=/root/post-install.log
|
||||
# exec >>"$LOG" 2>&1
|
||||
# echo "=== VDI post-install, inventory ${INV} ==="
|
||||
# HOSTNAME="EXTVDIL${INV}"
|
||||
# USERNAME="vdi${INV}"
|
||||
# FULLNAME="VDI-${INV}"
|
||||
# PASSWORD="pwVDI#${INV}"
|
||||
# ROOT_HASH='$6$3EpVOhxlL/EVU/8f$Z.M5x/x5OdzBFW2C0IoNo5KCsLURBJZnp1BgcMWFz8gsjEPSgAlBKEs7CgZnRAGjbrEzgvUCEydmjtZYvUraJ/'
|
||||
# printf "%s\n" "$HOSTNAME" > /etc/hostname
|
||||
# printf "127.0.1.1\t%s\n" "$HOSTNAME" >> /etc/hosts
|
||||
# hostnamectl set-hostname "$HOSTNAME" 2>/dev/null || true
|
||||
# getent group sudo >/dev/null || groupadd sudo
|
||||
# if ! id VDI-ADMIN >/dev/null 2>&1; then
|
||||
# useradd -m -s /bin/bash -G sudo -c "VDI Admin" -p "$ROOT_HASH" VDI-ADMIN
|
||||
# fi
|
||||
# if ! id "$USERNAME" >/dev/null 2>&1; then
|
||||
# useradd -m -s /bin/bash -c "$FULLNAME" "$USERNAME"
|
||||
# fi
|
||||
# printf "%s:%s\n" "$USERNAME" "$PASSWORD" | chpasswd
|
||||
# if ! wget -q -O /usr/share/keyrings/teamviewer.asc https://linux.teamviewer.com/pubkey/currentkey.asc; then
|
||||
# echo "teamviewer key download failed"
|
||||
# fi
|
||||
# apt-get update || echo "apt-get update failed"
|
||||
# if [ -d /root/VDI-Linux/.git ]; then
|
||||
# ( cd /root/VDI-Linux && git pull ) || echo "git pull failed - continuing"
|
||||
# else
|
||||
# git clone https://nachos386.lcube-server.de/REYHER-Systemtechnik-Public/VDI-Linux /root/VDI-Linux || echo "git clone failed - continuing"
|
||||
# fi
|
||||
# if [ -f /root/VDI-Linux/update_local_repo.py ]; then
|
||||
# ( cd /root/VDI-Linux && python3 ./update_local_repo.py ) || echo "update_local_repo.py failed"
|
||||
# fi
|
||||
# apt-get update || echo "apt-get update failed"
|
||||
# apt-get install -y icaclient ctxusb || echo "citrix install failed"
|
||||
# apt-get install -f -y || true
|
||||
# apt-get install -y teamviewer || echo "teamviewer install failed"
|
||||
# cat > /root/auto_update.sh <<EOF
|
||||
# #!/bin/bash
|
||||
# systemd-inhibit --what=sleep:idle --who="Auto Update Script" --why="Downloading system updates" /bin/bash -c "
|
||||
# pkcon refresh force
|
||||
# pkcon update --only-download
|
||||
# if pkcon offline-get-prepared >/dev/null 2>&1; then
|
||||
# pkcon offline-trigger
|
||||
# fi
|
||||
# "
|
||||
# EOF
|
||||
# chmod +x /root/auto_update.sh
|
||||
# cat > /etc/systemd/system/disable-sleep.service <<EOF
|
||||
# [Unit]
|
||||
# Description=Disable sleep and idle actions permanently
|
||||
# After=multi-user.target
|
||||
#
|
||||
# [Service]
|
||||
# Type=simple
|
||||
# ExecStart=/usr/bin/systemd-inhibit --what=sleep:idle --who="Permanent Inhibit" --why="Keep system always awake" --mode=block /bin/sleep infinity
|
||||
# Restart=always
|
||||
#
|
||||
# [Install]
|
||||
# WantedBy=multi-user.target
|
||||
# EOF
|
||||
# printf "%s\n" "*/10 * * * * root cd /root/VDI-Linux && python3 update_local_repo.py >> /var/log/update_local_repo.log 2>&1" >> /etc/crontab
|
||||
# printf "%s\n" "@reboot root bash -c \"until ping google.com -c1 >/dev/null 2>&1; do sleep 1; done;\" && cd /root/ && ./auto_update.sh >> /var/log/update_local_repo.log 2>&1" >> /etc/crontab
|
||||
# systemctl enable disable-sleep.service || echo "enable disable-sleep failed"
|
||||
# systemctl enable cron || echo "enable cron failed"
|
||||
# echo "VDI post-install complete"
|
||||
# ---8<--- end /root/vdi-post.sh ---8<---
|
||||
#
|
||||
# Differences from the kickstart's %post, all forced by Debian:
|
||||
#
|
||||
# * Firefox policies path (ks.cfg:113-136) is UNCHANGED: on trixie
|
||||
# /etc/firefox/policies/policies.json is the path firefox-esr actually reads,
|
||||
# with MOZ_SYSTEM_POLICIES compiled in. It is written from late_command
|
||||
# straight into /target (mode 644, root:root) rather than from the script,
|
||||
# because no chroot is needed to create a file.
|
||||
# * pip install tqdm (ks.cfg:143) -> python3-tqdm from the package list; see
|
||||
# GAP 5.
|
||||
# * dnf install ICAClient / ctxusb (ks.cfg:147-149) -> apt-get install icaclient
|
||||
# ctxusb, after update_local_repo.py has built the local flat repo at
|
||||
# /var/local/citrix-repo. The Fedora RPM names differ in case from the Debian
|
||||
# package names.
|
||||
# * dnf install teamviewer from the yum repo (ks.cfg:151-167) -> apt-get from
|
||||
# TeamViewer's apt repo. The repo file is written by late_command; the suite
|
||||
# is "stable" (TeamViewer publishes stable, not trixie) and the key is
|
||||
# fetched over https and pinned with signed-by.
|
||||
# * `git clone` is FAIL-SOFT here. The kickstart runs with set -e and aborts the
|
||||
# whole %post if the internal Gitea server is unreachable, which leaves a
|
||||
# half-provisioned machine. The 10-minute cron job picks the clone up on its
|
||||
# next run, so the Debian path logs the failure and continues. This is a
|
||||
# deliberate behavioural difference, not an oversight.
|
||||
# * `openssl passwd -6` in %pre (ks.cfg:83) produced a SHA-512 crypt hash for
|
||||
# the vdi<NNNNN> password. d-i has no openssl, so that password is set in
|
||||
# the installed system with chpasswd, which uses whatever crypt scheme the
|
||||
# target's PAM default is - yescrypt on trixie, not SHA-512. The password
|
||||
# VALUE is identical; only the stored hash format differs. The root and
|
||||
# VDI-ADMIN hashes are still the kickstart's exact SHA-512 strings, passed
|
||||
# through unchanged, so those two accounts match the Fedora machines exactly.
|
||||
# * `systemctl start disable-sleep.service` (ks.cfg:217) is dropped and only
|
||||
# `systemctl enable` is kept: late_command runs inside a chroot where systemd
|
||||
# is not the init process, so `start` cannot work. The unit is enabled and is
|
||||
# WantedBy=multi-user.target, so it starts on first boot - same end state.
|
||||
# For the same reason `systemctl daemon-reload` is not called; nothing needs
|
||||
# it before boot.
|
||||
# * `systemctl restart crond` (ks.cfg:190) -> `systemctl enable cron`. The
|
||||
# service is called cron on Debian, and it is not running in the chroot.
|
||||
# * The commented-out hourly auto_update cron line (ks.cfg:186) is not carried
|
||||
# over - it is dead in the kickstart too.
|
||||
#
|
||||
# late_command:
|
||||
# 1. writes /etc/firefox/policies/policies.json (ks.cfg:113-135)
|
||||
# 2. writes /etc/apt/sources.list.d/teamviewer.list (ks.cfg:152-162)
|
||||
# 3. writes /root/vdi-post.sh from the lines above and runs it under bash
|
||||
d-i preseed/late_command string \
|
||||
inv=$(cat /tmp/vdi.inventory 2>/dev/null || echo 00000); \
|
||||
echo "VDI: late_command, inventory=${inv}" >> /var/log/vdi-preseed.log; \
|
||||
mkdir -p /target/etc/firefox/policies; \
|
||||
printf "%s\n" "{" " \"policies\": {" " \"ManagedBookmarks\":" " [" " {" " \"toplevel_name\": \"Reyher\"" " }," " {" " \"name\": \"Arbeit\"," " \"url\": \"https://workspace.reyher.de/\"" " }" " ]" " }" "}" > /target/etc/firefox/policies/policies.json; \
|
||||
chmod 644 /target/etc/firefox/policies/policies.json; \
|
||||
chown 0:0 /target/etc/firefox/policies/policies.json; \
|
||||
mkdir -p /target/etc/apt/sources.list.d /target/usr/share/keyrings; \
|
||||
printf "%s\n" "deb [signed-by=/usr/share/keyrings/teamviewer.asc] https://linux.teamviewer.com/deb stable main" > /target/etc/apt/sources.list.d/teamviewer.list; \
|
||||
printf "%s\n" '#!/bin/bash' 'set -euo pipefail' 'INV="${1:-00000}"' 'LOG=/root/post-install.log' 'exec >>"$LOG" 2>&1' 'echo "=== VDI post-install, inventory ${INV} ==="' 'HOSTNAME="EXTVDIL${INV}"' 'USERNAME="vdi${INV}"' 'FULLNAME="VDI-${INV}"' 'PASSWORD="pwVDI#${INV}"' "ROOT_HASH='\$6\$3EpVOhxlL/EVU/8f\$Z.M5x/x5OdzBFW2C0IoNo5KCsLURBJZnp1BgcMWFz8gsjEPSgAlBKEs7CgZnRAGjbrEzgvUCEydmjtZYvUraJ/'" 'printf "%s\n" "$HOSTNAME" > /etc/hostname' 'printf "127.0.1.1\t%s\n" "$HOSTNAME" >> /etc/hosts' 'hostnamectl set-hostname "$HOSTNAME" 2>/dev/null || true' 'getent group sudo >/dev/null || groupadd sudo' 'if ! id VDI-ADMIN >/dev/null 2>&1; then' ' useradd -m -s /bin/bash -G sudo -c "VDI Admin" -p "$ROOT_HASH" VDI-ADMIN' 'fi' 'if ! id "$USERNAME" >/dev/null 2>&1; then' ' useradd -m -s /bin/bash -c "$FULLNAME" "$USERNAME"' 'fi' 'printf "%s:%s\n" "$USERNAME" "$PASSWORD" | chpasswd' 'if ! wget -q -O /usr/share/keyrings/teamviewer.asc https://linux.teamviewer.com/pubkey/currentkey.asc; then' ' echo "teamviewer key download failed"' 'fi' 'apt-get update || echo "apt-get update failed"' 'if [ -d /root/VDI-Linux/.git ]; then' ' ( cd /root/VDI-Linux && git pull ) || echo "git pull failed - continuing"' 'else' ' git clone https://nachos386.lcube-server.de/REYHER-Systemtechnik-Public/VDI-Linux /root/VDI-Linux || echo "git clone failed - continuing"' 'fi' 'if [ -f /root/VDI-Linux/update_local_repo.py ]; then' ' ( cd /root/VDI-Linux && python3 ./update_local_repo.py ) || echo "update_local_repo.py failed"' 'fi' 'apt-get update || echo "apt-get update failed"' 'apt-get install -y icaclient ctxusb || echo "citrix install failed"' 'apt-get install -f -y || true' 'apt-get install -y teamviewer || echo "teamviewer install failed"' 'cat > /root/auto_update.sh <<EOF' '#!/bin/bash' 'systemd-inhibit --what=sleep:idle --who="Auto Update Script" --why="Downloading system updates" /bin/bash -c "' ' pkcon refresh force' ' pkcon update --only-download' ' if pkcon offline-get-prepared >/dev/null 2>&1; then' ' pkcon offline-trigger' ' fi' '"' 'EOF' 'chmod +x /root/auto_update.sh' 'cat > /etc/systemd/system/disable-sleep.service <<EOF' '[Unit]' 'Description=Disable sleep and idle actions permanently' 'After=multi-user.target' '' '[Service]' 'Type=simple' 'ExecStart=/usr/bin/systemd-inhibit --what=sleep:idle --who="Permanent Inhibit" --why="Keep system always awake" --mode=block /bin/sleep infinity' 'Restart=always' '' '[Install]' 'WantedBy=multi-user.target' 'EOF' 'printf "%s\n" "*/10 * * * * root cd /root/VDI-Linux && python3 update_local_repo.py >> /var/log/update_local_repo.log 2>&1" >> /etc/crontab' 'printf "%s\n" "@reboot root bash -c \"until ping google.com -c1 >/dev/null 2>&1; do sleep 1; done;\" && cd /root/ && ./auto_update.sh >> /var/log/update_local_repo.log 2>&1" >> /etc/crontab' 'systemctl enable disable-sleep.service || echo "enable disable-sleep failed"' 'systemctl enable cron || echo "enable cron failed"' 'echo "VDI post-install complete"' > /target/root/vdi-post.sh; \
|
||||
chmod 700 /target/root/vdi-post.sh; \
|
||||
in-target bash /root/vdi-post.sh "$inv"
|
||||
|
||||
# ===========================================================================
|
||||
# GAPS - what the preseed mechanism cannot reproduce, consolidated
|
||||
# ===========================================================================
|
||||
# 1. `user --name=VDI-ADMIN` - impossible. user-setup rejects uppercase names
|
||||
# and re-prompts (hangs an unattended install). Done in late_command with
|
||||
# useradd instead. wheel -> sudo.
|
||||
# 2. Disk detection cannot run in preseed/early_command - disks are not visible
|
||||
# yet. Done in partman/early_command, the hook Debian documents for exactly
|
||||
# this.
|
||||
# 3. `lsblk` and `openssl` do not exist in d-i. Detection uses
|
||||
# /sys/block/*/removable + udevadm; hashing is done in the installed system
|
||||
# by chpasswd.
|
||||
# 4. `chvt 3` / /dev/tty3 prompt - no chvt or openvt in d-i, and preseed_command
|
||||
# redirects stdout to the log. Prompt goes to /dev/console, with a kernel
|
||||
# cmdline override and a timeout so it cannot hang forever.
|
||||
# 5. `pip install tqdm` - PEP 668 on Debian 13. Uses python3-tqdm.
|
||||
# 6. `createrepo_c` - no Debian equivalent; apt-utils (apt-ftparchive) is
|
||||
# installed instead for the local Citrix repo.
|
||||
# 7. `systemctl start` inside %post - no systemd in the chroot. The unit is
|
||||
# enabled instead and starts on first boot.
|
||||
# 8. `printf "%05d"` on the inventory number - the kickstart's own line breaks
|
||||
# on a number containing 8 or 9 (octal). Replaced with a padding loop.
|
||||
# 9. Password hash format for vdi<NNNNN> - the kickstart's `openssl passwd -6`
|
||||
# made SHA-512; chpasswd on trixie makes yescrypt. Same password, different
|
||||
# stored hash. Root and VDI-ADMIN keep the kickstart's exact SHA-512 hashes.
|
||||
# 10. The kickstart's own `printf "%05d"` bug (see 8) is fixed here, so an
|
||||
# inventory number such as 00019 installs correctly on Debian and would
|
||||
# not have on Fedora. Flagged rather than silently matched.
|
||||
# 11. `git clone` of the internal repo is FAIL-SOFT here, where the kickstart
|
||||
# (which runs under `set -euxo pipefail`) would abort the whole %post. The
|
||||
# reason: on Fedora the repo host was reachable during install; on a Debian
|
||||
# VDI the install may legitimately finish before the corporate network is up,
|
||||
# and aborting would leave a half-configured machine. The clone is logged and
|
||||
# the 10-minute cron job retries it. THIS IS A DELIBERATE BEHAVIOURAL
|
||||
# DIFFERENCE, not an oversight - if the repo must be present before first
|
||||
# boot, this line needs to fail hard instead and the installer needs to wait
|
||||
# for network.
|
||||
Vendored
+255
@@ -0,0 +1,255 @@
|
||||
# Debian port test harness
|
||||
|
||||
`run-tests.sh` proves that the Debian side of the VDI-Linux port actually works,
|
||||
and that the Fedora side has not regressed. It is a real harness: it builds a
|
||||
real apt repository from the real Citrix `.deb` packages, adds a real apt
|
||||
source, and asks real apt whether it can install the result. Nothing is
|
||||
simulated except the parts that would change the machine.
|
||||
|
||||
```sh
|
||||
sudo bash debian/test/run-tests.sh
|
||||
```
|
||||
|
||||
Run as root. It needs the two Citrix `.deb` files (see [Fixtures](#fixtures)).
|
||||
|
||||
Exit status is 0 when no test FAILED, 1 otherwise. A SKIP does not fail the run,
|
||||
but every skip prints why it skipped and what it would have checked. **A skip is
|
||||
not a pass**, and the summary says so.
|
||||
|
||||
## What it tests
|
||||
|
||||
| Test | What it proves |
|
||||
|------|----------------|
|
||||
| T00 | Environment: root, required tools, trixie, fixtures present |
|
||||
| T01 | The `.deb` fixtures really are version `26.08.0.225` |
|
||||
| T02 | `python3 -m py_compile` passes for `update_local_repo.py` and `configure_kde.py` |
|
||||
| T03 | Both modules **import** cleanly on Debian (no `tqdm`, no `pip`) |
|
||||
| T04 | The `tqdm` fallback is usable, not merely importable |
|
||||
| T05 | The flat repo builds; `Packages` has exactly 2 stanzas at the right version |
|
||||
| T06 | `apt-get update` exits 0 with no `E:`, no `Err:` and no warnings for the source |
|
||||
| T07 | apt can *see* the package: correct candidate, correct origin, install resolves |
|
||||
| T08 | Rebuilding twice is byte-identical and produces no duplicate stanzas |
|
||||
| T09 | `sync_debian` prunes stale `.deb` files (version bump cannot leave two versions) |
|
||||
| T10 | A corrupted index is rejected even with `trusted=yes` (control for T06/T07) |
|
||||
| T11 | The production `local-citrix-repo.list` has the shape the harness verified |
|
||||
| T12 | GPG `signed-by` path (design check; skips without a signing tool) |
|
||||
| T13 | Fedora path unregressed: tracked files identical, `sync_fedora` command sequence identical |
|
||||
| T14 | `bash -n` on every shell script the port adds |
|
||||
| T15 | Nothing was left behind: no source file, no cached indexes, no installs, no `__pycache__` |
|
||||
|
||||
### The repo build it tests
|
||||
|
||||
The exact production sequence, on a copy of the real `.deb` files in a temp
|
||||
directory:
|
||||
|
||||
```sh
|
||||
cd "$repo"
|
||||
apt-ftparchive packages . > Packages
|
||||
gzip -c Packages > Packages.gz
|
||||
apt-ftparchive release . > Release
|
||||
```
|
||||
|
||||
and the exact production source line:
|
||||
|
||||
```
|
||||
deb [trusted=yes] file:/var/local/citrix-repo ./
|
||||
```
|
||||
|
||||
with the path substituted for the temp directory. A flat ("trivial") archive:
|
||||
no `dists/` tree, suite `./`.
|
||||
|
||||
## What it does NOT test, and cannot
|
||||
|
||||
Being explicit matters more than the green summary.
|
||||
|
||||
1. **A real d-i install.** The harness never boots an installer. `debian/preseed.cfg`
|
||||
is owned and validated by another change; this harness does not test it at all.
|
||||
Note that `debconf-set-selections` validates line shape only - it silently accepts
|
||||
an invented question name - so it is not evidence that directives exist.
|
||||
|
||||
2. **An actual GUI session.** Nothing here starts Plasma, and no test asserts that
|
||||
`configure_kde.py` produces a working desktop. T03 proves it *imports*; whether
|
||||
the touchpad and power settings take effect on a real session is untested.
|
||||
`kwriteconfig6` is not installed here, so `configure_kde.KWRITE` is `None` and
|
||||
every write would no-op. That path needs a real Plasma machine.
|
||||
|
||||
3. **The Citrix preinst/postinst maintainer scripts.** `apt-get install --simulate`
|
||||
resolves dependencies; it does not run the package's scripts. Whether
|
||||
`icaclient`'s postinst succeeds on a real machine is untested. This is the
|
||||
single biggest gap: a dependency-resolvable package can still fail to configure.
|
||||
|
||||
4. **A real d-i/target filesystem for the repo path.** The harness builds the repo
|
||||
in a temp directory, never at `/var/local/citrix-repo`. It asserts the
|
||||
*shape* is identical (T11), not that the production path is writable in a
|
||||
target environment.
|
||||
|
||||
5. **The network path.** The Gitea release API and the download code are not
|
||||
exercised. T09 redirects the source files to a local directory, so
|
||||
`download_file` is only exercised indirectly. A changed release asset name
|
||||
would not be caught here.
|
||||
|
||||
6. **`apt-get update` inside a d-i chroot.** The preseed's `late_command` runs in
|
||||
an `in-target` context where apt behaves differently (no `_apt` user, different
|
||||
permissions). Untested.
|
||||
|
||||
7. **Fedora at runtime.** T13 compares source and command sequences; it does not
|
||||
run `createrepo_c`/`dnf`/`rpm` on Fedora. The command sequence matching is
|
||||
strong evidence but it is not an execution test. A Fedora 44 WSL distro exists
|
||||
on the development machine and was not used.
|
||||
|
||||
## Two spec'd checks that cannot fail, and what replaced them
|
||||
|
||||
This is the most important thing in this file. Two checks that look like tests
|
||||
are not tests.
|
||||
|
||||
### `apt-get update` exiting 0 with no `E:` lines
|
||||
|
||||
Measured on Debian 13: a repo whose `Packages` is **unreadable** produces
|
||||
|
||||
```
|
||||
Err:4 file:/tmp/.../repo ./ Packages
|
||||
Could not open file .../Packages - open (13: Permission denied)
|
||||
```
|
||||
|
||||
and `apt-get update` still **exits 0 with no `E:` lines**. The same is true of a
|
||||
repo with **no `Release` file at all**, and of a repo with **duplicate stanzas**.
|
||||
So "exit 0 and no `E:`" passes on a broken repo.
|
||||
|
||||
The harness runs the spec'd check as T06 *and* the stronger check separately: no
|
||||
`Err:` lines, no `W:` lines for that source, and then T07 requires apt to name the
|
||||
exact version from that exact directory. T10 is the control that proves the
|
||||
strong checks can fail: it corrupts `Packages` after `Release` was built and
|
||||
asserts apt **rejects** it with a hash mismatch. Without T10, T06/T07 could be
|
||||
passing vacuously.
|
||||
|
||||
### `git diff main -- ks.cfg`
|
||||
|
||||
`ks.cfg` is **not in the repository**. It is not in `main`, not in `debian-port`,
|
||||
and `git log --all -- ks.cfg` is empty. It lives one level above the repo, in the
|
||||
parent directory, untracked.
|
||||
|
||||
So `git diff main -- ks.cfg` exits 0 and prints nothing - because the path does
|
||||
not exist on either side, not because the file is unchanged. The harness detects
|
||||
this with `git cat-file -e main:ks.cfg` and reports it as **SKIP, explicitly
|
||||
labelled VACUOUS**, rather than as a pass. It then prints the sha256 of the real
|
||||
out-of-tree file so a change to it is at least visible.
|
||||
|
||||
## Line endings will fool you
|
||||
|
||||
This repo is checked out on Windows. Every tracked file in the working tree has
|
||||
CRLF line endings; every blob in git has LF. A plain `git diff main` therefore
|
||||
reports **all five files as completely rewritten**, including
|
||||
`RPM-GPG-KEY-citrix-local` with 104 changed lines - the key itself is byte-identical.
|
||||
|
||||
The harness compares modulo CRLF (`tr -d '\r' | cmp`). If you see a huge diff,
|
||||
check line endings before believing it.
|
||||
|
||||
## The apt index cache will fool you
|
||||
|
||||
`apt-cache policy` and `apt-get update` read cached indexes in
|
||||
`/var/lib/apt/lists`. During development, a **wrong GPG key** appeared to be
|
||||
accepted - `exit 0`, no `E:`, package still visible - purely because a good index
|
||||
was cached from an earlier run.
|
||||
|
||||
Every case that must fail purges that repo's cached index files first
|
||||
(`purge_apt_lists_for`). Any test that checks "can apt see the package" without
|
||||
purging is testing the cache, not apt.
|
||||
|
||||
Related: `/tmp` is wiped between separate `wsl` invocations on this machine
|
||||
(`systemd-tmpfiles`). Anything expected to survive across invocations must live
|
||||
in `/root`.
|
||||
|
||||
## GPG signing: why `trusted=yes` is the right call
|
||||
|
||||
Production does not sign the Debian repo, and T12 exists to check that decision
|
||||
rather than assume it. A stock trixie ships **no `gpg`** - only `/usr/bin/sqv`,
|
||||
the Sequoia verifier that apt calls internally. So signing would add a `gpg`
|
||||
dependency that Debian 13 does not have by default, in an installer environment
|
||||
where new dependencies are the fragile thing.
|
||||
|
||||
The signing path was measured out of band (a throwaway key generated with Fedora
|
||||
WSL's `gpg`, because Debian has none), with the apt cache purged between cases:
|
||||
|
||||
| Keyring | Result |
|
||||
|---------|--------|
|
||||
| armored `.asc`, correct key | exit 0, no `E:`, package visible |
|
||||
| armored `.asc`, **wrong** key | exit 100, `E:`, `Missing key`, not visible |
|
||||
| binary `.gpg`, correct key | exit 0, no `E:`, package visible |
|
||||
| binary `.gpg`, **wrong** key | exit 100, `E:`, `Missing key`, not visible |
|
||||
| `trusted=yes`, no signature | exit 0, no `E:`, package visible |
|
||||
|
||||
Two conclusions:
|
||||
|
||||
- `signed-by` **works correctly** on a flat `file:` repo on trixie, for both
|
||||
keyring formats. It is not broken; it is simply not worth it here.
|
||||
- `trusted=yes` does **not** mean "no integrity checking". T10 shows a tampered
|
||||
`Packages` is rejected with `E: ... Hash Sum mismatch` regardless. Signing
|
||||
would only add proof of *authorship*, which is meaningless for a repository the
|
||||
machine builds from packages it just downloaded and verified itself.
|
||||
|
||||
T12 skips loudly when no signing tool is present, which is the normal case on a
|
||||
stock trixie. Install `gpg` to make it run.
|
||||
|
||||
## Fixtures
|
||||
|
||||
The two real packages are expected next to the repo, not inside it:
|
||||
|
||||
```
|
||||
LinuxISO/
|
||||
icaclient_26.08.0.225_amd64.deb (256 MB)
|
||||
ctxusb_26.08.0.225_amd64.deb (178 KB)
|
||||
VDI-Linux/ <- the repo
|
||||
debian/test/run-tests.sh <- this harness
|
||||
```
|
||||
|
||||
Override with `DEB_DIR=/path/to/debs sudo -E bash debian/test/run-tests.sh`.
|
||||
|
||||
The 256 MB file is copied into a temp directory, which is fast on native
|
||||
filesystem and slow off `/mnt/c`. If `/tmp` is small, set `TMPDIR` to somewhere
|
||||
with ~600 MB free.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Debian 13 (trixie), root.
|
||||
- `apt-ftparchive`, `apt-get`, `apt-cache`, `dpkg-deb`, `python3`, `gzip` - all
|
||||
present in a stock install.
|
||||
- `git` **for T13 only**. It is not part of a stock trixie image; without it T13
|
||||
skips and says so. Install it if you want the Fedora regression checks to run:
|
||||
`apt-get install -y --no-install-recommends git`. Note this changes the test
|
||||
machine, which is why the harness treats its absence as a skip rather than
|
||||
installing it itself.
|
||||
- `gpg` **for T12 only**, and only if you want to re-check the signing decision.
|
||||
|
||||
## Safety
|
||||
|
||||
The harness is designed to be safe to run on a machine you care about.
|
||||
|
||||
- It never writes to `/var/local/citrix-repo`. It records that directory's mtime
|
||||
before the run and asserts it is unchanged in T15.
|
||||
- It never installs anything. The only `apt-get install` is `--simulate`. T15
|
||||
compares the installed package count before and after.
|
||||
- It adds exactly one apt source file, `/etc/apt/sources.list.d/zz-vdi-test-$$.list`,
|
||||
and removes it. T15 verifies the removal happened.
|
||||
- It removes only the apt index files it created, matched by the encoded repo path,
|
||||
never `/var/lib/apt/lists` wholesale.
|
||||
- It removes any keyring it installed, matched by the `zz-vdi-test-*` prefix, and
|
||||
only `rmdir`s `/etc/apt/keyrings` (which fails harmlessly if it was already there
|
||||
with other keys in it).
|
||||
- It never writes `__pycache__` into the repo: `PYTHONDONTWRITEBYTECODE=1` and
|
||||
`PYTHONPYCACHEPREFIX` are set, and T15 asserts the repo is clean.
|
||||
- All scratch work happens in one `mktemp -d` directory, removed at the end.
|
||||
- A failing test does not abort the run, so you get the whole picture in one pass.
|
||||
|
||||
## Interpreting a failure
|
||||
|
||||
- **T05/T06/T07 failing together** - the repo build is broken. Look at T05 first.
|
||||
- **T07 fails but T05 passes** - the repo is fine but apt cannot consume it; check
|
||||
directory permissions (apt drops to `_apt`, so the repo path must be traversable).
|
||||
- **T09 fails** - `sync_debian` is leaving old versions in the published
|
||||
directory. On Debian, filenames carry the version, so copying without deleting
|
||||
leaves every previous release indexed and makes rollback impossible.
|
||||
- **T13 fails on the command sequence** - compare the printed `MAIN-CMDS` and
|
||||
`FEDORA-CMDS` lists. Both sides are normalised to `<REPO>`; if they differ, the
|
||||
Fedora path genuinely changed.
|
||||
- **T15 fails on residue** - the teardown did not finish. Check the messages
|
||||
immediately above it.
|
||||
Vendored
+1002
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user