run deb package pip install stage as navidrome-uploader user instead of root

This commit is contained in:
2026-04-14 12:09:54 -04:00
parent 7f06ffe6d7
commit 792465dab2
+14 -10
View File
@@ -3,20 +3,24 @@ set -e
APP_DIR="/opt/navidrome-uploader"
VENV_DIR="${APP_DIR}/venv"
APP_USER="navidrome-uploader"
case "$1" in
configure)
python3 -m venv "${VENV_DIR}"
"${VENV_DIR}/bin/pip" install --no-cache-dir --upgrade pip
"${VENV_DIR}/bin/pip" install --no-cache-dir -r "${APP_DIR}/requirements.txt"
configure)
chown -R "$APP_USER:$APP_USER" "$APP_DIR"
if command -v systemctl > /dev/null 2>&1; then
systemctl daemon-reload || true
systemctl enable navidrome-uploader.service || true
systemctl restart navidrome-uploader.service || true
fi
;;
runuser -u "$APP_USER" -- python3 -m venv "$VENV_DIR"
runuser -u "$APP_USER" -- "$VENV_DIR/bin/pip" install --no-cache-dir --upgrade pip
runuser -u "$APP_USER" -- "$VENV_DIR/bin/pip" install --no-cache-dir -r "$APP_DIR/requirements.txt"
if command -v systemctl >/dev/null 2>&1; then
systemctl daemon-reload || true
systemctl enable navidrome-uploader.service || true
systemctl restart navidrome-uploader.service || true
fi
;;
esac
exit 0