summaryrefslogtreecommitdiff
blob: c11ae50b9f79c55e304b3dc9e877eb644fdd4af5 (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
#!/sbin/openrc-run
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

: ${configfile:=/etc/c-icap/c-icap.conf}

get_config() {
    local value=$(awk '$1 == "'$1'" { print $2 }' ${configfile})
    echo ${value:-$2}
}

command="/usr/libexec/c-icap"
command_arguments="${EXTRA_OPTS} -f ${configfile}"
pidfile=$(get_config PidFile /var/run/c-icap/c-icap.pid)

depend() {
	need localmount
	config ${configfile}
	[ "$(get_config Logger file_logger)" = "sys_logger" ] && use logger
}

start_pre() {
	local cmdsocket=$(get_config CommandsSocket /var/run/c-icap/c-icap.ctl)

	checkpath -d "$(dirname "${cmdsocket}")" "$(dirname "${pidfile}")"
}