Author: ttorcz
Update of /cvs/free/rpms/motion/devel
In directory old02.ovh.rpmfusion.lan:/tmp/cvs-serv4216
Modified Files:
motion-0002-there-is-no-bin-service-in-Fedora-use-systemctl.patch
motion.service motion.spec
Added Files:
motion.tmpfiles
Log Message:
* Sat Apr 20 2013 Tomasz Torcz <ttorcz(a)fedoraproject.org> - 3.3.0-trunkREV557.8
- migrate from running as root to running as motion:video (fixes #1935)
- don't ship INSTALL file
--- NEW FILE motion.tmpfiles ---
# Type Path Mode UID GID Age Argument
#
# home directory for motion
d /run/motion 0700 motion video - -
# create logfile if does not exists
f /var/log/motion.log 0600 motion video - -
motion-0002-there-is-no-bin-service-in-Fedora-use-systemctl.patch:
motion.logrotate | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: motion-0002-there-is-no-bin-service-in-Fedora-use-systemctl.patch
===================================================================
RCS file:
/cvs/free/rpms/motion/devel/motion-0002-there-is-no-bin-service-in-Fedora-use-systemctl.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- motion-0002-there-is-no-bin-service-in-Fedora-use-systemctl.patch 19 Apr 2013 10:57:01
-0000 1.1
+++ motion-0002-there-is-no-bin-service-in-Fedora-use-systemctl.patch 20 Apr 2013 14:53:27
-0000 1.2
@@ -16,7 +16,7 @@
create 0600 root root
postrotate
- /bin/service motion reload >/dev/null 2>&1 || true
-+ /usr/bin systemctl reload-or-try-restart motion.service >/dev/null
2>&1 || true
++ /usr/bin/systemctl reload-or-try-restart motion.service >/dev/null
2>&1 || true
endscript
}
--
Index: motion.service
===================================================================
RCS file: /cvs/free/rpms/motion/devel/motion.service,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- motion.service 19 Apr 2013 11:23:38 -0000 1.1
+++ motion.service 20 Apr 2013 14:53:28 -0000 1.2
@@ -3,6 +3,8 @@
Documentation=man:motion(1)
http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome
[Service]
+User=motion
+Group=video
# There's no way to do it automatically, sadly
# if you have problems with your camera, uncomment one of those
# for PPC64 and X86_64:
Index: motion.spec
===================================================================
RCS file: /cvs/free/rpms/motion/devel/motion.spec,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- motion.spec 19 Apr 2013 12:07:00 -0000 1.26
+++ motion.spec 20 Apr 2013 14:53:28 -0000 1.27
@@ -8,6 +8,7 @@
URL:
http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome
Source0:
http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: motion.service
+Source2: motion.tmpfiles
Patch0: motion-0001-emit-asm-emms-only-on-x86-and-amd64-arches.patch
Patch1: motion-0002-there-is-no-bin-service-in-Fedora-use-systemctl.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -17,6 +18,7 @@
BuildRequires: systemd-units
#This requires comes from the startup script, it will be there until motion supports
libv4l calls in the code
Requires: libv4l
+Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
@@ -47,6 +49,8 @@
#We move the logrotate configuration
mkdir %{buildroot}%{_sysconfdir}/logrotate.d
mv %{_builddir}/%{name}-%{version}/motion.logrotate
%{buildroot}%{_sysconfdir}/logrotate.d/motion
+#We run as motion:video user, reflect that in logrotate config
+sed -i 's|create 0600 root root|create 0600 motion video|g'
%{buildroot}%{_sysconfdir}/logrotate.d/motion
#We change the PID file path to match the one in the startup script
sed -i 's|/var/run/motion/motion.pid|/var/run/motion.pid|g'
%{buildroot}%{_sysconfdir}/%{name}/motion.conf
#We remove SQL directives in the configuration file, as we don't use them
@@ -60,8 +64,17 @@
sed -i 's|target_dir /usr/local/apache2/htdocs/cam1|target_dir /var/motion|g'
%{buildroot}%{_sysconfdir}/%{name}/motion.conf
#We install our startup script
install -D -m 0755 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
+#We install tmpfiles configuration
+install -D -m 0755 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
+
+%pre
+getent passwd motion >/dev/null || \
+ useradd -r -g video -d /run/motion -s /sbin/nologin \
+ -c "motion detection system" motion
+exit 0
%post
+/usr/bin/systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf
%systemd_post %{name}.service
%preun
@@ -70,6 +83,12 @@
%postun
%systemd_postun_with_restart %{name}.service
+%triggerun -- motion < 3.3.0-trunkREV557.8
+# we never shipped /var/motion directory, but it was set as
+# default target_dir in config file. Be nice to admin and migrate
+# ownership at the same time as we switch to running as user
+find /var/motion -user root -group root -exec chown motion:video '{}'
';'
+
%clean
rm -rf %{buildroot}
@@ -79,7 +98,7 @@
%dir %{_sysconfdir}/%{name}
%dir %{_datadir}/%{name}-%{version}
%dir %{_datadir}/%{name}-%{version}/examples
-%doc CHANGELOG COPYING CREDITS INSTALL README motion_guide.html
+%doc CHANGELOG COPYING CREDITS README motion_guide.html
%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/motion-dist.conf
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/examples/motion.init-Debian
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/examples/motion.init-FreeBSD.sh
@@ -93,8 +112,13 @@
%attr(0755,root,root) %{_bindir}/motion
%attr(0644,root,root) %{_mandir}/man1/motion.1*
%attr(0755,root,root) %{_unitdir}/%{name}.service
+%attr(0755,root,root) %{_tmpfilesdir}/%{name}.conf
%changelog
+* Sat Apr 20 2013 Tomasz Torcz <ttorcz(a)fedoraproject.org> - 3.3.0-trunkREV557.8
+- migrate from running as root to running as motion:video (fixes #1935)
+- don't ship INSTALL file
+
* Fri Apr 19 2013 Tomasz Torcz <ttorcz(a)fedoraproject.org> - 3.3.0-trunkREV557.7
- re-introduce ffmpeg-compat-devel