[neon/kde/ksysguard/Neon/unstable] debian: ksysguard setcap foo

Jonathan Riddell null at kde.org
Thu Oct 15 12:20:01 BST 2020


Git commit cf5f5dfea82d2b11671282b15ae4d3586b032254 by Jonathan Riddell.
Committed on 15/10/2020 at 11:19.
Pushed by jriddell into branch 'Neon/unstable'.

ksysguard setcap foo

A  +19   -0    debian/ksysguard.postinst.in
M  +5    -0    debian/rules
A  +5    -0    debian/setcap.yaml

https://invent.kde.org/neon/kde/ksysguard/commit/cf5f5dfea82d2b11671282b15ae4d3586b032254

diff --git a/debian/ksysguard.postinst.in b/debian/ksysguard.postinst.in
new file mode 100644
index 0000000..a93f91f
--- /dev/null
+++ b/debian/ksysguard.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/kf5/start_kdeinit"; 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 724d98d..739ae31 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,3 +17,8 @@ override_dh_auto_test:
 
 override_dh_gencontrol: l10npkgs_firstversion_ok
 	dh_gencontrol
+
+override_dh_installdeb:
+	sed 's/#DEB_HOST_MULTIARCH#/$(DEB_HOST_MULTIARCH)/' \
+	    debian/ksysguard.postinst.in > debian/ksysguard.postinst
+	dh_installdeb
diff --git a/debian/setcap.yaml b/debian/setcap.yaml
new file mode 100644
index 0000000..5c32746
--- /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_SYS_RESOURCE=+ep", "*/usr/lib/*/libexec/ksysguard/ksgrd_network_helper"]



More information about the Neon-commits mailing list