aboutsummaryrefslogtreecommitdiffstats
path: root/testing/motion/motion.initd
diff options
context:
space:
mode:
authorGP Orcullo <kinsamanka@gmail.com>2017-08-31 17:14:32 +0800
committerTimo Teräs <timo.teras@iki.fi>2017-09-06 07:10:38 +0000
commit66ff8434575d6f12b1d7ca893d22df1a55ff84e3 (patch)
tree1e7f38b1bbb17e594c24103ec0906b23dea2de15 /testing/motion/motion.initd
parent1e776e60847dfb253fc3e76286e40384ad9d8d96 (diff)
downloadaports-66ff8434575d6f12b1d7ca893d22df1a55ff84e3.tar.bz2
aports-66ff8434575d6f12b1d7ca893d22df1a55ff84e3.tar.xz
testing/motion: Updated to version 4.0.1 with ffmpeg
- updated to the latest release - re-enabled ffmpeg support - switched to openrc init - used /var/lib/motion for storage - disabled cpu optimization
Diffstat (limited to 'testing/motion/motion.initd')
-rw-r--r--testing/motion/motion.initd44
1 files changed, 27 insertions, 17 deletions
diff --git a/testing/motion/motion.initd b/testing/motion/motion.initd
index 78493c3d44..b475576487 100644
--- a/testing/motion/motion.initd
+++ b/testing/motion/motion.initd
@@ -1,27 +1,37 @@
-#!/sbin/runscript
-# Copyright 1999-2004 Gentoo Foundation
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/files/rsyncd.init.d,v 1.5 2007/02/23 11:33:59 uberlord Exp $
-description="motion daemon"
-user="motion"
-command="/usr/bin/motion"
-pidfile="/var/run/${RC_SVCNAME}/${RC_SVCNAME}.pid"
+extra_started_commands="reload"
+
+checkconfig() {
+ export MOTION_RUN_DIR="${MOTION_RUN_DIR:-/var/run/motion}"
+ checkpath -d -m 750 -o "${MOTION_USER:-motion}:${MOTION_GROUP:-video}" "${MOTION_RUN_DIR}"
+ export MOTION_LIB_DIR="${MOTION_LIB_DIR:-/var/lib/motion}"
+ checkpath -d -m 750 -o "${MOTION_USER:-motion}:${MOTION_GROUP:-video}" "${MOTION_LIB_DIR}"
+ return 0
+}
start() {
- ebegin "Starting ${RC_SVCNAME}"
- start-stop-daemon --start \
- --exec ${command} \
- --user ${user} \
- --pidfile ${pidfile} \
- -- ${MOTION_OPTS}
+ checkconfig || return 1
+
+ ebegin "Starting motion detection"
+ start-stop-daemon --start -u "${MOTION_USER}" -g "${MOTION_GROUP}" -d "${MOTION_LIB_DIR}" --quiet --exec /usr/bin/motion -- -b -p "${MOTION_RUN_DIR}/motion.pid"
eend $?
}
stop() {
- ebegin "Stopping ${RC_SVCNAME}"
- start-stop-daemon --stop \
- --exec ${command} \
- --pidfile ${pidfile}
+ checkconfig || return 1
+
+ ebegin "Stopping motion detection"
+ start-stop-daemon --stop --quiet --exec /usr/bin/motion --pidfile "${MOTION_RUN_DIR}/motion.pid"
+ eend $?
+}
+
+reload() {
+ checkconfig || return 1
+
+ ebegin "Reloading motion detection configuration"
+ start-stop-daemon --stop --signal HUP --exec /usr/bin/motion --pidfile "${MOTION_RUN_DIR}/motion.pid"
eend $?
}