smokeping.spec 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ##
  2. ## smokeping.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package information
  24. Name: smokeping
  25. Summary: Latency Logging and Graphing System
  26. URL: http://oss.oetiker.ch/smokeping/
  27. Vendor: Tobias Oetiker
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: PLUS
  31. Group: Mapping
  32. License: GPL
  33. Version: 2.4.0
  34. Release: 20080611
  35. # list of sources
  36. Source0: http://oss.oetiker.ch/smokeping/pub/smokeping-%{version}.tar.gz
  37. Source1: smokeping.conf
  38. Source2: smokeping.html
  39. Source3: rc.smokeping
  40. # build information
  41. Prefix: %{l_prefix}
  42. BuildRoot: %{l_buildroot}
  43. BuildPreReq: OpenPKG, openpkg >= 20060823
  44. PreReq: OpenPKG, openpkg >= 20060823
  45. PreReq: perl, perl-www, rrdtool, rrdtool::with_perl = yes, fping, MTA
  46. AutoReq: no
  47. AutoReqProv: no
  48. %description
  49. SmokePing is a latency logging and graphing system. It consists of
  50. a daemon process which organizes the latency measurements and a CGI
  51. which presents the graphs.
  52. %track
  53. prog smokeping = {
  54. version = %{version}
  55. url = http://oss.oetiker.ch/smokeping/pub/
  56. regex = smokeping-(__VER__)\.tar\.gz
  57. }
  58. %prep
  59. %setup -q
  60. # clean-up source tree
  61. find . -type f -name '.#*' -exec rm -f {} \;
  62. # fix paths
  63. %{l_shtool} subst \
  64. -e 's;^#!/.*$;#!%{l_prefix}/bin/perl;' \
  65. -e 's;^\(use lib qw(\)[^)]*rrdtool[^)]*\()\;.*\)$;\1%{l_prefix}/lib/smokeping\2;' \
  66. -e 's;^\(Smokeping::main("\).*\(")\;\)$;\1%{l_prefix}/etc/smokeping/smokeping.conf\2;' \
  67. -e 's;^\(Smokeping::cgi("\).*\(")\;\)$;\1%{l_prefix}/etc/smokeping/smokeping.conf\2;' \
  68. bin/smokeping.dist \
  69. htdocs/smokeping.cgi.dist
  70. %build
  71. :
  72. %install
  73. rm -rf $RPM_BUILD_ROOT
  74. # create directories
  75. %{l_shtool} mkdir -f -p -m 755 \
  76. $RPM_BUILD_ROOT%{l_prefix}/cgi \
  77. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping \
  78. $RPM_BUILD_ROOT%{l_prefix}/lib/smokeping \
  79. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  80. $RPM_BUILD_ROOT%{l_prefix}/share/smokeping \
  81. $RPM_BUILD_ROOT%{l_prefix}/var/smokeping/dat \
  82. $RPM_BUILD_ROOT%{l_prefix}/var/smokeping/img
  83. # install SmokePing
  84. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  85. bin/smokeping.dist \
  86. $RPM_BUILD_ROOT%{l_prefix}/sbin/smokeping
  87. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  88. htdocs/smokeping.cgi.dist \
  89. $RPM_BUILD_ROOT%{l_prefix}/cgi/smokeping
  90. ( cd lib
  91. umask 022
  92. %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/smokeping/
  93. ) || exit $?
  94. # install default configuration
  95. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  96. %{SOURCE smokeping.conf} \
  97. %{SOURCE smokeping.html} \
  98. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping/
  99. %{l_shtool} mkln -s \
  100. ../../etc/smokeping/smokeping.html \
  101. $RPM_BUILD_ROOT%{l_prefix}/share/smokeping/
  102. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  103. etc/smokemail.dist \
  104. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping/smokemail
  105. # install run-command script
  106. %{l_shtool} mkdir -f -p -m 755 \
  107. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  108. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  109. %{SOURCE rc.smokeping} \
  110. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  111. # determine installation files
  112. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  113. '%config %{l_prefix}/etc/smokeping/*' \
  114. '%dir %attr(1777,%{l_mgrp},%{l_mgrp}) %{l_prefix}/var/smokeping/img'
  115. %files -f files
  116. %clean
  117. rm -rf $RPM_BUILD_ROOT
  118. %post
  119. # after upgrade, restart service
  120. [ $1 -eq 2 ] || exit 0
  121. eval `%{l_rc} smokeping status 2>/dev/null`
  122. [ ".$smokeping_active" = .yes ] && %{l_rc} smokeping restart
  123. exit 0
  124. %preun
  125. # before erase, stop service and remove archvies and image caches
  126. [ $1 -eq 0 ] || exit 0
  127. %{l_rc} smokeping stop 2>/dev/null
  128. rm -rf $RPM_INSTALL_PREFIX/var/smokeping/dat/* >/dev/null 2>&1 || true
  129. rm -rf $RPM_INSTALL_PREFIX/var/smokeping/img/* >/dev/null 2>&1 || true
  130. exit 0