systemd: redirect HOME / XDG dirs into project so ProtectHome stays on
ezdxf, matplotlib, and other Python libs try to write into $HOME/.config and $HOME/.cache. With ProtectHome=true the real /home/busbar is invisible to the service and pathlib.Path.exists() throws PermissionError. Fix: set HOME, XDG_CONFIG_HOME, XDG_CACHE_HOME to /opt/busbar-designer/data/* which is already in ReadWritePaths. Hardening (ProtectHome) stays intact. install.sh also pre-creates the .config / .cache subdirs.
This commit is contained in:
+5
-2
@@ -88,8 +88,11 @@ sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install --upgrade pip
|
||||
sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install \
|
||||
-r "$INSTALL_DIR/requirements.txt" gunicorn
|
||||
|
||||
# ---- data dir (for SQLite) -------------------------------------------------
|
||||
sudo -u "$SVC_USER" mkdir -p "$INSTALL_DIR/data"
|
||||
# ---- data + XDG dirs (for SQLite, ezdxf config, build123d cache) -----------
|
||||
sudo -u "$SVC_USER" mkdir -p \
|
||||
"$INSTALL_DIR/data" \
|
||||
"$INSTALL_DIR/data/.config" \
|
||||
"$INSTALL_DIR/data/.cache"
|
||||
|
||||
# ---- systemd unit ----------------------------------------------------------
|
||||
log "Installing systemd unit..."
|
||||
|
||||
Reference in New Issue
Block a user