ansible/roles/autofs/files/usercache.sh

15 lines
451 B
Bash

# shellcheck shell=sh
if [ "$(id -u)" -gt 999 ] && [ "$(id -gn)" = "$(id -un)" ]; then
if [ -z "$XDG_RUNTIME_DIR" ]; then
if [ -d "/run/user/$(id -u)" ]; then
XDG_RUNTIME_DIR="/run/user/$(id -u)"
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
mkdir -m 0700 "$XDG_CACHE_HOME"
fi
fi