SPECS: gozerbot.spec - add user and initscript - package initial data - pac...

glen glen at pld-linux.org
Wed Nov 5 23:42:19 CET 2008


Author: glen                         Date: Wed Nov  5 22:42:19 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- add user and initscript
- package initial data
- package manual

---- Files affected:
SPECS:
   gozerbot.spec (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SPECS/gozerbot.spec
diff -u SPECS/gozerbot.spec:1.1 SPECS/gozerbot.spec:1.2
--- SPECS/gozerbot.spec:1.1	Wed Nov  5 21:43:37 2008
+++ SPECS/gozerbot.spec	Wed Nov  5 23:42:14 2008
@@ -1,31 +1,53 @@
 # $Revision$, $Date$
 # TODO
-# - user and initscript
+# - initscript
+# - patch code to support output logging
+# - patch code to support daemonizing
+# - patch code to switch uid
+# - config from /etc when ran as service
 Summary:	gozerbot is the Python IRC bot and Jabber bot in one
 Name:		gozerbot
 Version:	0.8.1.1
-Release:	0.2
+Release:	0.5
 License:	BSD
 Group:		Applications/Communications
 Source0:	http://www.gozerbot.org/media/tarball/%{name}-%{version}.tar.gz
 # Source0-md5:	f94037651700737f655f28244662c5a0
+Source1:	%{name}.init
+Patch0:		%{name}-pyc.patch
 URL:		http://www.gozerbot.org/
 BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.228
 BuildRequires:	sed >= 4.0
+Requires(post,preun):	/sbin/chkconfig
+Requires(postun):	/usr/sbin/groupdel
+Requires(postun):	/usr/sbin/userdel
+Requires(pre):	/bin/id
+Requires(pre):	/usr/bin/getgid
+Requires(pre):	/usr/sbin/groupadd
+Requires(pre):	/usr/sbin/useradd
 Requires:	python >= 1:2.4
+Provides:	group(gozerbot)
+Provides:	user(gozerbot)
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define		_rundir		/var/lib/%{name}
+
 %description
 Python IRC bot and Jabber bot in one.
 
 %prep
 %setup -q
+%patch0 -p1
 %{__grep} -rl '#!/usr/bin/env python' . | xargs %{__sed} -i -e '1s,#!.*bin/env python,#!%{__python}',
 
 %build
 %{__python} setup.py build
 
+# build datadir
+./bin/gozerinit
+
 %install
 rm -rf $RPM_BUILD_ROOT
 %{__python} setup.py install \
@@ -34,6 +56,11 @@
 
 %py_postclean
 
+install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_rundir},%{_mandir}/man1}
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/gozerbot
+cp -a man/gozerbot.1 $RPM_BUILD_ROOT%{_mandir}/man1
+cp -a gozerdata $RPM_BUILD_ROOT%{_rundir}
+
 # some merge tool. likely don't need it
 rm -f $RPM_BUILD_ROOT%{_bindir}/gozerbot-merc
 rm -f $RPM_BUILD_ROOT%{_bindir}/gozerupgrade06
@@ -52,10 +79,32 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%pre
+%groupadd -g 205 -r -f gozerbot
+%useradd -u 205 -r -d %{_rundir} -s /bin/sh -c "gozerbot" -g gozerbot gozerbot
+
+%post
+/sbin/chkconfig --add gozerbot
+%service gozerbot restart
+
+%preun
+if [ "$1" = "0" ]; then
+	%service -q gozerbot stop
+	/sbin/chkconfig --del gozerbot
+fi
+
+%postun
+if [ "$1" = "0" ]; then
+	%userremove gozerbot
+	%groupremove gozerbot
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc README
+%attr(754,root,root) /etc/rc.d/init.d/gozerbot
 %attr(755,root,root) %{_bindir}/gozerbot
+%{_mandir}/man1/gozerbot.1*
 %dir %{_datadir}/gozerbot
 %{_datadir}/gozerbot/gb_db
 %{_datadir}/gozerbot/postgres_db
@@ -63,11 +112,22 @@
 %{py_sitescriptdir}/gozerbot
 %{py_sitescriptdir}/gozerplugs
 
+%dir %attr(775,root,gozerbot) %{_rundir}
+%dir %attr(775,root,gozerbot) %{_rundir}/gozerdata
+%dir %attr(775,root,gozerbot) %{_rundir}/gozerdata/userstates
+# XXX: move to %{_sysconfdir}
+%attr(660,root,gozerbot) %config(noreplace) %verify(not md5 mtime size) %{_rundir}/gozerdata/config
+
 %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.2  2008/11/05 22:42:14  glen
+- add user and initscript
+- package initial data
+- package manual
+
 Revision 1.1  2008/11/05 20:43:37  glen
 - new
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/gozerbot.spec?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list