]> git.pld-linux.org Git - packages/apache-mod_bw.git/blob - apache-mod_bw.spec
- mv apache-mod_bandwitdh.spec apache-mod_bandwidth.spec (typo - #636)
[packages/apache-mod_bw.git] / apache-mod_bw.spec
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}
6 Version:        2.0.3
7 Release:        1
8 License:        Apache
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
14 Source2:        %{name}.conf
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)
23 Requires:       procps
24 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
25
26 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR)
27 %define         _sysconfdir     /etc/httpd
28
29 %description
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.
33
34 %description -l pl
35 Modu³ pozawlaj±cy na ograniczanie pasma poprzez serwer Apache bazuj±c
36 na katalogu, wielko¶ci plików oraz zdalnym IP/domenie.
37
38 %prep
39 %setup -q -T -c
40 cp %{SOURCE0} .
41
42 %build
43 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
44
45 %install
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}}
50
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
54 install %{SOURCE4} .
55
56 echo '* * * * * http %{_sbindir}/%{name}-cleanlink.pl' > \
57         $RPM_BUILD_ROOT/etc/cron.d/%{name}
58
59 %clean
60 rm -rf $RPM_BUILD_ROOT
61
62 %post
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
66 fi
67 if [ -f /var/lock/subsys/httpd ]; then
68         /etc/rc.d/init.d/httpd restart 1>&2
69 fi
70
71 %preun
72 if [ "$1" = "0" ]; then
73         %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
74         umask 027
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
80         fi
81 fi
82
83 %files
84 %defattr(644,root,root,755)
85 %doc *html
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
This page took 0.059117 seconds and 3 git commands to generate.