summaryrefslogtreecommitdiff
blob: f7c723d9b33e1f540f9b76ce8a5796149b40a371 (plain)
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
41
42
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

depend() {
	need net localmount
	after bootmisc
	use dns logger
}

checktun() {
	[ $(uname -s) = "Linux" ] || return 0
        [ -e /dev/net/tun ] && return 0
        modprobe tun && return 0

	eerror "TUN/TAP support is not available in the running kernel"
	return 1
}

checkconfig() {
	if ! [ -f /etc/gogoc/gogoc.conf ]; then
		eerror "Unable to find configuration file /etc/gogoc/gogoc.conf"
		return 1
	fi
}

start() {
        checktun || return 1
	checkconfig || return 1

	ebegin "Starting gogoCLIENT"
	start-stop-daemon --start --exec /usr/sbin/gogoc \
		--chdir /var/lib/gogoc -- -f /etc/gogoc/gogoc.conf -y
	eend $?
}

stop() {
	ebegin "Stopping gogoCLIENT"
	start-stop-daemon --stop --exec /usr/sbin/gogoc
	eend $?
}