From b3c6f9972f6f7f9b4444eb778f3bb3d2bd77d65d Mon Sep 17 00:00:00 2001 From: RomanNum3ral Date: Wed, 28 May 2025 23:17:35 +0000 Subject: [PATCH] Add updated_install2.sh --- updated_install2.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 updated_install2.sh diff --git a/updated_install2.sh b/updated_install2.sh new file mode 100644 index 0000000..6f3548d --- /dev/null +++ b/updated_install2.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# ====== CONFIGURATION ====== +DB_PASSWORD="changeme123" # <- Set your database password here +# ============================ + +# Create wp-config.php from the sample +sudo -u www-data cp /srv/www/wordpress/wp-config-sample.php /srv/www/wordpress/wp-config.php + +# Replace database settings +sudo -u www-data sed -i 's/database_name_here/wordpress/' /srv/www/wordpress/wp-config.php +sudo -u www-data sed -i 's/username_here/wordpress/' /srv/www/wordpress/wp-config.php +sudo -u www-data sed -i "s/password_here/${DB_PASSWORD}/" /srv/www/wordpress/wp-config.php + +# Path to config +WP_CONFIG="/srv/www/wordpress/wp-config.php" + +# Delete existing placeholder salts +sed -i "/AUTH_KEY/d;/SECURE_AUTH_KEY/d;/LOGGED_IN_KEY/d;/NONCE_KEY/d;/AUTH_SALT/d;/SECURE_AUTH_SALT/d;/LOGGED_IN_SALT/d;/NONCE_SALT/d" "$WP_CONFIG" + +# Fetch and append new salts from the WordPress API +curl -s https://api.wordpress.org/secret-key/1.1/salt/ >> "$WP_CONFIG"