add systemd support
This commit is contained in:
parent
e180dcc784
commit
7d6e9c0bd6
48
mrtg.spec
48
mrtg.spec
@ -6,13 +6,12 @@
|
||||
Summary: Multi Router Traffic Grapher
|
||||
Name: mrtg
|
||||
Version: 2.17.2
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
URL: http://oss.oetiker.ch/mrtg/
|
||||
Source0: http://oss.oetiker.ch/mrtg/pub/mrtg-%{version}.tar.gz
|
||||
Source1: http://oss.oetiker.ch/mrtg/pub/mrtg-%{version}.tar.gz.md5
|
||||
Source2: mrtg.cfg
|
||||
Source3: filter-requires-mrtg.sh
|
||||
Source4: mrtg.crond.in
|
||||
Source5: mrtg-httpd.conf
|
||||
Source6: filter-provides-mrtg.sh
|
||||
Source7: mrtg.tmpfiles
|
||||
@ -21,13 +20,13 @@ Source9: mrtg.timer
|
||||
Patch0: mrtg-2.15.0-lib64.patch
|
||||
License: GPLv2+
|
||||
Group: Applications/Internet
|
||||
Requires: vixie-cron
|
||||
Requires(post): /sbin/service
|
||||
Requires(postun): /sbin/service
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
Requires: perl-Socket6 perl-IO-Socket-INET6
|
||||
Requires: gd
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: gd-devel, libpng-devel
|
||||
BuildRequires: systemd-units
|
||||
|
||||
%global __find_requires %{SOURCE3}
|
||||
%global __find_provides %{SOURCE6}
|
||||
@ -61,7 +60,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/mrtg
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.d
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/mrtg
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lock/mrtg
|
||||
mkdir -p $RPM_BUILD_ROOT%{contentdir}
|
||||
@ -71,10 +69,6 @@ install -m 644 images/* $RPM_BUILD_ROOT%{contentdir}/
|
||||
sed 's,@CONTENTDIR@,%{contentdir},g; s,@LIBDIR@,%{_localstatedir}/lib/mrtg,g' \
|
||||
%{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/mrtg/mrtg.cfg
|
||||
chmod 644 $RPM_BUILD_ROOT%{_sysconfdir}/mrtg/mrtg.cfg
|
||||
sed -e 's,@bindir@,%{_bindir},g; s,@sysconfdir@,%{_sysconfdir},g;' \
|
||||
-e 's,@localstatedir@,%{_localstatedir},g' %{SOURCE4} \
|
||||
> $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/mrtg
|
||||
chmod 644 $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/mrtg
|
||||
|
||||
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/mrtg.conf
|
||||
|
||||
@ -84,8 +78,8 @@ install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/mrtg.conf
|
||||
|
||||
# install systemd files
|
||||
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
|
||||
install -p -m 644 %{SOURCE8} $RPM_BUILD_ROOT/lib/systemd/system/mrtg.service
|
||||
install -p -m 644 %{SOURCE9} $RPM_BUILD_ROOT/lib/systemd/system/mrtg.timer
|
||||
install -p -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_unitdir}/mrtg.service
|
||||
install -p -m 644 %{SOURCE9} $RPM_BUILD_ROOT%{_unitdir}/mrtg.timer
|
||||
|
||||
# Add mrtg-traffic-sum here when upstream decides to install it
|
||||
for i in mrtg cfgmaker indexmaker mrtg-traffic-sum; do
|
||||
@ -94,28 +88,32 @@ done
|
||||
|
||||
sed -i 's;@@lib@@;%{_lib};g' "$RPM_BUILD_ROOT"%{_mandir}/man1/*.1
|
||||
|
||||
# Tell crond to reload its configuration.
|
||||
%post
|
||||
install -d -m 0755 -o root -g root /var/lock/mrtg
|
||||
/sbin/service crond condrestart 2>&1 > /dev/null || :
|
||||
if [ $1 -eq 1 ] ; then
|
||||
# Initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
rm -rf /var/lock/mrtg
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable mrtg.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop mrtg.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
/sbin/service crond condrestart 2>&1 > /dev/null || :
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
# Package upgrade, not uninstall
|
||||
/bin/systemctl try-restart mrtg.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc contrib CHANGES COPYING COPYRIGHT README THANKS
|
||||
%dir %{_sysconfdir}/mrtg
|
||||
%config(noreplace) %{_sysconfdir}/mrtg/mrtg.cfg
|
||||
%config(noreplace) %{_sysconfdir}/cron.d/mrtg
|
||||
%config(noreplace) %{_sysconfdir}/httpd/conf.d/mrtg.conf
|
||||
%{contentdir}
|
||||
%{_bindir}/*
|
||||
@ -129,10 +127,14 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%config(noreplace) %{_sysconfdir}/tmpfiles.d/mrtg.conf
|
||||
%endif
|
||||
%ghost /var/lock/mrtg
|
||||
/lib/systemd/system/mrtg.service
|
||||
/lib/systemd/system/mrtg.timer
|
||||
%{_unitdir}/mrtg.service
|
||||
%{_unitdir}/mrtg.timer
|
||||
|
||||
%changelog
|
||||
* Thu Sep 8 2011 Tom Callaway <spot@fedoraproject.org> - 2.17.2-4
|
||||
- add missing systemd scriptlets
|
||||
- drop cron.d config (systemd handles it now)
|
||||
|
||||
* Wed Aug 24 2011 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.17.2-3
|
||||
- Ship systemd files
|
||||
Resolves: #696147
|
||||
|
Loading…
Reference in New Issue
Block a user