1 %define mod_name bandwidth
2 %define apxs /usr/sbin/apxs1
3 Summary: Apache module: bandwidth limits
4 Summary(pl): Modu³ do Apache: limity pasma
5 Name: apache1-mod_%{mod_name}
9 Group: Networking/Daemons
10 Source0: ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c
11 # Source0-md5: 00f0905d777f79485beb428b53191ecf
12 # ftp://ftp.cohprog.com/pub/apache/module/cleanlink.pl
13 # modified to work from cron NOT as daemon!
14 Source1: %{name}-cleanlink.pl
16 # http://www.cohprog.com/v3/bandwidth/doc-en.html
17 Source4: %{name}-doc.html
18 URL: http://www.cohprog.com/v3/bandwidth/intro-en.html
19 BuildRequires: apache1-devel
20 BuildRequires: %{apxs}
21 Requires(post,preun): %{apxs}
22 Requires(post,preun): grep
23 Requires(preun): fileutils
27 Obsoletes: apache-mod_%{mod_name} <= %{version}
28 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30 %define _pkglibdir %(%{apxs} -q LIBEXECDIR)
31 %define _sysconfdir %(%{apxs} -q SYSCONFDIR)
34 "Mod_bandwidth" is a module for the Apache webserver that enable the
35 setting of server-wide or per connection bandwidth limits, based on
36 the directory, size of files and remote IP/domain.
39 Modu³ pozwalaj±cy na ograniczanie pasma poprzez serwer Apache bazuj±c
40 na katalogu, wielko¶ci plików oraz zdalnym IP/domenie.
47 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
50 rm -rf $RPM_BUILD_ROOT
51 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} \
52 $RPM_BUILD_ROOT%{_var}/run/%{name}/{link,master} \
53 $RPM_BUILD_ROOT{/etc/cron.d,%{_sbindir}}
55 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
56 install %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}
57 install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/mod_%{mod_name}.conf
60 echo '* * * * * http %{_sbindir}/%{name}-cleanlink.pl' > \
61 $RPM_BUILD_ROOT/etc/cron.d/%{name}
64 rm -rf $RPM_BUILD_ROOT
67 %{apxs} -e -a -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
68 if [ -f /etc/apache/apache.conf ] && ! grep -q "^Include.*mod_%{mod_name}.conf" /etc/apache/apache.conf; then
69 echo "Include /etc/apache/mod_%{mod_name}.conf" >> /etc/apache/apache.conf
71 if [ -f /var/lock/subsys/apache ]; then
72 /etc/rc.d/init.d/apache restart 1>&2
76 if [ "$1" = "0" ]; then
77 %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
79 grep -v "^Include.*mod_%{mod_name}.conf" /etc/apache/apache.conf > \
80 /etc/apache/apache.conf.tmp
81 mv -f /etc/apache/apache.conf.tmp /etc/apache/apache.conf
82 if [ -f /var/lock/subsys/apache ]; then
83 /etc/rc.d/init.d/apache restart 1>&2
88 %defattr(644,root,root,755)
90 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mod_*.conf
91 %config(noreplace) %verify(not size mtime md5) %attr(640,root,root) /etc/cron.d/%{name}
92 %attr(755,root,root) %{_sbindir}/*
93 %attr(755,root,root) %{_pkglibdir}/*
94 %attr(750,http,root) %dir %{_var}/run/%{name}
95 %attr(750,http,root) %dir %{_var}/run/%{name}/link
96 %attr(750,http,root) %dir %{_var}/run/%{name}/master