diff --git a/usr/local/share/bastille/tags.sh b/usr/local/share/bastille/tags.sh index 4457f03d..0285570f 100644 --- a/usr/local/share/bastille/tags.sh +++ b/usr/local/share/bastille/tags.sh @@ -35,31 +35,45 @@ . /usr/local/etc/bastille/bastille.conf usage() { - error_notify "Usage: bastille tags TARGET add tag1[,tag2,...]" - error_notify " bastille tags TARGET delete tag1[,tag2,...]" - error_notify " bastille tags TARGET list [tag]" - echo -e "Example: bastille tags JAILNAME add database,mysql" - echo -e " bastille tags JAILNAME delete mysql" - echo -e " bastille tags ALL list" - echo -e " bastille tags ALL list mysql" + error_notify "Usage: bastille tags TARGET [add|delete|list] [tag1,tag2]" + cat << EOF + Options: + + -x | --debug Enable debug mode. + +EOF exit 1 } -# Handle special-case commands first. -case "$1" in -help|-h|--help) - usage - ;; -esac +# Handle options. +while [ "$#" -gt 0 ]; do + case "${1}" in + -h|--help|help) + usage + ;; + -x|--debug) + enable_debug + shift + ;; + -*) + error_exit "Unknown Option: \"${1}\"" + ;; + *) + break + ;; + esac +done -if [ $# -lt 1 ] || [ $# -gt 2 ]; then +if [ $# -lt 2 ] || [ $# -gt 3 ]; then usage fi -bastille_root_check +TARGET="${1}" +ACTION="${2}" +TAGS="${3}" -ACTION="${1}" -TAGS="${2}" +bastille_root_check +set_target "${TARGET}" for _jail in ${JAILS}; do bastille_jail_tags="${bastille_jailsdir}/${_jail}/tags"