From 3b46c5119dfafbba53f5f69c718d72206661aebc Mon Sep 17 00:00:00 2001
From: sebastien curt <curt.sebastien@gmail.com>
Date: Tue, 17 Jan 2017 16:30:09 +0100
Subject: [PATCH] InstallMySQL.sh : - read env file to set root password
 manually if required

Run.sh :
- support TetrasBack install
---
 installMySQL.env     |  1 +
 installMySQL.sh      | 17 +++++++----------
 installTetrasBack.sh | 32 ++++++++++++++++++++++++++++++++
 run.sh               |  5 +++++
 4 files changed, 45 insertions(+), 10 deletions(-)
 create mode 100644 installMySQL.env
 create mode 100644 installTetrasBack.sh

diff --git a/installMySQL.env b/installMySQL.env
new file mode 100644
index 0000000..4b64135
--- /dev/null
+++ b/installMySQL.env
@@ -0,0 +1 @@
+# MYSQL_ROOT_PASSWORD="password"
diff --git a/installMySQL.sh b/installMySQL.sh
index 484eebd..a60cfee 100644
--- a/installMySQL.sh
+++ b/installMySQL.sh
@@ -18,13 +18,10 @@
 
 set -o nounset                              # Treat unset variables as an error
 
-
-###########################################################################
-# 1. Install MySql
-# 2. Save root password to file /root/.my.cnf
-# 3. Configure MySql with mysql_secure_installation
-# 4. Start mysql service
-###########################################################################
+if [ -f installMySQL.env ]
+then
+    . `pwd`/installMySQL.env
+fi
 
 # If mysql not installed then install it
 DEBIAN_FRONTEND='noninteractive' apt-get -qq install mysql-server \
@@ -102,6 +99,6 @@ rm -v ${configureMySQLFile} # Remove the generated Expect script
 unset configureMySQLFile
 unset MYSQL_ROOT_PASSWORD
 
-echo "MySQL setup completed. Insecure defaults are gone. Please remove"
-echo " this script manually when you are done with it (or at least "
-echo "remove the MySQL root password that you put inside it."
+echo "MySQL setup completed. Insecure defaults are gone. Please remove" \
+     "this script manually when you are done with it (or at least " \
+     "remove the MySQL root password that you put inside it."
diff --git a/installTetrasBack.sh b/installTetrasBack.sh
new file mode 100644
index 0000000..a7d8217
--- /dev/null
+++ b/installTetrasBack.sh
@@ -0,0 +1,32 @@
+#!/bin/bash - 
+#
+# Copyright (C) 2017  Tetras Libre <admin@tetras-libre.fr>
+# Author: Curt, Sebastien <sebastien.curt@tetras-libre.fr>
+#
+# This program is free software: you can redistribute it and/or modify # it
+# under the terms of the GNU General Public License as published by # the Free
+# Software Foundation, either version 3 of the License, or # (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, # but WITHOUT
+# ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the # GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License # along
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set -o nounset                              # Treat unset variables as an error
+
+DEBIAN_FRONTEND="noninteractive" apt-get install git gnulib perl sendmail udev \
+    systemd
+
+OriginalDirectory=`pwd`
+
+git clone https://gitlab.tetras-libre.fr/tetras-libre/Tetras-back.git
+cd Tetras-back
+make dependencies
+make
+make config
+
+cd OriginalDirectory
diff --git a/run.sh b/run.sh
index 05cb9bc..c921d62 100644
--- a/run.sh
+++ b/run.sh
@@ -37,3 +37,8 @@ if [ -f installDolibarr.sh ]
 then
     . `pwd`/installDolibarr.sh
 fi
+
+if [ -f installTetrasBack.sh ]
+then
+    . `pwd`/installTetrasBack.sh
+fi
-- 
GitLab