[neon/kde/ksystemstats/Neon/release] debian: libcap stuffs

Carlos De Maine null at kde.org
Thu Sep 11 13:26:54 BST 2025


Git commit e0c22c422ac2e58d56dd403f74b114af11713d85 by Carlos De Maine.
Committed on 11/09/2025 at 12:26.
Pushed by carlosdem into branch 'Neon/release'.

libcap stuffs

A  +25   -0    debian/ksystemstats,postinst
A  +0    -0    debian/meta/cmake-ignore
A  +5    -0    debian/setcap.yaml

https://invent.kde.org/neon/kde/ksystemstats/-/commit/e0c22c422ac2e58d56dd403f74b114af11713d85

diff --git a/debian/ksystemstats,postinst b/debian/ksystemstats,postinst
new file mode 100644
index 0000000..7e941a9
--- /dev/null
+++ b/debian/ksystemstats,postinst
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = configure ]; then
+    # Try to setcap or fall back to setuid.
+    # The specific setcap invocations also need to be whitelisted to make the
+    # build pass (in debian/setcap.yaml as a nested array of argument
+    # arrays).
+    path="/usr/bin/ksystemstats"
+    if command -v setcap > /dev/null; then
+        cap="CAP_SYS_NICE=+ep"
+        if setcap $cap $path; then
+            echo "Setcap worked for $path!"
+        else
+            echo "Setcap failed for $path"
+        fi
+    else
+        echo "Setcap is not installed, failed to setcap on $path" >&2
+    fi
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/meta/cmake-ignore b/debian/meta/cmake-ignore
new file mode 100644
index 0000000..e69de29
diff --git a/debian/setcap.yaml b/debian/setcap.yaml
new file mode 100644
index 0000000..f147272
--- /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_NICE=+ep", "*/usr/bin/ksystemstats"]
\ No newline at end of file


More information about the Neon-commits mailing list