diff --git a/entrypoint-theme.sh b/entrypoint-theme.sh index dd2ef11..aa3fbb5 100644 --- a/entrypoint-theme.sh +++ b/entrypoint-theme.sh @@ -1,22 +1,51 @@ #!/usr/bin/env bash set -e +# ------------------------------------------------- +# Wait until WordPress core (wp‑config.php) exists +# ------------------------------------------------- while [ ! -f /var/www/html/wp-config.php ]; do echo "⏳ Waiting for WordPress core to be ready..." sleep 2 done -# ---- Release‑page URL (no hyphen in file name) ---- -THEME_URL="https://github.com/RadioParalelo/indy-wp-theme/releases/download/v1.0.0/indywp.zip" +# ------------------------------------------------- +# Theme source – Codeberg archive (bare repo) +# ------------------------------------------------- +THEME_ZIP="https://codeberg.org/radioparalelo/indy-wp-theme/archive/main.zip" +TMP_DIR=$(mktemp -d) -echo "🚀 Installing the Indy‑WP theme..." +# ------------------------------------------------- +# Download + unzip → ensure the folder is named `indywp` +# ------------------------------------------------- +echo "🚀 Downloading Indy‑WP theme archive..." +curl -L "$THEME_ZIP" -o "$TMP_DIR/main.zip" + +echo "🔧 Extracting archive..." +unzip -q "$TMP_DIR/main.zip" -d "$TMP_DIR" + +# The extracted folder will be something like `indy-wp-theme-main/` +EXTRACTED=$(find "$TMP_DIR" -maxdepth 1 -type d -name "indy-wp-theme*" | head -n1) + +# Move/rename it to the slug WordPress expects (`indywp`) +TARGET="/var/www/html/wp-content/themes/indywp" +echo "📁 Installing theme to $TARGET ..." +rm -rf "$TARGET" # remove any previous copy +mv "$EXTRACTED" "$TARGET" + +# Clean up temporary files +rm -rf "$TMP_DIR" + +# ------------------------------------------------- +# Activate the theme (force) +# ------------------------------------------------- su www-data -s /bin/bash -c "\ - wp theme install $THEME_URL \ - --activate \ + wp theme activate indywp \ --allow-root \ - --skip-themes \ - --force \ --path=/var/www/html \ " +# ------------------------------------------------- +# Start Apache (Docker’s default entrypoint) +# ------------------------------------------------- exec docker-entrypoint.sh apache2-foreground