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