jails and incs lists are sorted alphanumerically

This commit is contained in:
Jérémy Lecour 2020-08-28 10:21:13 +02:00 committed by Jérémy Lecour
parent 39901967a7
commit 7d1964370d
3 changed files with 21 additions and 21 deletions

View File

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
* jails and incs lists are sorted alphanumerically
### Changed
### Deprecated

View File

@ -10,6 +10,4 @@ set -eu
LIBDIR="$(dirname $0)" && . "${LIBDIR}/includes"
[ -d "${JAILDIR}" ] || exit 0
#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!.*/!!'
jails_list

View File

@ -94,14 +94,9 @@ is_btrfs() {
# Returns the list of all jails
jails_list() {
# shellcheck disable=SC2091
"${LIBDIR}/bkctld-list"
}
# Returns the list of all incs for a jail
incs_list() {
jail_name=${1:?}
# shellcheck disable=SC2091
ls "$(incs_path "${jail_name}")/"
# 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 complete path of a jail
jail_path() {
@ -109,6 +104,18 @@ jail_path() {
echo "${JAILDIR}/${jail_name}"
}
jail_config_dir() {
jail_name=${1:?}
echo "${CONFDIR}/${jail_name}.d"
}
jail_incs_policy_file() {
jail_name=${1:?}
jail_config_dir=$(jail_config_dir "${jail_name}")
echo "${jail_config_dir}/incs_policy"
}
# Returns the path of incs for a jail
incs_path() {
jail_name=${1:?}
@ -131,17 +138,10 @@ inc_exists() {
# inc_path must not be quoted because it can contain globs
ls -d ${inc_path} > /dev/null 2>&1
}
jail_config_dir() {
# Returns the list of all incs for a jail
incs_list() {
jail_name=${1:?}
echo "${CONFDIR}/${jail_name}.d"
}
jail_incs_policy_file() {
jail_name=${1:?}
jail_config_dir=$(jail_config_dir "${jail_name}")
echo "${jail_config_dir}/incs_policy"
find "$(incs_path "${jail_name}")" -mindepth 1 -maxdepth 1 -type d | sed 's!.*/!!' | sort -h
}
current_jail_incs_policy_file() {
jail_name=${1:?}