From 42b15e8a27397796e2e0036320b27fcd6ced35d7 Mon Sep 17 00:00:00 2001 From: allan Date: Fri, 29 Aug 2025 10:27:41 +0200 Subject: [PATCH] added creation of db --- helper | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/helper b/helper index 38b2547..ca0e9f9 100644 --- a/helper +++ b/helper @@ -231,3 +231,22 @@ git_clone_if_missing() { echo "Cloning repository $repo into $target_dir..." git clone --quiet --branch main "$repo" "$target_dir" } + +# +# Creates a MariaDB database and user +# +setup_mariadb() { + local mariapwd="$1" dbname="$2" dbuser="$3" dbpass="$4" + + if [[ -z "$mariapwd" || -z "$dbname" || -z "$dbuser" || -z "$dbpass" ]]; then + echo "Error: setup_mariadb requires mariapwd, dbname, dbuser, dbpass" + exit 1 + fi + +mysql -u root -p"$mariapwd" <