Add dbus session auto setup

This commit is contained in:
HuangXin 2018-08-03 09:49:54 +08:00
parent 8024690f68
commit cb9ea6fb5a
1 changed files with 33 additions and 0 deletions

View File

@ -10,6 +10,7 @@ export PATH="%PATH%"
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
export HOME=${HOME:-/root}
export PS1='\u@\h:\w\$ '
export GOROOT="/usr/share/golang/"
[ -x /bin/more ] || alias more=less
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
@ -26,3 +27,35 @@ export PS1='\u@\h:\w\$ '
unset FILE
}
[ -x /bin/ll ] || alias ll='ls -al'
ulimit -c unlimited
DBUS_SESSION_FILE=/tmp/dbus-session.env
#if [ ! -f $DBUS_SESSION_FILE ]; then
# echo "Setup Session" >> /tmp/sh.log
# dbus-daemon --session --print-address >> $DBUS_SESSION_FILE &
# sync
#fi
#if [ -f $DBUS_SESSION_FILE ]; then
# echo "Setup Session Env" >> /tmp/sh.log
# DBUS_SESSION_ENV=`cat $DBUS_SESSION_FILE`
# export DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_ENV
#else
# echo "Don't find Session" >> /tmp/sh.log
#fi
# add by huangxin
if [ -x /tmp/dbus_env.sh ]
then
source /tmp/dbus_env.sh
else
if [ -x /usr/bin/dbus-launch ]; then
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
fi