#Module-Specific definitions %define mod_version 0.1.3 %define mod_name mod_bwshare %define mod_conf 77_%{mod_name}.conf %define mod_so %{mod_name}.so %define sourcename bwshare-%{mod_version} %define apache_version 2.0.54 # Standard Module Definitions %define name apache-%{mod_name} %define version %{apache_version}_%{mod_version} Summary: Bandwidth throttling and balancing by client IP address Name: %{name} Version: %{version} Release: %mkrel 2 Group: System/Servers License: Artistic URL: http://www.topology.org/src/bwshare/README.html Source0: %{sourcename}.zip Source1: %{sourcename}.zip.asc Source2: %{mod_conf}.bz2 Patch: bwshare-fix-config.bz2 PreReq: rpm-helper BuildRequires: unzip Requires(pre): rpm-helper Requires(postun): rpm-helper Requires(pre): apache-conf >= 2.0.54 Requires(pre): apache >= %{apache_version} Requires: apache-conf >= 2.0.54 Requires: apache >= %{apache_version} BuildRequires: apache-devel >= %{apache_version} BuildRequires: file Provides: apache2-mod_bwshare Obsoletes: apache2-mod_bwshare BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot %description The Apache shaping module "bwshare" uses a form of "statistical shaping". This means that the software measures the statistical behaviour of the subscriber in the past, and uses this as a basis for controlling the current access to resources by the user. The purpose of this module is to give the web site operator some control over bandwidth utilization by individual client hosts. The "bwshare" module temporarily blocks access by excessive users. This is aimed especially at users who download whole websites at great speed. Excessive speed is considered bad etiquette for search engine robots. %prep %setup -q -n src pushd modules/bwshare %patch0 popd cp modules/bwshare/doc.html . cp modules/bwshare/LICENCE . cp modules/bwshare/README.html . cp modules/bwshare/%{mod_name}.c . # strip away annoying ^M find . -type f|xargs file|grep 'CRLF'|cut -d: -f1|xargs perl -p -i -e 's/\r//' find . -type f|xargs file|grep 'text'|cut -d: -f1|xargs perl -p -i -e 's/\r//' %build %{_sbindir}/apxs -c %{mod_name}.c %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} install -d %{buildroot}%{_libdir}/apache-extramodules install -d %{buildroot}%{_sysconfdir}/httpd/modules.d install -m0755 .libs/*.so %{buildroot}%{_libdir}/apache-extramodules/ bzcat %{SOURCE2} > %{buildroot}%{_sysconfdir}/httpd/modules.d/%{mod_conf} install -d %{buildroot}%{_var}/www/html/addon-modules ln -s ../../../..%{_docdir}/%{name}-%{version} %{buildroot}%{_var}/www/html/addon-modules/%{name}-%{version} cat > README.%{name} <<EOF NOTE! It's crucial that forward and reverse DNS lookups works perfectly on the host running this module. If, not apache won't start unless for example ServerName is 127.0.0.1. -- Regards // Oden Eriksson EOF %post if [ -f %{_var}/lock/subsys/httpd ]; then %{_initrddir}/httpd restart 1>&2; fi %postun if [ "$1" = "0" ]; then if [ -f %{_var}/lock/subsys/httpd ]; then %{_initrddir}/httpd restart 1>&2 fi fi %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %files %defattr(-,root,root) %doc doc.html LICENCE README.* %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/httpd/modules.d/%{mod_conf} %attr(0755,root,root) %{_libdir}/apache-extramodules/%{mod_so} %{_var}/www/html/addon-modules/* %changelog * Sat Jul 30 2005 Oden Eriksson <oeriksson@mandriva.com> 2.0.54_0.1.3-2mdk - fix deps * Thu Jun 02 2005 Oden Eriksson <oeriksson@mandriva.com> 2.0.54_0.1.3-1mdk - rename the package - the conf.d directory is renamed to modules.d - use new rpm-4.4.x pre,post magic * Sun Mar 20 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53_0.1.3-4mdk - use the %%mkrel macro * Mon Feb 28 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53_0.1.3-3mdk - fix %%post and %%postun to prevent double restarts - fix bug #6574 * Wed Feb 16 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53_0.1.3-2mdk - spec file cleanups, remove the ADVX-build stuff * Tue Feb 8 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53_0.1.3-1mdk - rebuilt for apache 2.0.53 * Tue Sep 28 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.52_0.1.3-1mdk - built for apache 2.0.52 * Thu Sep 16 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.51_0.1.3-1mdk - built for apache 2.0.51 * Mon Jul 12 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.50_0.1.3-1mdk - built for apache 2.0.50 - remove redundant provides * Mon Jun 14 2004 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.49_0.1.3-1mdk - built for apache 2.0.49 * Wed Nov 05 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.48_0.1.3-1mdk - built for apache 2.0.48 * Thu Jul 10 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.47_0.1.3-1mdk - rebuilt against latest apache2, requires and buildrequires * Sat May 31 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.46_0.1.3-1mdk - rebuilt for apache v2.0.46 - buildprereq ADVX-build >= 9.2 * Tue Apr 08 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.45_0.1.3-1mdk - cosmetic rebuild for apache v2.0.45 * Fri Feb 28 2003 Jean-Michel Dault <jmdault@mandrakesoft.com> 2.0.44_0.1.3-3mdk - _Major_ rework on the module, it would not use the values in httpd.conf for configuration. This module is totally weird, using shared memory and semaphores, and covers different Apache versions, which makes it a mess. I don't know if my patch will work for 1.3, but it works with Apache 2.0.42 and higher. Added BWSHARE_DEBUG define so we can recompile it with this option and trace the Apache API calls. - Set better default values in the conf file: the defaults were set to 0.067 pages per second, which is suitable for a server on an obsolete 33.6K modem, and totally unuseable according to the current standards. * Fri Feb 28 2003 Jean-Michel Dault <jmdault@mandrakesoft.com> 2.0.44_0.1.3-2mdk - rebuild * Thu Feb 27 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.44_0.1.3-1mdk - 0.1.3 - drop P0, it is now correcly done and included, great thanks Alan! * Tue Jan 21 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.44_0.1.2-1mdk - rebuilt for apache v2.0.44 * Mon Jan 20 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.43_0.1.2-3mdk - fix buildrequires apache-devel >= 2.0.53-1mdk, as pointed out by Olivier Thauvin * Sat Jan 18 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.43_0.1.2-2mdk - rebuilt against rebuilt buildrequires * Mon Jan 13 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.43_0.1.2-1mdk - initial cooker contrib