diff --git a/.env.example b/.env.example index 24db5ca..56d2992 100644 --- a/.env.example +++ b/.env.example @@ -2,8 +2,8 @@ STATIC_USER= 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= diff --git a/scripts/pull-assets.sh b/scripts/pull-assets.sh index 43f7dc5..409095d 100755 --- a/scripts/pull-assets.sh +++ b/scripts/pull-assets.sh @@ -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 "" diff --git a/scripts/push-assets.sh b/scripts/push-assets.sh index 0f37ecc..e45e39b 100755 --- a/scripts/push-assets.sh +++ b/scripts/push-assets.sh @@ -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 ""