[neon/neon-packaging/plasma-remotecontrollers/Neon/unstable] debian: check if running as root user

Carlos De Maine null at kde.org
Tue Jun 24 04:19:28 BST 2025


Git commit d182168f0c840a05d779b84fc5e2ec58425308ec by Carlos De Maine.
Committed on 24/06/2025 at 03:19.
Pushed by carlosdem into branch 'Neon/unstable'.

check if running as root user

M  +10   -5    debian/plasma-remotecontrollers.postinst

https://invent.kde.org/neon/neon-packaging/plasma-remotecontrollers/-/commit/d182168f0c840a05d779b84fc5e2ec58425308ec

diff --git a/debian/plasma-remotecontrollers.postinst b/debian/plasma-remotecontrollers.postinst
index 76b2846..5844502 100644
--- a/debian/plasma-remotecontrollers.postinst
+++ b/debian/plasma-remotecontrollers.postinst
@@ -8,8 +8,13 @@ if ! getent group | grep -q ^plasma-bigscreen-uinput:; then
     addgroup --quiet --system plasma-bigscreen-uinput 2>/dev/null || true
 fi
 
-# Check if user is part of plasma-bigscreen-uinput, if not add them.
-if ! groups | grep -q ^plasma-bigscreen-uinput; then
-    echo "Adding user to group plasma-bigscreen-uinput"
-    usermod -aG plasma-bigscreen-uinput $SUDO_USER
-fi
\ No newline at end of file
+if (( $EUID == 0 )); then
+    echo "You are running as root."
+else
+    echo "You are not running as root."
+    # Check if user is part of plasma-bigscreen-uinput, if not add them.
+    if ! groups | grep -q ^plasma-bigscreen-uinput; then
+        echo "Adding user to group plasma-bigscreen-uinput"
+        usermod -aG plasma-bigscreen-uinput $SUDO_USER
+    fi
+fi


More information about the Neon-commits mailing list