On info if verbose is set, print out the key too
This commit is contained in:
@@ -17,6 +17,11 @@ if [ "${INFO}" -eq 1 ]; then
|
|||||||
# run info command if not a dry drun
|
# run info command if not a dry drun
|
||||||
if [ "${DRYRUN}" -eq 0 ]; then
|
if [ "${DRYRUN}" -eq 0 ]; then
|
||||||
${BORG_COMMAND} info ${OPT_REMOTE} "${REPOSITORY}";
|
${BORG_COMMAND} info ${OPT_REMOTE} "${REPOSITORY}";
|
||||||
|
if [ "${VERBOSE}" -eq 1 ]; then
|
||||||
|
# print key information
|
||||||
|
echo "------------------------------------------------------------------------------";
|
||||||
|
${BORG_COMMAND} key export "${REPOSITORY}";
|
||||||
|
fi;
|
||||||
fi;
|
fi;
|
||||||
if [ "${MODULE}" = "files" ]; then
|
if [ "${MODULE}" = "files" ]; then
|
||||||
if [ "${FOLDER_OK}" -eq 1 ]; then
|
if [ "${FOLDER_OK}" -eq 1 ]; then
|
||||||
|
|||||||
@@ -291,6 +291,7 @@ COMMAND_INFO="${COMMAND_EXPORT}${BORG_COMMAND} info ${OPT_REMOTE} ${REPOSITORY}"
|
|||||||
# if this is user@host, we need to use ssh command to verify if the file is there
|
# if this is user@host, we need to use ssh command to verify if the file is there
|
||||||
# else a normal verify is ok
|
# else a normal verify is ok
|
||||||
# unless explicit given, verify is skipped
|
# unless explicit given, verify is skipped
|
||||||
|
# MARK: VERIFY / INFO
|
||||||
if [ "${VERIFY}" -eq 1 ] || [ "${INIT}" -eq 1 ]; then
|
if [ "${VERIFY}" -eq 1 ] || [ "${INIT}" -eq 1 ]; then
|
||||||
printf "${PRINTF_SUB_BLOCK}" "VERIFY" "$(date +'%F %T')" "${MODULE}";
|
printf "${PRINTF_SUB_BLOCK}" "VERIFY" "$(date +'%F %T')" "${MODULE}";
|
||||||
if [ -n "${TARGET_SERVER}" ]; then
|
if [ -n "${TARGET_SERVER}" ]; then
|
||||||
@@ -298,7 +299,7 @@ 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|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
|
||||||
@@ -339,11 +340,12 @@ if [ "${INIT}" -eq 1 ] && [ "${INIT_REPOSITORY}" -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
if [ "${DRYRUN}" -eq 0 ]; then
|
if [ "${DRYRUN}" -eq 0 ]; then
|
||||||
# should trap and exit properly here
|
# should trap and exit properly here
|
||||||
${BORG_COMMAND} init ${OPT_REMOTE} -e ${ENCRYPTION} ${OPT_VERBOSE} ${REPOSITORY};
|
${BORG_COMMAND} init ${OPT_REMOTE} -e "${ENCRYPTION}" ${OPT_VERBOSE} "${REPOSITORY}";
|
||||||
# show the key file
|
# show the key file
|
||||||
if [ "${ENCRYPTION}" = "keyfile" ]; then
|
if [ "${ENCRYPTION}" = "keyfile" ]; then
|
||||||
echo "--- [ENCRYPTION KEY] --[START]-------------------------------------------------->";
|
echo "--- [ENCRYPTION KEY] --[START]-------------------------------------------------->";
|
||||||
echo "Store the key and password in a safe place";
|
echo "Store the key and password in a safe place";
|
||||||
|
echo "export BORG_BASE_DIR=\"${BASE_FOLDER}\";borg key export [--paper] ${REPOSITORY}";
|
||||||
echo "----[BORG KEY] -------------------------------->";
|
echo "----[BORG KEY] -------------------------------->";
|
||||||
${BORG_COMMAND} key export "${REPOSITORY}";
|
${BORG_COMMAND} key export "${REPOSITORY}";
|
||||||
echo "----[BORG KEY:paper] -------------------------->";
|
echo "----[BORG KEY:paper] -------------------------->";
|
||||||
@@ -375,6 +377,7 @@ if [ ! -f "${BASE_FOLDER}${BACKUP_INIT_FILE}" ]; then
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
# MARK: LIST / PRINT
|
||||||
# PRINT OUT current data, only do this if REPO exists
|
# PRINT OUT current data, only do this if REPO exists
|
||||||
if [ "${PRINT}" -eq 1 ]; then
|
if [ "${PRINT}" -eq 1 ]; then
|
||||||
printf "${PRINTF_SUB_BLOCK}" "PRINT" "$(date +'%F %T')" "${MODULE}";
|
printf "${PRINTF_SUB_BLOCK}" "PRINT" "$(date +'%F %T')" "${MODULE}";
|
||||||
|
|||||||
Reference in New Issue
Block a user