summaryrefslogtreecommitdiff
blob: 6342a5dce18e8d53a7672c39dac1c7cebec33823 (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-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

get_config() {
    res=$(awk '$1 == "'$1'" { s=$2 } END { print s }' "$CONFFILE")

    if [ "x$res" = "x" ]; then
	echo "$2"
    else
	eval echo "$res"
    fi
}

: ${CONFFILE:="/etc/${SVCNAME}.conf"}

command=/usr/sbin/tinyproxy
command_args="-c ${CONFFILE}"
pidfile=$(get_config PidFile /run/tinyproxy/${SVCNAME}.pid)

depend() {
	config "$CONFFILE"

	use dns

	[ "$(get_config Syslog Off)" = "On" ] && \
	    use logger
}

start_pre() {
    piddir=$(dirname ${pidfile})

    if [ "${piddir}" = "/run" ]; then
	eerror "Please change your PidFile settings to be within the"
	eerror "/run/tinyproxy directory"
	eend 1
    else
	checkpath -d -o $(get_config User tinyproxy):$(get_config Group tinyproxy) ${piddir}
    fi
}