mirror of
https://github.com/hackacad/bastille.git
synced 2026-03-29 05:04:32 +02:00
tags: Implement new functions
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user