minor changes

This commit is contained in:
allan 2025-06-02 13:12:08 +02:00
parent 4c5475ff27
commit 52a073040b

View File

@ -33,6 +33,7 @@ printf -- "./wordpressinstall [-n] <wordpress domain>
printf -- " [-d] <wordpress database name> \n" printf -- " [-d] <wordpress database name> \n"
printf -- " [-u] <wordpress database user> \n" printf -- " [-u] <wordpress database user> \n"
printf -- " [-p] <wordpress database password> \n" printf -- " [-p] <wordpress database password> \n"
printf -- " [-r] <database root password> \n"
printf -- " [-help] <this screen> \n\n" printf -- " [-help] <this screen> \n\n"
printf -- "Examples: \n" printf -- "Examples: \n"
printf -- "./wordpressinstall -n wp.something.xyz -d wpdb -u wpuser -p wppassword \n\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 "$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 "$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 "$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 # If Nginx and MariaDB is not running then die
# #
@ -61,11 +63,11 @@ clear ; title
# Configure command line options # Configure command line options
# #
# Removed due to SC2199 and not really needed start # shellcheck disable=SC2199
# if [[ ! $@ =~ ^\-.+ ]]; then usage; fi if [[ ! $@ =~ ^\-.+ ]]; then usage; fi
# Removed due to SC2199 and not really needed stop
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 case $option in
n) # hostname n) # hostname
@ -80,6 +82,9 @@ while getopts "n:d:u:p:h:" option; do
p) # wordpress database password p) # wordpress database password
wpdbpass=$OPTARG;; wpdbpass=$OPTARG;;
r) # wordpress database password
rootdbpass=$OPTARG;;
h) # display help h) # display help
usage ; exit;; usage ; exit;;
@ -90,7 +95,7 @@ done
# #
# Check if input conditions are met # Check if input conditions are met
# #
inputcheck "$hostname" "$wpdbname" "$wpdbuser" "$wpdbpass" inputcheck "$hostname" "$wpdbname" "$wpdbuser" "$wpdbpass" "$rootdbpass"
# #
# Download Wordpress # Download Wordpress
# #
@ -124,7 +129,7 @@ GRANT ALL PRIVILEGES ON $wpdbname.* TO '$wpdbuser'@'localhost';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
" "
printf '%s\n' "${wpsql[@]}" |sed '1d; $d' > wpsql.sql 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 # Create a Wordpress Nginx configuration file
# #