tags: Implement new functions

This commit is contained in:
tschettervictor
2025-02-23 12:12:45 -07:00
committed by GitHub
parent 21b79247ab
commit 8a84d70c59

View File

@@ -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"