[neon/kde/powerdevil/Neon/unstable] debian: setcap workaround
Jonathan Riddell
null at kde.org
Thu Oct 15 13:34:52 BST 2020
Git commit 583d644bab8776676d5d8e77ae07f18674dcbfc8 by Jonathan Riddell.
Committed on 15/10/2020 at 12:34.
Pushed by jriddell into branch 'Neon/unstable'.
setcap workaround
A +19 -0 debian/powerdevil.postinst.in
M +5 -0 debian/rules
A +5 -0 debian/setcap.yaml
https://invent.kde.org/neon/kde/powerdevil/commit/583d644bab8776676d5d8e77ae07f18674dcbfc8
diff --git a/debian/powerdevil.postinst.in b/debian/powerdevil.postinst.in
new file mode 100644
index 0000000..04874b1
--- /dev/null
+++ b/debian/powerdevil.postinst.in
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = configure ]; then
+ # Set the capabilities
+ if command -v setcap > /dev/null && \
+ setcap "CAP_SYS_RESOURCE=+ep" \
+ "/usr/lib/#DEB_HOST_MULTIARCH#/libexec/org_kde_powerdevil"; then
+ echo "Sucessfully set capabilities for start_kdeinit"
+ else
+ echo "Failed to set capabilities for start_kdeinit" >&2
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/rules b/debian/rules
index f0e1e11..5aa45d0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,3 +16,8 @@ override_dh_strip:
override_dh_gencontrol: l10npkgs_firstversion_ok
dh_gencontrol
+
+override_dh_installdeb:
+ sed 's/#DEB_HOST_MULTIARCH#/$(DEB_HOST_MULTIARCH)/' \
+ debian/powerdevil.postinst.in > debian/powerdevil.postinst
+ dh_installdeb
diff --git a/debian/setcap.yaml b/debian/setcap.yaml
new file mode 100644
index 0000000..0d6789d
--- /dev/null
+++ b/debian/setcap.yaml
@@ -0,0 +1,5 @@
+# Whitelisted arguments to setcap.
+# Being whitelisted means they will pass the build without problems.
+# A whitelisted call needs to have a corresponding setcap/setuid call in
+# postinst so it actually gets applied.
+- ["CAP_WAKE_ALARM=+ep", "*/usr/lib/*/libexec/org_kde_powerdevil"]
More information about the Neon-commits
mailing list