7 Commits
Author SHA1 Message Date
Mistercoolertyper be6379107f tests: strengthen T17's over-grant check, add T21 modes, cross-file contract in T19
T17's package-remove assertion could not fire: it used a sleeper that had already
exited, so pkcheck returned 127 and the check printed 'info' rather than a
verdict. A negative assertion that cannot fail is worse than none. It now owns a
sleeper (setsid + exec -a, pid confirmed via /proc before pkcheck is trusted),
and 127 or any unexpected code is a FAIL rather than a pass. Verified capable of
failing by injecting package-remove into the rule: pkcheck went rc=2 -> rc=0 and
the assertion went red; the rule was then restored (sha256 unchanged).

T21 asserts both scripts are recorded as 100755 in the index. core.fileMode=false
means a Windows checkout silently drops the executable bit, so a fresh Linux
clone got non-executable files.

T19 now reads update_local_repo.OFFLINE_UPDATE_SCRIPT and asserts the preseed
names the same path. Both files hard-code it, and nothing tied them together, so
a rename would leave auto_update.sh printing 'not installed yet' with everything
else green.

Final: 107 passed, 0 failed, 2 skipped. The skips stay honest (T12 needs gpg;
T13's ks.cfg assertion is vacuous because the file is not in the repo).
2026-11-04 10:38:17 +01:00
Mistercoolertyper e9a447da4d preseed: bring the readable vdi-post.sh copy back in line with what runs
15d6518 rewrote the late_command payload (inline pkcon sequence -> delegation to
/usr/local/sbin/vdi-offline-update, plus enabling vdi-offline-update.timer) but
left the readable comment copy of the same script ~100 lines above it unchanged.
The two are meant to be the same script, so anyone reading preseed.cfg to learn
what a Debian install does was reading something that no longer matched the
payload. Caught by 8cc5's validator, which compares them byte-for-byte.

No behaviour change: the runtime payload was already correct. Also fixes a stale
comment - packagekit-tools was described as being used by /root/auto_update.sh,
which now delegates; the helper is what calls pkcon, and packagekit-tools is
still required for it.

Verified independently by running the reassembled late_command against a fake
/target: the generated script is 70 lines, parses, delegates, contains no inline
pkcon sequence, enables the timer, and is byte-identical to the comment copy.

Also tightens the README's claim about other updaters: unattended-upgrades is
absent, and apt.systemd.daily gates every install step on 'command -v
unattended-upgrade', so apt-daily-upgrade only refreshes the index. Checked
rather than asserted.
2026-11-04 10:38:13 +01:00
Mistercoolertyper 96815c5ffb git: record debian/make-iso.sh and debian/test/run-tests.sh as executable
core.fileMode=false on a Windows checkout, so git never picked up the executable
bit from disk. Both files are 100755 in the index now; a fresh Linux clone gets
them runnable instead of needing chmod.
2026-11-04 10:30:48 +01:00
Mistercoolertyper 402fea66fd tests: cover polkit rule, offline-update timer, preseed generation and ISO build
Adds T16-T20 to the Debian harness (103 passed, 0 failed, 2 skipped):

T16  the polkit rule is installed, mode 644, covers the two update actions,
     does not over-grant package-remove/reinstall/untrusted, and is idempotent.
T17  the real decision, in both directions: a sudo-group user is authorised
     (pkcheck rc=0) with the rule, and still prompted (rc=2) without it. The
     control is the point - without it the test cannot fail.
T18  vdi-offline-update: bash -n, unit verification, the throttle stamp, that
     a second run is skipped, that a stale stamp lets it run, that pkcon exit 5
     is reported as 'no updates available' rather than a download failure, and
     that /system-update is never armed without a prepared payload.
T19  the preseed still generates a script that parses, delegates to
     vdi-offline-update instead of an inline pkcon sequence, and enables cron
     and the timer.
T20  make-iso.sh: refuses to overwrite its input or an existing output, then
     checks the built image - preseed byte-identical, all 40 kernel lines
     patched, gtk.cfg patched, no doubled parameters, El Torito present with
     both BIOS and UEFI images, no source file missing, and size within 16MB of
     the original (the bloat regression).

Skips stay honest: T12 needs gpg, T13's ks.cfg assertion is vacuous because
the file was never in the repo.
2026-11-04 10:30:30 +01:00
Mistercoolertyper 15d65183dc Debian: passwordless updates, offline updates, and install ISO builder
Ports the update behaviour of the Fedora clients to Debian, and adds the
Debian equivalent of putting ks.cfg on the installation medium.

Updates
-------
Debian's shipped polkit policy only lets a sudo-group user trigger
upgrade-system and trigger-offline-update without a password. The actions
pkcon refresh and pkcon update actually use (system-sources-refresh and
system-update) are auth_admin, so a desktop user was prompted - a
behavioural difference from Fedora. update_local_repo.py now installs
/etc/polkit-1/rules.d/60-vdi-no-password-updates.rules granting exactly
those two plus package-install to group sudo. package-remove,
package-reinstall and package-install-untrusted stay auth_admin.

The offline update itself ports unchanged: Debian 13 PackageKit 1.3.1
supports offline-get-prepared and offline-trigger, and
packagekit-offline-update.service is wired into system-update.target.
Scheduling moves from an @reboot cron line to vdi-offline-update.timer
(6h, Persistent), with /root/auto_update.sh delegating to the same script
so there is one implementation instead of two.

Both are installed by update_local_repo.py, not only by the preseed, so
already-provisioned machines pick them up on their next 10-minute cron run.

install ISO
-----------
debian/make-iso.sh bakes preseed.cfg into a Debian netinst ISO and adds
auto=true priority=critical preseed/file=/cdrom/preseed.cfg to every boot
menu entry, then verifies its own output.

Measured, not assumed
---------------------
* subject.local == true never matches in this environment: pkcheck returns
  2 with the clause and 0 without it, same sudo-group user. It was in the
  first version of the rule and is removed; the reasoning is in the source.
* pkcon exits 5 for "no packages to update", which is the normal answer on
  a patched box and was being logged as a download failure. Fixed.
* offline-get-prepared exits 4 when nothing is prepared, so the Fedora
  "if ... offline-trigger" guard is load-bearing - triggering anyway can
  leave a dangling /system-update symlink that breaks the next boot.
* Extracting a netinst and rebuilding with "xorriso -as mkisofs" grows it
  792MB -> 988MB because Debian shares identical file extents; replaying
  the original session with -map keeps dedup and the boot record.
* A hardcoded menu list misses isolinux/gtk.cfg, where the BIOS *default*
  entry lives, so the machine still prompted. Menus are discovered now.

Tests: 90 passed, 0 failed, 2 skipped. T17 asserts the polkit decision in
both directions (authorised with the rule, prompted without it), because a
check that cannot fail proves nothing.
2026-11-04 10:16:23 +01:00
Mistercoolertyper 4f1a4530aa Serialise concurrent harness runs and purge stale apt indexes
Two runs of the harness share /var/lib/apt/lists and /etc/apt/sources.list.d.
With two in flight, one run's teardown deleted the other's temp repo while apt
was reading it, producing 'Could not open file .../vdi-debian-test.<other>' -
a failure that looks like a port bug but is a collision. Take a flock for the
duration of the run, and clear indexes left by earlier runs whose temp
directory no longer exists.
2026-11-04 09:25:17 +01:00
Mistercoolertyper 6ddb1d251a 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.
2026-11-04 09:24:57 +01:00