From: Matthieu Baerts <matt...@kernel.org>

Similar to wpasupplicant and NetworkManager, this group is used in the
D-Bus policy, see the file src/iwd-dbus.conf.

A new post-install step is added, simply to create the netdev group.
Note that 'addgroup' will return the exit code 0 if the group has been
successfully created, or if it already exists.

'adduser' is then now needed to create the new group.

Closes: https://bugs.debian.org/1098212
Reported-by: Philip Stewart <philip.stewart.pub...@gmail.com>
Suggested-by: Chris Hofstaedtler <z...@debian.org>
Signed-off-by: Matthieu Baerts <matt...@kernel.org>
---
 debian/control      |  1 +
 debian/iwd.postinst | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 debian/iwd.postinst

diff --git a/debian/control b/debian/control
index e52e3bdb..5a5a8856 100644
--- a/debian/control
+++ b/debian/control
@@ -21,6 +21,7 @@ Architecture: linux-any
 Depends:
  ${misc:Depends},
  ${shlibs:Depends},
+ adduser,
 Recommends:
  dbus | dbus-system-bus,
  wireless-regdb,
diff --git a/debian/iwd.postinst b/debian/iwd.postinst
new file mode 100644
index 00000000..f2720bf7
--- /dev/null
+++ b/debian/iwd.postinst
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -e
+
+# This script can be called in the following ways:
+#
+# After the package was installed:
+#      <postinst> configure <old-version>
+#
+#
+# If prerm fails during upgrade or fails on failed upgrade:
+#      <old-postinst> abort-upgrade <new-version>
+#
+# If prerm fails during deconfiguration of a package:
+#      <postinst> abort-deconfigure in-favour <new-package> <version>
+#                 removing <old-package> <version>
+#
+# If prerm fails during replacement due to conflict:
+#      <postinst> abort-remove in-favour <new-package> <version>
+
+case "$1" in
+    configure)
+        # Create netdev group used in the D-Bus policy. No error if it exists.
+        addgroup --quiet --system netdev
+        ;;
+
+    abort-upgrade|abort-deconfigure|abort-remove)
+        ;;
+
+    *)
+        echo "$0 called with unknown argument \`$1'" 1>&2
+        exit 1
+        ;;
+esac
+
+#DEBHELPER#
-- 
2.47.1

Reply via email to