forked from sackmotion/motion
-
Notifications
You must be signed in to change notification settings - Fork 36
/
motion.spec.in
134 lines (112 loc) · 5.75 KB
/
motion.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Name: @PACKAGE_NAME@
Version: @PACKAGE_VERSION@
Release: 1%{?dist}
Summary: A motion detection system
Group: Applications/Multimedia
License: GPLv2+
URL: http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome
Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libjpeg-devel ffmpeg-devel zlib-devel
#This requires comes from the startup script, it will be there until motion supports libv4l calls in the code
Requires: libv4l
Requires(post): chkconfig
Requires(preun): chkconfig initscripts
Requires(postun): initscripts
%description
Motion is a software motion detector. It grabs images from video4linux devices
and/or from webcams (such as the axis network cameras). Motion is the perfect
tool for keeping an eye on your property keeping only those images that are
interesting. Motion is strictly command line driven and can run as a daemon
with a rather small footprint. This version is built with ffmpeg support but
without MySQL and PostgreSQL support.
%prep
%setup -q
%build
%configure --sysconfdir=%{_sysconfdir}/%{name} --without-optimizecpu --with-ffmpeg --without-mysql --without-pgsql
make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
#We rename the configuration file
mv %{buildroot}%{_sysconfdir}/%{name}/motion-dist.conf %{buildroot}%{_sysconfdir}/%{name}/motion.conf
#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
sed -i 's|sql_log_image|; sql_log_image|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf
sed -i 's|sql_log_snapshot|; sql_log_snapshot|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf
sed -i 's|sql_log_mpeg|; sql_log_mpeg|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf
sed -i 's|sql_log_timelapse|; sql_log_timelapse|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf
sed -i 's|sql_query|; sql_query|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf
#We set the log file and target directory - logging is for 3.3 branch
sed -i 's|;logfile|logfile /var/log/motion.log|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf
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 motion.init-Fedora %{buildroot}%{_initrddir}/%{name}
%post
#We add the motion init script to the services when installing
/sbin/chkconfig --add %{name}
%preun
#We stop the service and remove it from init scripts when erasing
if [ $1 = 0 ] ; then
/sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
%postun
#We restart the service during an upgrade
if [ "$1" -ge "1" ] ; then
/sbin/service %{name} condrestart >/dev/null 2>&1
fi
%clean
rm -rf %{buildroot}
%files
#Permissions are bogus upstream, we need to be sure to set them here
%defattr (-,root,root,-)
%dir %{_sysconfdir}/%{name}
%dir %{_datadir}/%{name}-%{version}
%dir %{_datadir}/%{name}-%{version}/examples
%doc CHANGELOG COPYING CREDITS INSTALL 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
%attr(0755,root,root) %{_datadir}/%{name}-%{version}/examples/motion.init-Fedora
%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread1.conf
%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread2.conf
%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread3.conf
%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread4.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/motion.conf
%attr(0755,root,root) %{_bindir}/motion
%attr(0644,root,root) %{_mandir}/man1/motion.1*
%attr(0755,root,root) %{_initrddir}/%{name}
%changelog
* Thu Mar 06 2010 Steven Moix <[email protected]> - 3.2.12-1
- New upstream release, important bugfixes only
* Wed Oct 21 2009 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3.2.11.1-3
- rebuild for new ffmpeg
* Tue Aug 11 2009 Steven Moix <[email protected]> - 3.2.11.1-1
- Drop patch for ffmpeg 0.5 compatibility
- Drop ffmpeg detection patch
- Moved default output directory to /var/motion
- New startup script with added v4l2convert to support more cameras - https://bugzilla.rpmfusion.org/show_bug.cgi?id=681
- Fix Segfault on reload or quit for vloopback (maybe other v4l1 devices too)
- Fix fd leaks in external pipe
- Avoid possible stack smashing in v4l_open_vidpipe()
- Fix segfault for new libjpeg v7
* Mon Jul 06 2009 Steven Moix <[email protected]> - 3.3.0-1
- SPEC Preparation for the 3.3 branch
* Sun Jun 05 2009 Steven Moix <[email protected]> - 3.2.11-5
- Patch and rebuild for ffmpeg 0.5
* Sun Mar 29 2009 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3.2.11-4
- rebuild for new F11 features
* Wed Mar 18 2009 Steven Moix <[email protected]> - 3.2.11-3
- Even more corrected init script thanks to Stewart Adam
* Sun Mar 15 2009 Steven Moix <[email protected]> - 3.2.11-2
- Removed the ffmpeg requires
- Corrected the spec file
- New init script with a corrected start() function and LSB header support
* Tue Mar 03 2009 Steven Moix <[email protected]> - 3.2.11-1
- Updated to Fedora 10 standard
* Sun Sep 18 2005 Kenneth Lavrsen <[email protected]> - 3.2.4-1
- Generic version of livna spec file replacing the old less optimal specfile.
* Thu Sep 15 2005 Dams <anvil[AT]livna.org> - 3.2.3-0.lvn.1
- Initial released based upon upstream spec file