This commit is contained in:
Bart Sjerps
2026-07-10 16:28:39 +02:00
parent 154ad42f6b
commit d2539a75e7
2 changed files with 37 additions and 4 deletions
+5 -4
View File
@@ -66,14 +66,15 @@
- name: Create Directories
file:
path: '{{ item }}'
path: '{{ item.directory }}'
state: directory
mode: '0755'
mode: "{{ item.mode | default('0755') }}"
owner: root
group: root
loop:
- /var/backups
- /opt/atclab/bin
- { directory: "/var/backups" }
- { directory: "/opt/atclab/bin" }
- { directory: "/var/user", mode: "1777" }
- name: Copy etc configs
copy:
+32
View File
@@ -0,0 +1,32 @@
# Redirect XDG data/cache/state to local disk under /var/user/$USER.
# /var/user must allow users to create their own subdirectory.
# This fixes Opencode on users with home directories on NFS.
if [ -n "$USER" ] && [ "$USER" != "root" ]; then
LOCAL_BASE="/var/user/$USER"
test -d $LOCAL_BASE || mkdir $LOCAL_BASE
if [ ! -d "$LOCAL_BASE" ]; then
if mkdir -p \
"$LOCAL_BASE/.local/share" \
"$LOCAL_BASE/.cache" \
"$LOCAL_BASE/.local/state" 2>/dev/null
then
chmod 700 "$LOCAL_BASE" \
"$LOCAL_BASE/.local" \
"$LOCAL_BASE/.local/share" \
"$LOCAL_BASE/.local/state" \
"$LOCAL_BASE/.cache" 2>/dev/null || true
fi
fi
if [ -d "$LOCAL_BASE" ]; then
export XDG_DATA_HOME="$LOCAL_BASE/.local/share"
export XDG_CACHE_HOME="$LOCAL_BASE/.cache"
export XDG_STATE_HOME="$LOCAL_BASE/.local/state"
fi
fi