indy-wp/entrypoint-theme.sh

52 lines
1.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/usr/bin/env bash
set -e
# -------------------------------------------------
# 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
# -------------------------------------------------
# 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 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 "\
wp theme activate indywp \
--allow-root \
--path=/var/www/html \
"
# -------------------------------------------------
# Start Apache (Dockers default entrypoint)
# -------------------------------------------------
exec docker-entrypoint.sh apache2-foreground