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
This commit is contained in:
Jérémy Lecour 2020-11-12 18:35:41 +01:00 committed by Jérémy Lecour
parent bf56c16ed2
commit 3c5a646ae3
3 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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:?}