Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 405521 | Differences between
and this patch

Collapse All | Expand All

(-)app-misc/dnetc/files/dnetc.initd.orig (-10 / +14 lines)
Lines 3-9 Link Here
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
# $Header: /var/cvsroot/gentoo-x86/app-misc/dnetc/files/dnetc.initd,v 1.3 2008/04/10 05:43:10 wolf31o2 Exp $
4
# $Header: /var/cvsroot/gentoo-x86/app-misc/dnetc/files/dnetc.initd,v 1.3 2008/04/10 05:43:10 wolf31o2 Exp $
5
5
6
opts="${opts} reload fetch flush"
6
extra_commands="fetch flush"
7
extra_started_commands="reload"
8
9
description="distributed.net client"
10
description_flush="flush all output buffers"
11
description_fetch="fill all input buffers"
12
description_reload="restart all active clients"
7
13
8
depend() {
14
depend() {
9
	use net
15
	use net
Lines 15-23 processOpts() { Link Here
15
	DNETPATH="/opt/distributed.net"
21
	DNETPATH="/opt/distributed.net"
16
	DNETBIN="${DNETPATH}/dnetc"
22
	DNETBIN="${DNETPATH}/dnetc"
17
23
18
	STARTOPTS="--start --chuid dnetc:dnetc --quiet \
24
	STARTOPTS="--start --user dnetc:dnetc --quiet --exec ${DNETBIN}"
19
		--exec ${DNETBIN}"
20
21
	DNETOPTS="-quiet"
25
	DNETOPTS="-quiet"
22
26
23
	if [ -e /etc/dnetc.ini ] ; then
27
	if [ -e /etc/dnetc.ini ] ; then
Lines 26-39 processOpts() { Link Here
26
	elif [ -e ${DNETPATH}/dnetc.ini ]; then
30
	elif [ -e ${DNETPATH}/dnetc.ini ]; then
27
		retVal=0
31
		retVal=0
28
		DNETOPTS="${DNETOPTS} -ini ${DNETPATH}/dnetc.ini"
32
		DNETOPTS="${DNETOPTS} -ini ${DNETPATH}/dnetc.ini"
29
	elif [ ! -z ${EMAIL} ]; then
33
	elif [ ! -z "${EMAIL}" ]; then
30
		retVal=0
34
		retVal=0
31
	fi
35
	fi
32
36
33
	# override ini settings with values in /etc/conf.d/dnetc
37
	# override ini settings with values in /etc/conf.d/dnetc
34
38
35
	DNETOPTS="${DNETOPTS} ${EMAIL:+-e ${EMAIL}}"
39
	DNETOPTS="${DNETOPTS} ${EMAIL:+-e ${EMAIL}}"
36
	if [ ! -z ${BUFFER_BASE_DIR} ] ; then
40
	if [ ! -z "${BUFFER_BASE_DIR}" ] ; then
37
		local buff_in="${BUFFER_BASE_DIR:+${BUFFER_BASE_DIR}/}buff-in"
41
		local buff_in="${BUFFER_BASE_DIR:+${BUFFER_BASE_DIR}/}buff-in"
38
		local buff_out="${BUFFER_BASE_DIR:+${BUFFER_BASE_DIR}/}buff-out"
42
		local buff_out="${BUFFER_BASE_DIR:+${BUFFER_BASE_DIR}/}buff-out"
39
		DNETOPTS="${DNETOPTS} -inbase ${buff_in}"
43
		DNETOPTS="${DNETOPTS} -inbase ${buff_in}"
Lines 42-49 processOpts() { Link Here
42
	DNETOPTS="${DNETOPTS} ${KEYSERVER_ADDRESS:+-a ${KEYSERVER_ADDRESS}}"
46
	DNETOPTS="${DNETOPTS} ${KEYSERVER_ADDRESS:+-a ${KEYSERVER_ADDRESS}}"
43
47
44
	# fair group cpu scheduler
48
	# fair group cpu scheduler
45
	uidpath="/sys/kernel/uids/`id -u dnetc`"
49
	local uidpath="/sys/kernel/uids/$(id -u dnetc)"
46
	[ -d $uidpath ] && echo 2 >$uidpath/cpu_share
50
	[ -d "${uidpath}" ] && echo 2 >"${uidpath}"/cpu_share
47
	unset uidpath
51
	unset uidpath
48
52
49
	if [ ${retVal} -ne 0 ] ; then
53
	if [ ${retVal} -ne 0 ] ; then
Lines 63-76 start() { Link Here
63
stop() {
67
stop() {
64
	processOpts || return 1
68
	processOpts || return 1
65
	ebegin "Stopping distributed.net client"
69
	ebegin "Stopping distributed.net client"
66
	start-stop-daemon --stop --quiet --exec ${DNETBIN} --
70
	${DNETBIN} ${DNETOPTS} -shutdown
67
	eend ${?}
71
	eend ${?}
68
}
72
}
69
73
70
reload() {
74
reload() {
71
	processOpts || return 1
75
	processOpts || return 1
72
	ebegin "Reloading distributed.net client"
76
	ebegin "Reloading distributed.net client"
73
	start-stop-daemon --stop --quiet --signal HUP --exec ${DNETBIN}
77
	${DNETBIN} ${DNETOPTS} -restart
74
	eend ${?}
78
	eend ${?}
75
}
79
}
76
80

Return to bug 405521