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 # 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: apache(EAPI)-devel
20 Requires(post,preun): %{apxs}
21 Requires(post,preun): grep
22 Requires(preun): fileutils
23 Requires: apache(EAPI)
25 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
27 %define _pkglibdir %(%{apxs} -q LIBEXECDIR)
28 %define _sysconfdir /etc/httpd
31 "Mod_bandwidth" is a module for the Apache webserver that enable the
32 setting of server-wide or per connection bandwidth limits, based on
33 the directory, size of files and remote IP/domain.
36 Modu³ pozawlaj±cy na ograniczanie pasma poprzez serwer Apache bazuj±c
37 na katalogu, wielko¶ci plików oraz zdalnym IP/domenie.
44 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
47 rm -rf $RPM_BUILD_ROOT
48 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} \
49 $RPM_BUILD_ROOT%{_var}/run/%{name}/{link,master} \
50 $RPM_BUILD_ROOT{/etc/cron.d,%{_sbindir}}
52 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
53 install %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}
54 install %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/mod_%{mod_name}.conf
57 echo '* * * * * http %{_sbindir}/%{name}-cleanlink.pl' > \
58 $RPM_BUILD_ROOT/etc/cron.d/%{name}
61 rm -rf $RPM_BUILD_ROOT
64 %{apxs} -e -a -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
65 if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*mod_%{mod_name}.conf" /etc/httpd/httpd.conf; then
66 echo "Include /etc/httpd/mod_%{mod_name}.conf" >> /etc/httpd/httpd.conf
68 if [ -f /var/lock/subsys/httpd ]; then
69 /etc/rc.d/init.d/httpd restart 1>&2
73 if [ "$1" = "0" ]; then
74 %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
76 grep -v "^Include.*mod_%{mod_name}.conf" /etc/httpd/httpd.conf > \
77 /etc/httpd/httpd.conf.tmp
78 mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
79 if [ -f /var/lock/subsys/httpd ]; then
80 /etc/rc.d/init.d/httpd restart 1>&2
85 %defattr(644,root,root,755)
87 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mod_*.conf
88 %config(noreplace) %verify(not size mtime md5) %attr(640,root,root) /etc/cron.d/%{name}
89 %attr(755,root,root) %{_sbindir}/*
90 %attr(755,root,root) %{_pkglibdir}/*
91 %attr(750,http,root) %dir %{_var}/run/%{name}
92 %attr(750,http,root) %dir %{_var}/run/%{name}/link
93 %attr(750,http,root) %dir %{_var}/run/%{name}/master