No old dbus code anymore

OBS-URL: https://build.opensuse.org/package/show/editors/emacs?expand=0&rev=316
This commit is contained in:
Dr. Werner Fink 2021-11-19 14:18:25 +00:00 committed by Git OBS Bridge
parent 5398206849
commit 76c70ef78b
2 changed files with 16 additions and 51 deletions

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Nov 19 14:16:04 UTC 2021 - Dr. Werner Fink <werner@suse.de>
- Get rid of the old dbus shell code in the emacs shell script
nowadays this should be not needed anymore
-------------------------------------------------------------------
Fri Nov 19 11:56:17 UTC 2021 - Dr. Werner Fink <werner@suse.de>
- Make dbus code in emacs shell script failsafe
-------------------------------------------------------------------
Fri Nov 19 10:54:09 UTC 2021 - Dr. Werner Fink <werner@suse.de>

View File

@ -52,57 +52,11 @@ dbusdaemon=$(type -p dbus-daemon 2>/dev/null)
# Now check for valid dbus, e.g. after su/sudo/slogin
#
if test -n "$dbusdaemon" ; then
#
# Currently (2013/05/24) the option --autolaunch for scanning for an
# already existing session is an internal option of dbus-launch(1).
#
if test -s /var/lib/dbus/machine-id ; then
read -t1 mid < /var/lib/dbus/machine-id
elif test -s /etc/machine-id ; then
read -t1 mid < /etc/machine-id
else
mid=
fi
if test -n "$DBUS_SESSION_BUS_ADDRESS" ; then
# Determine dbus identifier
for guid in ${DBUS_SESSION_BUS_ADDRESS//,/ } ; do
case "$guid" in
guid=*) break
esac
done
# Check if dbus-daemon is active
dpid=
for suid in "${HOME}/.dbus/session-bus/"${mid}* ; do
test -e "$suid" || break
grep -q $guid "$suid" || continue
dpid=$(grep -E '^DBUS_SESSION_BUS_PID=[[:digit:]]+' "$suid")
test /proc/${dpid#*=}/exe -ef $dbusdaemon && continue
unset DBUS_SESSION_BUS_ADDRESS
break
done
if test -z "$dpid" ; then
case ":$DBUS_SESSION_BUS_ADDRESS" in
*:path=/run/user/${UID}/bus*) ;;
*) unset DBUS_SESSION_BUS_ADDRESS
esac
fi
fi
# Find a valid dbus-daemon if active
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
for suid in "${HOME}/.dbus/session-bus/"${mid}* ; do
test -e "$suid" || break
dpid=$(grep -E '^DBUS_SESSION_BUS_PID=[[:digit:]]+' "$suid")
test /proc/${dpid#*=}/exe -ef $dbusdaemon || continue
dadd=$(grep -E '^DBUS_SESSION_BUS_ADDRESS=' "$suid")
DBUS_SESSION_BUS_ADDRESS=${dadd#*=}
export DBUS_SESSION_BUS_ADDRESS
done
if test -z "$DBUS_SESSION_BUS_ADDRESS" -a -S "${XDG_RUNTIME_DIR}/bus" ; then
DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
export DBUS_SESSION_BUS_ADDRESS
fi
fi
unset mid guid suid dadd
# Standard on modern systems
: ${XDG_RUNTIME_DIR:=/run/user/${UID}}
export XDG_RUNTIME_DIR
# Oops ... no dbus-daemon then launch a new session
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
dbuslaunch=$(type -p dbus-launch 2>/dev/null)