2026-03-05 09:45:20 +00:00
|
|
|
|
#!/usr/bin/env bash
|
2026-03-10 22:07:14 +00:00
|
|
|
|
set -euo pipefail
|
2026-03-05 09:45:20 +00:00
|
|
|
|
|
2026-03-09 17:25:27 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# Wait for wp-config.php (core ready)
|
2026-03-09 17:25:27 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
while [ ! -f /var/www/html/wp-config.php ]; do
|
2026-03-10 22:07:14 +00:00
|
|
|
|
echo "⏳ Waiting for WordPress core to be ready..."
|
|
|
|
|
|
sleep 2
|
2026-03-05 09:45:20 +00:00
|
|
|
|
done
|
|
|
|
|
|
|
2026-03-09 17:25:27 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# Ensure theme directory ownership & permissions
|
2026-03-09 17:25:27 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
chown -R www-data:www-data /var/www/html/wp-content/themes
|
|
|
|
|
|
chmod -R 755 /var/www/html/wp-content/themes
|
2026-03-09 17:25:27 +00:00
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# Activate the theme that is already present
|
2026-03-09 17:25:27 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
THEME_SLUG="indy-wp-theme"
|
2026-03-05 09:45:20 +00:00
|
|
|
|
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# If the theme folder is missing (e.g., a volume was mounted over it),
|
|
|
|
|
|
# fall back to the tarball that matches the build‑time tag.
|
|
|
|
|
|
if [ ! -d "/var/www/html/wp-content/themes/${THEME_SLUG}" ]; then
|
|
|
|
|
|
echo "⚠️ Theme folder missing – extracting the built‑in ${THEME_TAG} archive …"
|
|
|
|
|
|
# The archive was already extracted during the build, but if a volume
|
|
|
|
|
|
# overwrote the directory we can re‑extract it from the image’s copy:
|
|
|
|
|
|
tar -xzf "/tmp/indy-wp-theme.tar.gz" -C "/var/www/html/wp-content/themes"
|
|
|
|
|
|
chown -R www-data:www-data "/var/www/html/wp-content/themes/${THEME_SLUG}"
|
|
|
|
|
|
chmod -R 755 "/var/www/html/wp-content/themes/${THEME_SLUG}"
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Activate if not already active
|
|
|
|
|
|
if ! wp theme is-active "$THEME_SLUG" --allow-root --path=/var/www/html; then
|
|
|
|
|
|
echo "🚀 Activating Indy‑WP theme (${THEME_TAG}) …"
|
|
|
|
|
|
wp theme activate "$THEME_SLUG" \
|
|
|
|
|
|
--allow-root \
|
|
|
|
|
|
--path=/var/www/html
|
|
|
|
|
|
fi
|