summaryrefslogtreecommitdiff
blob: edee6c6ac31a6378b73c529ceef1380d7f37aa8e (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

PID_FILE="/run/iodined.pid"

depend() {
	need net
}

start() {
	ebegin "Starting iodined"
	ARGS=""
	if [ "$IODINED_USER" ]; then
		ARGS="$ARGS -u $IODINED_USER"
	fi
	if [ "$IODINED_CHROOT" ]; then
		ARGS="$ARGS -t $IODINED_CHROOT"
	fi
	if [ "$IODINED_MTU" ]; then
		ARGS="$ARGS -m $IODINED_MTU"
	fi
	if [ "$IODINED_LISTENPORT" ]; then
		ARGS="$ARGS -p $IODINED_LISTENPORT"
	fi
	if [ "$IODINED_EXTERN_IP" ]; then
		ARGS="$ARGS -n $IODINED_EXTERN_IP"
	fi
	if [ "$IODINED_LOCAL_DNS_PORT" ]; then
		ARGS="$ARGS -b $IODINED_LOCAL_DNS_PORT"
	fi
	if [ "$IODINED_LISTENIP" ]; then
		ARGS="$ARGS -l $IODINED_LISTENIP"
	fi
	if [ "$IODINED_PASSWD" ]; then
		ARGS="$ARGS -P $IODINED_PASSWD"
	else
		eerror "Please set a password (IODINED_PASSWD) in /etc/conf.d/iodined!"
		return 1
	fi
	if [ "$IODINED_IP" ]; then
		ARGS="$ARGS $IODINED_IP"
	else
		eerror "Please set an IP (IODINED_IP) in /etc/conf.d/iodined!"
		return 1
	fi
	if [ "$IODINED_DOMAIN" ]; then
		ARGS="$ARGS $IODINED_DOMAIN"
	else
		eerror "Please set a domain (IODINED_DOMAIN) in /etc/conf.d/iodined!"
		return 1
	fi
	start-stop-daemon --start --exec /usr/sbin/iodined --pidfile $PID_FILE -- -F $PID_FILE $ARGS
	eend $?
}

stop() {
	ebegin "Stopping iodined"
	start-stop-daemon --stop --exec /usr/sbin/iodined --pidfile $PID_FILE
	eend $?
}