From 844a4263c9300398e5a2aa63c0fc4c67bdebcc6b Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:09:43 -0600 Subject: [PATCH 01/15] network: Standard is default --- usr/local/share/bastille/network.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/usr/local/share/bastille/network.sh b/usr/local/share/bastille/network.sh index b5257e92..47028a38 100644 --- a/usr/local/share/bastille/network.sh +++ b/usr/local/share/bastille/network.sh @@ -41,7 +41,6 @@ usage() { -a | --auto Start/stop the jail(s) if required. -B | --bridge Add a bridged VNET interface to an existing jail. - -C | --classic Add an interface to a classic (non-VNET) jail. -M | --static-mac Generate a static MAC address for the interface. -n | --no-ip Create interface without an IP (VNET only). -P | --passthrough Pass the entire interface through to the jail. @@ -56,8 +55,8 @@ EOF # Handle options. AUTO=0 BRIDGE=0 -CLASSIC=0 STATIC_MAC=0 +STANDARD=0 PASSTHROUGH=0 VNET=0 VLAN_ID="" @@ -75,10 +74,6 @@ while [ "$#" -gt 0 ]; do BRIDGE=1 shift ;; - -C|--classic) - CLASSIC=1 - shift - ;; -M|--static-mac) STATIC_MAC=1 shift @@ -112,7 +107,6 @@ while [ "$#" -gt 0 ]; do case ${_o} in a) AUTO=1 ;; B) BRIDGE=1 ;; - C) CLASSIC=1 ;; M) STATIC_MAC=1 ;; n) NO_IP=1 ;; P) PASSTHROUGH=1 ;; @@ -140,16 +134,19 @@ else IP="" fi +# Default is standard interface +if [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${PASSTHROUGH}" -eq 0 ]; then + STANDARD=1 +fi + if [ "${ACTION}" = "add" ]; then if { [ "${VNET}" -eq 1 ] && [ "${BRIDGE}" -eq 1 ]; } || \ - { [ "${VNET}" -eq 1 ] && [ "${CLASSIC}" -eq 1 ]; } || \ + { [ "${VNET}" -eq 1 ] && [ "${STANDARD}" -eq 1 ]; } || \ { [ "${VNET}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } || \ - { [ "${BRIDGE}" -eq 1 ] && [ "${CLASSIC}" -eq 1 ]; } || \ + { [ "${BRIDGE}" -eq 1 ] && [ "${STANDARD}" -eq 1 ]; } || \ { [ "${BRIDGE}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } || \ - { [ "${CLASSIC}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } then - error_exit "[ERROR]: Only one of [-B|--bridge], [-C|--classic], [-P|--passthrough] or [-V|--vnet] should be set." - elif [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${CLASSIC}" -eq 0 ] && [ "${PASSTHROUGH}" -eq 0 ]; then - error_exit "[ERROR]: [-B|--bridge], [-C|--classic], [-P|--passthrough] or [-V|--vnet] must be set." + { [ "${STANDARD}" -eq 1 ] && [ "${PASSTHROUGH}" -eq 1 ]; } then + error_exit "[ERROR]: Only one of [-B|--bridge], [-P|--passthrough] or [-V|--vnet] should be set." elif [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${PASSTHROUGH}" -eq 0 ] && [ -n "${VLAN_ID}" ]; then error_exit "[ERROR]: VLANs can only be used with VNET interfaces." elif [ "${VNET}" -eq 0 ] && [ "${BRIDGE}" -eq 0 ] && [ "${NO_IP}" -eq 1 ]; then @@ -455,7 +452,7 @@ EOF fi echo "Added Passthrough interface: \"${_if}\"" - elif [ "${CLASSIC}" -eq 1 ]; then + elif [ "${STANDARD}" -eq 1 ]; then if [ -n "${IP6_ADDR}" ]; then sed -i '' "s/interface = .*/&\n ip6.addr += ${_if}|${_ip};/" ${_jail_config} else @@ -674,7 +671,7 @@ case "${ACTION}" in if [ "${AUTO}" -eq 1 ]; then bastille start "${TARGET}" fi - elif [ "${CLASSIC}" -eq 1 ]; then + elif [ "${STANDARD}" -eq 1 ]; then if [ "$(bastille config ${TARGET} get vnet)" != "not set" ]; then error_exit "[ERROR]: ${TARGET} is a VNET jail." else From a331985687d7d9ba92cc71cc6ac3e6c859d03ed1 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:12:41 -0600 Subject: [PATCH 02/15] Update network.rst --- docs/chapters/subcommands/network.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/chapters/subcommands/network.rst b/docs/chapters/subcommands/network.rst index 077d632b..06a9f195 100644 --- a/docs/chapters/subcommands/network.rst +++ b/docs/chapters/subcommands/network.rst @@ -7,7 +7,8 @@ You can only add an interface once to a jail, with two exceptions. 1. For classic jails, you can add an interface as many times as you want, but each time with a different IP. All this does is add the IP as another alias - on that interface. + on that interface. This is the default if no option is given. See help output + below. 2. For VNET jails, if the ``-v|--vlan`` switch is given along with a numerical VLAN ID, Bastille will add the VLAN ID to the jail as a vnetX.X interface, @@ -16,6 +17,8 @@ You can only add an interface once to a jail, with two exceptions. Bridges and VNET interfaces can be added to VNET jails, no matter if they were created with ``-V`` or ``-B``. +If no option is given, Bastille will assume a standard/classic jail. + It is possible to passthrough an entire interface from the host to the jail using the ``-P|--passthrough`` option. This will make the interface fully available without the need for additional configuration. It will be available @@ -38,11 +41,10 @@ network TARGET remove INTERFACE`` while both jails are stopped. Options: -a | --auto Start/stop the jail(s) if required. - -B | --bridge Add a bridged VNET interface to an existing jail. - -C | --classic Add an interface to a classic (non-VNET) jail. - -M | --static-mac Generate a static MAC address for the interface. + -B | --bridge Add a bridge VNET interface to an existing jail. + -M | --static-mac Generate a static MAC address for the interface (VNET only). -n | --no-ip Create interface without an IP (VNET only). - -P | --passthrough Pass the entire interface through to the jail. + -P | --passthrough Pass entire interface to jail. -V | --vnet Add a VNET interface to an existing jail. -v | --vlan VLANID Add interface with specified VLAN ID (VNET only). -x | --debug Enable debug mode. \ No newline at end of file From 3eb1deb5efec4c9706e5d8db0148d38bcd0d77ab Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:17:29 -0600 Subject: [PATCH 03/15] Update network.sh --- usr/local/share/bastille/network.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr/local/share/bastille/network.sh b/usr/local/share/bastille/network.sh index 47028a38..ac9de8ae 100644 --- a/usr/local/share/bastille/network.sh +++ b/usr/local/share/bastille/network.sh @@ -39,13 +39,13 @@ usage() { Options: - -a | --auto Start/stop the jail(s) if required. - -B | --bridge Add a bridged VNET interface to an existing jail. - -M | --static-mac Generate a static MAC address for the interface. + -a | --auto Start/stop jail(s) if required. + -B | --bridge Add a bridge VNET interface. + -M | --static-mac Generate a static MAC address for the interface (VNET only). -n | --no-ip Create interface without an IP (VNET only). - -P | --passthrough Pass the entire interface through to the jail. - -V | --vnet Add a VNET interface to an existing jail. - -v | --vlan VLANID Add interface with specified VLAN ID (VNET only). + -P | --passthrough Add a raw interface. + -V | --vnet Add a VNET interface. + -v | --vlan VLANID Assign VLAN ID to interface (VNET only). -x | --debug Enable debug mode. EOF From 6d5ce7674ba401ecd525dbf5713feca4d631fc34 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:18:52 -0600 Subject: [PATCH 04/15] Update network.rst --- docs/chapters/subcommands/network.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/chapters/subcommands/network.rst b/docs/chapters/subcommands/network.rst index 06a9f195..a31f1892 100644 --- a/docs/chapters/subcommands/network.rst +++ b/docs/chapters/subcommands/network.rst @@ -40,11 +40,11 @@ network TARGET remove INTERFACE`` while both jails are stopped. Options: - -a | --auto Start/stop the jail(s) if required. - -B | --bridge Add a bridge VNET interface to an existing jail. + -a | --auto Start/stop jail(s) if required. + -B | --bridge Add a bridge VNET interface. -M | --static-mac Generate a static MAC address for the interface (VNET only). -n | --no-ip Create interface without an IP (VNET only). - -P | --passthrough Pass entire interface to jail. - -V | --vnet Add a VNET interface to an existing jail. - -v | --vlan VLANID Add interface with specified VLAN ID (VNET only). + -P | --passthrough Add a raw interface. + -V | --vnet Add a VNET interface. + -v | --vlan VLANID Assign VLAN ID to interface (VNET only). -x | --debug Enable debug mode. \ No newline at end of file From 418606e8f7f3d165354d0e7cad82901a2d016013 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:16:06 -0600 Subject: [PATCH 05/15] Update export.sh --- usr/local/share/bastille/export.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index 9ed3d43a..aeb53126 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -42,6 +42,7 @@ usage() { Options: + -a | --auto Auto mode. Start/stop jails if required. --gz Export a ZFS jail using GZIP(.gz) compressed image. -r | --raw Export a ZFS jail to an uncompressed RAW image. -s | --safe Safely stop and start a ZFS jail before the exporting process. @@ -69,6 +70,7 @@ opt_count() { } # Reset export options +AUTO=0 GZIP_EXPORT= XZ_EXPORT= SAFE_EXPORT= @@ -133,6 +135,10 @@ else -h|--help|help) usage ;; + -a|--auto) + AUTO=1 + shift + ;; --gz) GZIP_EXPORT="1" opt_count From 0be18e171aea22c699a01885246c41be6ad20baf Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:17:38 -0600 Subject: [PATCH 06/15] Update export.sh --- usr/local/share/bastille/export.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index aeb53126..f0a29a83 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -42,7 +42,7 @@ usage() { Options: - -a | --auto Auto mode. Start/stop jails if required. + -a | --auto Auto mode. Start/stop jail(s) if required. --gz Export a ZFS jail using GZIP(.gz) compressed image. -r | --raw Export a ZFS jail to an uncompressed RAW image. -s | --safe Safely stop and start a ZFS jail before the exporting process. From c8c2613a71a5309304c6120c375b5681b88d8df4 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:18:13 -0600 Subject: [PATCH 07/15] Update export.rst --- docs/chapters/subcommands/export.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/chapters/subcommands/export.rst b/docs/chapters/subcommands/export.rst index 72e628f1..043624a4 100644 --- a/docs/chapters/subcommands/export.rst +++ b/docs/chapters/subcommands/export.rst @@ -26,6 +26,7 @@ Available options are: Options: + -a | --auto Auto mode. Start/stop jail(s) if required. --gz Export a ZFS jail using GZIP(.gz) compressed image. -r | --raw Export a ZFS jail to an uncompressed RAW image. -s | --safe Safely stop and start a ZFS jail before the exporting process. From 5174641ece808a1ab9d386793888450149d7bb91 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:43:25 -0600 Subject: [PATCH 08/15] Fix export on UFS --- usr/local/share/bastille/export.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index f0a29a83..51293f1d 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -410,8 +410,7 @@ jail_export() { if [ -z "${USER_EXPORT}" ]; then # Generate container checksum file - cd "${bastille_backupsdir}" || error_exit "Failed to change directory." - sha256 -q "${TARGET}_${DATE}${FILE_EXT}" > "${TARGET}_${DATE}.sha256" + sha256 -q "${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}" > "${bastille_backupsdir}/${TARGET}_${DATE}.sha256" info "\nExported '${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}' successfully." From e6dcb8da4ddb57af5f2a313f1fc5e488b2765945 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:38:40 -0600 Subject: [PATCH 09/15] Update export.sh --- usr/local/share/bastille/export.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index 51293f1d..7f3419ae 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -50,6 +50,7 @@ usage() { --txz Export a jail using simple .txz compressed archive instead. -v | --verbose Be more verbose during the ZFS send operation. --xz Export a ZFS jail using XZ(.xz) compressed image. + -x | --debug Enable debug mode. Note: If no export option specified, the jail should be redirected to standard output. 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 10/15] 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." From f590dd0593f15057e4e66ec95c0e7227b78719d8 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:53:37 -0600 Subject: [PATCH 11/15] Update export.sh --- usr/local/share/bastille/export.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index 46cf41cd..e0541624 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -385,7 +385,7 @@ jail_export() { info "\nExporting '${TARGET}' to a compressed ${FILE_EXT} archive..." 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 + if ! tar -cf - "${TARGET}" | gzip ${bastille_compress_gz_options} > "${bastille_backupsdir}/{TARGET}_${DATE}${FILE_EXT}"; then error_exit "[ERROR]: Failed to export jail: ${TARGET}" fi @@ -397,7 +397,7 @@ jail_export() { info "\nExporting '${TARGET}' to a compressed ${FILE_EXT} archive..." 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 + if ! tar -cf - "${TARGET}" | xz ${bastille_compress_xz_options} > "${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}"; then error_exit "[ERROR]: Failed to export jail: ${TARGET}" fi From 2c0c99232ef2a39ef3d02bfcdb60904bf96c5307 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:56:34 -0600 Subject: [PATCH 12/15] Update export.sh --- usr/local/share/bastille/export.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index e0541624..80070042 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -385,7 +385,7 @@ jail_export() { info "\nExporting '${TARGET}' to a compressed ${FILE_EXT} archive..." cd "${bastille_jailsdir}" || error_exit "[ERROR]: Failed to change to directory: ${bastille_jailsdir}" - if ! tar -cf - "${TARGET}" | gzip ${bastille_compress_gz_options} > "${bastille_backupsdir}/{TARGET}_${DATE}${FILE_EXT}"; then + if ! tar -cf - "${TARGET}" | gzip ${bastille_compress_gz_options} > "${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}"; then error_exit "[ERROR]: Failed to export jail: ${TARGET}" fi From f8a56382e39c5973fbf4fceacd6a63148204c439 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 22:11:40 -0600 Subject: [PATCH 13/15] docs: export: add debug option --- docs/chapters/subcommands/export.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/chapters/subcommands/export.rst b/docs/chapters/subcommands/export.rst index 043624a4..873db8a7 100644 --- a/docs/chapters/subcommands/export.rst +++ b/docs/chapters/subcommands/export.rst @@ -34,5 +34,6 @@ Available options are: --txz Export a jail using simple .txz compressed archive instead. -v | --verbose Be more verbose during the ZFS send operation. --xz Export a ZFS jail using XZ(.xz) compressed image. + -x | --debug Enable debug mode. Note: If no export option specified, the container should be redirected to standard output. From 63a913195dbd054871397c0c24efb9a3980f097b Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 22:16:09 -0600 Subject: [PATCH 14/15] export: Allow grouping certain options (-ax) --- usr/local/share/bastille/export.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index 80070042..9b8c70b4 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -50,7 +50,7 @@ usage() { --txz Export a jail using simple .txz compressed archive instead. -v | --verbose Be more verbose during the ZFS send operation. --xz Export a ZFS jail using XZ(.xz) compressed image. - -x | --debug Enable debug mode. + -x | --debug Enable debug mode. Note: If no export option specified, the jail should be redirected to standard output. @@ -179,9 +179,15 @@ else enable_debug shift ;; - -*) - error_notify "[ERROR]: Unknown Option: \"${1}\"" - usage + -*) + for _opt in $(echo ${1} | sed 's/-//g' | fold -w1); do + case ${_opt} in + a) AUTO=1 ;; + x) enable_debug ;; + *) error_exit "[ERROR]: Unknown Option: \"${1}\"" + esac + done + shift ;; *) break From 5174c272517473b19c2c26728b5c78d1521c31f9 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Jun 2025 23:03:10 -0600 Subject: [PATCH 15/15] export: Exit if sha can't be generated --- usr/local/share/bastille/export.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index 9b8c70b4..ebbfdb24 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -417,13 +417,12 @@ jail_export() { error_exit "[ERROR]: Failed to export jail: ${TARGET}" else if [ -z "${USER_EXPORT}" ]; then - # Generate container checksum file cd "${bastille_backupsdir}" || error_exit "[ERROR]: Failed to change to directory: ${bastille_backupsdir}" - sha256 -q "${TARGET}_${DATE}${FILE_EXT}" > "${TARGET}_${DATE}.sha256" - + if ! sha256 -q "${TARGET}_${DATE}${FILE_EXT}" > "${TARGET}_${DATE}.sha256"; then + error_exit "[ERROR]: Failed to generate sha256 file." + fi info "\nExported '${bastille_backupsdir}/${TARGET}_${DATE}${FILE_EXT}' successfully." - fi exit 0 fi