From 0ac16d6e0e011fffeda214f4cb2ca368a028f639 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Fri, 16 Feb 2024 11:06:03 -0800 Subject: [PATCH] autodetect cert for https, output login info when done --- local/bin/wp-installer.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/local/bin/wp-installer.sh b/local/bin/wp-installer.sh index 654cbfd..450ed7f 100755 --- a/local/bin/wp-installer.sh +++ b/local/bin/wp-installer.sh @@ -178,7 +178,12 @@ function validate_u() { fi } if [ -z "${input_values_array[r]}" ] ; then - input_values_array[r]="www.${input_values_array[v]}" + if [ -f /etc/ssl/letsencrypt/${input_values_array[v]}.pem ]; then + HTTP=https + else + HTTP=http + fi + input_values_array[r]="$HTTP://www.${input_values_array[v]}" fi if [ -n "${input_values_array[r]}" ] ; then validate_u @@ -375,6 +380,13 @@ EOF /usr/bin/rm $virtualhost_basedir/${input_values_array[v]}/$virtualhost_htdocsdir/index.html fi + echo "WordPress Installed for ${input_values_array[v]}" + echo "URL: ${input_values_array[r]}" + echo "Admin Login: ${input_values_array[r]}/wp-login.php" + echo "Admin Email: ${input_values_array[e]}" + echo "Admin Username: ${input_values_array[u]}" + echo "Admin Password: ${input_values_array[p]}" + elif [[ "$option" == "q" ]]; then echo "Quiting without installing." elif [[ " ${input_keys_index[@]} " =~ " $option " ]]; then