mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-04 00:02:17 +01:00
70 lines
1.6 KiB
Plaintext
70 lines
1.6 KiB
Plaintext
#!/sbin/openrc-run
|
|
# Copyright 2012 N Angelacos - Based on Gentoo Foundation fprobe script
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
depend() {
|
|
need net
|
|
after firewall
|
|
}
|
|
|
|
|
|
BIN=/usr/bin/nfcapd
|
|
PIDFILE_EXTRA=${SVCNAME#*.}
|
|
if [ -n "${PIDFILE_EXTRA}" ] && [ ${SVCNAME} != "nfcapd" ]; then
|
|
PIDFILE="/var/run/nfcapd.${PIDFILE_EXTRA}.pid"
|
|
else
|
|
PIDFILE="/var/run/nfcapd.pid"
|
|
fi
|
|
|
|
start() {
|
|
ebegin "Starting nfcapd"
|
|
local OPTS=""
|
|
|
|
[ -n "${SOURCE}" ] && SOURCE=`echo -n "${SOURCE}" | sed 's/ / -n /g'`
|
|
[ "${IPV4}" == "yes" ] && OPTS="${OPTS} -4"
|
|
[ "${IPV6}" == "yes" ] && OPTS="${OPTS} -6"
|
|
[ "${ALIGN}" == "yes" ] && OPTS="${OPTS} -w"
|
|
[ "${AUTOEXPIRE}" == "yes" ] && OPTS="${OPTS} -e"
|
|
[ "${COMPRESS}" == "yes" ] && OPTS="${OPTS} -z"
|
|
for optname in p:PORT b:BINDHOST j:MULTICASTGROUP i:IFACE R:REPEAT \
|
|
I:IDENT l:BASEDIR n:SOURCE s:SAMPLERATE S:SUBDIR \
|
|
T:EXTENSIONS t:INTERVAL u:UID g:GID \
|
|
B:BUFFLEN ; do
|
|
opt="${optname/:*}" optvar="${optname/*:}"
|
|
eval optvalue="\$$optvar"
|
|
[ -n "$optvalue" ] && OPTS="${OPTS} -${opt} ${optvalue}"
|
|
done
|
|
|
|
# Attempt to make the basedir if specified
|
|
if [ -n "${BASEDIR}" ]; then
|
|
mkdir -p "${BASEDIR}"
|
|
chown "${UID}":"${GID}" "${BASEDIR}"
|
|
fi
|
|
|
|
# Handle remote command as a special case
|
|
if [ -n "${ROTATECMD}" ]; then
|
|
start-stop-daemon --start -b --exec $BIN \
|
|
--pidfile ${PIDFILE} --make-pidfile \
|
|
-- ${OPTS} -x "${ROTATECMD}"
|
|
else
|
|
start-stop-daemon --start -b --exec $BIN \
|
|
--pidfile ${PIDFILE} --make-pidfile \
|
|
-- ${OPTS}
|
|
fi
|
|
|
|
eend $?
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping nfcapd"
|
|
start-stop-daemon --stop --quiet --exec $BIN \
|
|
--pidfile ${PIDFILE}
|
|
eend $?
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|