48 lines
1.6 KiB
Bash
48 lines
1.6 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
WP_PATH=/var/www/html
|
|
FLAG=$WP_PATH/.studioe5-init-done
|
|
WP_USER=www-data
|
|
|
|
if [ -f "$FLAG" ]; then
|
|
echo "[studioE5] WordPress already initialized."
|
|
exit 0
|
|
fi
|
|
|
|
echo "[studioE5] Waiting for WordPress config and database..."
|
|
until [ -f "$WP_PATH/wp-config.php" ] && wp --path="$WP_PATH" db query "SELECT 1" --allow-root > /dev/null 2>&1; do
|
|
sleep 2
|
|
done
|
|
|
|
echo "[studioE5] Fixing permissions..."
|
|
# Ensure the web server (www-data) can write to wp-content and wp-config.php.
|
|
chmod -R 777 "$WP_PATH/wp-content"
|
|
chmod 666 "$WP_PATH/wp-config.php"
|
|
|
|
run_wp() {
|
|
su -s /bin/sh "$WP_USER" -c "wp --path=$WP_PATH $1"
|
|
}
|
|
|
|
echo "[studioE5] Installing WordPress..."
|
|
run_wp "core install --url='{PUBLIC_URL}' --title='Mon site wordpress' --admin_user='admin' --admin_password='admin' --admin_email='admin@example.com' --skip-email --allow-root"
|
|
|
|
echo "[studioE5] Setting language to French..."
|
|
run_wp "language core install fr_FR --activate --allow-root" || true
|
|
|
|
echo "[studioE5] Installing and activating theme Astra..."
|
|
run_wp "theme install astra --activate --allow-root" || true
|
|
|
|
echo "[studioE5] Installing plugins..."
|
|
run_wp "plugin install wordpress-seo --allow-root" || true
|
|
run_wp "plugin install ultimate-addons-for-gutenberg --activate --allow-root" || true
|
|
|
|
echo "[studioE5] Disabling automatic updates..."
|
|
run_wp "config set AUTOMATIC_UPDATER_DISABLED true --raw --allow-root" || true
|
|
run_wp "config set WP_AUTO_UPDATE_CORE false --raw --allow-root" || true
|
|
run_wp "config set AUTO_UPDATE_PLUGIN false --raw --allow-root" || true
|
|
run_wp "config set AUTO_UPDATE_THEME false --raw --allow-root" || true
|
|
|
|
touch "$FLAG"
|
|
echo "[studioE5] Initialization complete."
|