Files
microduck/mediad/systemd
Fabien Danieau 90fcc86132 Adopt old edits on the first write too, and trim the layer helpers
adopt_base_edits ran only at robotd startup. An edit made while robotd
was stopped (robotctl configure, policy add on a bench board) created
the user layer first, so adoption never ran and the old edits stayed in
/etc, to be lost at the next OS update. Every writer now adopts under
its own hold of the lock before writing.

Also: one read_optional helper instead of three copies, padd calls
config_stamp directly, and mediad's comments name both layers.

Tested on a Radxa Zero 3W (microduck OS, daemon 0.17.9 with robotd,
robotctl and updaterd bind-mounted): adoption at start, adoption on a
robotctl write with robotd stopped, an edit through robotd, a restored
base keeping the user's values, a broken user layer leaving robotd up,
the token move with its symlink, and mediad's sandbox reading both files.

Assisted-by: Claude:claude-opus-5-5
2026-10-29 10:15:51 +01:00
..