Sunil Mohan Adapa 71a50e6d19
privileged: Add systemd units for socket activating the daemon
Tests:

- Daemon starts up with uid/gid set to root.

- Daemon does not run by default if a request is not received. Socket file is
  created with 666 permissions and root:root ownership. Socket file parent directory
  is created with 755 permissions and root:root ownership.

- Daemon starts if a request is sent to the socket using nc.

- If there an exception in daemon starting, then restart is done every second to
  5 seconds, forever.

- Build a Debian package.

  - Install it on fresh trixie Debian VM. Ensure that setup works and privileged
    daemon is auto-enabled.

  - Start a fresh trixie Debian VM and install freedombox from Debian repos.
    Upgrade to the built package. Privileged daemon works and is auto-enabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-16 22:41:20 +05:30

39 lines
1.4 KiB
Makefile
Executable File

#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
export DH_VERBOSE=1
export PYBUILD_DESTDIR=debian/tmp
export PYBUILD_SYSTEM=custom
export PYBUILD_CONFIGURE_ARGS=make configure
export PYBUILD_BUILD_ARGS=make PYTHON={interpreter} build
export PYBUILD_INSTALL_ARGS=make PYTHON={interpreter} DESTDIR={destdir} install
export PYBUILD_CLEAN_ARGS=make clean
export PYBUILD_TEST_ARGS=make PYTHON={interpreter} check-tests
FBX_VERSION := $(shell ./run --develop --version | awk 'NF{ print $$NF }')
%:
dh $@ --with python3 --buildsystem=pybuild
override_dh_auto_install-indep:
dh_auto_install
./run --develop --list-dependencies | sort | tr '\n' ', ' | \
sed -e 's/^/freedombox:Depends=/' >> debian/freedombox.substvars
# Ensure the list of dependencies is not empty.
test -s debian/freedombox.substvars || exit 1
# Check that FreedomBox version number is matching.
ifneq ($(FBX_VERSION),$(DEB_VERSION))
>&2 echo "WARNING: FreedomBox version $(FBX_VERSION) does not match package version $(DEB_VERSION)."
endif
override_dh_installsystemd:
# Do not enable or start any service other than FreedomBox service. Use
# of --tmpdir is a hack to workaround an issue with dh_installsystemd
# (as of debhelper 13.5.2) that still has hardcoded search path of
# /lib/systemd/system for searching systemd services. See #987989 and
# reversion of its changes.
dh_installsystemd --tmpdir=debian/tmp/usr --package=freedombox \
plinth.service freedombox-privileged.socket