Skip to content
Snippets Groups Projects
Commit 1d797300 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: make calling skripts more cwd independent

parent c908d69b
Branches
Tags
No related merge requests found
...@@ -24,10 +24,11 @@ ...@@ -24,10 +24,11 @@
# Dump a database with all procedures, permissions, structure and data # Dump a database with all procedures, permissions, structure and data
if [ -z "$UTILSPATH" ]; then if [ -z "$UTILSPATH" ]; then
UTILSPATH="$(realpath $(dirname $0))" UTILSPATH="$(realpath $(dirname $0))"
export UTILSPATH export UTILSPATH
MAINPATH="$(dirname $UTILSPATH)"
export MAINPATH
fi fi
# The directory which the dump is to be stored to. Do not change it here. Use # 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. # the --backupdir=./my/dir/ option or an environment variable instead.
......
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
# - .config (in the current directory) # - .config (in the current directory)
# - The file given in ENV_FILE. # - The file given in ENV_FILE.
if [ "$MAINPATH" ]; then
pushd "$MAINPATH" > /dev/null
pushed=1
fi
if [[ -r "config.defaults" ]] ; then if [[ -r "config.defaults" ]] ; then
source "config.defaults" source "config.defaults"
fi fi
...@@ -38,6 +43,10 @@ if [[ -z "$MYSQL_CMD" ]] ; then ...@@ -38,6 +43,10 @@ if [[ -z "$MYSQL_CMD" ]] ; then
exit 1 exit 1
fi fi
if [ $pushed ]; then
popd > /dev/null
fi
export MYSQL_CMD export MYSQL_CMD
export MYSQLDUMP_CMD export MYSQLDUMP_CMD
export MYSQLADMIN_CMD export MYSQLADMIN_CMD
......
...@@ -29,6 +29,8 @@ INSTALL_SQL_FILE="db_2_0.sql" ...@@ -29,6 +29,8 @@ INSTALL_SQL_FILE="db_2_0.sql"
if [ -z "$UTILSPATH" ]; then if [ -z "$UTILSPATH" ]; then
UTILSPATH="$(realpath $(dirname $0))" UTILSPATH="$(realpath $(dirname $0))"
export UTILSPATH export UTILSPATH
MAINPATH="$(dirname $UTILSPATH)"
export MAINPATH
fi fi
source $UTILSPATH/load_settings.sh source $UTILSPATH/load_settings.sh
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
if [ -z "$UTILSPATH" ]; then if [ -z "$UTILSPATH" ]; then
UTILSPATH=$(realpath "$(dirname $0)") UTILSPATH=$(realpath "$(dirname $0)")
export UTILSPATH export UTILSPATH
MAINPATH="$(dirname $UTILSPATH)"
export MAINPATH
fi fi
source $UTILSPATH/helpers.sh source $UTILSPATH/helpers.sh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment