summaryrefslogtreecommitdiff
path: root/net-p2p/gnunet/files/gnunet.initd-0.9.0v2
blob: 604f448ecfccb1ce19fc18f77d2f31b05ab21f3d (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
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need net
}

start() {
	if ! test -f "/etc/gnunet.conf"; then
		eerror "You must create /etc/gnunet.conf file first"
		return 1
	fi
	if ! test -f "/var/lib/gnunet/hostlist/learned.data"; then
		mkdir -p /var/lib/gnunet/hostlist/
		wget -q http://v9.gnunet.org:58080/ -O /var/lib/gnunet/hostlist/learned.data
		chown -R gnunetd:gnunetd /var/lib/gnunet/hostlist
	fi

	ebegin "Starting GNUnet"
	sudo -u gnunetd /usr/bin/gnunet-arm -s -c /etc/gnunet.conf
	eend $? "Failed to start GNUnet"
}

stop() {
	ebegin "Stopping GNUnet"
	sudo -u gnunetd /usr/bin/gnunet-arm -e -c /etc/gnunet.conf
	eend $? "Failed to stop GNUnet"
}

restart() {
        svc_stop
        sleep 3
        svc_start
}