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
|
#Bash-Library for TerabyteTerminator Project
|
||||||
LIBVER=1.1
|
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,16 +14,17 @@
|
|||||||
# $2: <paht of md5-file>
|
# $2: <paht of md5-file>
|
||||||
# [$3]: <path to movie folder>
|
# [$3]: <path to movie folder>
|
||||||
|
|
||||||
{ #set enviroemnt
|
#load functions from LIB
|
||||||
readonly TRUE=1 #like <stdbool.h>
|
if [ -f "$(readlink -f "$(dirname $0)/bash-lib")" ]; then
|
||||||
readonly FALSE=0 #like <stdbool.h>
|
source "$(readlink -f "$(dirname $0)/bash-lib")"
|
||||||
readonly TTSYNC_EXIST=0
|
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
|
||||||
readonly TTSYNC_BACKUP=1
|
elif [ -f "<LIBDIR>/bash-lib" ]; then #<LIBDIR>
|
||||||
readonly TTSYNC_REMOTE=2
|
source "<LIBDIR>/bash-lib"
|
||||||
readonly TTSYNC_DEL=3
|
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
|
||||||
readonly globalconf="/etc/tt/global"
|
else
|
||||||
[ -z "$DEBUG" ] && readonly DEBUG=$FALSE
|
echo "ERROR: Global Lib not found"
|
||||||
}
|
exit 255
|
||||||
|
fi
|
||||||
|
|
||||||
{ #get options & args
|
{ #get options & args
|
||||||
readonly mode=$(echo $1 | tr -d '-')
|
readonly mode=$(echo $1 | tr -d '-')
|
||||||
@ -35,18 +36,6 @@
|
|||||||
dbhost=$(grep -v '#' $globalconf | grep ^dbhost= | sed "s|^dbhost=||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 '"')
|
dbuser=$(grep -v '#' $globalconf | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"')
|
||||||
dbpwd=$(grep -v '#' $globalconf | grep ^dbpwd= | sed "s|^dbpwd=||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() {
|
function help() {
|
||||||
|
@ -6,16 +6,17 @@
|
|||||||
## Options/Parameter
|
## Options/Parameter
|
||||||
# [$1]: <path to movie folder>
|
# [$1]: <path to movie folder>
|
||||||
|
|
||||||
{ #set enviroemnt
|
#load functions from LIB
|
||||||
readonly TRUE=1 #like <stdbool.h>
|
if [ -f "$(readlink -f "$(dirname $0)/bash-lib")" ]; then
|
||||||
readonly FALSE=0 #like <stdbool.h>
|
source "$(readlink -f "$(dirname $0)/bash-lib")"
|
||||||
readonly TTSYNC_EXIST=0 #file exist local
|
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
|
||||||
readonly TTSYNC_BACKUP=1 #file exist local - backup exist
|
elif [ -f "<LIBDIR>/bash-lib" ]; then #<LIBDIR>
|
||||||
readonly TTSYNC_REMOTE=2 #file exists remote - not used jet
|
source "<LIBDIR>/bash-lib"
|
||||||
readonly TTSYNC_DEL=3 #local file deleted
|
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER"
|
||||||
readonly globalconf="/etc/tt/global"
|
else
|
||||||
[ -z "$DEBUG" ] && readonly DEBUG=$FALSE
|
echo "ERROR: Global Lib not found"
|
||||||
}
|
exit 255
|
||||||
|
fi
|
||||||
|
|
||||||
{ #get options & args
|
{ #get options & args
|
||||||
readonly mode=$(echo $1 | tr -d '-')
|
readonly mode=$(echo $1 | tr -d '-')
|
||||||
@ -38,18 +39,6 @@
|
|||||||
dbhost=$(grep -v '#' $globalconf | grep ^dbhost= | sed "s|^dbhost=||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 '"')
|
dbuser=$(grep -v '#' $globalconf | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"')
|
||||||
dbpwd=$(grep -v '#' $globalconf | grep ^dbpwd= | sed "s|^dbpwd=||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() {
|
function help() {
|
||||||
|
Loading…
Reference in New Issue
Block a user