diff --git a/install.sh b/install.sh index d4b8679..f0673e1 100755 --- a/install.sh +++ b/install.sh @@ -79,8 +79,8 @@ if [ "${1:-}" = "-update" ]; then sudo_if mkdir -p "$BACKUP_DIR" BACKUP_FILE="$BACKUP_DIR/expenses-$(date +%Y%m%d-%H%M%S).db" sudo_if cp "$INSTALL_DIR/expenses.db" "$BACKUP_FILE" - # Restore ownership so the app user can still write to the database. - sudo_if chown --reference="$INSTALL_DIR/expenses.db" "$BACKUP_FILE" 2>/dev/null || true + # Restore file ownership so the app user can still write. + sudo_if chown $(stat -c "%U:%G" "$INSTALL_DIR/expenses.db") "$BACKUP_FILE" 2>/dev/null || true info "Database backed up to $BACKUP_FILE" fi