SPECS: motion.spec - init subpackage - use it for starting daemon-...

blues blues at pld-linux.org
Thu Mar 23 20:26:09 CET 2006


Author: blues                        Date: Thu Mar 23 19:26:09 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- init subpackage - use it for starting daemon-mode motion detector.

---- Files affected:
SPECS:
   motion.spec (1.28 -> 1.29) 

---- Diffs:

================================================================
Index: SPECS/motion.spec
diff -u SPECS/motion.spec:1.28 SPECS/motion.spec:1.29
--- SPECS/motion.spec:1.28	Sun Mar 19 23:21:31 2006
+++ SPECS/motion.spec	Thu Mar 23 20:26:03 2006
@@ -1,6 +1,6 @@
 # $Revision$, $Date$
 # TODO:
-# - init subpackage to run motion as daemon
+# - init subpackage should have own user. Current solution isn't safe.
 #
 # Conditional builds:
 %bcond_without	pgsql		# build PostgreSQL support
@@ -11,11 +11,13 @@
 Summary(pl):	Motion - programowy wykrywacz ruchu
 Name:		motion
 Version:	3.2.5.1
-Release:	1.1
+Release:	1.5
 Group:		Applications/Graphics
 License:	GPL
 Source0:	http://dl.sourceforge.net/motion/%{name}-%{version}.tar.gz
 # Source0-md5:	2ea49b07582b70284699fb448d6137f7
+Source1:	%{name}.init
+Source2:	%{name}.sysconfig
 URL:		http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -37,6 +39,19 @@
 doskonałym narzędziem do doglądania swojej posiadłości, przechowując
 tylko interesujące obrazy.
 
+%package init
+Summary:        Init script for Motion
+Summary(pl):    Skrypt init dla systemu Motion
+Group:          Applications/System
+Requires(post,preun):   /sbin/chkconfig
+Requires:       %{name} = %{epoch}:%{version}-%{release}
+
+%description init
+Init script for Motion.
+
+%description init -l pl
+Skrypt init dla systemu Motion.
+
 %prep
 %setup -q
 
@@ -53,17 +68,31 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_examplesdir}/%{name}-%{version},%{_sysconfdir},/etc/motion}
+install -d $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_examplesdir}/%{name}-%{version},%{_sysconfdir}} \
+	$RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,motion}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
 mv $RPM_BUILD_ROOT%{_datadir}/doc doc
-mv $RPM_BUILD_ROOT%{_sysconfdir}/motion-dist.conf $RPM_BUILD_ROOT%{_sysconfdir}/motion.conf 
+mv $RPM_BUILD_ROOT%{_sysconfdir}/motion-dist.conf $RPM_BUILD_ROOT%{_sysconfdir}/motion.conf
+
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post init
+/sbin/chkconfig --add motion
+%service motion restart
+
+%preun init
+if [ "$1" = "0" ]; then
+	%service motion stop
+	/sbin/chkconfig --del motion
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG CREDITS FAQ README README.axis_2100 motion_guide.html *.conf motion.init-RH
@@ -73,12 +102,20 @@
 %{_datadir}/motion
 %{_mandir}/man1/*
 
+%files init
+%defattr(644,root,root,755)
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
 * %{date} PLD Team <feedback at pld-linux.org>
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.29  2006/03/23 19:26:03  blues
+- init subpackage - use it for starting daemon-mode motion detector.
+
 Revision 1.28  2006/03/19 22:21:31  blues
 - examples dir is /usr/src .... these examples are not sources, it's docs
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/motion.spec?r1=1.28&r2=1.29&f=u



More information about the pld-cvs-commit mailing list