diff options
| author | Robert Günzler <r@gnzler.io> | 2020-12-03 13:11:11 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2020-12-07 19:28:05 +0100 |
| commit | 87ab60128318cd6b9aa5589bf256d3a98340f1e2 (patch) | |
| tree | d819818a8d9a983ca2f09dbf5ffceababc1d4f4c /.profile | |
| parent | 30c3766736c191e224356084493c004740c27181 (diff) | |
create/set XDG_CACHE_HOME if it doesn't exists
Diffstat (limited to '')
| -rw-r--r-- | .profile | 10 |
1 files changed, 9 insertions, 1 deletions
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" |