petersweb-infra/nixos/atitraining/wp-init-bg.sh

26 lines
1 KiB
Bash
Raw Permalink Normal View History

2026-06-25 20:43:10 -08:00
#!/bin/bash
set -e
# Wait for the official WP entrypoint to write wp-config.php
until [ -f /var/www/html/wp-config.php ]; do sleep 1; done
# Wait for the database to accept connections
until wp --allow-root --path=/var/www/html db check 2>/dev/null; do
sleep 3
done
# Perform first-time install only if WordPress isn't installed yet
if ! wp --allow-root --path=/var/www/html core is-installed 2>/dev/null; then
wp --allow-root --path=/var/www/html core install \
--url="${WORDPRESS_SITEURL:-https://atitraining.coldairnetworks.com}" \
--title="${WORDPRESS_BLOG_TITLE:-ATI Training}" \
--admin_user="${WORDPRESS_ADMIN_USER:-admin}" \
--admin_password="${WORDPRESS_ADMIN_PASSWORD:-changeme}" \
--admin_email="${WORDPRESS_ADMIN_EMAIL:-peterson@sent.com}" \
--skip-email
wp --allow-root --path=/var/www/html theme activate \
"${WORDPRESS_ACTIVE_THEME:-p2}"
wp --allow-root --path=/var/www/html option update blogdescription \
"${WORDPRESS_BLOG_TAGLINE:-advanced training intelligence}"
fi