The following commit has been merged in the master branch:
commit f232112d1383ee1e9f4c41f08cea1a2feaf0be47
Author: Damyan Ivanov <[EMAIL PROTECTED]>
Date: Tue Sep 2 14:11:55 2008 +0300
detect_x_display(): pass $user and $home variables to callers
these are useful outside of detect_x_display. Pass them only if
an running display was detected
diff --git a/functions.sh b/functions.sh
index 972a927..2606fc0 100644
--- a/functions.sh
+++ b/functions.sh
@@ -16,21 +16,23 @@ detect_wlan()
detect_x_display()
{
- local user
- local home
- user=$(who | sed -n '/ (:0[\.0]*)$\| :0 /{s/ .*//p;q}')
- if [ "$user" = "" ]; then
+ local _user
+ local _home
+ _user=$(who | sed -n '/ (:0[\.0]*)$\| :0 /{s/ .*//p;q}')
+ if [ "$_user" = "" ]; then
# no users seem to be logged on a X display?
# try the first logged user without any filters
# useful for users starting X via 'startx' after logging
# on the console
- user=$( who | head -n 1 | cut -d' ' -f1 )
+ _user=$( who | head -n 1 | cut -d' ' -f1 )
fi
- home=$(getent passwd $user | cut -d: -f6)
- XAUTHORITY=$home/.Xauthority
+ _home=$(getent passwd $_user | cut -d: -f6)
+ XAUTHORITY=$_home/.Xauthority
if [ -f $XAUTHORITY ]; then
export XAUTHORITY
export DISPLAY=:0
+ user=$_user
+ home=$_home
fi
}
--
Maintenance of eeepc-acpi-scripts debian package
_______________________________________________
Debian-eeepc-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-eeepc-devel