From 83e2ca18e9c2668b7cc75cc2f40c7c6ab6f5eebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Tue, 19 Dec 2023 15:55:09 +0100 Subject: [PATCH] Add a script that automates the WordPress setup --- wordpress/setup.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 wordpress/setup.sh diff --git a/wordpress/setup.sh b/wordpress/setup.sh new file mode 100644 index 0000000..046018c --- /dev/null +++ b/wordpress/setup.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# This script automates the setup of a fresh WordPress installation. + +# Set environment variables if not already set +: ${WORDPRESS_TITLE:="WordPress Local"} +: ${WORDPRESS_ADMIN_USER:="admin"} +: ${WORDPRESS_ADMIN_PASSWORD:="password"} +: ${WORDPRESS_ADMIN_MAIL:="your@email.com"} +: ${WORDPRESS_LANGUAGE:="de_AT"} + +# Do install step 1 +curl -X POST -d "language=$WORDPRESS_LANGUAGE" 'http://wp.lan/wp-admin/install.php?step=1' + +# Build the POST data for step 2 +POST_DATA="weblog_title=$WORDPRESS_TITLE" +POST_DATA+="&user_name=$WORDPRESS_USER" +POST_DATA+="&admin_password=$ADMIN_PWORDPRESS_PASSWORDASSWORD" +POST_DATA+="&admin_password2=$ADMIN_PASSWORD" +POST_DATA+="&pw_weak=on" +POST_DATA+="&admin_email=$ADMIN_EMAIL" +POST_DATA+="&Submit=WordPress+installieren" +POST_DATA+="&language=$WORDPRESS_LANGUAGE" + +# Make the POST request for setup step 2 +curl -X POST -d "$POST_DATA" 'http://wp.lan/wp-admin/install.php?step=2' + +