]> git.pld-linux.org Git - packages/apache-mod_bw.git/blobdiff - apache-mod_bw.spec
- dropped %%{_ver} macro, use %%{version} where possible
[packages/apache-mod_bw.git] / apache-mod_bw.spec
index 06dafcb3157e5ef9f0645d8037ccef5fc1b1d6d5..95d1d10a384a85db3847ed2c21b0cdf4124a38ab 100644 (file)
@@ -1,34 +1,33 @@
+# TODO:
+# - cron?
+# - rename to apache-mod_bw (it is not the same as apache1-mod_bandwidth)
+
 %define                mod_name        bandwidth
-%define        apxs            /usr/sbin/apxs1
+%define        apxs            /usr/sbin/apxs
 Summary:       Apache module: bandwidth limits
 Summary(pl):   Modu³ do Apache: limity pasma
-Name:          apache1-mod_%{mod_name}
-Version:       2.0.5
-Release:       1
+Name:          apache-mod_%{mod_name}
+Version:       0.6
+Release:       0.2
 License:       Apache
 Group:         Networking/Daemons
-Source0:       ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c
-# Source0-md5: 00f0905d777f79485beb428b53191ecf
-# ftp://ftp.cohprog.com/pub/apache/module/cleanlink.pl
-# modified to work from cron NOT as daemon!
-Source1:       %{name}-cleanlink.pl
-Source2:       %{name}.conf
-# http://www.cohprog.com/v3/bandwidth/doc-en.html
-Source4:       %{name}-doc.html
-URL:           http://www.cohprog.com/v3/bandwidth/intro-en.html
-BuildRequires: apache1-devel
+Source0:       http://www.ivn.cl/apache/bw_mod-%{version}.tgz
+# Source0-md5: 0c92fa6344f487321291a592dbb49856
+Source1:       %{name}.conf
+URL:           http://www.ivn.cl/apache/
+BuildRequires: apache-devel >= 2.0.0
 BuildRequires: %{apxs}
 Requires(post,preun):  %{apxs}
 Requires(post,preun):  grep
 Requires(preun):       fileutils
-Requires:      apache1
+Requires:      apache >= 2.0.0
 Requires:      crondaemon
 Requires:      procps
 Obsoletes:     apache-mod_%{mod_name} <= %{version}
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define                _pkglibdir      %(%{apxs} -q LIBEXECDIR)
-%define         _sysconfdir     /etc/apache
+%define                _sysconfdir     %(%{apxs} -q SYSCONFDIR)
 
 %description
 "Mod_bandwidth" is a module for the Apache webserver that enable the
@@ -36,49 +35,38 @@ setting of server-wide or per connection bandwidth limits, based on
 the directory, size of files and remote IP/domain.
 
 %description -l pl
-Modu³ pozawlaj±cy na ograniczanie pasma poprzez serwer Apache bazuj±c
+Modu³ pozwalaj±cy na ograniczanie pasma poprzez serwer Apache bazuj±c
 na katalogu, wielko¶ci plików oraz zdalnym IP/domenie.
 
 %prep
-%setup -q -T -c
-cp %{SOURCE0} .
+%setup -q -n bw_mod-%{version}
 
 %build
-%{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
+perl -pi -e 's@include "apr@include "apr/apr@g' bw_mod-%{version}.c
+perl -pi -e 's@^.*apr_buckets.h.*$@@'  bw_mod-%{version}.c
+%{apxs} -c bw_mod-%{version}.c
+mv .libs/bw_mod-%{version}.so mod_bandwidth.so
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} \
        $RPM_BUILD_ROOT%{_var}/run/%{name}/{link,master} \
-       $RPM_BUILD_ROOT{/etc/cron.d,%{_sbindir}}
+       $RPM_BUILD_ROOT{/etc/cron.d,%{_sbindir},%{_sysconfdir}/httpd.conf}
 
 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}
-install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/mod_%{mod_name}.conf
-install %{SOURCE4} .
-
-echo '* * * * * http %{_sbindir}/%{name}-cleanlink.pl' > \
-       $RPM_BUILD_ROOT/etc/cron.d/%{name}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/97_mod_%{mod_name}.conf
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
-%{apxs} -e -a -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
-if [ -f /etc/apache/apache.conf ] && ! grep -q "^Include.*mod_%{mod_name}.conf" /etc/apache/apache.conf; then
-        echo "Include /etc/apache/mod_%{mod_name}.conf" >> /etc/apache/apache.conf
-fi
 if [ -f /var/lock/subsys/apache ]; then
        /etc/rc.d/init.d/apache restart 1>&2
 fi
 
 %preun
 if [ "$1" = "0" ]; then
-       %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
        umask 027
-       grep -v "^Include.*mod_%{mod_name}.conf" /etc/apache/apache.conf > \
-               /etc/apache/apache.conf.tmp
-       mv -f /etc/apache/apache.conf.tmp /etc/apache/apache.conf
        if [ -f /var/lock/subsys/apache ]; then
                /etc/rc.d/init.d/apache restart 1>&2
        fi
@@ -86,10 +74,10 @@ fi
 
 %files
 %defattr(644,root,root,755)
-%doc *html
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mod_*.conf
-%config(noreplace) %verify(not size mtime md5) %attr(640,root,root) /etc/cron.d/%{name}
-%attr(755,root,root) %{_sbindir}/*
+%doc bw_mod-%{version}.txt LICENSE
+%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd.conf/*mod_*.conf
+#%config(noreplace) %verify(not size mtime md5) %attr(640,root,root) /etc/cron.d/%{name}
+#%attr(755,root,root) %{_sbindir}/*
 %attr(755,root,root) %{_pkglibdir}/*
 %attr(750,http,root) %dir %{_var}/run/%{name}
 %attr(750,http,root) %dir %{_var}/run/%{name}/link
This page took 0.068188 seconds and 4 git commands to generate.