blob: e7ad4e858a01c33b13b36fa125598ff5c00a2944 (
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
62
63
64
|
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
depend() {
need capi
}
checkconfig() {
local DEFAULT_OUTPUT_FORMAT="HYLAFAX"
local DEFAULT_VIRTUAL_DEVICE="faxCAPI"
local DEFAULT_RECEIVE_DIR="/var/spool/fax"
local DEFAULT_CONFIG_FILE="/var/spool/fax/etc/config.faxCAPI"
[ -n "${CONFIG_FILE}" ] || CONFIG_FILE="${DEFAULT_CONFIG_FILE}"
[ -n "${OUTPUT_FORMAT}" ] || OUTPUT_FORMAT="${DEFAULT_OUTPUT_FORMAT}"
[ -n "${VIRTUAL_DEVICE}" ] || VIRTUAL_DEVICE="${DEFAULT_VIRTUAL_DEVICE}"
[ "${OUTPUT_FORMAT}" = "HYLAFAX" ] || DEFAULT_RECEIVE_DIR="/var/spool/fax/recvq"
[ -n "${RECEIVE_DIR}" ] || RECEIVE_DIR="${DEFAULT_RECEIVE_DIR}"
if [ ! -f "${CONFIG_FILE}" ]; then
eerror "You're missing ${CONFIG_FILE}"
return 1
fi
OPTIONS=""
PIDFILE="/var/run/c2faxrecv.pid"
[ "${ACTIVATE_LOGGING}" = "yes" ] && OPTIONS="${OPTIONS} -L"
[ "${OUTPUT_FORMAT}" = "${DEFAULT_OUTPUT_FORMAT}" ] || \
OPTIONS="${OPTIONS} -f ${OUTPUT_FORMAT}"
[ "${CONFIG_FILE}" = "${DEFAULT_CONFIG_FILE}" ] || \
OPTIONS="${OPTIONS} -C ${CONFIG_FILE}"
[ "${OUTPUT_FORMAT}" = "HYLAFAX" -a "${RECEIVE_DIR}" = "${DEFAULT_RECEIVE_DIR}" ] || \
OPTIONS="${OPTIONS} -q ${RECEIVE_DIR}"
if [ "${VIRTUAL_DEVICE}" != "${DEFAULT_VIRTUAL_DEVICE}" ]; then
PIDFILE="/var/run/c2faxrecv.${VIRTUAL_DEVICE}.pid"
OPTIONS="${OPTIONS} ${VIRTUAL_DEVICE}"
fi
}
start() {
checkconfig || return 1
ebegin "Starting CAPI4HylaFAX for ${VIRTUAL_DEVICE}"
start-stop-daemon -b -m --quiet --start --pidfile ${PIDFILE} \
--exec /usr/bin/c2faxrecv -- ${OPTIONS}
eend $?
}
stop() {
checkconfig || return 1
ebegin "Stopping CAPI4HylaFAX for ${VIRTUAL_DEVICE}"
start-stop-daemon >/dev/null --quiet --stop --pidfile ${PIDFILE} --retry 10 && \
/bin/rm -f ${PIDFILE}
eend $?
}
|