]> git.pld-linux.org Git - packages/smokeping.git/blobdiff - smokeping.spec
changed scripts used to generate _noautoreq
[packages/smokeping.git] / smokeping.spec
index 52d59b7ddf1dfb3be08bfdf8cee087a52be1c8a9..e5e774e8ac82e07fe3b3500cc9aab659f900be04 100644 (file)
@@ -1,36 +1,65 @@
-# TODO
-# - IMPORTANT: resolve permission problem for webserver access to /usr/sbin/fping
-# - generated config does not always match the used webserver vhost (don't autogenerate it at all?)
-# - finish -cgi and main files, afaik templates/ needed only by -cgi
-# - use .patch not decruft()
-# - IMPORTANT: use other user than root for daemon (uid=stats perhaps)
 %include       /usr/lib/rpm/macros.perl
 Summary:       Smokeping - a latency grapher that uses rrdtool
-Summary(pl):   Smokeping - narzêdzie do tworzenia wykresów opó¼nieñ sieci
+Summary(pl.UTF-8):     Smokeping - narzędzie do tworzenia wykresów opóźnień sieci
 Name:          smokeping
-Version:       2.0.5
-Release:       2.5
-License:       GPL v2
+Version:       2.6.11
+Release:       0.3
+License:       GPL v2+
 Group:         Networking/Utilities
-Source0:       http://people.ee.ethz.ch/~oetiker/webtools/smokeping/pub/%{name}-%{version}.tar.gz
-# Source0-md5: c965439c147012b91585c3e134225b4d
+Source0:       http://oss.oetiker.ch/smokeping/pub/%{name}-%{version}.tar.gz
+# Source0-md5: 702392f5f3599f7eb1cc47eb2d192cb9
 Source1:       %{name}.init
-Source2:       %{name}.conf
+Source2:       %{name}-apache.conf
 Source3:       %{name}-config
-URL:           http://people.ee.ethz.ch/~oetiker/webtools/smokeping/
+Source4:       %{name}-lighttpd.conf
+Source5:       %{name}.tmpfiles
+Source6:       %{name}-httpd.conf
+Patch0:                fix-paths.patch
+Patch1:                high_precision_sleep_timer.patch
+URL:           http://oss.oetiker.ch/smokeping/
+BuildRequires: perl-Config-Grammar
+BuildRequires: perl-rrdtool
 BuildRequires: perl-tools-pod
 BuildRequires: rpm-perlprov >= 4.1-13
-BuildRequires: rpmbuild(macros) >= 1.264
-BuildRequires: rrdtool
+BuildRequires: rpmbuild(macros) >= 1.268
 BuildRequires: sed >= 4.0
 Requires(post):        sed >= 4.0
 Requires(post,preun):  /sbin/chkconfig
-Requires:      fping
-Requires:      rc-scripts
+Requires(postun):      /usr/sbin/groupdel
+Requires(postun):      /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/lib/rpm/user_group.sh
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires(pre): /usr/sbin/usermod
+Requires(triggerpostun):       findutils
+Requires:      perl-Config-Grammar
+Requires:      rc-scripts >= 0.4.1.23
 Requires:      rrdtool >= 1.2
