From 05c3715c6a45eca1d3be7f8988b2176f6acfeaf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Sun, 11 Oct 2020 14:51:39 +0200 Subject: [PATCH 1/9] Better help message composition and formating --- CHANGELOG.md | 4 +++- bkctld | 6 +++++- lib/bkctld-check-incs | 2 +- lib/bkctld-check-jails | 2 +- lib/bkctld-check-last-incs | 2 +- lib/bkctld-check-setup | 4 ++-- lib/bkctld-firewall | 4 ++-- lib/bkctld-inc | 2 +- lib/bkctld-init | 2 +- lib/bkctld-ip | 2 +- lib/bkctld-is-on | 2 +- lib/bkctld-key | 2 +- lib/bkctld-list | 2 +- lib/bkctld-port | 2 +- lib/bkctld-reload | 4 ++-- lib/bkctld-remove | 2 +- lib/bkctld-restart | 4 ++-- lib/bkctld-rm | 4 ++-- lib/bkctld-start | 2 +- lib/bkctld-stats | 2 +- lib/bkctld-status | 4 ++-- lib/bkctld-stop | 6 +++--- lib/bkctld-sync | 4 ++-- lib/bkctld-update | 4 ++-- lib/bkctld-upgrade-config | 4 ++-- lib/includes | 13 ++++++------- 26 files changed, 48 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88b1c2e..69d1688 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 +* Better help message composition and formating + ### Deprecated ### Removed @@ -58,7 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * bkctld-update: start jail after upgrade if it was started before * bkctld: don't replace SSH host keys when creating/updating a jail * Split check into check-jails and check-setup -* bkctld-check-jails checks if jails +* bkctld-check-jails checks if jails * bkctld-check-setup checks if the partition is mounted and writable, if firewall is configured and if all jails are in their expected state * create new ssh keys for new jails instead of copying those from the host diff --git a/bkctld b/bkctld index 03342a8..b46810d 100755 --- a/bkctld +++ b/bkctld @@ -36,6 +36,10 @@ fi # Parse options # based on https://gist.github.com/deshion/10d3cb5f88a21671e17a +if [ "$#" = "0" ]; then + show_help + exit 1 +fi while :; do case $1 in -h|-\?|--help) @@ -81,7 +85,7 @@ case "${subcommand}" in show_help exit 1 else - "${LIBDIR}/bkctld-${subcommand}" "${jail_name}" + "${LIBDIR}/bkctld-${subcommand}" "${jail_name}" fi ;; "key" | "port" | "ip") diff --git a/lib/bkctld-check-incs b/lib/bkctld-check-incs index d862e70..1a1f5c3 100755 --- a/lib/bkctld-check-incs +++ b/lib/bkctld-check-incs @@ -1,6 +1,6 @@ #!/bin/sh # -# Run check on all expected incs of all jails +# Description: Run check on all expected incs of all jails # Usage: check-incs all # diff --git a/lib/bkctld-check-jails b/lib/bkctld-check-jails index 531ab27..aafa456 100755 --- a/lib/bkctld-check-jails +++ b/lib/bkctld-check-jails @@ -1,6 +1,6 @@ #!/bin/sh # -# Run check on jails (NRPE output) +# Description: Run check on jails (NRPE output) # Usage: check-jails # diff --git a/lib/bkctld-check-last-incs b/lib/bkctld-check-last-incs index c73e302..e0cafa1 100755 --- a/lib/bkctld-check-last-incs +++ b/lib/bkctld-check-last-incs @@ -1,6 +1,6 @@ #!/bin/sh # -# Run check on the last inc of all jails +# Description: Run check on the last inc of all jails # Usage: check-incs last # diff --git a/lib/bkctld-check-setup b/lib/bkctld-check-setup index a66b357..d2632a0 100755 --- a/lib/bkctld-check-setup +++ b/lib/bkctld-check-setup @@ -1,7 +1,7 @@ #!/bin/sh # -# Run check on jails (NRPE output) -# Usage: check-setup +# Description: Run check on jails (NRPE output) +# Usage: check setup # # shellcheck source=./includes diff --git a/lib/bkctld-firewall b/lib/bkctld-firewall index 2c1293f..7cb434c 100755 --- a/lib/bkctld-firewall +++ b/lib/bkctld-firewall @@ -1,7 +1,7 @@ #!/bin/sh # -# Update firewall rules of or all -# Usage: firewall |all +# Description: Update firewall rules +# Usage: firewall [|all] # # shellcheck source=./includes diff --git a/lib/bkctld-inc b/lib/bkctld-inc index 7c81404..d29c752 100755 --- a/lib/bkctld-inc +++ b/lib/bkctld-inc @@ -1,6 +1,6 @@ #!/bin/sh # -# Make incremental inc of all jails +# Description: Make dated copies (incs) of jails # Usage: inc # diff --git a/lib/bkctld-init b/lib/bkctld-init index a7dec49..6b52815 100755 --- a/lib/bkctld-init +++ b/lib/bkctld-init @@ -1,6 +1,6 @@ #!/bin/sh # -# Init jail +# Description: Initialize a new jail # Usage: init # diff --git a/lib/bkctld-ip b/lib/bkctld-ip index dae1913..83e8e33 100755 --- a/lib/bkctld-ip +++ b/lib/bkctld-ip @@ -1,6 +1,6 @@ #!/bin/sh # -# Set or get allowed(s) ip(s) of +# Description: Set or get allowed(s) ip(s) # Usage: ip [|all] # diff --git a/lib/bkctld-is-on b/lib/bkctld-is-on index 36deafb..9c2b904 100755 --- a/lib/bkctld-is-on +++ b/lib/bkctld-is-on @@ -1,6 +1,6 @@ #!/bin/sh # -# Check if a jail is on or not +# Description: Check if a SSH server is on (exit 0) or not (exit 100) # Usage: is-on # diff --git a/lib/bkctld-key b/lib/bkctld-key index bfe6e51..393afd7 100755 --- a/lib/bkctld-key +++ b/lib/bkctld-key @@ -1,6 +1,6 @@ #!/bin/sh # -# Set or get ssh pubic key of +# Description: Set or get ssh pubic key # Usage: key [] # diff --git a/lib/bkctld-list b/lib/bkctld-list index 3815871..10b11bf 100755 --- a/lib/bkctld-list +++ b/lib/bkctld-list @@ -1,6 +1,6 @@ #!/bin/sh # -# List jails +# Description: List jails # Usage: list # diff --git a/lib/bkctld-port b/lib/bkctld-port index dffe4e9..2b1f17d 100755 --- a/lib/bkctld-port +++ b/lib/bkctld-port @@ -1,6 +1,6 @@ #!/bin/sh # -# Set or get ssh port of +# Description: Set or get SSH port # Usage: port [|auto] # diff --git a/lib/bkctld-reload b/lib/bkctld-reload index 5feec92..1036618 100755 --- a/lib/bkctld-reload +++ b/lib/bkctld-reload @@ -1,7 +1,7 @@ #!/bin/sh # -# Reload jail or all -# Usage: reload |all +# Description: Reload SSH server +# Usage: reload [|all] # # shellcheck source=./includes diff --git a/lib/bkctld-remove b/lib/bkctld-remove index 7b4b152..30d2594 100755 --- a/lib/bkctld-remove +++ b/lib/bkctld-remove @@ -1,6 +1,6 @@ #!/bin/sh # -# Remove jail or all +# Description: Remove jail and all dated copies (incs) # Usage: remove |all # diff --git a/lib/bkctld-restart b/lib/bkctld-restart index 7aaa314..9394b9a 100755 --- a/lib/bkctld-restart +++ b/lib/bkctld-restart @@ -1,7 +1,7 @@ #!/bin/sh # -# Restart jail or all -# Usage: restart |all +# Description: Restart SSH server +# Usage: restart [|all] # set -eu diff --git a/lib/bkctld-rm b/lib/bkctld-rm index 59035da..1c448c8 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -1,6 +1,6 @@ #!/bin/sh # -# Remove old incremtal inc of all jails +# Description: Remove old dated copies (incs) according to policy # Usage: rm # @@ -102,7 +102,7 @@ for jail_name in ${jails_list}; do # If no incs policy is found, we don't remove incs if [ -n "${incs_policy_file}" ]; then # shellcheck disable=SC2046 - + incs_to_delete=$(incs_to_delete "${jail_name}" "${incs_policy_file}") incs_total=$(echo ${incs_to_delete} | wc -w) incs_count=0 diff --git a/lib/bkctld-start b/lib/bkctld-start index a0d6f9c..343e2db 100755 --- a/lib/bkctld-start +++ b/lib/bkctld-start @@ -1,6 +1,6 @@ #!/bin/sh # -# Start jail or all +# Description: Start SSH Server # Usage: start |all # diff --git a/lib/bkctld-stats b/lib/bkctld-stats index c619b2d..8e69f12 100755 --- a/lib/bkctld-stats +++ b/lib/bkctld-stats @@ -1,6 +1,6 @@ #!/bin/sh # -# Make and display stats on jails (size, lastconn) +# Description: Display stats on jails (size, last connection…) # Usage: stats # diff --git a/lib/bkctld-status b/lib/bkctld-status index 80e6769..e815927 100755 --- a/lib/bkctld-status +++ b/lib/bkctld-status @@ -1,7 +1,7 @@ #!/bin/sh # -# Print status of (default all jail) -# Usage: status [] +# Description: Display status of SSH server +# Usage: status [|all] # # shellcheck source=./includes diff --git a/lib/bkctld-stop b/lib/bkctld-stop index 2d8a76f..fa8809d 100755 --- a/lib/bkctld-stop +++ b/lib/bkctld-stop @@ -1,7 +1,7 @@ #!/bin/sh # -# Stop jail or all -# Usage: stop |all +# Description: Stop SSH server +# Usage: stop [|all] # # shellcheck source=./includes @@ -21,7 +21,7 @@ pid=$(cat "${jail_path}/${SSHD_PID}") pkill --parent "${pid}" -if kill "${pid}"; then +if kill "${pid}"; then notice "Stop jail \`${jail_name}' : OK [${pid}]" umount --lazy --recursive "${jail_path}/dev" diff --git a/lib/bkctld-sync b/lib/bkctld-sync index df18917..e982af3 100755 --- a/lib/bkctld-sync +++ b/lib/bkctld-sync @@ -1,7 +1,7 @@ #!/bin/sh # -# Sync jail or all to another node -# Usage: sync |all +# Description: Sync jail configuration and state on other node(s) +# Usage: sync [|all] # # shellcheck source=./includes diff --git a/lib/bkctld-update b/lib/bkctld-update index 3309030..c6af12a 100755 --- a/lib/bkctld-update +++ b/lib/bkctld-update @@ -1,7 +1,7 @@ #!/bin/sh # -# Update jail or all -# Usage: update |all +# Description: Update binaries and libraries +# Usage: update [|all] # # shellcheck source=./includes diff --git a/lib/bkctld-upgrade-config b/lib/bkctld-upgrade-config index 054ade4..e835f7b 100644 --- a/lib/bkctld-upgrade-config +++ b/lib/bkctld-upgrade-config @@ -1,7 +1,7 @@ #!/bin/sh # -# Upgrade chroot components for jail or all -# Usage: upgrade-config |all +# Description: Upgrade configuration to new convention +# Usage: upgrade-config [|all] # # shellcheck source=./includes diff --git a/lib/includes b/lib/includes index 2196e5e..4d6c9cc 100755 --- a/lib/includes +++ b/lib/includes @@ -51,11 +51,10 @@ Options Subcommands: EOF - for subcommand in ${LIBDIR}/bkctld-*; do - name=$(basename "${subcommand}"|sed 's/^bkctld-//') - desc=$(grep -E "^#" "${subcommand}"|sed -n '3p'|sed "s/^# //") - usage=$(grep -E "^# Usage: ${name}" "${subcommand}"|sed "s/^# Usage: ${name}//") - printf " %- 15s %- 30s %- 40s\n" "${name}" "${usage}" "${desc}" + for filename in ${LIBDIR}/bkctld-*; do + desc=$(grep -E "^# Description:" "${filename}"|sed "s/^# Description: //") + usage=$(grep -E "^# Usage:" "${filename}"|sed "s/^# Usage: //") + printf " %- 32s %s\n" "${usage}" "${desc}" done printf "\n" @@ -380,8 +379,8 @@ is_mounted_inside_jail() { target=${1:?} # TODO: try to find why it doesn't work with this findmnt(8) command - # findmnt --target "${target}" --tab-file /proc/mounts - grep -q "${target}" /proc/mounts + # findmnt --target "${target}" --tab-file /proc/mounts + grep -q "${target}" /proc/mounts } mount_jail_fs() { From 9eae80c002540c6a668611694ac05d9759059d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Sun, 11 Oct 2020 14:56:22 +0200 Subject: [PATCH 2/9] globally disable shecllcheck SC2034 in lib/includes Many variables defined in this file are not used here. --- lib/includes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/includes b/lib/includes index 4d6c9cc..3b97162 100755 --- a/lib/includes +++ b/lib/includes @@ -2,10 +2,10 @@ # # Config for bkctld # +# shellcheck disable=SC2034 [ -f /etc/default/bkctld ] && . /etc/default/bkctld -# shellcheck disable=SC2034 VERSION="2.6.0" LIBDIR=${LIBDIR:-/usr/lib/bkctld} From 2ccd8c1b8d3a8543ead54f090c0a66a086a4cac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Sun, 11 Oct 2020 14:57:47 +0200 Subject: [PATCH 3/9] add a [-f|--force] option to remove confirmation on some commands --- CHANGELOG.md | 2 ++ bkctld | 3 +++ lib/includes | 1 + 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69d1688..b59c51a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* bkctld: add a [-f|--force] option to remove confirmation on some commands + ### Changed * Better help message composition and formating diff --git a/bkctld b/bkctld index b46810d..07d399a 100755 --- a/bkctld +++ b/bkctld @@ -50,6 +50,9 @@ while :; do show_version exit 0 ;; + -f|--force) + FORCE=1 + ;; *) # Default case: If no more options then break out of the loop. break diff --git a/lib/includes b/lib/includes index 3b97162..9b0c211 100755 --- a/lib/includes +++ b/lib/includes @@ -27,6 +27,7 @@ LOGLEVEL="${LOGLEVEL:-6}" CRITICAL="${CRITICAL:-48}" WARNING="${WARNING:-24}" DUC=$(command -v duc-nox || command -v duc) +FORCE=0 show_version() { cat < Date: Sun, 11 Oct 2020 15:19:00 +0200 Subject: [PATCH 4/9] bkctld-remove: confirmation before removal of jails if not in force mode --- CHANGELOG.md | 1 + lib/bkctld-remove | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b59c51a..179315d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * bkctld: add a [-f|--force] option to remove confirmation on some commands +* bkctld-remove: confirmation before removal of jails if not in force mode ### Changed diff --git a/lib/bkctld-remove b/lib/bkctld-remove index 30d2594..94d6b19 100755 --- a/lib/bkctld-remove +++ b/lib/bkctld-remove @@ -2,6 +2,8 @@ # # Description: Remove jail and all dated copies (incs) # Usage: remove |all +# Return codes: +# * 101 : jail removal aborted # # shellcheck source=./includes @@ -16,6 +18,28 @@ incs_path=$(incs_path "${jail_name}") test -d "${jail_path}" || error "${jail_name}: jail not found" 2 +if [ "${FORCE}" != "1" ]; then + answer="" + while :; do + printf "> Are you sure you want to delete jail \`%s'? [Y,n,?] " "${jail_name}" + read -r answer + case $answer in + [Yy]|"" ) + break + ;; + [Nn] ) + tty -s && echo "Abort." >&2 + exit 101 + ;; + * ) + printf "y - yes, execute actions and exit\n" + printf "n - no, don't execute actions and exit\n" + printf "? - print this help\n" + ;; + esac + done +fi + "${LIBDIR}/bkctld-is-on" "${jail_name}" && "${LIBDIR}/bkctld-stop" "${jail_name}" rm -f "${CONFDIR}/${jail_name}" From 3c5a646ae39ec38b83cba1729abcd3c32aa8a276 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 12 Nov 2020 18:35:41 +0100 Subject: [PATCH 5/9] bkctld-rm: list jails from incs directory We list jails in "incs" directory, not in "jails" directory so we can clean old incs after a jail is archived --- CHANGELOG.md | 1 + lib/bkctld-rm | 4 +++- lib/includes | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 179315d..db6f390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Better help message composition and formating +* bkctld-rm: list jails from incs directory ### Deprecated diff --git a/lib/bkctld-rm b/lib/bkctld-rm index 1c448c8..3d5a99f 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -92,7 +92,9 @@ trap "rm -f ${lock_file}; cleanup_tmp;" 0 kill_or_clean_lockfile "${lock_file}" new_lock_file "${lock_file}" -jails_list=$(jails_list) +# We list jails in "incs" directory, not in "jails" directory +# so we can clean old incs after a jail is archived +jails_list=$(jails_with_incs_list) jails_total=$(echo $jails_list | wc -w) jails_count=0 diff --git a/lib/includes b/lib/includes index 9b0c211..91b0547 100755 --- a/lib/includes +++ b/lib/includes @@ -129,12 +129,16 @@ is_btrfs() { test $inode -eq 256 } -# Returns the list of all jails +# Returns the list of jails found in the "jails" directory (default) jails_list() { # TODO: try if this command works the same : # find "${JAILDIR}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' find "${JAILDIR}" -mindepth 1 -maxdepth 1 -type d | sed 's!.*/!!' | sort -h } +# Returns the list of jails found in the "incs" directory +jails_with_incs_list() { + find "${INCDIR}" -mindepth 1 -maxdepth 1 -type d | sed 's!.*/!!' | sort -h +} # Returns the complete path of a jail jail_path() { jail_name=${1:?} From f9018738b9cd4fdb574745e731104e835c29958e Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 13 Nov 2020 15:32:19 +0100 Subject: [PATCH 6/9] tests: use FORCE flag to remove jail in tests --- lib/includes | 2 +- test/test_helper.bash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/includes b/lib/includes index 91b0547..5cd4586 100755 --- a/lib/includes +++ b/lib/includes @@ -27,7 +27,7 @@ LOGLEVEL="${LOGLEVEL:-6}" CRITICAL="${CRITICAL:-48}" WARNING="${WARNING:-24}" DUC=$(command -v duc-nox || command -v duc) -FORCE=0 +FORCE="${FORCE:-0}" show_version() { cat < Date: Fri, 13 Nov 2020 15:33:18 +0100 Subject: [PATCH 7/9] bkctld-rm: delete empty jails in incs directory --- CHANGELOG.md | 1 + lib/bkctld-rm | 18 +++++++++++++++++- lib/includes | 4 ++++ test/incs.bats | 17 +++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db6f390..f7354bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * bkctld: add a [-f|--force] option to remove confirmation on some commands * bkctld-remove: confirmation before removal of jails if not in force mode +* bkctld-rm: delete empty jails in incs directory ### Changed diff --git a/lib/bkctld-rm b/lib/bkctld-rm index 3d5a99f..7b1df54 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -84,6 +84,21 @@ delete_inc_ext4() { fi } +delete_empty_inc() { + jail_name=$1 + + incs_path=$(incs_path "${jail_name}") + empty_incs_list=$(find "${incs_path}" -mindepth 0 -maxdepth 0 -type d -empty) + + for empty_inc in ${empty_incs_list}; do + if dry_run; then + echo "[dry-run] Delete empty \`${empty_inc}'" + else + rmdir "${empty_inc}" + notice "Delete empty \`${empty_inc}' : OK" + fi + done +} lock_file="${LOCKDIR}/rm-global.lock" # shellcheck disable=SC2064 @@ -104,7 +119,6 @@ for jail_name in ${jails_list}; do # If no incs policy is found, we don't remove incs if [ -n "${incs_policy_file}" ]; then # shellcheck disable=SC2046 - incs_to_delete=$(incs_to_delete "${jail_name}" "${incs_policy_file}") incs_total=$(echo ${incs_to_delete} | wc -w) incs_count=0 @@ -132,6 +146,8 @@ for jail_name in ${jails_list}; do else notice "Skip jail \`${jail_name}' : incs policy is missing" fi + # Delete empty incs directory for jail + delete_empty_inc "${jail_name}" done # Remove the lock file and cleanup tmp files diff --git a/lib/includes b/lib/includes index 5cd4586..5d979cd 100755 --- a/lib/includes +++ b/lib/includes @@ -184,6 +184,10 @@ incs_list() { jail_name=${1:?} find "$(incs_path "${jail_name}")" -mindepth 1 -maxdepth 1 -type d | sed 's!.*/!!' | sort -h } +# Return the list of empty incs directories +empty_incs_list() { + find ${INCDIR} -mindepth 1 -maxdepth 1 -type d -empty +} current_jail_incs_policy_file() { jail_name=${1:?} diff --git a/test/incs.bats b/test/incs.bats index 380d990..9120503 100644 --- a/test/incs.bats +++ b/test/incs.bats @@ -87,4 +87,21 @@ load test_helper assert_failure } +@test "empty inc directory are removed" { + # Create an inc + /usr/lib/bkctld/bkctld-inc + # no inc should be kept + echo '' > "${CONFDIR}/${JAILNAME}.d/incs_policy" + + # The inc directory is present + run test -d "${INCSPATH}" + assert_success + + /usr/lib/bkctld/bkctld-rm + + # The inc directory is absent + run test -d "${INCSPATH}" + assert_failure +} + # TODO: add many tests for incs (creation and removal) From a7dc09bb463032b33f97fdf2957771d61e91f7bc Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 13 Nov 2020 15:47:06 +0100 Subject: [PATCH 8/9] New test : All incs are removed by 'rm' with empty inc policy --- test/incs.bats | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/incs.bats b/test/incs.bats index 9120503..8f17400 100644 --- a/test/incs.bats +++ b/test/incs.bats @@ -87,6 +87,24 @@ load test_helper assert_failure } +@test "All incs are removed by 'rm' with empty inc policy" { + # Setup empty incs policy + echo "" > "${CONFDIR}/${JAILNAME}.d/incs_policy" + inc_path="${INCSPATH}/${INC_NAME}" + + # Create the inc + /usr/lib/bkctld/bkctld-inc + # Inc should be removed + run test -d "${inc_path}" + assert_success + + # Remove incs + /usr/lib/bkctld/bkctld-rm + # Inc should be removed + run test -d "${inc_path}" + assert_failure +} + @test "empty inc directory are removed" { # Create an inc /usr/lib/bkctld/bkctld-inc From 01a19ad2dab9416e884207822333296f5d644fd9 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 13 Nov 2020 15:49:43 +0100 Subject: [PATCH 9/9] Release 2.7.0 --- CHANGELOG.md | 22 ++++++++++++++-------- lib/includes | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7354bb..ea4c32f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security + +## [2.7.0] - 2020-11-13 + +### Added + * bkctld: add a [-f|--force] option to remove confirmation on some commands * bkctld-remove: confirmation before removal of jails if not in force mode * bkctld-rm: delete empty jails in incs directory @@ -17,14 +31,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Better help message composition and formating * bkctld-rm: list jails from incs directory -### Deprecated - -### Removed - -### Fixed - -### Security - ## [2.6.0] - 2020-10-07 ### Added diff --git a/lib/includes b/lib/includes index 5d979cd..c5870d9 100755 --- a/lib/includes +++ b/lib/includes @@ -6,7 +6,7 @@ [ -f /etc/default/bkctld ] && . /etc/default/bkctld -VERSION="2.6.0" +VERSION="2.7.0" LIBDIR=${LIBDIR:-/usr/lib/bkctld} CONFDIR="${CONFDIR:-/etc/evobackup}"