feat: usb-automount feature — udev+systemd auto-mount of USB sticks, flag-gated like autostart

features/usb-automount.sh (installed via ./install.sh --feature, flag
usb-automount) mounts every unmounted removable block device at
/media/<label> — world-writable via -o umask=000 (fallback plain mount),
label-collision bump -2/-3, no-label -> usb-<name>. First root run
self-installs the hotplug udev rule (/etc/udev/rules.d/99-usb-automount.rules,
SYSTEMD_WANTS=usb-automount.service) + udevadm reload/trigger; an existing
rule is never overwritten. systemd/usb-automount.service (Type=oneshot,
WantedBy=multi-user.target) covers boot + hotplug + manual start, gated in
postinstall.sh's systemd loop exactly like autostart. Purpose: a plugged-in
stick is ready for pos system backup's post-verify USB copy without manual
mounting. Docs: SYSTEMD/SCRIPTS/README/AGENT_Context (tree, filetable —
postinstall.sh count corrected 152->163, it was already stale). Verified:
stub suite /tmp/opencode/usb-automount-test 47/47 green; make gen && make check.
This commit is contained in:
Your Name
2026-08-13 03:40:13 -04:00
parent d4d38ad901
commit a3c01a0394
8 changed files with 217 additions and 19 deletions
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Auto-mount USB storage (usb-automount feature)
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/usb-automount.sh
[Install]
WantedBy=multi-user.target