media-video/motion: add new ebuild for version 4, mostly based upon the ebuild from...
authorWolfram Schlich <wschlich@gentoo.org>
Mon, 16 Jan 2017 11:47:55 +0000 (12:47 +0100)
committerWolfram Schlich <wschlich@gentoo.org>
Mon, 16 Jan 2017 11:49:16 +0000 (12:49 +0100)
Package-Manager: portage-2.3.0

media-video/motion/Manifest
media-video/motion/files/motion.conf [new file with mode: 0644]
media-video/motion/files/motion.confd-r1 [new file with mode: 0644]
media-video/motion/files/motion.initd-r3 [new file with mode: 0644]
media-video/motion/files/motion.service [new file with mode: 0644]
media-video/motion/files/motion_at.service [new file with mode: 0644]
media-video/motion/metadata.xml
media-video/motion/motion-4.0.1.ebuild [new file with mode: 0644]

index a8e665f89c350a5e1535daa99bceb077ab1b1f21..3334e86bd86021425b4027ebca0ee6d3738dff3a 100644 (file)
@@ -1 +1,2 @@
 DIST motion-3.2.12.tar.gz 425729 SHA256 a597f8d7ec0bf3c5fb62722c4eead59717fe01c2ae0d256c642027cea74b2f0a SHA512 d44620f8865420da71ff1dc1e1d8ba8e5465b395f2cf3b2cc9a91d3d415694b26376a9f8e3a1b78ffd0efde22d9e0338daa77237aed38c060dc3577af4c0864c WHIRLPOOL 0b7618d48161e8ffefacc5331d1078004d87839b532100c37bfaf06e99772921228feea6eea063301dfdc9e5f5a1dc07fd0847858440c6f876c1e03deaa078c8
