Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media-video/motion: version bump to 4.3.1 #15513

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions acct-group/motion/metadata.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>hfern@fernhout.info</email>
<name>Hans Fernhout</name>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
</pkgmetadata>
8 changes: 8 additions & 0 deletions acct-group/motion/motion-0.ebuild
@@ -0,0 +1,8 @@
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit acct-group

ACCT_GROUP_ID=395
12 changes: 12 additions & 0 deletions acct-user/motion/metadata.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>hfern@fernhout.info</email>
<name>Hans Fernhout</name>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
</pkgmetadata>
12 changes: 12 additions & 0 deletions acct-user/motion/motion-0.ebuild
@@ -0,0 +1,12 @@
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit acct-user

DESCRIPTION="added by portage for motion, a software motion detector"
ACCT_USER_ID=395
ACCT_USER_GROUPS=( motion video )

acct-user_add_deps
1 change: 1 addition & 0 deletions media-video/motion/Manifest
@@ -1 +1,2 @@
DIST motion-release-4.1.1.tar.gz 447795 BLAKE2B 8c7dfdad89f49ba8ec39689d268b4bc95c6a8bd85d4bd333f66638b2e815b3c59b2e42dd93811601b2ee7870100a0a21eaa789633056f74a5cc9f39f4f92229f SHA512 3b08d464f9243ccfc4b53b16cfc2001d1e0d206bf0295d55d8914914bc14ad0248ce5ac622cb7eb89ed32e1913a9a10add1b56497c4094ba876f7f85d6ad4143
DIST motion-release-4.3.1.tar.gz 849633 BLAKE2B 33039d9b8b6db0698767892997be958d84a881cc56e8cdc31d8c27242c972e629d328197c92f91c1b71a957d85807877dc602f474d430384b1e27c9213ddc697 SHA512 17033dab055c4f1d9e2912a27d0a5b419d325b0781def98428a6117e38c62201b87199210071ba93d6c4dae514733b749e39cbc1befe6242f157d4583e07dcc6
28 changes: 28 additions & 0 deletions media-video/motion/files/motion.confd-r4
@@ -0,0 +1,28 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# Motion OpenRC conf.d file
# All settings are optional

# Set the user and group under which motion will be run
#MOTION_USER="motion"
#MOTION_GROUP="motion"
Comment on lines +8 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is everything commented in this file? Looks ok to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the comments are just documentation, showing default values.


#Set motion's config file:
#MOTION_CONFIGFILE="/etc/motion/motion.conf"

#Set motion's log file. Leave unset for syslog:
#MOTION_LOGFILE="/var/log/motion/motion.log"

#Set log type: 1-9 for COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL
#MOTION_LOGTYPE="9"

#Set log level: 1-9 for EMG, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL
#MOTION_LOGLEVEL="6"

#Set a default dir where motion places its output
#MOTION_DIR="/var/lib/motion"

#Set the umask for the output files, for additonal security
#MOTION_UMASK="007"

30 changes: 30 additions & 0 deletions media-video/motion/files/motion.initd-r4
@@ -0,0 +1,30 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

: ${MOTION_USER:="motion"}
: ${MOTION_GROUP:="motion"}

[ "${MOTION_UMASK}" ] && umask="${MOTION_UMASK}"
[ "${MOTION_CONFIGFILE}" ] && command_args="-c ${MOTION_CONFIGFILE}"
[ "${MOTION_LOGFILE}" ] && command_args="${command_args} -l ${MOTION_LOGFILE}"
[ "${MOTION_LOGTYPE}" ] && command_args="${command_args} -k ${MOTION_LOGTYPE}"
[ "${MOTION_LOGLEVEL}" ] && command_args="${command_args} -d ${MOTION_LOGLEVEL}"

command=/usr/bin/motion
command_user="${MOTION_USER}:${MOTION_GROUP}"

