From 678886f6191a1e12fde0f359569ce624bfadc009 Mon Sep 17 00:00:00 2001 From: JRGTH Date: Wed, 16 Jul 2025 00:05:14 -0400 Subject: [PATCH] Remove sort option to fix recent conflicts Remove the sort option to fix the recent conflicts. --- usr/local/bin/bastille | 10 ++++----- usr/local/share/bastille/list.sh | 35 ++++---------------------------- 2 files changed, 9 insertions(+), 36 deletions(-) mode change 100644 => 100755 usr/local/bin/bastille diff --git a/usr/local/bin/bastille b/usr/local/bin/bastille old mode 100644 new mode 100755 index 1f05106d..96ab6793 --- a/usr/local/bin/bastille +++ b/usr/local/bin/bastille @@ -203,9 +203,11 @@ case "${CMD}" in # Commands that don't allow parallel mode bootstrap| \ clone| \ + cmd| \ console| \ convert| \ create| \ + destroy| \ edit| \ etcupdate| \ export| \ @@ -213,10 +215,13 @@ case "${CMD}" in import| \ limits| \ list| \ + migrate| \ network| \ + pkg| \ rcp| \ rdr| \ rename| \ + service| \ setup| \ top| \ update| \ @@ -227,17 +232,12 @@ case "${CMD}" in fi ;; # Commands that allow parallel mode - cmd| \ config| \ cp| \ - destroy| \ jcp| \ limits| \ - migrate| \ mount| \ - pkg| \ restart| \ - service| \ start| \ stop| \ sysrc| \ diff --git a/usr/local/share/bastille/list.sh b/usr/local/share/bastille/list.sh index 326f7031..d02d78f5 100644 --- a/usr/local/share/bastille/list.sh +++ b/usr/local/share/bastille/list.sh @@ -41,7 +41,6 @@ usage() { -d | --down List stopped jails only. -j | --json List jails or sub-arg(s) in json format. -p | --pretty Print JSON in columns. - -s | --sort VALUE Print info in VALUE order. -u | --up List running jails only. -x | --debug Enable debug mode. @@ -52,10 +51,10 @@ EOF print_info() { # Print jails in given order - for _file in $(echo ${_tmp_list}); do + for _file in $(echo ${_tmp_list} | sort); do cat ${_file} rm -f ${_file} - done | sort ${OPT_SORT} + done } pretty_json() { @@ -194,8 +193,8 @@ get_jail_info() { # Get info if jail is UP if [ "$(awk '$1 == "vnet;" { print $1 }' "${bastille_jailsdir}/${JAIL_NAME}/jail.conf" 2> /dev/null)" ]; then # Get IP for VNET jails - JAIL_IP4="$(jexec -l ${JAIL_NAME} ifconfig -an | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}')" - JAIL_IP6="$(jexec -l ${JAIL_NAME} ifconfig -an | grep "inet6" | grep -Ev 'lo[0-9]+| ::1 | fe80::' | awk '{print $2}' | sed 's/%.*//g')" + JAIL_IP4="$(jexec -l ${JAIL_NAME} ifconfig -an | grep "^[[:space:]]*inet " | grep -v "127.0.0.1" | awk '{print $2}')" + JAIL_IP6="$(jexec -l ${JAIL_NAME} ifconfig -an | grep "^[[:space:]]*inet6" | grep -Ev 'lo[0-9]+| ::1 | fe80::' | awk '{print $2}' | sed 's/%.*//g')" else # Get IP for standard jails JAIL_IP4=$(jls -j ${JAIL_NAME} ip4.addr | sed 's/,/\n/g') @@ -646,7 +645,6 @@ TARGET="" OPT_JSON=0 OPT_PRETTY=0 OPT_STATE="all" -OPT_SORT="-k2" while [ "$#" -gt 0 ]; do case "${1}" in -h|--help|help) @@ -664,25 +662,6 @@ while [ "$#" -gt 0 ]; do OPT_PRETTY=1 shift ;; - -s|--sort) - if [ -n "${3}" ]; then - error_exit "[ERROR]: [-s|--sort] can only be used with 'bastille list'." - fi - case "${2}" in - jid) OPT_SORT="-k1 -n" ;; - name) OPT_SORT="-k2" ;; - boot) OPT_SORT="-k3" ;; - prio|priority) OPT_SORT="-k4 -n" ;; - state) OPT_SORT="-k5" ;; - type|jailtype) OPT_SORT="-k6" ;; - ip) OPT_SORT="-k7 -n" ;; - ports) OPT_SORT="-k8 -n" ;; - release) OPT_SORT="-k9" ;; - tags) OPT_SORT="-k10" ;; - *) error_exit "Invalid sort option: \"${2}\"" ;; - esac - shift 2 - ;; -u|--up) OPT_STATE="Up" shift @@ -734,7 +713,6 @@ fi if [ "$#" -eq 1 ]; then case "${1}" in -a|--all|all) - OPT_SORT="-k2" if [ "${OPT_JSON}" -eq 1 ]; then if [ "${OPT_PRETTY}" -eq 1 ]; then list_all | awk 'BEGIN{print "["} NR>1{if(NR>2)print ","; printf " {\"JID\":\"%s\",\"Boot\":\"%s\",\"Prio\":\"%s\",\"State\":\"%s\",\"IP Address\":\"%s\",\"Published Ports\":\"%s\",\"Hostname\":\"%s\",\"Release\":\"%s\",\"Path\":\"%s\"}",$1,$2,$3,$4,$5,$6,$7,$8,$9} END{print "\n]"}' | pretty_json @@ -746,7 +724,6 @@ if [ "$#" -eq 1 ]; then fi ;; ip|ips) - OPT_SORT="-k3 -n" if [ "${OPT_JSON}" -eq 1 ]; then if [ "${OPT_PRETTY}" -eq 1 ]; then list_ips | awk 'BEGIN{print "["} NR>1{if(NR>2)print ","; printf " {\"JID\":\"%s\",\"Name\":\"%s\",\"IP Address\":\"%s\"}",$1,$2,$3} END{print "\n]"}' | pretty_json @@ -758,7 +735,6 @@ if [ "$#" -eq 1 ]; then fi ;; path|paths) - OPT_SORT="-k3" if [ "${OPT_JSON}" -eq 1 ]; then if [ "${OPT_PRETTY}" -eq 1 ]; then list_paths | awk 'BEGIN{print "["} NR>1{if(NR>2)print ","; printf " {\"JID\":\"%s\",\"Name\":\"%s\",\"Path\":\"%s\"}",$1,$2,$3} END{print "\n]"}' | pretty_json @@ -770,7 +746,6 @@ if [ "$#" -eq 1 ]; then fi ;; rdr|port|ports) - OPT_SORT="-k3 -n" if [ "${OPT_JSON}" -eq 1 ]; then if [ "${OPT_PRETTY}" -eq 1 ]; then list_ports | awk 'BEGIN{print "["} NR>1{if(NR>2)print ","; printf " {\"JID\":\"%s\",\"Name\":\"%s\",\"Published Ports\":\"%s\"}",$1,$2,$3} END{print "\n]"}' | pretty_json @@ -782,7 +757,6 @@ if [ "$#" -eq 1 ]; then fi ;; state|status) - OPT_SORT="-k3" if [ "${OPT_JSON}" -eq 1 ]; then if [ "${OPT_PRETTY}" -eq 1 ]; then list_state | awk 'BEGIN{print "["} NR>1{if(NR>2)print ","; printf " {\"JID\":\"%s\",\"Name\":\"%s\",\"State\":\"%s\"}",$1,$2,$3} END{print "\n]"}' | pretty_json @@ -794,7 +768,6 @@ if [ "$#" -eq 1 ]; then fi ;; type|jailtype) - OPT_SORT="-k3" if [ "${OPT_JSON}" -eq 1 ]; then if [ "${OPT_PRETTY}" -eq 1 ]; then list_type | awk 'BEGIN{print "["} NR>1{if(NR>2)print ","; printf " {\"JID\":\"%s\",\"Name\":\"%s\",\"Type\":\"%s\"}",$1,$2,$3} END{print "\n]"}' | pretty_json