[Debian-eeepc-commits] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 9ea4d21031f21af12d167aa27f2fdb4b47171e8f

Darren Salt linux at youmustbejoking.demon.co.uk
Fri Feb 6 23:36:18 UTC 2009


The following commit has been merged in the master branch:
commit 9ea4d21031f21af12d167aa27f2fdb4b47171e8f
Author: Darren Salt <linux at youmustbejoking.demon.co.uk>
Date:   Fri Feb 6 23:34:41 2009 +0000

    xtrlock would (sometimes?) ask for the root password.
    Using a login shell to run it with quoted DISPLAY & XAUTHORITY should fix this.

diff --git a/functions.sh b/functions.sh
index 6b2474e..49748b6 100644
--- a/functions.sh
+++ b/functions.sh
@@ -65,6 +65,11 @@ detect_x_display()
     fi
 }
 
+shell_quote()
+{
+  echo "$1" | sed -e 's/'\''/'\''\\'\'''\''/g; s/^/'\''/; s/$/'\''/; $! s/$/\\/'
+}
+
 lock_x_screen()
 {
     # activate screensaver if available
@@ -80,7 +85,7 @@ lock_x_screen()
             if [ -x /usr/bin/dcop ]; then
                 dcop --user $user kdesktop KScreensaverIface lock
             fi
-            [ -x /usr/bin/xtrlock ] && su "$user" -s /usr/bin/xtrlock &
+            [ -x /usr/bin/xtrlock ] && su - "$user" -c "DISPLAY=$(shell_quote "$DISPLAY") XAUTHORITY=$(shell_quote "$XAUTHORITY") /usr/bin/xtrlock" &
         fi
     fi
 }

-- 
Maintenance of eeepc-acpi-scripts debian package



More information about the Debian-eeepc-commits mailing list