packages: policyd/policyd.spec - rewritten using bundled spec - webui subpa...

glen glen at pld-linux.org
Mon Jan 3 14:08:18 CET 2011


Author: glen                         Date: Mon Jan  3 13:08:18 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rewritten using bundled spec
- webui subpackage

---- Files affected:
packages/policyd:
   policyd.spec (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: packages/policyd/policyd.spec
diff -u packages/policyd/policyd.spec:1.11 packages/policyd/policyd.spec:1.12
--- packages/policyd/policyd.spec:1.11	Mon Dec 20 16:08:25 2010
+++ packages/policyd/policyd.spec	Mon Jan  3 14:08:13 2011
@@ -1,13 +1,6 @@
 # $Revision$, $Date$
-# $Id$
-#
-# TODO:
-# - upgrade database smooth
-#   smart updates tables from older to newer version of policyd
 # TODO
-# - mysql and postfix info, see:
-#   /etc/rc.d/init.d/policyd init
-#
+# - perl-cbp (for amavisd integration)
 Summary:	Policyd - an anti-spam plugin for Postfix
 Summary(pl.UTF-8):	Policyd - wtyczka antyspamowa dla Postfiksa
 Name:		policyd
@@ -22,8 +15,7 @@
 Source3:	%{name}.conf
 Source4:	%{name}.init
 URL:		http://www.policyd.org/
-BuildRequires:	mysql-devel
-BuildRequires:	zlib-devel
+BuildRequires:	bash
 Requires(pre):	/bin/id
 Requires(pre):	/usr/bin/getgid
 Requires(pre):	/usr/sbin/groupadd
@@ -34,8 +26,14 @@
 Requires:	rc-scripts
 Provides:	group(policyd)
 Provides:	user(policyd)
+BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define		_webapps	/etc/webapps
+%define		_webapp		%{name}
+# this path is hardcoded
+%define		cblibdir	%{_prefix}/lib/policyd-2.0
+
 %description
 Policyd v2 (codenamed "cluebringer") is a multi-platform policy server
 for popular MTAs. This policy daemon is designed mostly for large
@@ -56,25 +54,47 @@
 automatyczne dodawanie do czarnej listy HELO i zapobieganie losowemu
 HELO.
 
+%package webui
+Summary:	Webui
+Group:		Applications/WWW
+
+%description webui
+webui
+
 %prep
 %setup -q -n cluebringer-%{version}
 
 %build
-%{__make} build \
-	CC="%{__cc}" \
-	CPPFLAGS="-I/usr/include/mysql" \
-	CFLAGS="%{rpmcflags} -W -Wall -DMAXFDS=1023" \
-	lib=
+cd database
+for db_type in mysql4 mysql pgsql sqlite; do
+	./convert-tsql $db_type core.tsql > policyd.$db_type.sql
+	for file in $(find . -name '*.tsql' -and -not -name core.tsql); do
+		./convert-tsql $db_type $file
+	done >> policyd.$db_type.sql
+	cd whitelists
+		./parse-checkhelo-whitelist >> policyd.$db_type.sql
+		./parse-greylisting-whitelist >> policyd.$db_type.sql
+	cd ..
+done
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_libdir}/%{name},%{_sysconfdir}/%{name},/etc/rc.d/init.d,/etc/sysconfig,/etc/cron.hourly}
-install -p policyd cleanup $RPM_BUILD_ROOT%{_libdir}/%{name}
-cp -a policyd.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.conf-dist
-cp -a %{SOURCE1} $RPM_BUILD_ROOT/etc/cron.hourly/%{name}
-cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
-cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.conf
+# cbpolicyd
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/policyd,%{_sbindir},%{cblibdir},/etc/{rc.d/init.d,sysconfig}}
+cp -R cbp $RPM_BUILD_ROOT%{cblibdir}
+install -p cbpolicyd cbpadmin database/convert-tsql $RPM_BUILD_ROOT%{_sbindir}
+cp -a cluebringer.conf $RPM_BUILD_ROOT%{_sysconfdir}/policyd/cluebringer.conf
 install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+
+# Webui
+install -d $RPM_BUILD_ROOT{%{_webapps}/%{_webapp},%{_datadir}/%{name}/webui}
+cp -R webui/* $RPM_BUILD_ROOT%{_datadir}/%{name}/webui
+install contrib/httpd/cluebringer-httpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
+cp -a $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/{apache,httpd}.conf
+# Move config into %{_sysconfdir}
+mv $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/includes/config.php $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
+ln -s %{_webapps}/%{_webapp}/config.php $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/includes
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -85,18 +105,11 @@
 
 %post
 /sbin/chkconfig --add policyd
-if [ -f /var/lock/subsys/policyd ]; then
-	/etc/rc.d/init.d/policyd restart >&2 || :
-else
-	echo "Run \"/etc/rc.d/init.d/policyd init\" to read howto setup policy daemon." >&2
-	echo "Run \"/etc/rc.d/init.d/policyd start\" to start policy daemon." >&2
-fi
+%service policyd restart
 
 %preun
 if [ "$1" = "0" ]; then
-	if [ -f /var/lock/subsys/policyd ]; then
-		/etc/rc.d/init.d/policyd stop >&2
-	fi
+	%service policyd stop
 	/sbin/chkconfig --del policyd
 fi
 
@@ -106,16 +119,49 @@
 	%groupremove policyd
 fi
 
+%triggerin webui -- apache1 < 1.3.37-3, apache1-base
+%webapp_register apache %{_webapp}
+
+%triggerun webui -- apache1 < 1.3.37-3, apache1-base
+%webapp_unregister apache %{_webapp}
+
+%triggerin webui -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun webui -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerin webui -- lighttpd
+%webapp_register lighttpd %{_webapp}
+
+%triggerun webui -- lighttpd
+%webapp_unregister lighttpd %{_webapp}
+
 %files
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/%{name}/*
+%doc AUTHORS CHANGELOG INSTALL TODO WISHLIST
+%doc database/*.sql
+%doc contrib/amavisd-new
+%attr(755,root,root) %{_sbindir}/cbpadmin
+%attr(755,root,root) %{_sbindir}/cbpolicyd
+%attr(755,root,root) %{_sbindir}/convert-tsql
 %dir %{_sysconfdir}/%{name}
-%doc *.txt *.mysql doc/*.sql doc/*.txt
-%doc %{_sysconfdir}/%{name}/%{name}.conf-dist
-%config(noreplace) %verify(not md5 mtime size) %attr(640,root,root) %{_sysconfdir}/%{name}/%{name}.conf
-%config(noreplace) %verify(not md5 mtime size) %attr(755,root,root) /etc/cron.hourly/%{name}
-%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%config(noreplace) %verify(not md5 mtime size) %attr(640,root,root) %{_sysconfdir}/%{name}/cluebringer.conf
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+
+# TODO: use perl vendor dir?
+%dir %{cblibdir}
+%{cblibdir}/cbp
+
+%files webui
+%defattr(644,root,root,755)
+%dir %attr(750,root,http) %{_webapps}/%{_webapp}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/config.php
+%dir %{_datadir}/%{name}
+%{_datadir}/%{name}/webui
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -123,6 +169,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.12  2011/01/03 13:08:13  glen
+- rewritten using bundled spec
+- webui subpackage
+
 Revision 1.11  2010/12/20 15:08:25  glen
 - 2.0.10 tarball fetch
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/policyd/policyd.spec?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list