Compare commits
2 Commits
v4.7.0
...
943d1c551e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
943d1c551e | ||
|
|
45e1e29d22 |
@@ -141,7 +141,7 @@ All below have default values if not set in the main settings file
|
||||
|
||||
* COMPRESSION: zstd
|
||||
* COMPRESSION_LEVEL: 3
|
||||
* ENCRYPTION: none
|
||||
* ENCRYPTION: keyfile (with no password)
|
||||
* FORCE_VERIFY: false
|
||||
* COMPACT_INTERVAL: 1
|
||||
* CHECK_INTERVAL: none
|
||||
|
||||
@@ -7,14 +7,19 @@ fi;
|
||||
|
||||
set -ETu #-e -o pipefail
|
||||
trap cleanup SIGINT SIGTERM ERR
|
||||
trap error_trap ERR
|
||||
|
||||
cleanup() {
|
||||
# script cleanup here
|
||||
echo "Some part of the script failed with an error: $? @LINE: $(caller)";
|
||||
echo "Script abort: $? @LINE: $(caller)";
|
||||
# unset exported vars
|
||||
unset BORG_BASE_DIR BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK BORG_RELOCATED_REPO_ACCESS_IS_OK;
|
||||
# end trap
|
||||
trap - SIGINT SIGTERM ERR
|
||||
trap - SIGINT SIGTERM
|
||||
}
|
||||
error_trap() {
|
||||
echo "Some part of the script failed with an error: $? @LINE: $(caller)";
|
||||
trap - ERR
|
||||
}
|
||||
# on exit unset any exported var
|
||||
trap "unset BORG_BASE_DIR BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK BORG_RELOCATED_REPO_ACCESS_IS_OK" EXIT;
|
||||
@@ -348,7 +353,7 @@ if [ -n "${ONE_TIME_TAG}" ] && ! [[ "${ONE_TIME_TAG}" =~ ^[A-Za-z0-9_-]+$ ]]; th
|
||||
echo "One time tag '${ONE_TIME_TAG}' must be alphanumeric with dashes and underscore only.";
|
||||
exit 1;
|
||||
elif [ -n "${ONE_TIME_TAG}" ]; then
|
||||
# all ok, attach . at the end
|
||||
# all ok, attach '.' at the end
|
||||
ONE_TIME_TAG=${ONE_TIME_TAG}".";
|
||||
fi;
|
||||
# if -D, cannot be with -T, -i, -C, -I, -P
|
||||
@@ -359,7 +364,7 @@ fi;
|
||||
# -D also must be in valid backup set format
|
||||
# ! [[ "${DELETE_ONE_TIME_TAG}" =~ ^[A-Za-z0-9_-]+\.${MODULE},(\*-)?[0-9]{4}-[0-9]{2}-[0-9]{2}T\*$ ]]
|
||||
if [ -n "${DELETE_ONE_TIME_TAG}" ] && ! [[ "${DELETE_ONE_TIME_TAG}" =~ ^[A-Za-z0-9_-]+\.${MODULE},([A-Za-z0-9_-]+-)?[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$ ]] && ! [[ "${DELETE_ONE_TIME_TAG}" =~ ^[A-Za-z0-9_-]+\.${MODULE},(\*-)?[0-9]{4}-[0-9]{2}-[0-9]{2}T\*$ ]]; then
|
||||
echo "Delete one time tag '${DELETE_ONE_TIME_TAG}' is in an invalid format. "
|
||||
echo "Delete one time tag '${DELETE_ONE_TIME_TAG}' is in an invalid format."
|
||||
echo "Please verify existing tags with -P option."
|
||||
echo "For a globing be sure it is in the format of: TAG.MODULE,*-YYYY-MM-DDT*";
|
||||
echo "Note the dash (-) after the first *, also time (T) is a globa (*) must."
|
||||
|
||||
@@ -299,7 +299,14 @@ if [ "${VERIFY}" -eq 1 ] || [ "${INIT}" -eq 1 ]; then
|
||||
echo "${BORG_COMMAND} info ${OPT_REMOTE} ${REPOSITORY} 2>&1|grep \"Repository ID:\"";
|
||||
fi;
|
||||
# use borg info and verify if it returns "Repository ID:" in the first line
|
||||
REPO_VERIFY=$(${BORG_COMMAND} info ${OPT_REMOTE} "${REPOSITORY}" 2>&1|grep "Repository ID:");
|
||||
REPO_VERIFY=$(${BORG_COMMAND} info ${OPT_REMOTE} "${REPOSITORY}" 2>&1);
|
||||
if ! $?; then
|
||||
echo "[!] Repository verify error: ${REPO_VERIFY}";
|
||||
REPO_VERIFY="";
|
||||
else
|
||||
REPO_VERIFY=$(echo "${REPO_VERIFY}" | grep "Repository ID:");
|
||||
fi;
|
||||
# | grep "Repository ID:"
|
||||
# this is currently a hack to work round the error code in borg info
|
||||
# this checks if REPO_VERIFY holds this error message and then starts init
|
||||
if [[ -z "${REPO_VERIFY}" ]] || [[ "${REPO_VERIFY}" =~ ${REGEX_ERROR} ]]; then
|
||||
|
||||
Reference in New Issue
Block a user