-BOLD="\\033[1;39m"
-NORMAL="\\033[0;39m"
-ERROR="\\033[1;31m"
-
-. /etc/init/functions
-
-if [ -e "/lib/network/functions" ]; then
- . /lib/network/functions
-elif [ -e "lib/functions" ]; then
- HOME_DIR="lib"
- . lib/functions
-else
- echo "Cannot find functions library. Exiting." >&2
- exit 1
-fi
-
-function usage() {
- echo -e "${BOLD}Usage $0${NORMAL}:\n"
- case "$1" in
- main|"")
- echo "This script will help you configuring your network."
- echo
- echo "You should know that there are three different things:"
- echo
- echo " hook: A script to control connections and protocols."
- echo " port: A physical connection to somewhere."
- echo " zone: A group of ports."
- echo
- echo " $0 [global flags] <hook|port|zone> ... or"
- echo " $0 [global flags] <cmd line options...>"
- echo
- echo -e "${BOLD}Global flags:${NORMAL}"
- echo " --verbose -v - Turn on verbose mode."
- echo " --debug -d - Turn on debug mode."
- echo
- echo -e "${BOLD}Command line options:${NORMAL}"
- echo " help - Prints this help message."
- echo " start - Starts the whole network."
- echo " stop - Stops the whole network."
- echo " restart - Restarts the whole network."
- echo " reload - Reloads the whole network."
- echo
- echo " hook - Run \"$0 hook help\" for more information."
- echo " port - Run \"$0 port help\" for more information."
- echo " zone - Run \"$0 zone help\" for more information."
- echo
- ;;
- hook*)
- echo -e "${BOLD}Hook configuration:${NORMAL}"
- echo
- echo " ${0} [global options] hook <command>"
- echo
- echo -e "${BOLD}1st level commands:${NORMAL}"
- echo -e " ${BOLD}list:${NORMAL}"
- echo " Returns a list of all available hooks."
- echo
- echo
- echo " ${0} [global options] hook <hook> <command>"
- echo
- echo -e "${BOLD}2nd level commands:${NORMAL}"
- echo -e " ${BOLD}help:${NORMAL}"
- echo " Displays some help about the given hook."
- echo
- echo " Example: $0 hook ethernet help"
- echo
- ;;
- port)
- echo -e "${BOLD}Port Configuration:${NORMAL}"
- echo
- echo " $0 [global options] port <command> ..."
- echo
- echo -e "${BOLD}Commands:${NORMAL}"
- echo -e " ${BOLD}show:${NORMAL}"
- echo " Displays information about a given port."
- echo
- echo " Requires a \"port\"."
- echo " Example: $0 port show 00:11:22:33:44:55"
- echo " $0 port show port0"
- echo
- ;;
- zone)
- echo -e "${BOLD}Zone Configuration:${NORMAL}"
- echo
- echo " $0 [global options] zone <command> ..."
- echo
- echo -e "${BOLD}Commands:${NORMAL}"
- echo -e " ${BOLD}show:${NORMAL}"
- echo " Displays information about a given zone."
- echo
- echo " Requires a \"zone\"."
- echo " Example: $0 zone show green0"
- echo
- echo -e " ${BOLD}add:${NORMAL}"
- echo " Adds a new zone."
- echo
- echo " Requires a \"zone\"."
- echo " Example: $0 zone add green0"
- echo
- echo -e " ${BOLD}del:${NORMAL}"
- echo " Deletes a zone."
- echo
- echo " Requires a \"zone\"."
- echo " Example: $0 zone del green0"
- echo
- echo -e " ${BOLD}addport:${NORMAL}"
- echo " Adds a port to a zone."
- echo
- echo " Requires a \"zone\" and \"port\"."
- echo " Example: $0 zone addport green0 port0"
- echo
- echo " You may also pass a hook and its parameters:"
- echo " $0 zone addport green0 port0 vlan 10"
- echo
- echo -e " ${BOLD}delport:${NORMAL}"
- echo " Deletes a port from a zone."
- echo
- echo " Requires a \"zone\" and \"port\"."
- echo " Example: $0 zone delport green0"
- echo
- echo " You may also pass a hook and its parameters:"
- echo " $0 zone delport green0 port0 vlan 10"
- echo