%define name mod_throttle %define version 3.1.2 %define apache_version 1.3.33 %define release 12mdk Summary: Bandwidth & Request Throttling module for apache Name: %{name} Version: %{version} Release: %{release} Group: System/Servers License: Apache License URL: http://www.snert.com/Software/mod_throttle Source0: http://www.snert.com/Software/mod_throttle/%{name}-%{version}.tar.bz2 Source1: %{name}.conf Prereq: apache = %{apache_version} Prereq: apache-common >= %{apache_version} Prereq: apache-conf >= %{apache_version} BuildRequires: apache-devel = %{apache_version} BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot %description This Apache module is intended to reduce the load on your server& bandwidth enerated by popular virtual hosts, directories, locations, or users according to supported polices (see below) that decide when to delay or refuse requests. Also mod_throttle can track and throttle incoming connections by IP address or by authenticated remote user. %prep %setup -q # fix mod_throttle (the NPTL issue...) perl -pi -e "s|^#define USE_SYSTEM_V_SERIALIZATION|#undef USE_SYSTEM_V_SERIALIZATION|g" mod_throttle.c perl -pi -e "s|^#undef USE_FCNTL_SERIALIZATION|#define USE_FCNTL_SERIALIZATION|g" mod_throttle.c %build %{_sbindir}/apxs -I%{_includedir} -L%{_libdir} \ -c %{name}.c %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} install -d %{buildroot}%{_libdir}/apache-extramodules install -d %{buildroot}%{_var}/www/html/addon-modules install -d %{buildroot}%{_sysconfdir}/httpd/conf install -m 755 %{name}.so %{buildroot}%{_libdir}/apache-extramodules/ cp index.shtml %{buildroot}%{_var}/www/html/addon-modules/%{name}.html cp %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf cp CHANGES.txt ./changes.txt %pre #Check config file sanity if [ -e %{_sbindir}/ap13chkconfig ]; then %{_sbindir}/ap13chkconfig;fi %post if [ $1 = "1" ]; then #We're in Install mode, add module to the config files for config in %{_sysconfdir}/httpd/conf/{httpd,httpd-perl}.conf; do if [ -x %{_sbindir}/advxaddmod -a -e $config ]; then %{_sbindir}/advxaddmod $config \ extramodules/%{name}.so %{name}.c throttle_module \ define=HAVE_THROTTLE addconf=conf/%{name}.conf fi done if [ -e %{_sbindir}/ADVXctl ]; then %{_sbindir}/ADVXctl update;fi fi if [ $1 -gt 1 ]; then #We're in *upgrade mode*. Since we can't be sure the configuration files #are sane, remove module from the conf files to clean them, re-add again #in a way that the older module we're replacing won't try to erase (the #post scripts were broken on some packages), and finally clean the module #specific config file so it's compatible with the upgrade. for config in %{_sysconfdir}/httpd/conf/{httpd,httpd-perl}.conf; do if [ -x %{_sbindir}/advxdelmod -a -e $config ]; then %{_sbindir}/advxdelmod $config \ extramodules/%{name}.so %{name}.c throttle_module \ define=HAVE_THROTTLE addconf=conf/%{name}.conf $config fi if [ -x %{_sbindir}/advxaddmod -a -e $config ]; then %{_sbindir}/advxaddmod $config \ extramodules/%{name}.so %{name}.c throttle_module \ define=HAVE_THROTTLE addconf=conf/%{name}.conf fi done if [ -e %{_sbindir}/ADVXctl ]; then %{_sbindir}/ADVXctl update;fi fi %postun if [ $1 = "0" ]; then for config in %{_sysconfdir}/httpd/conf/{httpd,httpd-perl}.conf; do if [ -x %{_sbindir}/advxdelmod -a -e $config ]; then %{_sbindir}/advxdelmod $config \ extramodules/%{name}.so %{name}.c throttle_module \ define=HAVE_THROTTLE addconf=conf/%{name}.conf fi done if [ -e %{_sbindir}/ADVXctl ]; then %{_sbindir}/ADVXctl update;fi fi %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %files %defattr(-,root,root) %doc changes.txt %{_var}/www/html/addon-modules/* %{_libdir}/apache-extramodules/%{name}.so %config(noreplace) %{_sysconfdir}/httpd/conf/%{name}.conf %changelog * Tue Feb 15 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 3.1.2-12mdk - spec file cleanups, remove the ADVX-build stuff * Tue Feb 15 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 3.1.2-11mdk - fix lock file location (S1) * Sun Nov 21 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 3.1.2-10mdk - built for apache 1.3.33 * Tue Aug 03 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 3.1.2-9mdk - force fcntl * Thu Jun 10 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 3.1.2-8mdk - built for apache 1.3.31 * Sun Nov 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 3.1.2-7mdk - built for apache 1.3.29 * Tue Sep 16 2003 Jean-Michel Dault <jmdault@mandrakesoft.com> 3.1.2-6mdk - rebuild with apache 1.3.28 * Thu Feb 13 2003 Jean-Michel Dault <jmdault@mandrakesoft.com> 3.1.2-5mdk - new macros from ADVX-build * Thu Jan 30 2003 Lenny Cartier <lenny@mandrakesoft.com> 3.1.2-4mdk - rebuild * Fri Nov 8 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 3.1.2-2mdk - Rebuild for Cooker * Mon Oct 28 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 3.1.2-2mdk - Rebuild with new apache * Wed Oct 02 2002 Lenny Cartier <lenny@mandrakesoft.com> 3.1.2-1mdk - from Per Øyvind Karlsen <peroyvind@delonic.no> : - Initial release