Fix to set XDG runtime and D-Bus env in xterm shells
Some checks failed
webmin.dev: webmin/webmin / build (push) Has been cancelled

https://github.com/webmin/webmin/issues/2679
This commit is contained in:
Ilia Ross
2026-05-05 09:41:45 +02:00
parent 95fee0cc33
commit 7e01b3eb44
2 changed files with 28 additions and 0 deletions

View File

@@ -53,3 +53,17 @@ if [ -d ~/.bashrc.d ]; then
done
fi
unset rc
# set XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS if not set
if [ -z "$XDG_RUNTIME_DIR" ]; then
uid=$(id -u)
xdg_runtime_dir="/run/user/$uid"
if [ -d "$xdg_runtime_dir" ] && [ -O "$xdg_runtime_dir" ] && \
[ -S "$xdg_runtime_dir/bus" ]; then
export XDG_RUNTIME_DIR="$xdg_runtime_dir"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
fi
unset uid xdg_runtime_dir
fi

View File

@@ -22,3 +22,17 @@ fi
if [ -f ~/.zshrc ]; then
. ~/.zshrc
fi
# set XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS if not set
if [ -z "$XDG_RUNTIME_DIR" ]; then
uid=$(id -u)
xdg_runtime_dir="/run/user/$uid"
if [ -d "$xdg_runtime_dir" ] && [ -O "$xdg_runtime_dir" ] && \
[ -S "$xdg_runtime_dir/bus" ]; then
export XDG_RUNTIME_DIR="$xdg_runtime_dir"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
fi
unset uid xdg_runtime_dir
fi