+Suggests:      bind-utils
+Suggests:      curl
+Suggests:      echoping
+Suggests:      fping
+Suggests:      openssh-clients
+Suggests:      traceroute
+Provides:      group(%{name})
+Provides:      user(%{name})
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define                _noautoprovfiles        %{_datadir}/%{name}
+%define                _noautoreq_perl         BER CGI::Session::Driver CGI::Session::Driver::DBI CGI::Session::ErrorHandler Config::Grammar Digest::HMAC Digest::HMAC_MD5 JSON JSON::Converter JSON::Parser Smokeping Smokeping::ciscoRttMonMIB Smokeping::Colorspace Smokeping::Config Smokeping::Examples Smokeping::Graphs Smokeping::Master Smokeping::matchers::Avgratio Smokeping::matchers::base Smokeping::probes::base Smokeping::probes::basefork Smokeping::probes::basevars Smokeping::probes::EchoPing Smokeping::probes::EchoPingHttp Smokeping::probes::EchoPingPlugin Smokeping::probes::FPing Smokeping::probes::passwordchecker Smokeping::RRDhelpers Smokeping::RRDtools Smokeping::Slave Smokeping::sorters::base SNMP_Session SNMP_util
+
+# How to obtain _noautoreq:
+# 1. comment out _noauto* macros
+# 2. repackage smokeping
+# 3. select Provides from repackage output
+# 4. xclip -o | sed 's/ perl/\nperl/g' | awk '{print $1}' | sort -u > perlprov
+# 5. select Requires from repackage output
+# 6. xclip -o | sed 's/ perl/\nperl/g' | awk '{print $1}' | sort -u > perlreq
+# 7. cat perlprov perlprov perlreq | awk '{print $1}' | sort | uniq -c | grep '^      2 ' | awk '{print $2}' | tr '\n' ' '
+
 %define                _sysconfdir     /etc/%{name}
 %define                _webapps        /etc/webapps
 %define                _webapp         %{name}
@@ -42,128 +71,117 @@ SmokePing is a ICMP latency logging and graphing system. It consists
 of a daemon process which organizes the latency measurements and a CGI
 which presents the graphs with interesting smoke-like effects.
 
-%description -l pl
-Smokeping jest narzêdziem do tworzenia wykresów aktywno¶ci sieci.
-U¿ywaj±c pakietów ICMP zapisuje czas odpowiedzi poszczególnych hostów
-i wywietla je w postaci czytelnego wykresu.
+%description -l pl.UTF-8
+Smokeping jest narzędziem do tworzenia wykresów aktywności sieci.
+Używając pakietów ICMP zapisuje czas odpowiedzi poszczególnych hostów
+i wyświetla je w postaci czytelnego wykresu.
 
 %package cgi
 Summary:       CGI webinterface for smokeping
-Summary(pl):   Interfejs WWW (CGI) do smokepinga
+Summary(pl.UTF-8):     Interfejs WWW (CGI) do smokepinga
 Group:         Applications/WWW
 Requires:      %{name} = %{version}-%{release}
 Requires:      webapps
+Requires:      webserver(access)
+Requires:      webserver(alias)
+Requires:      webserver(cgi)
+Conflicts:     apache-base < 2.4.0-1
 
 %description cgi
 CGI webinterface for smokeping.
 
-%description cgi -l pl
+%description cgi -l pl.UTF-8
 Interfejs WWW (CGI) do smokepinga.
 
 %prep
 %setup -q
 
-decruft() { %{__sed} -i -e "s|$1|$2|g" `grep -lr "$1" *` ;}
-
-# eliminate Tobi's quirks
-decruft /usr/sepp/bin %{_bindir}
-
-decruft /home/oetiker/data/projects/AADJ-smokeping/dist/etc    %{_sysconfdir}
-decruft /home/oetiker/data/projects/AADJ-smokeping/dist/lib    %{_datadir}/%{name}
+%patch0 -p1
+%patch1 -p1
 
-# rrdtool package goes into standard perl tree
-decruft '^use lib .*rrdtool.*;' ''
+#sed -i -e 's,^Net::.*$,,' PERL_MODULES
 
-# there's no SpeedyCGI for apache2? use regular perl...
-decruft %{_bindir}/speedy %{_bindir}/perl
-
-# working config in wrong location
-decruft "etc/config.dist" "%{_sysconfdir}/config"
-
-sed -i -e 's@^#!/usr/bin/perl-5.8.4@#!/usr/bin/perl@' bin/smokeping.dist
-sed -i -e 's#use lib qw(lib);#use lib qw(%{_datadir}/%{name});#' bin/smokeping.dist
+sed -i -e 's#@prefix@/etc/\(.*\).dist#/etc/smokeping/\1#' etc/config.dist.in
+sed -i -e 's#@prefix@/etc/#/etc/smokeping/#' etc/config.dist.in
 
 %build
