mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
Fwknop: Update to newest release
add basic uci support add optional gpg support signed-off-by: Jonathan Bennett <jbennett@incomsystems.biz>
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Fwknop is developed primarily by the people listed in the file 'AUTHORS'.
|
||||
# Copyright (C) 2009-2014 fwknop developers and contributors. For a full
|
||||
# list of contributors, see the file 'CREDITS'.
|
||||
#
|
||||
. /lib/functions.sh
|
||||
UCI_ENABLED=0
|
||||
START=60
|
||||
|
||||
FWKNOPD_BIN=/usr/sbin/fwknopd
|
||||
|
||||
start()
|
||||
{
|
||||
gen_confs
|
||||
$FWKNOPD_BIN
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
$FWKNOPD_BIN -K
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
stop;
|
||||
sleep 1;
|
||||
start;
|
||||
}
|
||||
|
||||
reload()
|
||||
{
|
||||
$FWKNOPD_BIN -R
|
||||
}
|
||||
|
||||
gen_confs()
|
||||
{
|
||||
|
||||
|
||||
config_cb() {
|
||||
|
||||
local type="$1"
|
||||
local name="$2"
|
||||
if [ "$type" = "global" ]
|
||||
then
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
if [ "$option" = "uci_enabled" ] && [ "$value" -eq 1 ] ; then
|
||||
> /etc/fwknop/fwknopd.conf
|
||||
> /etc/fwknop/access.conf
|
||||
UCI_ENABLED=1
|
||||
fi
|
||||
}
|
||||
elif [ "$type" = "config" ]
|
||||
then
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
if [ $UCI_ENABLED ]; then
|
||||
echo "${option//_/-} $value" >> /etc/fwknop/fwknopd.conf #writing each option to fwknopd.conf
|
||||
fi
|
||||
}
|
||||
elif [ "$type" = "SOURCE" ]
|
||||
then
|
||||
echo "${type//_/-} $name" >> /etc/fwknop/access.conf #writing each option to access.conf
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
if [ $UCI_ENABLED ]; then
|
||||
echo "${option//_/-} $value" >> /etc/fwknop/access.conf #writing each option to access.conf
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if [ -f /etc/config/fwknopd ]; then
|
||||
|
||||
config_load fwknopd
|
||||
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user