diff options
Diffstat (limited to 'src/ufw/rc.d')
-rwxr-xr-x | src/ufw/rc.d | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/ufw/rc.d b/src/ufw/rc.d new file mode 100755 index 0000000..bd8c3e3 --- /dev/null +++ b/src/ufw/rc.d @@ -0,0 +1,64 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +[ -x /usr/bin/ufw ] || exit 0 + +for s in "/usr/lib/ufw/ufw-init-functions" "/etc/ufw/ufw.conf" ; do + if [ -s "$s" ]; then + . "$s" + else + echo "Could not find $s (aborting)" + exit 1 + fi +done + +error=0 +case "$1" in +start) + if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then + stat_busy "Starting ufw" + if ! ufw_start; then + stat_fail + else + add_daemon ufw + stat_done + fi + + else + echo "Skip starting firewall:" "ufw (not enabled)" + fi + ;; +stop) + if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then + stat_busy "Stopping ufw" + if ! ufw_stop; then + stat_fail + else + rm_daemon ufw + stat_done + fi + else + echo "Skip stopping firewall:" "ufw (not enabled)" + fi + ;; +restart|force-reload) + stat_busy "Reloading ufw" + if ! ufw_reload; then + stat_fail + else + stat_done + fi + ;; +status) + ufw_status + ;; +*) + echo "Usage: /etc/rc.d/ufw {start|stop|restart|force-reload|status}" + exit 1 + ;; +esac + +exit 0 + |