From c4ea9cf84c90e3199d5d78e747f1d7f1667e6327 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Thu, 10 Nov 2022 21:26:27 -0500
Subject: [PATCH] Add database setup command

Note that database setup is more complicated and handled in a
completely separate script.

This just downloads the corresponding script and then runs that.
---
 .gitignore |  2 ++
 run.sh     | 24 +++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b0c665a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+
+src/database_setup/
diff --git a/run.sh b/run.sh
index b3f7c91..906e63b 100755
--- a/run.sh
+++ b/run.sh
@@ -9,7 +9,7 @@ set -e
 
 
 # Import utility script.
-source $(dirname $0)/src/utils.sh
+source $(dirname ${0})/src/utils.sh
 
 
 ###
@@ -57,6 +57,28 @@ function main () {
             echo -e "${text_blue}This may ask for your system password.${text_reset}"
             get_user_confirmation "${text_blue}This will also trigger a general system update. Is this okay?${text_reset}"
 
+            if [[ ${return_value} == true ]]
+            then
+                # Check if dir exists. Purge if so.
+                if [[ -d "./database_setup" ]]
+                then
+                    sudo rm -r ./database_setup
+                fi
+
+                # Clone relevant script to local machine.
+                git clone https://git.brandon-rodriguez.com/scripts/bash/database_setup.git
+                ./database_setup/run.sh
+
+                echo ""
+                echo -e "${text_blue}Local database installed and setup."
+                echo ""
+
+            else
+                echo ""
+                echo -e "${text_blue}Cancelling local database setup."
+                echo ""
+            fi
+
         elif [[ "${user_input}" == "3" ]]
         then
             # Install/Update Npm & NodeJs.
-- 
GitLab