From 1a75a232402f2ec3ad1475218eae1020886b0560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Tue, 24 Mar 2020 11:28:52 +0100 Subject: [PATCH] MAINT: make paths relative to file location --- utils/backup.sh | 5 +++-- utils/load_settings.sh | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/backup.sh b/utils/backup.sh index bdf334b..d041d57 100755 --- a/utils/backup.sh +++ b/utils/backup.sh @@ -58,11 +58,12 @@ backup: EOF ) +UTILS_PATH=`dirname "$(realpath $0)"` # Load settings from .config and defaults ##################################### -. load_settings.sh +. $UTILS_PATH/load_settings.sh # load useful functions ####################################################### -. helpers.sh +. $UTILS_PATH/helpers.sh function backup() { NARG_NAME="$1" diff --git a/utils/load_settings.sh b/utils/load_settings.sh index 461e3ee..5f2b499 100644 --- a/utils/load_settings.sh +++ b/utils/load_settings.sh @@ -18,8 +18,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -[[ -n "../config.defaults" ]] && source "../config.defaults" -[[ -n "../.config" ]] && source "../.config" +UTILS_PATH=`dirname "$(realpath $0)"` +MAIN_PATH=`dirname "${UTILS_PATH}"` + +[[ -n "${MAIN_PATH}/config.defaults" ]] && source "${MAIN_PATH}/config.defaults" +[[ -n "${MAIN_PATH}/.config" ]] && source "${MAIN_PATH}/.config" [[ -n "$ENV_FILE" ]] && source "$ENV_FILE" if [[ -z "$DATABASE_NAME" && -z "$MYSQL_CONNECTION" ]] -- GitLab