Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > d2fac19a32de99c40a19955e7457c6a4 > files > 2

apache2-mod_bw-2.0.53_0.5-2mdk.src.rpm

#Module-Specific definitions
%define mod_version 0.5
%define mod_name mod_bw
%define mod_conf A32_%{mod_name}.conf
%define mod_so %{mod_name}.so
%define sourcename %{mod_name}-%{mod_version}

%define apache_version 2.0.53

# Standard Module Definitions
%define name apache2-%{mod_name}
%define version %{apache_version}_%{mod_version}

Summary:        Bandwidth administration module for Apache2 HTTPD
Name:		%{name}
Version:	%{version}
Release:	%mkrel 2
Group:		System/Servers
License:	Apache License
URL:		http://www.ivn.cl/apache/
Source0: 	bw_mod-%{mod_version}.tar.bz2
Source1:	%{mod_conf}.bz2
Prereq:		apache2 >= %{apache_version}
Prereq:		apache2-conf
BuildRequires:	apache2-devel >= 2.0.53-1mdk
BuildRequires:	file
BuildRoot:	%{_tmppath}/%{name}-buildroot

%description
mod_bw is a bandwidth administration module for Apache HTTPD 2.0.x

* Restrict the number of simultaneous connections per vhost/dir
* Limit the bandwidth for files on vhost/dir

%prep

%setup -q -n bw_mod-%{mod_version}
cp bw_mod-0.5.c mod_bw.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}/apxs2 -c %{mod_name}.c

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

install -d %{buildroot}%{_libdir}/apache2-extramodules
install -d %{buildroot}%{_sysconfdir}/httpd/conf.d

install -m0755 .libs/*.so %{buildroot}%{_libdir}/apache2-extramodules/
bzcat %{SOURCE1} > %{buildroot}%{_sysconfdir}/httpd/conf.d/%{mod_conf}

install -d %{buildroot}%{_var}/www/html/addon-modules
ln -s ../../../..%{_docdir}/%{name}-%{version} %{buildroot}%{_var}/www/html/addon-modules/%{name}-%{version}

%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 APACHE2-LICENSE LICENSE bw_mod-0.5.txt
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{mod_conf}
%attr(0755,root,root) %{_libdir}/apache2-extramodules/%{mod_so}
%{_var}/www/html/addon-modules/*

%changelog
* Sun Mar 20 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53_0.5-2mdk
- use the %%mkrel macro

* Wed Feb 23 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53_0.5-1mdk
- initial Mandrakelinux package
- src.rpm file sent by Emre SOKULLU <esokullu@gmail.com> to the 
  cooker mailinglist, and polished by me.