diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d2c62..7c3b3ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +* bkctld-archive: confirmation defaults to 'No' +* bkctld-remove: confirmation defaults to 'No' * bkctld-remove: remove config directory ### Deprecated diff --git a/lib/bkctld-archive b/lib/bkctld-archive index abf179d..9d279a3 100755 --- a/lib/bkctld-archive +++ b/lib/bkctld-archive @@ -24,13 +24,13 @@ test -d "${archive_jail_path}" && error "${jail_name}: archive already exists" 2 if [ "${FORCE}" != "1" ]; then answer="" while :; do - printf "> Are you sure you want to archive jail \`%s'? [Y,n,?] " "${jail_name}" + printf "> Are you sure you want to archive jail \`%s'? [y,N,?] " "${jail_name}" read -r answer case $answer in - [Yy]|"" ) + [Yy] ) break ;; - [Nn] ) + [Nn]|"" ) tty -s && echo "Abort." >&2 exit 101 ;; diff --git a/lib/bkctld-remove b/lib/bkctld-remove index bcc109e..0913b50 100755 --- a/lib/bkctld-remove +++ b/lib/bkctld-remove @@ -28,13 +28,13 @@ fi if [ "${FORCE}" != "1" ]; then answer="" while :; do - printf "> Are you sure you want to delete jail \`%s'? [Y,n,?] " "${jail_name}" + printf "> Are you sure you want to delete jail \`%s'? [y,N,?] " "${jail_name}" read -r answer case $answer in - [Yy]|"" ) + [Yy] ) break ;; - [Nn] ) + [Nn]|"" ) tty -s && echo "Abort." >&2 exit 101 ;; @@ -51,14 +51,16 @@ fi rm -f "${CONFDIR}/${jail_name}" rm -rf "$(jail_config_dir "${jail_name}")" + jail_inode=$(stat --format=%i "${jail_path}") if [ "${jail_inode}" -eq 256 ]; then /bin/btrfs subvolume delete "${jail_path}" | debug else rm -rf "${jail_path:?}" | debug fi + # TODO: use functions here -if [ -d "${incs_path}" ]; then +if [ -d "${incs_path}" ]; then incs=$(ls "${incs_path}") for inc in ${incs}; do inc_inode=$(stat --format=%i "${incs_path}/${inc}") @@ -70,5 +72,6 @@ if [ -d "${incs_path}" ]; then done rmdir --ignore-fail-on-non-empty "${incs_path}" | debug fi + "${LIBDIR}/bkctld-firewall" "${jail_name}" notice "Delete jail \`${jail_name}' : OK"