pkg: build a local .deb; de-duplicate onto DAEMON's systemd/nativehost/man page
DAEMON landed packaging/nativehost/, packaging/systemd/{velox.service,velox.socket}
(real sd_listen_fds() socket activation) and cli/man/velox.1 on main while this was
in flight, duplicating paths this branch had drafted independently. Per CLAUDE.md
(packaging/nativehost/ is DAEMON's; the rest of packaging/ is PKG/QA's), DAEMON's
copies are kept as the single source and this branch's packaging/native-messaging/,
packaging/man/velox.1 and stale packaging/systemd/velox.service are dropped rather
than maintained twice. The root CMakeLists.txt's install() rules now point at
DAEMON's paths directly, install both systemd units (not just velox.service), and
docs/07-packaging.md / packaging/README.md no longer claim there's no socket
activation — there is, and this package now ships it.
Adds the local-test-only .deb itself: debian/{control,rules,postinst,postrm,
changelog,copyright}, a placeholder icon set, the desktop entry and PKG/QA's own
man pages (veloxd.8, velox-gui.1 — velox.1 stays DAEMON's). libveloxcore stays
static (no consumer needs a .so yet); pairing has no real approval UI in this
build (D1 unbuilt), so postinst and packaging/README.md both say VELOX_PAIR_AUTO=1
is required and print it prominently. No PPA, no GPG — local dpkg -i only.
Verified live: dpkg-buildpackage -us -uc -b, dpkg -i, socket activation (systemctl
--user enable --now velox.socket), `velox ls` against the running daemon, lintian
clean, dpkg -r removes the manifest/units and leaves $XDG_DATA_HOME/velox alone.
.gitignore now excludes dpkg-buildpackage's debhelper build tree and obj-*/ (the
debuild output dir) — debian/control et al. stay tracked, everything debhelper
regenerates does not.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0176u3fTrxegrGNm2yC7r69W
This commit is contained in:
+92
@@ -0,0 +1,92 @@
|
||||
#!/bin/sh
|
||||
# postinst for velox (local test build). See packaging/README.md.
|
||||
set -e
|
||||
|
||||
NM_MANIFEST_SRC=/usr/lib/mozilla/native-messaging-hosts/com.velox.host.json
|
||||
NM_MANIFEST_NAME=com.velox.host.json
|
||||
|
||||
# Every real (human) user with a home directory — UID range matches Debian's own
|
||||
# adduser default (login.defs UID_MIN=1000), not just "everyone in /home" (a service
|
||||
# account can have a home dir too) and not root.
|
||||
real_users() {
|
||||
getent passwd | awk -F: '$3 >= 1000 && $3 < 60000 && $6 != "" {print $1":"$6}'
|
||||
}
|
||||
|
||||
# Per-user native-messaging manifest (ADR 0003 / docs/05 §4.A): needed for BOTH
|
||||
# deb/tarball and snap Firefox — the system-wide manifest this package also installs at
|
||||
# $NM_MANIFEST_SRC only covers deb/tarball Firefox, never snap. Runs unconditionally,
|
||||
# not just when snap is detected: a per-user login.defs-based install can't assume every
|
||||
# user runs the same Firefox flavour, and dropping a JSON file nobody reads is harmless.
|
||||
install_per_user_manifests() {
|
||||
[ -f "$NM_MANIFEST_SRC" ] || {
|
||||
echo "velox: native-messaging host not built yet (nmhost lane not landed) —" \
|
||||
"skipping per-user manifest install."
|
||||
return 0
|
||||
}
|
||||
real_users | while IFS=: read -r user home; do
|
||||
[ -d "$home" ] || continue
|
||||
dest_dir="$home/.mozilla/native-messaging-hosts"
|
||||
install -d -o "$user" -g "$user" -m 0755 "$dest_dir" 2>/dev/null || {
|
||||
echo "velox: could not create $dest_dir for $user — skipping" >&2
|
||||
continue
|
||||
}
|
||||
cp "$NM_MANIFEST_SRC" "$dest_dir/$NM_MANIFEST_NAME"
|
||||
chown "$user:$user" "$dest_dir/$NM_MANIFEST_NAME"
|
||||
chmod 0644 "$dest_dir/$NM_MANIFEST_NAME"
|
||||
done
|
||||
}
|
||||
|
||||
# docs/07-packaging.md: detect snap Firefox and say so — the extension pairs over
|
||||
# loopback WebSocket there (ADR 0003), not native messaging from inside the sandbox.
|
||||
note_snap_firefox() {
|
||||
if command -v snap >/dev/null 2>&1 && snap list firefox >/dev/null 2>&1; then
|
||||
cat <<'EOF'
|
||||
|
||||
velox: Firefox is installed as a snap on this system. The extension will pair with
|
||||
veloxd over the loopback WebSocket (ws://127.0.0.1:<port>), not native
|
||||
messaging — this is expected (see docs/adr/0003, ADR 0003) and needs no
|
||||
action from you.
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
install_per_user_manifests
|
||||
note_snap_firefox
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
============================================================================
|
||||
velox: LOCAL TEST BUILD — read this before pairing the extension
|
||||
============================================================================
|
||||
No real pairing-approval UI is built into this package yet (it needs
|
||||
libdbus-1-dev, which this build's dependencies do not include). veloxd's
|
||||
only pairing approver in this build auto-rejects every request UNLESS you
|
||||
set VELOX_PAIR_AUTO=1 in its environment — there is no prompt to accept or
|
||||
decline; it is all-or-nothing. Do not run this on a machine or account
|
||||
where you would not want every pairing request accepted automatically.
|
||||
|
||||
systemctl --user edit velox.service
|
||||
# add, in the [Service] section:
|
||||
# Environment=VELOX_PAIR_AUTO=1
|
||||
|
||||
debhelper's dh_installsystemduser marks velox.service and velox.socket enabled (the
|
||||
pair together, via velox.service's Also=velox.socket) for your next login session
|
||||
automatically. For your CURRENT session, start socket activation now yourself — a
|
||||
root postinst has no live user session to reach:
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now velox.socket
|
||||
|
||||
See packaging/README.md in the source tree for the rest of this build's
|
||||
testing-only limitations (placeholder icon, no license chosen yet, no
|
||||
libveloxcore.so — it is linked statically).
|
||||
============================================================================
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user