smokeping.spec 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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.0.1
  35. Release: 20050905
  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/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. # fix typo
  71. %{l_shtool} subst \
  72. -e 's;attache ;attached ;g' \
  73. etc/smokemail.dist
  74. %build
  75. :
  76. %install
  77. rm -rf $RPM_BUILD_ROOT
  78. # create directories
  79. %{l_shtool} mkdir -f -p -m 755 \
  80. $RPM_BUILD_ROOT%{l_prefix}/cgi/smokeping \
  81. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping \
  82. $RPM_BUILD_ROOT%{l_prefix}/lib/smokeping \
  83. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  84. $RPM_BUILD_ROOT%{l_prefix}/share/smokeping \
  85. $RPM_BUILD_ROOT%{l_prefix}/var/smokeping/dat \
  86. $RPM_BUILD_ROOT%{l_prefix}/var/smokeping/img
  87. # install SmokePing
  88. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  89. bin/smokeping.dist \
  90. $RPM_BUILD_ROOT%{l_prefix}/sbin/smokeping
  91. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  92. htdocs/smokeping.cgi.dist \
  93. $RPM_BUILD_ROOT%{l_prefix}/cgi/smokeping/smokeping.cgi
  94. ( cd lib
  95. umask 022
  96. %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/smokeping/
  97. ) || exit $?
  98. # install default configuration
  99. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  100. %{SOURCE smokeping.conf} \
  101. %{SOURCE smokeping.html} \
  102. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping/
  103. %{l_shtool} mkln -s \
  104. ../../etc/smokeping/smokeping.html \
  105. $RPM_BUILD_ROOT%{l_prefix}/share/smokeping/
  106. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  107. etc/smokemail.dist \
  108. $RPM_BUILD_ROOT%{l_prefix}/etc/smokeping/smokemail
  109. # install run-command script
  110. %{l_shtool} mkdir -f -p -m 755 \
  111. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  112. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  113. %{SOURCE rc.smokeping} \
  114. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  115. # determine installation files
  116. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  117. '%config %{l_prefix}/etc/smokeping/*' \
  118. '%dir %attr(1777,%{l_mgrp},%{l_mgrp}) %{l_prefix}/var/smokeping/img'
  119. %files -f files
  120. %clean
  121. rm -rf $RPM_BUILD_ROOT
  122. %post
  123. # after upgrade, restart service
  124. [ $1 -eq 2 ] || exit 0
  125. eval `%{l_rc} smokeping status 2>/dev/null`
  126. [ ".$lighttpd_active" = .yes ] && %{l_rc} smokeping restart
  127. exit 0
  128. %preun
  129. # before erase, stop service and remove archvies and image caches
  130. [ $1 -eq 0 ] || exit 0
  131. %{l_rc} smokeping stop 2>/dev/null
  132. rm -rf $RPM_INSTALL_PREFIX/var/smokeping/dat/* >/dev/null 2>&1 || true
  133. rm -rf $RPM_INSTALL_PREFIX/var/smokeping/img/* >/dev/null 2>&1 || true
  134. exit 0