From b8f0a377d9880c4592a719b38d3967abbc33f039 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 30 Jun 2021 14:56:09 +0200 Subject: [PATCH 1/6] force flag must be exported --- CHANGELOG.md | 2 ++ bkctld | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 992fb70..03ad08d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +* force flag must be exported + ### Security ## [2.10.0] - 2021-06-29 diff --git a/bkctld b/bkctld index 1c37ceb..05ba7a7 100755 --- a/bkctld +++ b/bkctld @@ -51,7 +51,7 @@ while :; do exit 0 ;; -f|--force) - FORCE=1 + export FORCE=1 ;; *) # Default case: If no more options then break out of the loop. From 7c6fefd00bbe78e113667cf7dc56bd315e1dae71 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 30 Jun 2021 14:56:53 +0200 Subject: [PATCH 2/6] bkctld-remove: remove config directory --- CHANGELOG.md | 2 ++ lib/bkctld-remove | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03ad08d..63d2c62 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-remove: remove config directory + ### Deprecated ### Removed diff --git a/lib/bkctld-remove b/lib/bkctld-remove index def4e74..bcc109e 100755 --- a/lib/bkctld-remove +++ b/lib/bkctld-remove @@ -50,6 +50,7 @@ fi "${LIBDIR}/bkctld-is-on" "${jail_name}" && "${LIBDIR}/bkctld-stop" "${jail_name}" 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 From 1960e9097a205c3978562888b2587f574eb9926e Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 30 Jun 2021 14:58:39 +0200 Subject: [PATCH 3/6] bkctld-archive/remove: confirmation defaults to 'No' --- CHANGELOG.md | 2 ++ lib/bkctld-archive | 6 +++--- lib/bkctld-remove | 11 +++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) 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" From 09f1789a53e5c9dc179a50d7b752d698ba707229 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 30 Jun 2021 14:59:54 +0200 Subject: [PATCH 4/6] Release 2.11.0 --- CHANGELOG.md | 16 ++++++++++------ lib/bkctld-archive | 6 +++--- lib/bkctld-remove | 6 +++--- lib/includes | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c3b3ff..9a71fa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,20 +10,24 @@ 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 ### Removed ### Fixed -* force flag must be exported - ### Security +## [2.11.0] - 2021-06-29 + +### Changed + +* bkctld-remove: remove config directory + +### Fixed + +* force flag must be exported + ## [2.10.0] - 2021-06-29 ### Added diff --git a/lib/bkctld-archive b/lib/bkctld-archive index 9d279a3..abf179d 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 0913b50..dab3b6c 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 ;; diff --git a/lib/includes b/lib/includes index 93d83ba..a8a5bb4 100755 --- a/lib/includes +++ b/lib/includes @@ -6,7 +6,7 @@ [ -f /etc/default/bkctld ] && . /etc/default/bkctld -VERSION="2.10.0" +VERSION="2.11.0" LIBDIR=${LIBDIR:-/usr/lib/bkctld} CONFDIR="${CONFDIR:-/etc/evobackup}" From a2c6d073a7544329f97511851c068cdb1f9f5560 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 30 Jun 2021 18:12:36 +0200 Subject: [PATCH 5/6] bkctld-rename: abort operation if incs exist with the new name --- CHANGELOG.md | 2 ++ lib/bkctld-rename | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a71fa8..d5ade18 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-rename: abort operation if incs exist with the new name + ### Deprecated ### Removed diff --git a/lib/bkctld-rename b/lib/bkctld-rename index 2147a13..3270ea9 100755 --- a/lib/bkctld-rename +++ b/lib/bkctld-rename @@ -14,6 +14,7 @@ new_jail_name="${2:?}" if [ -z "${jail_name}" ] || [ -z "${new_jail_name}" ]; then show_help && exit 1 fi + jail_path=$(jail_path "${jail_name}") incs_path=$(incs_path "${jail_name}") jail_config_dir=$(jail_config_dir "${jail_name}") @@ -27,6 +28,7 @@ new_jail_config_dir=$(jail_config_dir "${new_jail_name}") new_legacy_config_file="${CONFDIR}/${new_jail_name}" test -d "${new_jail_path}" && error "${new_jail_name}: jail already exists" 2 +test -d "${new_incs_path}" && error "${new_jail_name}: incs already exists" 2 "${LIBDIR}/bkctld-is-on" "${jail_name}" 2>/dev/null case "$?" in From d6dd91eb1ffa78f8bef1bf99473096b59d2e5662 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 30 Jun 2021 18:13:34 +0200 Subject: [PATCH 6/6] Release 2.11.1 --- CHANGELOG.md | 8 ++++++-- lib/includes | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5ade18..188e01a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -* bkctld-rename: abort operation if incs exist with the new name - ### Deprecated ### Removed @@ -20,6 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [2.11.1] - 2021-06-30 + +### Changed + +* bkctld-rename: abort operation if incs exist with the new name + ## [2.11.0] - 2021-06-29 ### Changed diff --git a/lib/includes b/lib/includes index a8a5bb4..9c1f074 100755 --- a/lib/includes +++ b/lib/includes @@ -6,7 +6,7 @@ [ -f /etc/default/bkctld ] && . /etc/default/bkctld -VERSION="2.11.0" +VERSION="2.11.1" LIBDIR=${LIBDIR:-/usr/lib/bkctld} CONFDIR="${CONFDIR:-/etc/evobackup}"