fix: supprime --delete, exclut wiki/ et fichiers ISPConfig

Push : additive uniquement (pas de suppression sur le serveur)
Pull : idem, wiki/ exclu des deux côtés
Excludes communs : .git/, scripts/, README.md, .env*, .gitignore, wiki/
Correction bug bash set -e avec ((VAR++)) → VAR=$(( VAR + 1 ))

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alpinux 2026-05-03 18:22:45 +02:00
parent 1c0731a829
commit 7c70e904f3
3 changed files with 25 additions and 13 deletions

View file

@ -2,8 +2,8 @@
STATIC_USER=<votre-utilisateur-ssh>
STATIC_HOST=alpinux.org
# Chemin vers le dossier logo dans le web root ISPConfig
STATIC_PATH=/var/www/clients/client1/web17/web/logo
# Chemin vers le web root ISPConfig (dossier web/ complet)
STATIC_PATH=/var/www/clients/client1/web17/web
# Répertoire local des assets générés par wiki/scripts/build-assets.py
LOCAL_ASSETS_DIR=/tmp/alpinux-static-assets
# Répertoire local source (racine du repo alpinux-static)
LOCAL_ASSETS_DIR=<chemin absolu vers org.alpinux.owni/static>

View file

@ -51,8 +51,13 @@ echo -e " Source : ${CYAN}$REMOTE${RESET}"
echo -e " Cible : ${CYAN}$LOCAL_DIR/${RESET}"
echo ""
EXCLUDES=(--exclude='.git/' --exclude='scripts/' --exclude='README.md'
--exclude='.env' --exclude='.env.example' --exclude='.gitignore'
--exclude='wiki/')
DIFF=$(rsync -rlcz --dry-run --itemize-changes \
--rsync-path="sudo rsync" \
"${EXCLUDES[@]}" \
"$REMOTE" "$LOCAL_DIR/" 2>&1)
NEW=0; CHANGED=0
@ -63,10 +68,10 @@ while IFS= read -r line; do
[ -z "$file" ] && continue
if [[ "$item" =~ ^\>f\+{6,} || "$item" =~ ^\.f\+{6,} ]]; then
echo -e " ${GREEN}nouveau ${RESET} $file"
((NEW++))
NEW=$(( NEW + 1 ))
elif [[ "$item" =~ ^\>f || "$item" =~ ^\.f ]]; then
echo -e " ${YELLOW}modifié ${RESET} $file"
((CHANGED++))
CHANGED=$(( CHANGED + 1 ))
fi
done <<< "$DIFF"
@ -81,7 +86,7 @@ echo ""
echo -e " ${GREEN}+$NEW nouveau(x)${RESET} ${YELLOW}~$CHANGED modifié(s)${RESET}"
echo ""
$DRY_RUN && { echo -e "${CYAN}Mode dry-run — aucune modification effectuée.${RESET}"; exit 0; }
if $DRY_RUN; then echo -e "${CYAN}Mode dry-run — aucune modification effectuée.${RESET}"; exit 0; fi
# ── Confirmation ────────────────────────────────────────────────────
if ! $AUTO_YES; then
@ -94,6 +99,7 @@ echo ""
echo -e "${BOLD}Récupération en cours…${RESET}"
rsync -rlcz --human-readable --progress \
--rsync-path="sudo rsync" \
"${EXCLUDES[@]}" \
"$REMOTE" "$LOCAL_DIR/"
echo ""

View file

@ -55,8 +55,13 @@ echo -e " Source : ${CYAN}$LOCAL_DIR/${RESET}"
echo -e " Cible : ${CYAN}$REMOTE${RESET}"
echo ""
DIFF=$(rsync -rlcz --dry-run --itemize-changes --delete \
EXCLUDES=(--exclude='.git/' --exclude='scripts/' --exclude='README.md'
--exclude='.env' --exclude='.env.example' --exclude='.gitignore'
--exclude='wiki/')
DIFF=$(rsync -rlcz --dry-run --itemize-changes \
--rsync-path="sudo rsync" \
"${EXCLUDES[@]}" \
"$LOCAL_DIR/" "$REMOTE" 2>&1)
NEW=0; CHANGED=0; DELETED=0
@ -67,13 +72,13 @@ while IFS= read -r line; do
[ -z "$file" ] && continue
if [[ "$item" == *"deleting"* ]]; then
echo -e " ${RED}supprimé ${RESET} $file"
((DELETED++))
DELETED=$(( DELETED + 1 ))
elif [[ "$item" =~ ^\>f\+{6,} ]]; then
echo -e " ${GREEN}nouveau ${RESET} $file"
((NEW++))
NEW=$(( NEW + 1 ))
elif [[ "$item" =~ ^\>f ]]; then
echo -e " ${YELLOW}modifié ${RESET} $file"
((CHANGED++))
CHANGED=$(( CHANGED + 1 ))
fi
done <<< "$DIFF"
@ -88,7 +93,7 @@ echo ""
echo -e " ${GREEN}+$NEW nouveau(x)${RESET} ${YELLOW}~$CHANGED modifié(s)${RESET} ${RED}-$DELETED supprimé(s)${RESET}"
echo ""
$DRY_RUN && { echo -e "${CYAN}Mode dry-run — aucune modification effectuée.${RESET}"; exit 0; }
if $DRY_RUN; then echo -e "${CYAN}Mode dry-run — aucune modification effectuée.${RESET}"; exit 0; fi
# ── Confirmation ────────────────────────────────────────────────────
if ! $AUTO_YES; then
@ -99,8 +104,9 @@ fi
# ── Synchronisation ─────────────────────────────────────────────────
echo ""
echo -e "${BOLD}Synchronisation en cours…${RESET}"
rsync -rlcz --human-readable --progress --delete \
rsync -rlcz --human-readable --progress \
--rsync-path="sudo rsync" \
"${EXCLUDES[@]}" \
"$LOCAL_DIR/" "$REMOTE"
echo ""