smokeping.spec 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. ##
  2. ## smokeping.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2005 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: smokeping
  26. Summary: Latency Logging and Graphing System
  27. URL: http://people.ee.ethz.ch/~oetiker/webtools/smokeping/
  28. Vendor: Tobias Oetiker
  29. Packager: OpenPKG
  30. Distribution: OpenPKG
  31. Class: EVAL
  32. Group: Network
  33. License: GPL
  34. Version: 2.0rc5
  35. Release: 20050601
  36. # list of sources
  37. Source0: http://people.ee.ethz.ch/~oetiker/webtools/smokeping/pub/smokeping-%{version}.tar.gz
  38. Source1: smokeping.conf
  39. Source2: smokeping.html
  40. Source3: rc.smokeping
  41. # build information
  42. Prefix: %{l_prefix}
  43. BuildRoot: %{l_buildroot}
  44. BuildPreReq: OpenPKG, openpkg >= 20040130
  45. PreReq: OpenPKG, openpkg >= 20040130, perl, rrdtool, 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://people.ee.ethz.ch/~oetiker/webtools/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\2;' \
  66. -e 's;^\(use lib qw(\)[^)]*smokeping[^)]*\()\;.*\)$;\1%{l_prefix}/lib/smokeping\2;' \
  67. -e 's;^\(Smokeping::main("\).*\(")\;\)$;\1%{l_prefix}/etc/smokeping/smokeping.conf\2;' \
  68. -e 's;^\(Smokeping::cgi("\).*\(")\;\)$;\1%{l_prefix}/etc/smokeping/smokeping.conf\2;' \
  69. bin/smokeping.dist \
  70. htdocs/smokeping.cgi.dist
  71. # fix typo
  72. %{l_shtool} subst \
  73. -e 's;attache ;attached ;g' \
  74. etc/smokemail.dist
  75. %build
  76. :
  77. %install
  78. rm -rf $RPM_BUILD_ROOT
  79. # create directories
  80. %{l_shtool} mkdir -f -p -m 755 \
  81. $RPM_BUILD_ROOT%{l_prefix}/cgi/smokeping \
  82. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping \
  83. $RPM_BUILD_ROOT%{l_prefix}/lib/smokeping \
  84. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  85. $RPM_BUILD_ROOT%{l_prefix}/share/smokeping \
  86. $RPM_BUILD_ROOT%{l_prefix}/var/smokeping/dat \
  87. $RPM_BUILD_ROOT%{l_prefix}/var/smokeping/img
  88. # install SmokePing
  89. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  90. bin/smokeping.dist \
  91. $RPM_BUILD_ROOT%{l_prefix}/sbin/smokeping
  92. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  93. htdocs/smokeping.cgi.dist \
  94. $RPM_BUILD_ROOT%{l_prefix}/cgi/smokeping/smokeping.cgi
  95. ( cd lib
  96. umask 022
  97. %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/smokeping/
  98. ) || exit $?
  99. # install default configuration
  100. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  101. %{SOURCE smokeping.conf} \
  102. %{SOURCE smokeping.html} \
  103. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping/
  104. %{l_shtool} mkln -s \
  105. ../../etc/smokeping/smokeping.html \
  106. $RPM_BUILD_ROOT%{l_prefix}/share/smokeping/
  107. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  108. etc/smokemail.dist \
  109. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping/smokemail
  110. # install run-command script
  111. %{l_shtool} mkdir -f -p -m 755 \
  112. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  113. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  114. %{SOURCE rc.smokeping} \
  115. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  116. # determine installation files
  117. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  118. '%config %{l_prefix}/etc/smokeping/*' \
  119. '%dir %attr(1777,%{l_mgrp},%{l_mgrp}) %{l_prefix}/var/smokeping/img'
  120. %files -f files
  121. %clean
  122. rm -rf $RPM_BUILD_ROOT
  123. %post
  124. # after upgrade, restart service
  125. [ $1 -eq 2 ] || exit 0
  126. eval `%{l_rc} smokeping status 2>/dev/null`
  127. [ ".$lighttpd_active" = .yes ] && %{l_rc} smokeping restart
  128. exit 0
  129. %preun
  130. # before erase, stop service and remove archvies and image caches
  131. [ $1 -eq 0 ] || exit 0
  132. %{l_rc} smokeping stop 2>/dev/null
  133. rm -rf $RPM_INSTALL_PREFIX/var/smokeping/dat/* >/dev/null 2>&1 || true
  134. rm -rf $RPM_INSTALL_PREFIX/var/smokeping/img/* >/dev/null 2>&1 || true
  135. exit 0