From a3b4d259d78f8dba34748659ed09ad5cf6657ab3 Mon Sep 17 00:00:00 2001
From: Elian Loraux <elian.loraux@tetras-libre.fr>
Date: Wed, 23 Oct 2024 11:59:06 +0200
Subject: [PATCH] update loaded env file and prompte for utils

---
 utils/attestDolibarr.sh                      | 8 +++++---
 utils/clamav-weekly.sh                       | 2 +-
 utils/configure_base_tools.sh                | 3 ++-
 utils/expandCertbot.sh                       | 2 +-
 utils/getLastDolibarrDeb.sh                  | 2 +-
 utils/getip.sh                               | 2 +-
 utils/nextcloudStrongDirectoryPermissions.sh | 2 +-
 utils/startcollabora.sh                      | 8 +++++---
 8 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/utils/attestDolibarr.sh b/utils/attestDolibarr.sh
index 3b047f6..2f75062 100755
--- a/utils/attestDolibarr.sh
+++ b/utils/attestDolibarr.sh
@@ -1,13 +1,15 @@
 #!/bin/bash
 
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
 
-if [ ! -e $(pwd)/$(dirname "$0")/../main.env ]
+if [ ! -e $(dirname "$0")/../main.env ]
 then
     echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it"
     exit 1
+else
+    echo "Environment file loaded"
 fi
-. $(pwd)/$(dirname "$0")/../main.env
+. $(dirname "$0")/../main.env
 
 version=7.0
 dol_path="/usr/share/dolibarr"
diff --git a/utils/clamav-weekly.sh b/utils/clamav-weekly.sh
index 009b4af..d8dab0a 100755
--- a/utils/clamav-weekly.sh
+++ b/utils/clamav-weekly.sh
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
 
 LOGFILE="/var/log/clamav.log";
 EMAIL_TO="root";
diff --git a/utils/configure_base_tools.sh b/utils/configure_base_tools.sh
index baaae43..732acb1 100755
--- a/utils/configure_base_tools.sh
+++ b/utils/configure_base_tools.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
+
 
 if [ -z "$(grep '^alias ls=' /root/.bashrc)" ]
 then
diff --git a/utils/expandCertbot.sh b/utils/expandCertbot.sh
index 4504b13..e51d8ce 100644
--- a/utils/expandCertbot.sh
+++ b/utils/expandCertbot.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
 
 if [ -z "$2" ]
 then
diff --git a/utils/getLastDolibarrDeb.sh b/utils/getLastDolibarrDeb.sh
index 7b4f9df..042338f 100755
--- a/utils/getLastDolibarrDeb.sh
+++ b/utils/getLastDolibarrDeb.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
 
 # Get Dolideb version list
 curl \
diff --git a/utils/getip.sh b/utils/getip.sh
index 378ccb6..1c42efd 100755
--- a/utils/getip.sh
+++ b/utils/getip.sh
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
 
 isIP()
 {
diff --git a/utils/nextcloudStrongDirectoryPermissions.sh b/utils/nextcloudStrongDirectoryPermissions.sh
index d9e7304..c4a9902 100755
--- a/utils/nextcloudStrongDirectoryPermissions.sh
+++ b/utils/nextcloudStrongDirectoryPermissions.sh
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
 
 # from  https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html?highlight=trusted#trusted-domains
 NEXTCLOUD_INSTALL_DIR=${NEXTCLOUD_INSTALL_DIR:-'/var/www/nextcloud'}
diff --git a/utils/startcollabora.sh b/utils/startcollabora.sh
index ebf8403..54654f4 100755
--- a/utils/startcollabora.sh
+++ b/utils/startcollabora.sh
@@ -1,13 +1,15 @@
 #!/bin/bash
 
-echo "============= $(basename "$0") ================="
+echo "RUN $(basename "$0") ==="
 
-if [ ! -e $(pwd)/$(dirname "$0")/../main.env ]
+if [ ! -e $(dirname "$0")/../main.env ]
 then
     echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it"
     exit 1
+else
+    echo "Environment file loaded"
 fi
-. $(pwd)/$(dirname "$0")/../main.env
+. $(dirname "$0")/../main.env
 
 SCRIPT_DIRECTORY=`dirname $0`
 . $SCRIPT_DIRECTORY/main.env
-- 
GitLab