#!/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 # ------------------------------------------------- # Theme source – Codeberg archive (bare repo) # ------------------------------------------------- THEME_ZIP="https://codeberg.org/radioparalelo/indy-wp-theme/archive/main.zip" TMP_DIR=$(mktemp -d) # ------------------------------------------------- # 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 activate indywp \ --allow-root \ --path=/var/www/html \ " # ------------------------------------------------- # Start Apache (Docker’s default entrypoint) # ------------------------------------------------- exec docker-entrypoint.sh apache2-foreground