Debian Codegraph @

netfilter-persistent

raw
1 #!/bin/sh
2
3 # This file is part of netfilter-persistent
4 # Copyright (C) 2014 Jonathan Wiltshire
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation, either version 3
9 # of the License, or (at your option) any later version.
10
11 set -e
12
13 IAM=$(whoami)
14 PLUGINS=/usr/share/netfilter-persistent/plugins.d
15
16 if [ ${IAM} != "root" ]; then
17 echo "You must be root to use this utility"
18 fi
19
20 # Source configuration
21 if [ -f "/etc/default/netfilter-persistent" ]; then
22 . /etc/default/netfilter-persistent
23 fi
24
25 run_plugins () {
26 if [ -d ${PLUGINS} ]; then
27 run-parts -v -a ${1} ${PLUGINS}
28 fi
29 }
30
31 case $1 in
32 start|save|flush)
33 run_plugins ${1}
34 ;;
35 reload|restart)
36 run_plugins start
37 ;;
38 stop)
39 if [ ${FLUSH_ON_STOP} -gt 0 ]; then
40 run_plugins flush
41 else
42 echo "Automatic flush disabled; use '${0} flush'"
43 fi
44 ;;
45 *)
46 echo "Usage: ${0} (start|stop|restart|reload|flush|save)"
47 ;;
48 esac
49
50
51 exit 0
52