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: zstd
|
||||||
* COMPRESSION_LEVEL: 3
|
* COMPRESSION_LEVEL: 3
|
||||||
* ENCRYPTION: none
|
* ENCRYPTION: keyfile (with no password)
|
||||||
* FORCE_VERIFY: false
|
* FORCE_VERIFY: false
|
||||||
* COMPACT_INTERVAL: 1
|
* COMPACT_INTERVAL: 1
|
||||||
* CHECK_INTERVAL: none
|
* CHECK_INTERVAL: none
|
||||||
|
|||||||
@@ -7,14 +7,19 @@ fi;
|
|||||||
|
|
||||||
set -ETu #-e -o pipefail
|
set -ETu #-e -o pipefail
|
||||||
trap cleanup SIGINT SIGTERM ERR
|
trap cleanup SIGINT SIGTERM ERR
|
||||||
|
trap error_trap ERR
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
# script cleanup here
|
# script cleanup here
|
||||||
echo "Some part of the script failed with an error: $? @LINE: $(caller)";
|
echo "Script abort: $? @LINE: $(caller)";
|
||||||
# unset exported vars
|
# unset exported vars
|
||||||
unset BORG_BASE_DIR BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK BORG_RELOCATED_REPO_ACCESS_IS_OK;
|
unset BORG_BASE_DIR BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK BORG_RELOCATED_REPO_ACCESS_IS_OK;
|
||||||
# end trap
|
# 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
|
# 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;
|
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.";
|
echo "One time tag '${ONE_TIME_TAG}' must be alphanumeric with dashes and underscore only.";
|
||||||
exit 1;
|
exit 1;
|
||||||
elif [ -n "${ONE_TIME_TAG}" ]; then
|
elif [ -n "${ONE_TIME_TAG}" ]; then
|
||||||
# all ok, attach . at the end
|
# all ok, attach '.' at the end
|
||||||
ONE_TIME_TAG=${ONE_TIME_TAG}".";
|
ONE_TIME_TAG=${ONE_TIME_TAG}".";
|
||||||
fi;
|
fi;
|
||||||
# if -D, cannot be with -T, -i, -C, -I, -P
|
# if -D, cannot be with -T, -i, -C, -I, -P
|
||||||
|
|||||||
@@ -299,7 +299,14 @@ if [ "${VERIFY}" -eq 1 ] || [ "${INIT}" -eq 1 ]; then
|
|||||||
echo "${BORG_COMMAND} info ${OPT_REMOTE} ${REPOSITORY} 2>&1|grep \"Repository ID:\"";
|
echo "${BORG_COMMAND} info ${OPT_REMOTE} ${REPOSITORY} 2>&1|grep \"Repository ID:\"";
|
||||||
fi;
|
fi;
|
||||||
# use borg info and verify if it returns "Repository ID:" in the first line
|
# 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 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
|
# this checks if REPO_VERIFY holds this error message and then starts init
|
||||||
if [[ -z "${REPO_VERIFY}" ]] || [[ "${REPO_VERIFY}" =~ ${REGEX_ERROR} ]]; then
|
if [[ -z "${REPO_VERIFY}" ]] || [[ "${REPO_VERIFY}" =~ ${REGEX_ERROR} ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user