From 87ab60128318cd6b9aa5589bf256d3a98340f1e2 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Thu, 3 Dec 2020 13:11:11 +0100 Subject: create/set XDG_CACHE_HOME if it doesn't exists --- .profile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.profile b/.profile index 7a589d9..50b4e6d 100644 --- a/.profile +++ b/.profile @@ -3,10 +3,18 @@ if [ -z "${XDG_RUNTIME_DIR}" ]; then export XDG_RUNTIME_DIR=/run/user/"$(id -u)" if [ ! -d "${XDG_RUNTIME_DIR}" ]; then - mkdir "${XDG_RUNTIME_DIR}" + mkdir -p "${XDG_RUNTIME_DIR}" chmod 0700 "${XDG_RUNTIME_DIR}" fi fi +# set xdg cache dir if it's not defined +if [ -z "${XDG_CACHE_DIR}" ]; then + export XDG_CACHE_DIR=/tmp/"$(id -un)"/.cache + if [ ! -d "${XDG_CACHE_DIR}" ]; then + mkdir -p "${XDG_CACHE_DIR}" + chmod 0700 "${XDG_CACHE_DIR}" + fi +fi if [ -d "${HOME}/bin" ]; then pathprepend "${HOME}/bin" -- cgit 1.4.1