#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2012 IPFire Network Development Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### . /usr/lib/network/functions function cli_start() { firewall_start } function cli_stop() { firewall_stop } function cli_config() { if cli_help_requested $@; then cli_usage root-config exit ${EXIT_OK} fi if [ -n "${1}" ]; then config_set $@ firewall_config_write else firewall_config_print fi } # Parse the command line while [ $# -gt 0 ]; do case "${1}" in -d|--debug) DEBUG=1 log DEBUG "Enabled debugging mode" ;; *) action=${1} ;; esac shift [ -n "${action}" ] && break done # Process the given action case "${action}" in start|restart|reload) cli_start $@ ;; stop) cli_stop $@ ;; config) cli_config $@ ;; ""|help|--help|-h) cli_usage root exit ${EXIT_OK} ;; *) error "Invalid command given: ${action}" cli_usage usage exit ${EXIT_CONF_ERROR} ;; esac exit ${EXIT_OK}