From 43baa965c5c04fd5ad95e2b724316ad076bfce0c Mon Sep 17 00:00:00 2001 From: allan Date: Mon, 2 Jun 2025 14:28:55 +0200 Subject: [PATCH] minor changes --- README.md | 4 ++++ giteainstall | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 49194ed..32cd294 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,10 @@ and also the default "sites-enabled" Nginx configurarion I use [\[Here\]](https://git.x-files.dk/ubuntu-web-server/nginx-install/src/branch/main/cfg/default) when you start troubleshooting. +### Q and A +Q: Why does the script need the MariaDB root password ?\ +A: The script need this password in order to be able to create the wordpress database and det the correct permisions. + ### More guides More guides can be found on [\[wiki.x-files.dk\]](https://wiki.x-files.dk) diff --git a/giteainstall b/giteainstall index dc416fd..e0860ad 100755 --- a/giteainstall +++ b/giteainstall @@ -35,6 +35,7 @@ printf -- "giteamultiinstall \n\n" printf -- "Usage: \n" printf -- "./giteainstall [-n] \n" printf -- " [-p] \n" +printf -- " [-r] \n" printf -- " [-help] \n\n" printf -- "Examples: \n" printf -- "./giteamultiinstall -n git.something.xyz -p giteadatabsepwd\n\n"; } @@ -48,7 +49,8 @@ servicedead () { status=$(systemctl is-active $service); if [[ "$status" != "ac # inputcheck () { if [[ -z "$hostname" ]]; then usage ; printf "Error! Hostname Empty...\n\n" ; exit; fi -if [[ -z "$giteapwd" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; } +if [[ -z "$giteapwd" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi +if [[ -z "$mariadbpwd" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; } # # If Nginx and MariaDB is not running then die # @@ -61,13 +63,12 @@ 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 # shellcheck disable=SC2086 - -while getopts "n:p:h:" option; do +while getopts "n:p:r:h:" option; do case $option in n) # hostname @@ -76,6 +77,9 @@ while getopts "n:p:h:" option; do p) # database password giteapwd=$OPTARG;; + r) # database password + mariadbpwd=$OPTARG;; + h) # display help usage ; exit;; @@ -86,7 +90,7 @@ done # # Check if input conditions are met # -inputcheck "$hostname" "$giteapwd" +inputcheck "$hostname" "$giteapwd" "$mariadbpwd" # # Check if a Nginx conf file with the hostname allready exists # @@ -122,7 +126,7 @@ GRANT ALL PRIVILEGES ON $giteauser$giteadb.* TO '$giteauser'@'127.0.0.1' IDENTIF FLUSH PRIVILEGES; " printf '%s\n' "${giteasql[@]}" |sed '1d; $d' > giteasql.sql -mysql < giteasql.sql +mysql -u root -p"$mariadbpwd" < giteasql.sql # # Create a Gitea Nginx configuration file #