]> git.pld-linux.org Git - packages/apache1-mod_antihak.git/blobdiff - apache1-mod_antihak.spec
- mv apache-* apache1-*; release 3.1
[packages/apache1-mod_antihak.git] / apache1-mod_antihak.spec
index bd3f4362369363a6db7ebdd387d13e94f5955dc2..ad3283bf118dc7a29362b47c822a7c85b5ad78d0 100644 (file)
@@ -1,29 +1,35 @@
-%define        apxs    /usr/sbin/apxs
+%define apxs   /usr/sbin/apxs1
+%define        mod_name        antihak
 Summary:       Antihak module for Apache
 Summary(pl):   Modu³ antihak dla Apache
-Name:          apache-mod_antihak
+Name:          apache1-mod_%{mod_name}
+%define                tar_ver 0.3.1-beta
 Version:       0.3.1beta
-Release:       3
+Release:       3.1
 License:       GPL
 Group:         Networking/Daemons
-Source0:       ftp://ftp.sourceforge.net/pub/sourceforge/apantihak/mod_antihak-0.3.1-beta.tar.gz
-Patch0:                mod_antihak-iptables.patch
-Patch1:                mod_antihak-am.patch
+Source0:       http://dl.sourceforge.net/apantihak/mod_antihak-%{tar_ver}.tar.gz
+# Source0-md5: 38f22f5b5662e8dd7318c42fa96fb083
+Patch0:                %{name}-iptables.patch
+Patch1:                %{name}-am.patch
+URL:           http://sourceforge.net/projects/apantihak/
 BuildRequires: automake
 BuildRequires: autoconf
-BuildRequires: apache(EAPI)-devel
+BuildRequires: apache1-devel
 BuildRequires: libtool
 BuildRequires: mysql-devel
 BuildRequires: %{apxs}
-Requires:      apache(EAPI) >= 1.3.1
+Requires(post,preun):  %{apxs}
+Requires(post,preun):  grep
+Requires(post,preun):  sudo
+Requires(preun):       fileutils
+Requires:      apache1 >= 1.3.1
 Requires:      iptables
 Requires:      sudo
-Prereq:                %{_sbindir}/apxs
-Prereq:                grep
+Obsoletes:     apache-mod_%{mod_name} <= %{version}
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define         _libexecdir     %{_libdir}/apache
-%define         _htmldocdir     /home/httpd/manual/mod
+%define                _pkglibdir      %(%{apxs} -q LIBEXECDIR)
 
 %description
 mod_antihak is an Apache Module designed to eliminate the CodeRed and
@@ -36,19 +42,16 @@ przez robaki CodeRed i Nimda. Ponadto trwaj
 ³atwego dodawania obs³ugi kolejnych robaków.
 
 %prep
-%setup -q -n mod_antihak-0.3.1-beta
-cd src
+%setup -q -n mod_antihak-0.3.1-beta/src
 %patch0 -p0
 %patch1 -p0
 
 %build
-cd src
-
 rm -f tools/missing
-libtoolize --copy --force
-aclocal
-autoconf
-automake -a -c -f
+%{__libtoolize}
+%{__aclocal}
+%{__autoconf}
+%{__automake}
 
 %configure \
        CC=%{__cc} \
@@ -60,45 +63,44 @@ automake -a -c -f
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_libexecdir},%{_htmldocdir}}
-
-cd src
+install -d $RPM_BUILD_ROOT%{_pkglibdir}
 
-install mod_antihak/mod_antihak.so $RPM_BUILD_ROOT%{_libexecdir}
+install mod_antihak/mod_antihak.so $RPM_BUILD_ROOT%{_pkglibdir}
 
-gzip -9nf AUTHORS INSTALL ChangeLog NEWS TODO
+%clean
+rm -rf $RPM_BUILD_ROOT
 
 %post
-if [ `fgrep "http ALL= NOPASSWD: /sbin/iptables" /etc/sudoers | wc -l` = 0 ]; then
-       echo "http ALL= NOPASSWD: /sbin/iptables" >> /etc/sudoers
+if ! grep -qF "http ALL= NOPASSWD: /sbin/iptables" ; then
+       echo "#http ALL= NOPASSWD: /sbin/iptables" >> /etc/sudoers
+       echo "%{mod_name}: you need to allow apache to run iptables as root,"
+       echo "%{mod_name}: appropriate (commented out) line added to /etc/sudoers;"
+       echo "%{mod_name}: be sure to uncomment it if you want this module to work"
 fi
 
-%{_sbindir}/apxs -e -a -n antihak %{_libexecdir}/mod_antihak.so 1>&2
-if [ -f /var/lock/subsys/httpd ]; then
-       /etc/rc.d/init.d/httpd restart 1>&2
+%{apxs} -e -a -n antihak %{_pkglibdir}/mod_antihak.so 1>&2
+if [ -f /var/lock/subsys/apache ]; then
+       /etc/rc.d/init.d/apache restart 1>&2
 else
-       echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache http daemon."
+       echo "Run \"/etc/rc.d/init.d/apache start\" to start apache http daemon."
 fi
 
 %preun
 if [ "$1" = "0" ]; then
-       if [ `fgrep "http ALL= NOPASSWD: /sbin/iptables" /etc/sudoers | wc -l` != 0 ]
-       then
+       if grep -qF "^http ALL= NOPASSWD: /sbin/iptables" /etc/sudoers ; then
+               umask 227
                grep -v '^http ALL= NOPASSWD: /sbin/iptables$' /etc/sudoers \
                        > /etc/sudoers.rpmnew-antihak
                mv -f /etc/sudoers.rpmnew-antihak /etc/sudoers
        fi
 
-       %{_sbindir}/apxs -e -A -n antihak %{_libexecdir}/mod_antihak.so 1>&2
-       if [ -f /var/lock/subsys/httpd ]; then
-               /etc/rc.d/init.d/httpd restart 1>&2
+       %{apxs} -e -A -n antihak %{_pkglibdir}/mod_antihak.so 1>&2
+       if [ -f /var/lock/subsys/apache ]; then
+               /etc/rc.d/init.d/apache restart 1>&2
        fi
 fi
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %files
 %defattr(644,root,root,755)
-%doc src/*.gz
-%attr(755,root,root) %{_libexecdir}/*
+%doc AUTHORS INSTALL ChangeLog NEWS TODO
+%attr(755,root,root) %{_pkglibdir}/*
This page took 0.085362 seconds and 4 git commands to generate.