+%configure \
+       --enable-pkgonly
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir},%{_sbindir}} \
+install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir}} \
        $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sharedstatedir}/%{name}/{img,rrd},%{_cgi_bindir}} \
-       $RPM_BUILD_ROOT%{_mandir}/man1
-
-install etc/basepage.html.dist $RPM_BUILD_ROOT%{_sysconfdir}/basepage.html
-install etc/config.dist $RPM_BUILD_ROOT%{_sysconfdir}
-#install etc/config-echoping.dist $RPM_BUILD_ROOT%{_sysconfdir}/config-echoping
-install etc/smokemail.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokemail
-install bin/smokeping.dist $RPM_BUILD_ROOT%{_sbindir}/smokeping
-install bin/tSmoke.dist $RPM_BUILD_ROOT%{_sbindir}/tSmoke
-install htdocs/smokeping.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
-cp -r lib/* $RPM_BUILD_ROOT%{_datadir}/%{name}
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
-install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
-install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
-install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
-install doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
+       $RPM_BUILD_ROOT{%{_mandir}/man{1,3,5,7},/var/run/%{name}} \
+       $RPM_BUILD_ROOT%{systemdtmpfilesdir}
 
-%clean
-rm -rf $RPM_BUILD_ROOT
+%{__make} install DESTDIR=$RPM_BUILD_ROOT
 
-%post
-if [ "$1" = "1" ]; then
-
-firstgate=`route -n |awk '$1=="0.0.0.0" && $4 ~ /G/ {print $2}' | head -n 1`
-echo "
-+ gateway
- menu   = Default Gateway
- title  = Default Gateway Router
- host   = $firstgate
-
-+ dns
- menu   = DNS Servers
- title  = Domain Name Servers
-        " >> %{_sysconfdir}/config
-for dns in `awk '$1 ~ /^nameserver/ {print $2}' /etc/resolv.conf | LC_ALL=C sort -u` ; do
-((dnscnt++))
-echo "++ dns$dnscnt
-  menu  = DNS Server $dnscnt
-  title = Domain Name Server $dnscnt
-  host  = $dns
-        " >> %{_sysconfdir}/config
+# start of fixing paths
+for f in basepage.html smokemail smokeping_secrets tmail; do
+    mv $RPM_BUILD_ROOT/etc/smokeping/{$f.dist,$f}
 done
 
-[ "$HOSTNAME" ] && %{__sed} -i -e "s|localhost|$HOSTNAME|g" %{_sysconfdir}/config
+rm -rf $RPM_BUILD_ROOT/etc/smokeping/examples
+
+mv $RPM_BUILD_ROOT%{_prefix}/lib/{*.pm,Smokeping} $RPM_BUILD_ROOT%{_datadir}/%{name}
+
+mv $RPM_BUILD_ROOT{%{_prefix}/htdocs/cropper,%{_cgi_bindir}}
+mv $RPM_BUILD_ROOT%{_bindir}/smokeping_cgi $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
+
+mv $RPM_BUILD_ROOT%{_mandir}/man1/{smokeping_cgi.1,smokeping.cgi.1}
+# end of fixing paths
+
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
+cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
+cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
 
-fi
 
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+%groupadd -g 207 %{name}
+%useradd -u 207 -d /var/lib/%{name} -g %{name} -s /bin/false -c "Smokeping User" %{name}
+%addusertogroup smokeping adm
+
+%post
 /sbin/chkconfig --add %{name}
-if [ -f /var/lock/subsys/%{name} ]; then
-       /etc/rc.d/init.d/%{name} restart 1>&2
-else
-       echo "Run \"/etc/rc.d/init.d/%{name} start\" to start smokeping."
-fi
 
 %preun
-if [ $1 = 0 ]; then
-       if [ -f /var/lock/subsys/%{name} ]; then
-               /etc/rc.d/init.d/%{name} stop 1>&2
-       fi
-
+if [ "$1" = 0 ]; then
+       %service %{name} stop
        /sbin/chkconfig --del %{name}
 fi
 
-%triggerin cgi -- apache1
+%postun
+if [ "$1" = 0 ]; then
+       %userremove %{name}
+       %groupremove %{name}
+fi
+
+%triggerin cgi -- apache1 < 1.3.37-3, apache1-base
 %webapp_register apache %{_webapp}
 
-%triggerun cgi -- apache1
+%triggerun cgi -- apache1 < 1.3.37-3, apache1-base
 %webapp_unregister apache %{_webapp}
 
-%triggerin cgi -- apache < 2.2.0, apache-base
+%triggerin cgi -- apache-base
 %webapp_register httpd %{_webapp}
 
-%triggerun cgi -- apache < 2.2.0, apache-base
+%triggerun cgi -- apache-base
 %webapp_unregister httpd %{_webapp}
 
+%triggerin cgi -- lighttpd
+%webapp_register lighttpd %{_webapp}
+
+%triggerun cgi -- lighttpd
+%webapp_unregister lighttpd %{_webapp}
+
 %triggerpostun -- %{name} < 2.0.5-0.3
 # we put trigger on main package, because we can't trigger in new package
 # this will create .rpmnew files when one installs -cgi package. but that's more than okay
@@ -172,31 +190,50 @@ if [ -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave ]; then
        mv -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave %{_wwwconfdir}/httpd.conf
 fi
 
-if [ -f /var/lock/subsys/httpd ]; then
-       /etc/rc.d/init.d/httpd reload 1>&2
-fi
+%service -q httpd reload
 
 %banner -e %{name} << EOF
 The CGI program is available as %{name}-cgi package.
 EOF
 
+%triggerpostun -- %{name} < 2.4.2-3
+find /var/lib/smokeping/rrd -type f -user root -group root -name \*.rrd -mtime -7 -exec chown smokeping \{\} \;
+find /var/lib/smokeping/rrd -type d -user root -group root -exec chown smokeping \{\} \;
+
 %files
 %defattr(644,root,root,755)
-%doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.txt doc/*.html
-%attr(755,root,root) %{_sbindir}/*
+%doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.txt doc/examples
+%attr(755,root,root) %{_bindir}/smokeinfo
+%attr(755,root,root) %{_bindir}/smokeping
+%attr(755,root,root) %{_bindir}/tSmoke
 %{_datadir}/smokeping
-%exclude %{_datadir}/smokeping/*.cgi
-%{_mandir}/man1/*.1*
+%exclude %{_cgi_bindir}/cropper
+%exclude %{_datadir}/smokeping/smokeping.*cgi
+%{_mandir}/man1/smokeping.1*
+%{_mandir}/man1/smokeping.cgi.1*
+%{_mandir}/man1/tSmoke.1*
+%{_mandir}/man3/*.3*
+%{_mandir}/man5/*.5*
+%{_mandir}/man7/*.7*
 %dir %{_sysconfdir}
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*
-%attr(754,root,root) /etc/rc.d/init.d/*
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/basepage.html
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.dist
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokemail
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokeping_secrets
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/tmail
+%attr(754,root,root) /etc/rc.d/init.d/smokeping
 %dir %{_sharedstatedir}/%{name}
-%{_sharedstatedir}/%{name}/rrd
+%dir %attr(775,root,smokeping) %{_sharedstatedir}/%{name}/rrd
 %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img
+%dir %attr(770,root,smokeping) /var/run/%{name}
+%{systemdtmpfilesdir}/%{name}.conf
 
 %files cgi
 %defattr(644,root,root,755)
 %dir %attr(750,root,http) %{_wwwconfdir}
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/apache.conf
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/httpd.conf
-%attr(755,root,root) %{_cgi_bindir}/*.cgi
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/lighttpd.conf
+%{_cgi_bindir}/cropper
+%attr(755,root,root) %{_cgi_bindir}/smokeping.cgi
This page took 0.048245 seconds and 4 git commands to generate.