Rename service variable to hooks

This commit is contained in:
JuliusFreudenberger 2022-02-20 19:07:06 +01:00
parent af5be2c1ea
commit 9ff150ff01

View file

@ -8,7 +8,7 @@ PING_ROUTE=$HC_HOST/ping/$HC_UUID
HAS_HOOKS="" HAS_HOOKS=""
checkInput() { checkInput() {
for variable in SERVICE BACKUP_PATH HC_UUID RESTIC_REPOSITORY RESTIC_PASSWORD; do for variable in HOOKS BACKUP_PATH HC_UUID RESTIC_REPOSITORY RESTIC_PASSWORD; do
if [[ -z ${!variable} ]]; then if [[ -z ${!variable} ]]; then
echo "Variable $variable not given" echo "Variable $variable not given"
exit 1 exit 1
@ -17,13 +17,13 @@ checkInput() {
} }
checkForHooks() { checkForHooks() {
test -f "$SERVICE.sh" && HAS_HOOKS=1 test -f "$HOOKS.sh" && HAS_HOOKS=1
} }
loadServiceHooks() { loadServiceHooks() {
if [ "$HAS_HOOKS" == "1" ]; then if [ "$HAS_HOOKS" == "1" ]; then
echo "Loading hooks for service $SERVICE" echo "Loading hooks $HOOKS"
source "$SERVICE.sh" source "$HOOKS.sh"
fi fi
} }