Initial commit
This commit is contained in:
50
bootstrap.sh
Executable file
50
bootstrap.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# bootstrap.sh — clone le thème et les plugins personnalisés THALIM
|
||||
# dans l'arborescence WordPress montée par docker compose.
|
||||
#
|
||||
# Pré-requis :
|
||||
# - `docker compose up -d` a déjà été lancé au moins une fois (pour que
|
||||
# wp-data/ soit peuplé par l'image WordPress)
|
||||
# - tu as accès au Gitea interne
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GITEA_BASE="${GITEA_BASE:-gitea@figureslibres.io:valentin_le_moign}"
|
||||
THEME_REPO="${GITEA_BASE}/thalim-theme.git"
|
||||
HAL_REPO="${GITEA_BASE}/thalim-plugin-hal-importer.git"
|
||||
NL_REPO="${GITEA_BASE}/thalim-plugin-newsletter.git"
|
||||
|
||||
THEMES_DIR="wp-data/wp-content/themes"
|
||||
PLUGINS_DIR="wp-data/wp-content/plugins"
|
||||
|
||||
if [[ ! -d "wp-data/wp-content" ]]; then
|
||||
echo "✘ wp-data/wp-content/ introuvable."
|
||||
echo " Lance d'abord : docker compose up -d (puis attends quelques secondes)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clone_if_missing() {
|
||||
local repo="$1"
|
||||
local dest="$2"
|
||||
local name
|
||||
name="$(basename "$dest")"
|
||||
|
||||
if [[ -d "$dest/.git" ]]; then
|
||||
echo "→ $name déjà cloné, je passe."
|
||||
elif [[ -d "$dest" ]]; then
|
||||
echo "⚠ $dest existe mais n'est pas un repo git — renommé en ${dest}.bak"
|
||||
mv "$dest" "${dest}.bak"
|
||||
git clone "$repo" "$dest"
|
||||
else
|
||||
git clone "$repo" "$dest"
|
||||
fi
|
||||
}
|
||||
|
||||
clone_if_missing "$THEME_REPO" "$THEMES_DIR/thalim"
|
||||
clone_if_missing "$HAL_REPO" "$PLUGINS_DIR/thalim-hal-importer"
|
||||
clone_if_missing "$NL_REPO" "$PLUGINS_DIR/thalim-newsletter"
|
||||
|
||||
echo
|
||||
echo "✔ Clonage terminé."
|
||||
echo " Pense à installer les dépendances Composer du thème :"
|
||||
echo " (cd $THEMES_DIR/thalim && composer install)"
|
||||
Reference in New Issue
Block a user