From bc2af931fb696624d4ac9753b1e2df79aa8fa46e Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:45:19 -0600 Subject: [PATCH] export: Fix export --- usr/local/share/bastille/export.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index 7f3419ae..46cf41cd 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -384,7 +384,8 @@ jail_export() { # Create standard tgz backup archive info "\nExporting '${TARGET}' to a compressed ${FILE_EXT} archive..." - if ! cd "${bastille_jailsdir}" && tar -cf - "${TARGET}" | gzip ${bastille_compress_gz_options} > "${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}"; then + cd "${bastille_jailsdir}" || error_exit "[ERROR]: Failed to change to directory: ${bastille_jailsdir}" + if ! tar -cf - "${TARGET}" | gzip ${bastille_compress_gz_options} > "${TARGET}_${DATE}${FILE_EXT}"; then error_exit "[ERROR]: Failed to export jail: ${TARGET}" fi @@ -395,7 +396,8 @@ jail_export() { # Create standard txz backup archive info "\nExporting '${TARGET}' to a compressed ${FILE_EXT} archive..." - if ! cd "${bastille_jailsdir}" && tar -cf - "${TARGET}" | xz ${bastille_compress_xz_options} > "${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}"; then + cd "${bastille_jailsdir}" || error_exit "[ERROR]: Failed to change to directory: ${bastille_jailssdir}" + if ! tar -cf - "${TARGET}" | xz ${bastille_compress_xz_options} > "${TARGET}_${DATE}${FILE_EXT}"; then error_exit "[ERROR]: Failed to export jail: ${TARGET}" fi @@ -411,7 +413,8 @@ jail_export() { if [ -z "${USER_EXPORT}" ]; then # Generate container checksum file - sha256 -q "${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}" > "${bastille_backupsdir}/${TARGET}_${DATE}.sha256" + cd "${bastille_backupsdir}" || error_exit "[ERROR]: Failed to change to directory: ${bastille_backupsdir}" + sha256 -q "${TARGET}_${DATE}${FILE_EXT}" > "${TARGET}_${DATE}.sha256" info "\nExported '${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}' successfully."