From 37377dd3d6997f263823006ca38db67177fee338 Mon Sep 17 00:00:00 2001
From: Chris Sharp <csharp@georgialibraries.org>
Date: Mon, 4 Mar 2019 14:00:23 -0500
Subject: [PATCH] move confirmation that we want to run setup to the beginning
 of the script

---
 templates/setup-head.sh | 70 ++++++++++++++++++++++++-------------------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/templates/setup-head.sh b/templates/setup-head.sh
index 18210d6..665e136 100755
--- a/templates/setup-head.sh
+++ b/templates/setup-head.sh
@@ -25,41 +25,6 @@ if [ ! -d debs ] ### Check if debs exist.
         exit 3
 fi
 
-### Due to bug in apparmor profile for ejabberd we disable apparmor for installation
-echo;echo;echo;echo
-echo "Due to bug in apparmor profile for ejabberd we disable apparmor for installation"
-echo "Stopping and tearing down apparmor..."
-sleep 3
-echo;echo "stopping apparmor"
-if ! service apparmor stop 
-then
-	echo;echo;echo "Failed to stop apparmor"
-	echo "please run: service apparmor stop"
-	read -p "then press [Enter] to continue: " ENTER
-else
-	echo done.
-	sleep 1
-fi
-
-echo;echo "tearing down apparmor"
-if ! service apparmor teardown
-then
-	echo;echo;echo "Failed to teardown apparmor"
-	echo "Please run: service apparmor teardown"
-	read -p "then press [Enter] to continue: " ENTER
-else
-	echo done.
-	sleep 1
-fi
-
-Prep_DB_9_X () { #Prepare the database schema
-/openils/bin/eg_db_config --service all --create-schema --create-offline --create-database \
- --user EG_DB_USER --password EG_DB_PASSWORD --hostname MASTER_DB.CLUSTER_DOMAINNAME --port 5432 \
- --database evergreen --admin-user EG_ADMIN_USER --admin-pass EG_ADMIN_PASS
-
-}
-
-
 if [ -e $INSTALL_LOG ]
         then
         echo
@@ -100,6 +65,41 @@ echo
 
 echo $(date) >> "$INSTALL_LOG"
 
+
+### Due to bug in apparmor profile for ejabberd we disable apparmor for installation
+echo;echo;echo;echo
+echo "Due to bug in apparmor profile for ejabberd we disable apparmor for installation"
+echo "Stopping and tearing down apparmor..."
+sleep 3
+echo;echo "stopping apparmor"
+if ! service apparmor stop 
+then
+	echo;echo;echo "Failed to stop apparmor"
+	echo "please run: service apparmor stop"
+	read -p "then press [Enter] to continue: " ENTER
+else
+	echo done.
+	sleep 1
+fi
+
+echo;echo "tearing down apparmor"
+if ! service apparmor teardown
+then
+	echo;echo;echo "Failed to teardown apparmor"
+	echo "Please run: service apparmor teardown"
+	read -p "then press [Enter] to continue: " ENTER
+else
+	echo done.
+	sleep 1
+fi
+
+Prep_DB_9_X () { #Prepare the database schema
+/openils/bin/eg_db_config --service all --create-schema --create-offline --create-database \
+ --user EG_DB_USER --password EG_DB_PASSWORD --hostname MASTER_DB.CLUSTER_DOMAINNAME --port 5432 \
+ --database evergreen --admin-user EG_ADMIN_USER --admin-pass EG_ADMIN_PASS
+
+}
+
 THISHOST="head_file"
 if echo "$THISHOST" | grep -q "brick01-head" 
 	then
-- 
2.11.0