autofs: Fix cache path when xdg runtime is not set

This commit is contained in:
Timo Makinen 2020-11-14 17:13:56 +00:00
parent 822e46c818
commit f89672dd59
2 changed files with 15 additions and 0 deletions

View file

@ -1,4 +1,12 @@
if [ $UID -gt 999 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
if [ -z "$XDG_RUNTIME_DIR" ]; then
if [ -d "/run/user/${UID}" ]; then
XDG_RUNTIME_DIR="/run/user/${UID}"
else
XDG_RUNTIME_DIR="$HOME"
fi
export XDG_RUNTIME_DIR
fi
export XDG_CACHE_HOME="$XDG_RUNTIME_DIR/.cache"
if [ ! -d "$XDG_CACHE_HOME" ] ; then
install -d -m 0700 "$XDG_CACHE_HOME"