summaryrefslogtreecommitdiff
blob: 43b472f1ff5316c60a102374a8a624e2dac0ab96 (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-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/gogoc/files/gogoc.rc,v 1.4 2010/10/12 18:21:16 voyageur Exp $

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.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 $?
}