packages/net/chaosvpn/files/chaosvpn.init
Norbert Summer f6acde7187 chaosvpn: add new package
Signed-off-by: Norbert Summer <git@o-g.at>
2015-09-22 16:14:53 +02:00

31 lines
761 B
Bash
Executable file

#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
start_service()
{
#check if chaosvpn is configured
if [ ! -f "/etc/tinc/chaos/rsa_key.pub" -o ! -f "/etc/tinc/chaos/rsa_key.priv" ]; then
logger -t chaosvpn "please generate rsa key pair"
logger -t chaosvpn "tincd -n chaos --generate-keys=2048"
exit 1
fi
if [ "`grep unique_name /etc/tinc/chaosvpn.conf | wc -l`" != "0" ]; then
logger -t chaosvpn "/etc/tinc/chaosvpn.conf is not configured yet or contains 'unique_name'"
exit 1
fi
procd_open_instance
procd_set_param command /usr/sbin/chaosvpn -r -c /etc/tinc/chaosvpn.conf
procd_close_instance
}
stop_service()
{
#force remove tinc pid
if [ -f "/var/run/tinc.chaos.pid" ]; then
rm "/var/run/tinc.chaos.pid"
fi
}