summaryrefslogtreecommitdiff
blob: 2ea6a44759f5e4900822a322173089a85aa59016 (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
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

: ${pidfile:=/run/${RC_SVCNAME}.pid}

: ${IRKERD_NICK:=}
: ${IRKERD_PASSWORD:=}
: ${IRKERD_USER:=nobody}

depend() {
        use net
}

start () {
	if [[ ${IRKERD_LOGFILE} ]] ; then
		checkpath -f \
			-o "${IRKERD_USER}" \
			"${IRKERD_LOGFILE}" \
			|| return 1
	fi

	if [[ -z "${IRKERD_USER}" ]] ; then
		die "IRKERD_USER is mandatory"
	fi

	[[ -n "${IRKERD_LOGLEVEL}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -d ${IRKERD_LOGLEVEL}"
	[[ -n "${IRKERD_LOGFILE}"  ]] && IRKERD_OPTS="${IRKERD_OPTS} -l ${IRKERD_LOGFILE}"
	[[ -n "${IRKERD_NICK}"     ]] && IRKERD_OPTS="${IRKERD_OPTS} -n ${IRKERD_NICK}"
	[[ -n "${IRKERD_PASSWORD}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -p ${IRKERD_PASSWORD}"

        ebegin "Starting ${RC_SVCNAME}"
        start-stop-daemon --start \
                --quiet --background \
                --user "${IRKERD_USER}" \
                --make-pidfile --pidfile "${pidfile}" \
                --exec /usr/bin/irkerd \
                -- ${IRKERD_OPTS} < /dev/null
        eend $?
}