subcommand options are examined in their respective context
This commit is contained in:
parent
14c4b63e69
commit
4c9cbf976e
16
bkctld
16
bkctld
|
@ -35,24 +35,21 @@ fi
|
|||
. "${LIBDIR}/includes"
|
||||
|
||||
subcommand="${1:-}"
|
||||
jail_name="${2:-}"
|
||||
option="${3:-}"
|
||||
|
||||
if [ ! -x "${LIBDIR}/bkctld-${subcommand}" ]; then
|
||||
"${LIBDIR}/bkctld-help" && exit 1
|
||||
fi
|
||||
|
||||
case "${subcommand}" in
|
||||
"inc" | "rm" | "check" | "stats" | "help" | "list")
|
||||
"${LIBDIR}/bkctld-${subcommand}"
|
||||
;;
|
||||
"init" | "is-on")
|
||||
jail_name="${2:-}"
|
||||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
|
||||
;;
|
||||
"key" | "port" | "ip")
|
||||
jail_name="${2:-}"
|
||||
option="${3:-}"
|
||||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}" "${option}"
|
||||
;;
|
||||
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove" | "firewall")
|
||||
jail_name="${2:-}"
|
||||
if [ "${jail_name}" = "all" ]; then
|
||||
"${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 --max-procs=0 "${LIBDIR}/bkctld-${subcommand}"
|
||||
else
|
||||
|
@ -60,10 +57,15 @@ case "${subcommand}" in
|
|||
fi
|
||||
;;
|
||||
"status")
|
||||
jail_name="${2:-}"
|
||||
if [ "${jail_name}" = "all" ] || [ -z "${jail_name}" ]; then
|
||||
"${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 "${LIBDIR}/bkctld-${subcommand}"
|
||||
else
|
||||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
"${LIBDIR}/bkctld-help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue