feat: Replace BBLIB with BBLIBRARY
This commit is contained in:
parent
cfc88ae3c5
commit
c37803236f
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# boring-backup -- backup automation micro-framework and library.
|
# boring-backup -- backup files and databases.
|
||||||
# Copyright (c) 2022 ge <https://nixhacks.net/>
|
# Copyright (c) 2022 ge <https://nixhacks.net/>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@ -25,12 +25,15 @@ __tar_options='-acf'
|
|||||||
__tar_exclude=
|
__tar_exclude=
|
||||||
__name_date_fmt='_%Y%m%d-%H%M'
|
__name_date_fmt='_%Y%m%d-%H%M'
|
||||||
__compression='gzip'
|
__compression='gzip'
|
||||||
__library="${BBLIB:-./lib}"
|
BBLIBRARY="${BBLIBRARY:-./lib}"
|
||||||
|
|
||||||
# Source library
|
# Source library
|
||||||
for file in "$__library"/*; do
|
if [ -f "$BBLIBRARY/lib.sh" ]; then
|
||||||
. "$file"
|
. "$BBLIBRARY/lib.sh"
|
||||||
done
|
else
|
||||||
|
echo "Error: Cannot source library from $BBLIBRARY" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
print_help() {
|
print_help() {
|
||||||
cat <<- EOF
|
cat <<- EOF
|
||||||
@ -46,7 +49,7 @@ Options:
|
|||||||
-V, --version print version and exit.
|
-V, --version print version and exit.
|
||||||
|
|
||||||
Environment:
|
Environment:
|
||||||
BBLIB path to bb library [current: $__library]
|
BBLIBRARY path to bb library [current: $BBLIBRARY]
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,24 +140,24 @@ for script in "${__args[@]}"; do
|
|||||||
|
|
||||||
# Run prepare() before all if set
|
# Run prepare() before all if set
|
||||||
if is_function_set prepare; then
|
if is_function_set prepare; then
|
||||||
echo -e "Execute \e[1mprepare()\e[0m ..." | log -p
|
echo -e "Run \e[1mprepare()\e[0m ..." | log -p
|
||||||
prepare
|
prepare
|
||||||
unset prepare
|
unset prepare
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run user defined backup() if set or builtin_backup()
|
# Run user defined backup() if set or builtin_backup()
|
||||||
if is_function_set backup; then
|
if is_function_set backup; then
|
||||||
echo -e "Execute \e[1mbackup()\e[0m ..." | log -p
|
echo -e "Run \e[1mbackup()\e[0m ..." | log -p
|
||||||
backup
|
backup
|
||||||
unset backup
|
unset backup
|
||||||
else
|
else
|
||||||
echo -e "Execute \e[1mbuiltin_backup()\e[0m ..." | log -p
|
echo -e "Run \e[1mbuiltin_backup()\e[0m ..." | log -p
|
||||||
builtin_backup
|
builtin_backup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run post backup function if set
|
# Run post backup function if set
|
||||||
if is_function_set finalise; then
|
if is_function_set finalise; then
|
||||||
echo -e "Execute \e[1mfinalise()\e[0m ..." | log -p
|
echo -e "Run \e[1mfinalise()\e[0m ..." | log -p
|
||||||
finalise
|
finalise
|
||||||
unset finalise
|
unset finalise
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user