Stop trapping errors und unset enviromant vars

On error just print error, but do not reset env vars, if this is done on verify error the init afterwards will store all settings in the wrong path
This commit is contained in:
Clemens Schwaighofer
2025-12-03 12:38:01 +09:00
parent 45e1e29d22
commit 943d1c551e
2 changed files with 17 additions and 5 deletions

View File

@@ -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