+DIST release-4.0.1.tar.gz 444779 SHA256 2f67669a09ce0481ecd987028dae1c5cb135dfdc3c254c06ab7c9ca0c6c183f0 SHA512 6ccde3890e6af56f28208321987dd1b9d62a55bbe7cbc3ab5600263602e6e8f47589392c2f3a3a6cb54f927ee76aea94d0e83f26ce8e4047890c891b6c2f8976 WHIRLPOOL 425587a1ff52edadddbdc7fd65cdb015324b99514128d3810a6d1bb6d2cd2f1c5daea03c1db0c4a89679358793f9201156dd821ce795d704ede12bdb151fafdd
diff --git a/media-video/motion/files/motion.conf b/media-video/motion/files/motion.conf
new file mode 100644 (file)
index 0000000..f032d87
--- /dev/null
@@ -0,0 +1 @@
+d /var/lib/motion/ 0750 motion video
diff --git a/media-video/motion/files/motion.confd-r1 b/media-video/motion/files/motion.confd-r1
new file mode 100644 (file)
index 0000000..dfff31b
--- /dev/null
@@ -0,0 +1,9 @@
+# Set the user and group under which motion will be run
+MOTION_USER="motion"
+MOTION_GROUP="video"
+
+# Set the the directory for storing the pidfile
+MOTION_RUN_DIR="/var/run/motion"
+
+# Set the the working directory for storing images/videos
+MOTION_LIB_DIR="/var/lib/motion"
diff --git a/media-video/motion/files/motion.initd-r3 b/media-video/motion/files/motion.initd-r3
new file mode 100644 (file)
index 0000000..d893a82
--- /dev/null
@@ -0,0 +1,43 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+depend() {
+       need modules
+       after mysql
+}
+
+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() {
+       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() {
+       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 $?
+}
diff --git a/media-video/motion/files/motion.service b/media-video/motion/files/motion.service
new file mode 100644 (file)
index 0000000..559b94b
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=Motion detection daemon
+After=local-fs.target network.target
+Documentation=man:motion(1)
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/motion -n -c /etc/motion/motion.conf
+StandardError=null
+
+User=motion
+Group=video
+
+#RuntimeDirectory=motion
+#RuntimeDirectoryMode=0750
+
+WorkingDirectory=/var/lib/motion
+
+[Install]
+WantedBy=multi-user.target
diff --git a/media-video/motion/files/motion_at.service b/media-video/motion/files/motion_at.service
new file mode 100644 (file)
index 0000000..87df911
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=Motion detection daemon for %I
+After=local-fs.target network.target
+Documentation=man:motion(1)
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/motion -n -c /etc/motion/motion-%i.conf
+StandardError=null
+
+User=motion
+Group=video
+
+#RuntimeDirectory=motion
+#RuntimeDirectoryMode=0750
+
+WorkingDirectory=/var/lib/motion
+
+[Install]
+WantedBy=multi-user.target
index bd52de83b0deced5d286d6b599febbc1d9237bae..cf2e1ad9450471907699ef4093dc233f966f4355 100644 (file)
@@ -4,6 +4,9 @@
        <maintainer type="project">
                <email>media-video@gentoo.org</email>
        </maintainer>
+       <use>
+               <flag name="mmal">Enables Multi-Media Abstraction Layer (MMAL) decoding support: Available e.g. on the Raspberry Pi.</flag>
+       </use>
        <upstream>
                <remote-id type="sourceforge">motion</remote-id>
        </upstream>
diff --git a/media-video/motion/motion-4.0.1.ebuild b/media-video/motion/motion-4.0.1.ebuild
new file mode 100644 (file)
index 0000000..e820993
--- /dev/null
@@ -0,0 +1,81 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+inherit autotools readme.gentoo-r1 user systemd
+
+DESCRIPTION="A software motion detector"
+HOMEPAGE="https://motion-project.github.io"
+SRC_URI="https://github.com/Motion-Project/${PN}/archive/release-${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="ffmpeg libav mmal mysql postgres v4l"
+
+RDEPEND="
+       ffmpeg? (
+               libav? ( media-video/libav:= )
+               !libav? ( media-video/ffmpeg:0= )
+       )
+       virtual/jpeg:=
+       mmal? ( media-libs/raspberrypi-userland )
+       mysql? ( virtual/mysql )
+       postgres? ( dev-db/postgresql:= )
+"
+DEPEND="${RDEPEND}
+       v4l? ( virtual/os-headers media-libs/libv4l )
+"
+
+DISABLE_AUTOFORMATTING="yes"
+DOC_CONTENTS="You need to setup /etc/${PN}/${PN}.conf before running
+${PN} for the first time.
+To install ${PN} as a service, use:
+rc-update add ${PN} default # with OpenRC
+systemctl enable ${PN}.service # with systemd
+"
+
+pkg_setup() {
+       enewuser ${PN} -1 -1 -1 video
+}
+
+S="${WORKDIR}"/${PN}-release-${PV}
+
+src_prepare() {
+       eapply_user
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               $(use_with ffmpeg) \
+               $(use_with mmal) \
+               $(use_with mysql) \
+               $(use_with postgres pgsql) \
+               $(use_with v4l) \
+               --without-optimizecpu
+}
+
+src_install() {
+       emake \
+               DESTDIR="${D}" \
+               docdir=/usr/share/doc/${PF} \
+               examplesdir=/usr/share/doc/${PF}/examples \
+               install
+
+       newinitd "${FILESDIR}"/${PN}.initd-r2 ${PN}
+       newconfd "${FILESDIR}"/${PN}.confd ${PN}
+
+       systemd_dounit "${FILESDIR}"/${PN}.service
+       systemd_dounit "${FILESDIR}"/${PN}_at.service
+       systemd_dotmpfilesd "${FILESDIR}"/${PN}.conf
+
+       keepdir /var/lib/motion
+       fowners motion:video /var/lib/motion
+       fperms 0750 /var/lib/motion
+
+       mv -vf "${D}"/etc/${PN}/${PN}{-dist,}.conf || die
+
+       readme.gentoo_create_doc
+}