MV Enviroment Vars 2 Global LIB
This commit is contained in:
parent
73bbce159d
commit
297c6f958a
@ -1,2 +1,14 @@
|
||||
#!/bin/bash
|
||||
#Bash-Library for TerabyteTerminator Project
|
||||
LIBVER=1.1
|
||||
|
||||
{ #set enviroemnt
|
||||
readonly TRUE=1 #like <stdbool.h>
|
||||
readonly FALSE=0 #like <stdbool.h>
|
||||
readonly TTSYNC_EXIST=0 #file exist local
|
||||
readonly TTSYNC_BACKUP=1 #file exist local - backup exist
|
||||
readonly TTSYNC_REMOTE=2 #file exists remote - not used jet
|
||||
readonly TTSYNC_DEL=3 #local file deleted
|
||||
readonly globalconf="/etc/tt/global"
|
||||
[ -z "$DEBUG" ] && readonly DEBUG=$FALSE
|
||||
}
|
||||
|
@ -14,28 +14,6 @@
|
||||
# $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
|
||||
}
|
||||
|
||||
{ #get options & args
|
||||
readonly mode=$(echo $1 | tr -d '-')
|
||||
readonly md5list="$2"
|
||||
moviedir="$3"
|
||||
|
||||
#db
|
||||
dbname=$(grep -v '#' $globalconf | grep ^dbname= | sed "s|^dbname=||g" | tr -d '"')
|
||||
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")"
|
||||
@ -47,6 +25,17 @@
|
||||
echo "ERROR: Global Lib not found"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
{ #get options & args
|
||||
readonly mode=$(echo $1 | tr -d '-')
|
||||
readonly md5list="$2"
|
||||
moviedir="$3"
|
||||
|
||||
#db
|
||||
dbname=$(grep -v '#' $globalconf | grep ^dbname= | sed "s|^dbname=||g" | tr -d '"')
|
||||
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 '"')
|
||||
}
|
||||
|
||||
function help() {
|
||||
|
@ -6,16 +6,17 @@
|
||||
## Options/Parameter
|
||||
# [$1]: <path to movie folder>
|
||||
|
||||
{ #set enviroemnt
|
||||
readonly TRUE=1 #like <stdbool.h>
|
||||
readonly FALSE=0 #like <stdbool.h>
|
||||
readonly TTSYNC_EXIST=0 #file exist local
|
||||
readonly TTSYNC_BACKUP=1 #file exist local - backup exist
|
||||
readonly TTSYNC_REMOTE=2 #file exists remote - not used jet
|
||||
readonly TTSYNC_DEL=3 #local file deleted
|
||||
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 '-')
|
||||
@ -38,18 +39,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() {
|
||||
|
Loading…
Reference in New Issue
Block a user