start_pre() {
if [ "${MOTION_DIR}" ] ; then
mkdir -p "${MOTION_DIR}"
checkpath -d -o "${MOTION_USER}" "${MOTION_DIR}"
directory="${MOTION_DIR}"
fi
if [ "${MOTION_LOGFILE}" ] ; then
local LOGFILE=${MOTION_LOGFILE##*/}
local LOGDIR=${MOTION_LOGFILE%$LOGFILE}
mkdir -p "${LOGDIR}"
checkpath -d -o "${MOTION_USER}" "${LOGDIR}"
fi
}

4 changes: 2 additions & 2 deletions media-video/motion/files/motion.service
Expand Up @@ -8,13 +8,13 @@ Type=simple
ExecStart=/usr/bin/motion -n -c /etc/motion/motion.conf
StandardError=null

User=motion
#User=motion
Group=video

#RuntimeDirectory=motion
#RuntimeDirectoryMode=0750

WorkingDirectory=/var/lib/motion
#WorkingDirectory=/var/lib/motion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment? Just remove if it's not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should actually make a separate r4 version and leave the original as is for motion-4.1.1. That way existing 4.1.1 won't be bothered with any changes and 4.1.1 can be deprecated over time. The new version can set the uid/gid and the working dir properly.


[Install]
WantedBy=multi-user.target
26 changes: 26 additions & 0 deletions media-video/motion/files/motion.service-r4
@@ -0,0 +1,26 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# Motion OpenRC systemd service file


[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=motion

UMask=007
WorkingDirectory=-/var/lib/motion


[Install]
WantedBy=multi-user.target

10 changes: 10 additions & 0 deletions media-video/motion/metadata.xml
@@ -1,11 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>hfern@fernhout.info</email>
<name>Hans Fernhout</name>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<maintainer type="project">
<email>media-video@gentoo.org</email>
</maintainer>
<use>
<flag name="mariadb">Add mariadb database support</flag>
<flag name="mmal">Enables Multi-Media Abstraction Layer (MMAL) decoding support: Available e.g. on the Raspberry Pi.</flag>
<flag name="supervise-daemon">Add experimental suppport for OpenRC's supervise-daemon process supervision</flag>
</use>
<upstream>
<remote-id type="github">Motion-Project/motion</remote-id>
Expand Down
104 changes: 104 additions & 0 deletions media-video/motion/motion-4.3.1.ebuild
@@ -0,0 +1,104 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools readme.gentoo-r1 systemd

DESCRIPTION="A software motion detector"
HOMEPAGE="https://motion-project.github.io"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you want me to do with this...

SRC_URI="https://github.com/Motion-Project/${PN}/archive/release-${PV}.tar.gz -> ${PN}-release-${PV}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="ffmpeg mariadb mmal mysql postgres sqlite supervise-daemon v4l webp"

RDEPEND="
acct-group/motion
acct-user/motion
virtual/jpeg:=
ffmpeg? ( media-video/ffmpeg:0= )
mariadb? ( dev-db/mariadb-connector-c )
mmal? ( media-libs/raspberrypi-userland )
mysql? ( dev-db/mysql-connector-c )
postgres? ( dev-db/postgresql:= )
sqlite? ( dev-db/sqlite:3 )
webp? ( media-libs/libwebp:= )
"
DEPEND="${RDEPEND}
net-libs/libmicrohttpd
v4l? (
media-libs/libv4l
virtual/os-headers
)
"

DISABLE_AUTOFORMATTING="yes"
DOC_CONTENTS="
You need to setup a configuraton file (/etc/motion/motion.conf) before
running motion for the first time.

If motion is built with the mysql or mariadb use flags then please make
sure to configure a matching database_type in the config file.

Motion runs by default under user motion and group motion:
- change this if needed in /etc/conf.d/motion
- or add users who need access to the output files to the motion group

To install motion as a service, use:
- rc-update add motion default # with OpenRC
- systemctl enable motion.service # with systemd
"

S="${WORKDIR}"/${PN}-release-${PV}

src_prepare() {
default
eautoreconf
}

src_configure() {
econf \
$(use_with ffmpeg) \
$(use_with mariadb) \
$(use_with mmal) \
$(use_with mysql) \
$(use_with postgres pgsql) \
$(use_with sqlite sqlite3) \
$(use_with v4l v4l2) \
$(use_with webp) \
--without-optimizecpu
}

src_install() {
emake \
DESTDIR="${D}" \
docdir=/usr/share/doc/${PF} \
examplesdir=/usr/share/doc/${PF}/examples \
install

# build INITDAD string cwto be added to initd based on use flags, eg
# "depend() {
# use mysql
# }
#
# supervisor=supervise-daemon"
local INITDADJ=""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also while at it, please make a local variable smallcase. We distinct them from global variables this way. Global variables cannot be changed inside a phase while local can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is weird that is shows installing in /usr/local on your machine. I see this:

$ equery f motion

  • Searching for motion ...
  • Contents of media-video/motion-4.3.1:
    /etc
    /etc/conf.d
    /etc/conf.d/motion
    /etc/init.d
    /etc/init.d/motion
    /etc/motion
    /etc/motion/camera1-dist.conf
    /etc/motion/camera2-dist.conf
    /etc/motion/camera3-dist.conf
    /etc/motion/camera4-dist.conf
    /etc/motion/motion-dist.conf
    /lib
    /lib/systemd
    /lib/systemd/system
    /lib/systemd/system/motion.service
    /usr
    /usr/bin
    /usr/bin/motion
    /usr/share
    /usr/share/doc
    /usr/share/doc/motion-4.3.1
    /usr/share/doc/motion-4.3.1/COPYING.bz2
    /usr/share/doc/motion-4.3.1/CREDITS.bz2
    /usr/share/doc/motion-4.3.1/README.gentoo.bz2
    /usr/share/doc/motion-4.3.1/mask1.png
    /usr/share/doc/motion-4.3.1/motion_build.html
    /usr/share/doc/motion-4.3.1/motion_config.html
    /usr/share/doc/motion-4.3.1/motion_guide.html
    /usr/share/doc/motion-4.3.1/motion_stylesheet.css
    /usr/share/doc/motion-4.3.1/normal.jpg
    /usr/share/doc/motion-4.3.1/outputmotion1.jpg
    /usr/share/doc/motion-4.3.1/outputnormal1.jpg
    /usr/share/locale
    /usr/share/locale/de
    /usr/share/locale/de/LC_MESSAGES
    /usr/share/locale/de/LC_MESSAGES/motion.mo
    /usr/share/locale/nl
    /usr/share/locale/nl/LC_MESSAGES
    /usr/share/locale/nl/LC_MESSAGES/motion.mo
    /usr/share/man
    /usr/share/man/man1
    /usr/share/man/man1/motion.1.bz2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happens with FEATURES="test".

( use mysql || use mariadb ) && INITDADJ=" use mysql\n"
use postgres && INITDADJ="${INITDADJ} use postgresql\n"
[ "${#INITDADJ}" -gt 0 ] && INITDADJ="depend() {\n${INITDADJ}}\n"
if use supervise-daemon ; then
INITDADJ="${INITDADJ}\nsupervisor=supervise-daemon\n"
else
INITDADJ="${INITDADJ}\npidfile=/run/\${RC_SVCNAME}.pid\ncommand_background=true\n"
fi
cp "${FILESDIR}/${PN}.initd-r4" "${T}/initd" || die
echo -e ${INITDADJ} >> "${T}/initd" || die

newinitd "${T}/initd" ${PN}
newconfd "${FILESDIR}/${PN}.confd-r4" ${PN}
systemd_newunit "${FILESDIR}/${PN}.service-r4" "${PN}.service"
readme.gentoo_create_doc
readme.gentoo_print_elog
}