Use USER_UID and USER_GID from environment in restore script

Updated restore script to respect USER_UID and USER_GID environment variables
with default values of 1000:1000. This aligns with docker-compose.yml
configuration and allows users to customize file ownership if needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
BeauTroll
2025-12-17 06:00:53 +01:00
parent bddadc867b
commit b0fd4ad4b7

View File

@@ -252,9 +252,11 @@ if ! sudo tar xzf "$BACKUP_DIR/gitea_data.tar.gz" -C "$DATA_DIR" 2>> "$LOG_FILE"
exit 1
fi
# Restaurer les bonnes permissions (UID/GID 1000 pour Gitea)
log "Restauration des permissions..."
if ! sudo chown -R 1000:1000 "$DATA_DIR" 2>> "$LOG_FILE"; then
# Restaurer les bonnes permissions (UID/GID pour Gitea)
GITEA_UID=${USER_UID:-1000}
GITEA_GID=${USER_GID:-1000}
log "Restauration des permissions (${GITEA_UID}:${GITEA_GID})..."
if ! sudo chown -R "${GITEA_UID}:${GITEA_GID}" "$DATA_DIR" 2>> "$LOG_FILE"; then
log "${YELLOW}Avertissement: Impossible de changer les permissions${NC}"
fi