From ba97731670deba002eb4fff7ad410e9685af8280 Mon Sep 17 00:00:00 2001 From: allan Date: Mon, 2 Jun 2025 13:51:40 +0200 Subject: [PATCH] minor changes --- README.md | 4 ++++ giteainstall | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f2724fe..a4682b1 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,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 eb0ece3..1696a5b 100755 --- a/giteainstall +++ b/giteainstall @@ -31,6 +31,7 @@ printf -- "giteainstall \n\n" printf -- "Usage: \n" printf -- "./giteainstall [-n] \n" printf -- " [-p] \n" +printf -- " [-r] \n" printf -- " [-help] \n\n" printf -- "Examples: \n" printf -- "./giteainstall -n git.something.xyz -p giteadatabsepwd\n\n"; } @@ -44,7 +45,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 "$mariadbpass" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; } # # If Nginx and MariaDB is not running then die # @@ -58,11 +60,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:p:h:" option; do +# shellcheck disable=SC2086 +while getopts "n:p:r:h:" option; do case $option in n) # hostname @@ -71,6 +73,9 @@ while getopts "n:p:h:" option; do p) # database password giteapwd=$OPTARG;; + r) # mariadb root password + mariadbpass=$OPTARG;; + h) # display help usage ; exit;; @@ -103,7 +108,7 @@ GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'127.0.0.1' IDENTIFIED BY '$giteapwd' FLUSH PRIVILEGES; " printf '%s\n' "${giteasql[@]}" |sed '1d; $d' > giteasql.sql -mysql < giteasql.sql +mysql -u root -p"$mariadbpass" < giteasql.sql # # Create a Gitea Nginx configuration file #