From 5bc91a640d8bafd682447e52cfbe0757c136fe6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org>
Date: Thu, 26 Mar 2020 13:33:47 +0100
Subject: [PATCH] MAINT: use better code for setting UTILSPATH

---
 utils/backup.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/utils/backup.sh b/utils/backup.sh
index 22c1406..549393d 100755
--- a/utils/backup.sh
+++ b/utils/backup.sh
@@ -24,6 +24,11 @@
 
 # Dump a database with all procedures, permissions, structure and data
 
+
+if [ -z "$UTILSPATH" ]; then
+	UTILSPATH="$(realpath $(dirname $0))"
+	export UTILSPATH
+fi
 # The directory which the dump is to be stored to. Do not change it here. Use
 # the --backupdir=./my/dir/ option or an environment variable instead.
 BACKUPDIR="${BACKUPDIR:-../backup}"
@@ -58,7 +63,6 @@ backup:
 EOF
         )
 
-UTILS_PATH=`dirname "$(realpath $0)"`
 # Load settings from .config and defaults #####################################
 . $UTILS_PATH/load_settings.sh
 
-- 
GitLab