libreoffice: wrapper: fallback to /tmp if /run is not usable

This commit is contained in:
Michael Raskin 2019-03-23 12:16:02 +01:00
parent 239f5e8376
commit b8ed97001e

View file

@ -5,7 +5,13 @@ export JAVA_HOME="${JAVA_HOME:-@jdk@}"
if uname | grep Linux > /dev/null &&
! ( test -n "$DBUS_SESSION_BUS_ADDRESS" ); then
dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus"
mkdir "$dbus_tmp_dir"
if ! test -d "$dbus_tmp_dir" && test -d "/run"; then
mkdir -p "$dbus_tmp_dir"
fi
if ! test -d "$dbus_tmp_dir"; then
dbus_tmp_dir="/tmp/libreoffice-$(id -u)/libreoffice-dbus"
mkdir -p "$dbus_tmp_dir"
fi
dbus_socket_dir="$(mktemp -d -p "$dbus_tmp_dir")"
"@dbus@"/bin/dbus-daemon --nopidfile --nofork --config-file "@dbus@"/share/dbus-1/session.conf --address "unix:path=$dbus_socket_dir/session" &> /dev/null &
export DBUS_SESSION_BUS_ADDRESS="unix:path=$dbus_socket_dir/session"