indy-wp/entrypoint-theme.sh

51 lines
1.7 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2026-03-09 17:25:27 +00:00
# -------------------------------------------------
# Wait until WordPress core (wpconfig.php) exists
# -------------------------------------------------
while [ ! -f /var/www/html/wp-config.php ]; do
echo "⏳ Waiting for WordPress core to be ready..."
sleep 2
done
2026-03-09 17:25:27 +00:00
# -------------------------------------------------
# Theme source Codeberg archive (bare repo)
# -------------------------------------------------
THEME_ZIP="https://codeberg.org/radioparalelo/indy-wp-theme/archive/main.zip"
TMP_DIR=$(mktemp -d)
2026-03-09 17:25:27 +00:00
# -------------------------------------------------
# Download + unzip → ensure the folder is named `indywp`
# -------------------------------------------------
echo "🚀 Downloading IndyWP 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 "\
2026-03-09 17:25:27 +00:00
wp theme activate indywp \
--allow-root \
--path=/var/www/html \
"
2026-03-09 17:25:27 +00:00
# -------------------------------------------------
# Start Apache (Dockers default entrypoint)
# -------------------------------------------------
exec docker-entrypoint.sh apache2-foreground