%define mod_name watch
%define apxs /usr/sbin/apxs
+%include /usr/lib/rpm/macros.perl
Summary: Apache module: Monitoring Interface for MRTG
Summary(pl): Modu³ do apache: Interfejs do monitorowania za pomoc± MRTG
Name: apache-mod_%{mod_name}
-Version: 3.13
-Release: 2
+Version: 4.03
+Release: 1
License: BSD
Group: Networking/Daemons
-Source0: http://www.snert.com/Software/mod_watch/mod_watch%(echo %{version} | sed -e "s#\.##g").tgz
+Source0: http://www.snert.com/Software/download/mod_watch%(echo %{version} | tr -d .).tgz
+# Source0-md5: 06d57713adb935f16596d22256bca913
Source1: %{name}.conf
-Patch0: %{name}-PLD-v6stuff.patch
URL: http://www.snert.com/Software/mod_watch/
BuildRequires: %{apxs}
-BuildRequires: apache(EAPI)-devel
-Prereq: %{_sbindir}/apxs
-Requires: apache(EAPI)
+BuildRequires: apache-devel >= 2
+Requires(post,preun): %{apxs}
+Requires(post,preun): grep
+Requires(preun): fileutils
+Requires: apache >= 2
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _pkglibdir %(%{apxs} -q LIBEXECDIR)
+%define _sysconfdir /etc/httpd
%description
This module will watch and collect the bytes, requests, and documents
graficzn± reprezentacje danych. Modu³ wspiera mod_vhost_alias oraz mod_gzip.
%prep
-%setup -q -n mod_%{mod_name}-%{version}
-%patch -p0
+%setup -q -n mod_%{mod_name}-4.3
%build
-%{__make} build-dynamic
+%{__make} -f Makefile.dso build \
+ APXS=%{apxs}
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/httpd}
+install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_bindir},%{_sysconfdir}}
-install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/mod_watch.conf
+install .libs/mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
+install apache2mrtg.pl mod_watch.pl $RPM_BUILD_ROOT%{_bindir}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mod_watch.conf
+
+%clean
+rm -rf $RPM_BUILD_ROOT
%post
%{apxs} -e -a -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
-if [ -f %{_sysconfdir}/httpd/httpd.conf ] && \
- ! grep -q "^Include.*mod_watch.conf" %{_sysconfdir}/httpd/httpd.conf; then
- echo Include %{_sysconfdir}/httpd/mod_watch.conf >> %{_sysconfdir}/httpd/httpd.conf
+if [ -f %{_sysconfdir}/httpd.conf ] && \
+ ! grep -q "^Include.*mod_watch.conf" %{_sysconfdir}/httpd.conf; then
+ echo "Include %{_sysconfdir}/mod_watch.conf" >> %{_sysconfdir}/httpd.conf
fi
if [ -f /var/lock/subsys/httpd ]; then
- %{_sysconfdir}/rc.d/init.d/httpd restart 1>&2
+ /etc/rc.d/init.d/httpd restart 1>&2
else
echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache http daemon."
fi
%preun
if [ "$1" = "0" ]; then
%{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
- grep -v "^Include.*mod_watch.conf" %{_sysconfdir}/httpd/httpd.conf > \
- %{_sysconfdir}/httpd/httpd.conf.tmp
- mv -f %{_sysconfdir}/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
+ umask 027
+ grep -v "^Include.*mod_watch.conf" %{_sysconfdir}/httpd.conf > \
+ %{_sysconfdir}/httpd.conf.tmp
+ mv -f %{_sysconfdir}/httpd.conf.tmp %{_sysconfdir}/httpd.conf
if [ -f /var/lock/subsys/httpd ]; then
- %{_sysconfdir}/rc.d/init.d/httpd restart 1>&2
+ /etc/rc.d/init.d/httpd restart 1>&2
fi
fi
-%clean
-rm -rf $RPM_BUILD_ROOT
-
%files
%defattr(644,root,root,755)
-%doc CHANGES* *.html
+%doc CHANGES* *html *.txt Contrib nfields.pl
+%attr(755,root,root) %{_bindir}/*
%attr(755,root,root) %{_pkglibdir}/*
-%{_sysconfdir}/httpd/mod_watch.conf
+%{_sysconfdir}/mod_watch.conf