Merge pull request #1253 from michael-o/version-sort

Apply version (natural) sort to listings
This commit is contained in:
tschettervictor
2025-09-30 12:17:44 -06:00
committed by GitHub
3 changed files with 7 additions and 7 deletions

View File

@@ -156,7 +156,7 @@ destroy_rel() {
BASE_HASCHILD="0"
if [ -d "${bastille_jailsdir}" ]; then
JAIL_LIST=$(ls "${bastille_jailsdir}" | sed "s/\n//g")
JAIL_LIST=$(ls -v --color=never "${bastille_jailsdir}" | sed "s/\n//g")
for _jail in ${JAIL_LIST}; do

View File

@@ -71,7 +71,7 @@ get_jail_list() {
if [ -n "${TARGET}" ]; then
JAIL_LIST="${TARGET}"
else
JAIL_LIST="$(ls --color=never "${bastille_jailsdir}" | sed "s/\n//g")"
JAIL_LIST="$(ls -v --color=never "${bastille_jailsdir}" | sed "s/\n//g")"
fi
}
@@ -583,7 +583,7 @@ list_release(){
if [ -d "${bastille_releasesdir}" ]; then
# TODO: Check if this can be changed to `find` as SC2012 suggests.
# shellcheck disable=SC2012
REL_LIST="$(ls "${bastille_releasesdir}" | sed "s/\n//g")"
REL_LIST="$(ls -v --color=never "${bastille_releasesdir}" | sed "s/\n//g")"
for _REL in ${REL_LIST}; do
if [ -f "${bastille_releasesdir}/${_REL}/root/.profile" ] || [ -d "${bastille_releasesdir}/${_REL}/debootstrap" ]; then
if [ "${1}" = "-p" ] && [ -f "${bastille_releasesdir}/${_REL}/bin/freebsd-version" ]; then
@@ -602,7 +602,7 @@ list_snapshot(){
# TODO: Ability to list snapshot data for a single target.
# List snapshots with its usage data for valid bastille jails only.
if [ -d "${bastille_jailsdir}" ]; then
JAIL_LIST=$(ls --color=never "${bastille_jailsdir}" | sed "s/\n//g")
JAIL_LIST=$(ls -v --color=never "${bastille_jailsdir}" | sed "s/\n//g")
for _JAIL in ${JAIL_LIST}; do
if [ -f "${bastille_jailsdir}/${_JAIL}/jail.conf" ]; then
info "\n[${_JAIL}]:"
@@ -618,7 +618,7 @@ list_template(){
list_jail(){
if [ -d "${bastille_jailsdir}" ]; then
JAIL_LIST=$(ls --color=never "${bastille_jailsdir}" | sed "s/\n//g")
JAIL_LIST=$(ls -v --color=never "${bastille_jailsdir}" | sed "s/\n//g")
for _JAIL in ${JAIL_LIST}; do
if [ -f "${bastille_jailsdir}/${_JAIL}/jail.conf" ]; then
echo "${_JAIL}"
@@ -637,7 +637,7 @@ list_limit(){
list_import(){
# shellcheck disable=SC2010
ls "${bastille_backupsdir}" | grep -v ".sha256$"
ls -v "${bastille_backupsdir}" | grep -v ".sha256$"
}
bastille_root_check

View File

@@ -88,7 +88,7 @@ set_target "${TARGET}" "reverse"
for _jail in ${JAILS}; do
# Validate that all jails that 'depend' on this one are stopped
for _depend_jail in $(ls --color=never ${bastille_jailsdir} | sed -e 's/\n//g'); do
for _depend_jail in $(ls -v --color=never ${bastille_jailsdir} | sed -e 's/\n//g'); do
if ! grep -hoqsw "depend=" ${bastille_jailsdir}/${_depend_jail}/settings.conf; then
sysrc -q -f ${bastille_jailsdir}/${_depend_jail}/settings.conf depend="" >/dev/null
fi