From 52a073040bb86c4db314a80c8e062c66700a1d59 Mon Sep 17 00:00:00 2001 From: allan Date: Mon, 2 Jun 2025 13:12:08 +0200 Subject: [PATCH] minor changes --- wordpressinstall | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/wordpressinstall b/wordpressinstall index 993ac61..c01db6f 100755 --- a/wordpressinstall +++ b/wordpressinstall @@ -33,6 +33,7 @@ printf -- "./wordpressinstall [-n] printf -- " [-d] \n" printf -- " [-u] \n" printf -- " [-p] \n" +printf -- " [-r] \n" printf -- " [-help] \n\n" printf -- "Examples: \n" printf -- "./wordpressinstall -n wp.something.xyz -d wpdb -u wpuser -p wppassword \n\n"; } @@ -48,7 +49,8 @@ inputcheck () { if [[ -z "$hostname" ]]; then usage ; printf "Error! Hostname Empty...\n\n" ; exit; fi if [[ -z "$wpdbname" ]]; then usage ; printf "Error! Database name Empty...\n\n" ; exit; fi if [[ -z "$wpdbuser" ]]; then usage ; printf "Error! Database username Empty...\n\n" ; exit; fi -if [[ -z "$wpdbpass" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; } +if [[ -z "$wpdbpass" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi +if [[ -z "$rootdbpass" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; } # # If Nginx and MariaDB is not running then die # @@ -61,11 +63,11 @@ clear ; title # Configure command line options # -# Removed due to SC2199 and not really needed start -# if [[ ! $@ =~ ^\-.+ ]]; then usage; fi -# Removed due to SC2199 and not really needed stop +# shellcheck disable=SC2199 +if [[ ! $@ =~ ^\-.+ ]]; then usage; fi -while getopts "n:d:u:p:h:" option; do +# shellcheck disable=SC2086 +while getopts "n:d:u:p:r:h:" option; do case $option in n) # hostname @@ -80,6 +82,9 @@ while getopts "n:d:u:p:h:" option; do p) # wordpress database password wpdbpass=$OPTARG;; + r) # wordpress database password + rootdbpass=$OPTARG;; + h) # display help usage ; exit;; @@ -90,7 +95,7 @@ done # # Check if input conditions are met # -inputcheck "$hostname" "$wpdbname" "$wpdbuser" "$wpdbpass" +inputcheck "$hostname" "$wpdbname" "$wpdbuser" "$wpdbpass" "$rootdbpass" # # Download Wordpress # @@ -124,7 +129,7 @@ GRANT ALL PRIVILEGES ON $wpdbname.* TO '$wpdbuser'@'localhost'; FLUSH PRIVILEGES; " printf '%s\n' "${wpsql[@]}" |sed '1d; $d' > wpsql.sql -mysql < wpsql.sql +mysql -u root -p"$rootdbpass" < wpsql.sql # # Create a Wordpress Nginx configuration file #