MV Enviroment Vars 2 Global LIB

This commit is contained in:
2019-05-11 23:38:21 +02:00
parent 73bbce159d
commit 297c6f958a
3 changed files with 34 additions and 44 deletions

View File

@ -14,16 +14,17 @@
# $2: <paht of md5-file>
# [$3]: <path to movie folder>
{ #set enviroemnt
readonly TRUE=1 #like <stdbool.h>
readonly FALSE=0 #like <stdbool.h>
readonly TTSYNC_EXIST=0
readonly TTSYNC_BACKUP=1
readonly TTSYNC_REMOTE=2
readonly TTSYNC_DEL=3
readonly globalconf="/etc/tt/global"
[ -z "$DEBUG" ] && readonly DEBUG=$FALSE
}
#load functions from LIB
if [ -f "$(readlink -f "$(dirname $0)/bash-lib")" ]; then
source "$(readlink -f "$(dirname $0)/bash-lib")"
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
elif [ -f "<LIBDIR>/bash-lib" ]; then #<LIBDIR>
source "<LIBDIR>/bash-lib"
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
else
echo "ERROR: Global Lib not found"
exit 255
fi
{ #get options & args
readonly mode=$(echo $1 | tr -d '-')
@ -35,18 +36,6 @@
dbhost=$(grep -v '#' $globalconf | grep ^dbhost= | sed "s|^dbhost=||g" | tr -d '"')
dbuser=$(grep -v '#' $globalconf | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"')
dbpwd=$(grep -v '#' $globalconf | grep ^dbpwd= | sed "s|^dbpwd=||g" | tr -d '"')
#load functions from LIB
if [ -f "$(readlink -f "$(dirname $0)/bash-lib")" ]; then
source "$(readlink -f "$(dirname $0)/bash-lib")"
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
elif [ -f "<LIBDIR>/bash-lib" ]; then #<LIBDIR>
source "<LIBDIR>/bash-lib"
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
else
echo "ERROR: Global Lib not found"
exit 255
fi
}
function help() {