From 307c0634613ed947411800b4e64b04006007733f Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 28 Jul 2026 22:03:49 +0100 Subject: [PATCH] Install and use sysusers.d config files sysusers.d config files allow a package to use declarative configuration instead of manually written maintainer scripts. This also allows image-based systems to be created with /usr/ only, and also allows for factory resetting a system and recreating /etc/ on boot. https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html Note that this does not require a hard dependency on systemd, debhelper generates depetencies correctly so that they work out of the box on non-systemd and non-linux Debian builds seamlessly. --- debian/control | 4 ++-- debian/midiminder.sysusers | 1 + debian/postinst | 8 -------- 3 files changed, 3 insertions(+), 10 deletions(-) create mode 100644 debian/midiminder.sysusers diff --git a/debian/control b/debian/control index 9ae229a..694cfc3 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: midiminder Section: sound Priority: optional Maintainer: John Horigan -Build-Depends: debhelper-compat (= 13), libasound2-dev, libfmt-dev, libicu-dev +Build-Depends: debhelper-compat (= 13), dh-sequence-installsysusers, libasound2-dev, libfmt-dev, libicu-dev Standards-Version: 4.7.0 Homepage: https://github.com/mzero/midiminder Rules-Requires-Root: no @@ -10,7 +10,7 @@ Rules-Requires-Root: no Package: midiminder Architecture: any Multi-Arch: foreign -Depends: ${misc:Depends}, ${shlibs:Depends}, adduser +Depends: ${misc:Depends}, ${shlibs:Depends} Description: MIDI connection minder & viewer Keeps track of connections between MIDI ports (hardware & software alike). If those connections are lost because the hardware disconnects, or the diff --git a/debian/midiminder.sysusers b/debian/midiminder.sysusers new file mode 100644 index 0000000..9bbf15a --- /dev/null +++ b/debian/midiminder.sysusers @@ -0,0 +1 @@ +u! midiminder -:audio "midiminder daemon" /run/midiminder diff --git a/debian/postinst b/debian/postinst index 414b141..a4e98b7 100755 --- a/debian/postinst +++ b/debian/postinst @@ -2,12 +2,6 @@ set -e -create_service_user() { - adduser --system --home /run/midiminder --gecos "midiminder daemon" \ - --no-create-home --disabled-password --ingroup audio \ - --quiet midiminder || true -} - suggest_package_removal() { if [ \ "$(dpkg-query --showformat='${db:Status-Status}' -W $1 2>/dev/null)" \ @@ -43,8 +37,6 @@ advise_old_rules() { } if [ "$1" = "configure" ]; then - create_service_user - suggest_package_removal amidiauto stop_and_disable_service amidiauto