Fwknopd: Fix a typo in the init file
[feed/packages.git] / net / fwknop / files / fwknopd.init
1 #!/bin/sh /etc/rc.common
2 #
3 # Fwknop is developed primarily by the people listed in the file 'AUTHORS'.
4 # Copyright (C) 2009-2014 fwknop developers and contributors. For a full
5 # list of contributors, see the file 'CREDITS'.
6 #
7 . /lib/functions.sh
8 START=60
9
10 FWKNOPD_BIN=/usr/sbin/fwknopd
11
12 start()
13 {
14 gen_confs
15 $FWKNOPD_BIN
16 }
17
18 stop()
19 {
20 $FWKNOPD_BIN -K
21 }
22
23 restart()
24 {
25 stop;
26 sleep 1;
27 start;
28 }
29
30 reload()
31 {
32 $FWKNOPD_BIN -R
33 }
34
35 gen_confs()
36 {
37
38
39 config_cb() {
40
41 local type="$1"
42 local name="$2"
43 if [ "$type" = "global" ]
44 then
45 option_cb() {
46 local option="$1"
47 local value="$2"
48 if [ "$option" = "uci_enabled" ] && [ "$value" -eq 1 ] ; then
49 > /etc/fwknop/fwknopd.conf
50 > /etc/fwknop/access.conf
51 UCI_ENABLED=1
52 fi
53 }
54 elif [ "$type" = "config" ]
55 then
56 option_cb() {
57 local option="$1"
58 local value="$2"
59 if [ $UCI_ENABLED ]; then
60 echo "${option//_/-} $value" >> /etc/fwknop/fwknopd.conf #writing each option to fwknopd.conf
61 fi
62 }
63 elif [ "$type" = "SOURCE" ]
64 then
65 echo "${type//_/-} $name" >> /etc/fwknop/access.conf #writing each option to access.conf
66 option_cb() {
67 local option="$1"
68 local value="$2"
69 if [ $UCI_ENABLED ]; then
70 echo "${option//_/-} $value" >> /etc/fwknop/access.conf #writing each option to access.conf
71 fi
72 }
73 fi
74
75
76
77
78 }
79
80
81 if [ -f /etc/config/fwknopd ]; then
82
83 config_load fwknopd
84
85
86 fi
87
88 }