aboutsummaryrefslogtreecommitdiffstats
path: root/main/ferm/ferm.initd
blob: d855f6f79a1a6f140cd85d465a15c5ef51647aef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/sbin/openrc-run

name="ferm"
description="For Easy Rule Making is a perl-based iptables frontend"
description_checkconfig="Checks script validity"

extra_commands="checkconfig"

depend() {
    after net sysctl
    provide firewall
}

checkconfig() {
    ferm -n "$inputfile"
}

start_pre() {
    if [ "${RC_CMD}" != "restart" ] ; then
        checkconfig || return $?
    fi
}

stop_pre() {
    if [ "${RC_CMD}" = "restart" ] ; then
        checkconfig || return $?
    fi
}

start() {
    ebegin "Loading $inputfile rules"
    ferm "$inputfile"
    eend $?
}

stop() {
    ebegin "Unloading $inputfile rules"
    ferm -F "$inputfile"
    eend $?
}