BuildRequires: libtool
BuildRequires: mysql-devel
BuildRequires: %{apxs}
+Requires(post,preun): %{apxs}
+Requires(post,preun): grep
+Requires(post,preun): sudo
+Requires(preun): fileutils
Requires: apache(EAPI) >= 1.3.1
Requires: iptables
Requires: sudo
-Prereq: %{_sbindir}/apxs
-Prereq: grep
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _libexecdir %{_libdir}/apache
install mod_antihak/mod_antihak.so $RPM_BUILD_ROOT%{_libexecdir}
+%clean
+rm -rf $RPM_BUILD_ROOT
+
%post
-if [ `fgrep "http ALL= NOPASSWD: /sbin/iptables" /etc/sudoers | wc -l` = 0 ]; then
+if ! grep -qF "http ALL= NOPASSWD: /sbin/iptables" ; then
echo "http ALL= NOPASSWD: /sbin/iptables" >> /etc/sudoers
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
fi
-%clean
-rm -rf $RPM_BUILD_ROOT
-
%files
%defattr(644,root,root,755)
%doc src/{AUTHORS,INSTALL,ChangeLog,NEWS,TODO}