From b0dfb5fad34d71670620d9452abc3a1cb5feb0d8 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Wed, 3 Jun 2026 08:20:23 +0000 Subject: [PATCH] fix: reset ownership at start of update mode before any file operations - Moves chown to the very beginning of the update - Ensures app user can write to /opt/receiptnext/ before build - Removes redundant chown later in update (already done upfront) --- install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install.sh b/install.sh index 2654116..8ea38a6 100755 --- a/install.sh +++ b/install.sh @@ -73,6 +73,10 @@ if [ "${1:-}" = "-update" ]; then cd "$INSTALL_DIR" fi + # Reset ownership so the app user can write files. + APP_USER="${APP_USER:-${SUDO_USER:-$(whoami)}}" + sudo_if chown -R "${APP_USER}:${APP_USER}" "$INSTALL_DIR" 2>/dev/null || true + # Backup the database before making any changes. if [ -f "$INSTALL_DIR/expenses.db" ]; then BACKUP_DIR="$INSTALL_DIR/backups"