Files
firmware/pkgs/anvil-core/control/postinst
Oleksandr ShyshatskyiandClaude Opus 5 15aa6abdda The boot database is compiled on the printer too, not only by the build
s6-rc's database is generated from anvil-core's etc/s6-rc/source, and the
only thing that ran s6-rc-compile was the payload build. So `opkg upgrade
anvil-core` on a printer wrote new service definitions and left the machine
booting the database compiled from the old ones -- the upgrade landed and
changed nothing.

anvil-core ships bin/anvil-s6-rc-compile.sh and its postinst calls it.
anvil-s6-rc calls it too, because s6-rc-compile writes its own execline
shebang and oneshot runner into every database it produces, so one left by
the previous s6-rc is not one this s6-rc should run.

The payload build calls the same script rather than its own copy of the
compile, passing the database name: given one the script prunes every other
database, which is what keeps two builds of one commit byte-identical.
Without a name it timestamps and keeps the database it replaced, so a printer
that will not boot has one to point `current` back at. Nothing live is
touched either way -- a running supervision tree keeps its database until the
next boot, so an upgrade cannot restart services mid-print.

anvil-s6-rc gains PKG_STAMP_EXTRA: its version comes from the tarball and
cannot see control/postinst, and a stamp that cannot see an input reports
"already current" and ships the previous .ipk.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AVUMfbNuKUWWV32PBcydwb
2026-08-31 12:22:48 +03:00

30 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# Put the printer on what this package just installed.
#
# Two things an unpacked package is not enough for, both because what the
# printer reads is generated or symlinked rather than shipped:
#
# the boot path $MODDIR/prog/firmwareExe is a new file, and /usr/prog
# goes on running the copy it already had
# the boot database etc/s6-rc/source/ is text, and the database the last
# boot used was compiled from the PREVIOUS definitions --
# so a changed or added service would not reach the
# printer at all
#
# The same two scripts run from installer/runFirmwareExe.sh on the .tgz path.
# Their own guards are what make this a no-op when the build installs this
# package rather than a printer.
set -e
MODDIR=/usr/data/anvil
if [ -x "$MODDIR/bin/anvil-link-prog.sh" ]; then
"$MODDIR/bin/anvil-link-prog.sh"
fi
if [ -x "$MODDIR/bin/anvil-s6-rc-compile.sh" ]; then
"$MODDIR/bin/anvil-s6-rc-compile.sh"
fi
exit 0