]> git.pld-linux.org Git - packages/apache-mod_bw.git/blob - apache-mod_bw.spec
- spaces->tabs
[packages/apache-mod_bw.git] / apache-mod_bw.spec
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}
6 Version:        2.0.5
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 # 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
15 Source2:        %{name}.conf
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
24 Requires:       apache1
25 Requires:       crondaemon
26 Requires:       procps
27 Obsoletes:      apache-mod_%{mod_name} <= %{version}
28 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29
30 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR)
31 %define         _sysconfdir     %(%{apxs} -q SYSCONFDIR)
32
33 %description
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.
37
38 %description -l pl
39 Modu³ pozwalaj±cy na ograniczanie pasma poprzez serwer Apache bazuj±c
40 na katalogu, wielko¶ci plików oraz zdalnym IP/domenie.
41
42 %prep
43 %setup -q -T -c
44 cp %{SOURCE0} .
45
46 %build
47 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
48
49 %install
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}}
54
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
58 install %{SOURCE4} .
59
60 echo '* * * * * http %{_sbindir}/%{name}-cleanlink.pl' > \
61         $RPM_BUILD_ROOT/etc/cron.d/%{name}
62
63 %clean
64 rm -rf $RPM_BUILD_ROOT
65
66 %post
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
70 fi
71 if [ -f /var/lock/subsys/apache ]; then
72         /etc/rc.d/init.d/apache restart 1>&2
73 fi
74
75 %preun
76 if [ "$1" = "0" ]; then
77         %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
78         umask 027
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
84         fi
85 fi
86
87 %files
88 %defattr(644,root,root,755)
89 %doc *html
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
This page took 0.106675 seconds and 4 git commands to generate.