From 2f72e1ebce1ccc22ee7898800f3b947bb5eb9da8 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 28 Jun 2023 17:03:54 +0200 Subject: [PATCH] debian: install udev rule and create related group postinst script based on the example here: https://www.debian.org/doc/manuals/securing-debian-manual/bpp-lower-privs.en.html Signed-off-by: Oliver Smith --- debian/control | 2 +- debian/sispmctl.install | 1 + debian/sispmctl.postinst | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 debian/sispmctl.postinst diff --git a/debian/control b/debian/control index 5462dc5..ef976ba 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Homepage: http://sispmctl.sourceforge.net/ Package: sispmctl Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser (>= 3.11) Description: Control Gembird SIS-PM programmable power outlet strips The sispmctl tool can control Gembird SIS-PM Silver Shield programmable power outlet strips (also known under the name Revolt Intelli-Plug) from diff --git a/debian/sispmctl.install b/debian/sispmctl.install index 378eac4..98efbac 100644 --- a/debian/sispmctl.install +++ b/debian/sispmctl.install @@ -1,2 +1,3 @@ /usr/bin/sispmctl /usr/share/man/man1/sispmctl.1 +/usr/share/doc/sispmctl/examples/60-sispmctl.rules /lib/udev/rules.d/ diff --git a/debian/sispmctl.postinst b/debian/sispmctl.postinst new file mode 100755 index 0000000..3513976 --- /dev/null +++ b/debian/sispmctl.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +case "$1" in + configure) + if ! getent group | grep -q "^sispmctl:" ; then + echo -n "Adding group sispmctl.." + addgroup --quiet --system sispmctl 2>/dev/null ||true + echo "..done" + fi + ;; +esac