Merge pull request #2486 from thypon/acpid-user

acpid: generate user env variables
This commit is contained in:
Andrea Brancaleoni 2015-09-09 11:05:13 +02:00
commit 445f2b3388
2 changed files with 13 additions and 2 deletions

View file

@ -10,6 +10,17 @@ setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
set $* set $*
PID=$(pgrep dbus-launch)
USER=$(ps -o user --no-headers $PID)
USERHOME=$(getent passwd $USER | cut -d: -f6)
export XAUTHORITY="$USERHOME/.Xauthority"
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
fi
done
case "$1" in case "$1" in
button/power) button/power)
#echo "PowerButton pressed!">/dev/tty5 #echo "PowerButton pressed!">/dev/tty5
@ -58,7 +69,7 @@ case "$1" in
;; ;;
esac esac
;; ;;
CPU0) CPU0)
;; ;;
*) logger "ACPI action undefined: $2" ;; *) logger "ACPI action undefined: $2" ;;
esac esac

View file

@ -1,7 +1,7 @@
# Template file for 'acpid' # Template file for 'acpid'
pkgname=acpid pkgname=acpid
version=2.0.25 version=2.0.25
revision=1 revision=2
build_pie=yes build_pie=yes
build_style=gnu-configure build_style=gnu-configure
configure_args="--sbindir=/usr/bin" configure_args="--sbindir=/usr/bin"