monit.spec 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. ##
  2. ## monit.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2017 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: monit
  25. Summary: Service Monitoring Daemon
  26. URL: http://mmonit.com/monit/
  27. Vendor: Jan-Henrik Haukeland et al.
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: BASE
  31. Group: Monitoring
  32. License: GPL
  33. Version: 5.24.0
  34. Release: 20170925
  35. # package options
  36. %option with_fsl yes
  37. %option with_ssl no
  38. # list of sources
  39. Source0: http://mmonit.com/monit/dist/monit-%{version}.tar.gz
  40. Source1: rc.monit
  41. Source2: fsl.monit
  42. Source3: monitrc
  43. Patch0: monit.patch
  44. # build information
  45. BuildPreReq: OpenPKG, openpkg >= 20160101, make, gcc, bison, flex
  46. PreReq: OpenPKG, openpkg >= 20160101
  47. %if "%{with_fsl}" == "yes"
  48. BuildPreReq: fsl
  49. PreReq: fsl
  50. %endif
  51. %if "%{with_ssl}" == "yes"
  52. BuildPreReq: openssl
  53. PreReq: openssl
  54. %endif
  55. %description
  56. Monit is a utility for monitoring and managing daemons or similar
  57. programs running on a Unix system. It will start specified programs
  58. if they are not running and restart programs not responding.
  59. %track
  60. prog monit = {
  61. version = %{version}
  62. url = http://mmonit.com/monit/dist/
  63. regex = monit-(__VER__)\.tar\.gz
  64. }
  65. %prep
  66. # unpack and patch distribution
  67. %setup -q
  68. %patch -p0
  69. %{l_shtool} subst %{l_value -s -a} \
  70. src/file.c monit.1
  71. %{l_shtool} subst \
  72. -e 's;piddir=;dummy=;g' \
  73. configure
  74. %build
  75. # configure program
  76. cppflags=""
  77. libs=""
  78. options=""
  79. case "%{l_platform -t}" in
  80. *-sunos5.6 )
  81. cppflags="-Dsocklen_t=int"
  82. libs="-lkstat"
  83. ;;
  84. *-sunos* )
  85. options="--without-largefiles"
  86. ;;
  87. esac
  88. CC="%{l_cc}" \
  89. CFLAGS="%{l_cflags -O}" \
  90. CPPFLAGS="%{l_cppflags} $cppflags" \
  91. LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
  92. LIBS="%{l_fsl_libs} $libs" \
  93. GREP="grep" \
  94. piddir="%{l_prefix}/var/monit" \
  95. ./configure \
  96. --prefix=%{l_prefix} \
  97. --mandir=%{l_prefix}/man \
  98. %if "%{with_ssl}" == "yes"
  99. --with-ssl \
  100. --with-ssl-dir=%{l_prefix} \
  101. %else
  102. --without-ssl \
  103. %endif
  104. $options
  105. # build program
  106. %{l_make} %{l_mflags -O}
  107. %install
  108. # install program
  109. %{l_make} %{l_mflags} install \
  110. DESTDIR="$RPM_BUILD_ROOT" \
  111. INSTALL="%{l_shtool} install -c"
  112. # install run-command script
  113. %{l_shtool} mkdir -f -p -m 755 \
  114. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  115. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  116. %{SOURCE rc.monit} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  117. # install default configuration
  118. %{l_shtool} mkdir -f -p -m 755 \
  119. $RPM_BUILD_ROOT%{l_prefix}/etc/monit
  120. %{l_shtool} install -c -m 600 %{l_value -s -a} \
  121. %{SOURCE monitrc} $RPM_BUILD_ROOT%{l_prefix}/etc/monit/
  122. # create empty run-time directory
  123. %{l_shtool} mkdir -f -p -m 755 \
  124. $RPM_BUILD_ROOT%{l_prefix}/var/monit
  125. # install OSSP fsl configuration
  126. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  127. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  128. %{SOURCE fsl.monit} \
  129. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  130. # determine installation files
  131. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  132. %{l_files_std} \
  133. '%config %{l_prefix}/etc/fsl/fsl.monit' \
  134. '%config %attr(0600,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/monit/*'
  135. %files -f files
  136. %clean
  137. %post
  138. # after upgrade, restart service
  139. [ $1 -eq 2 ] || exit 0
  140. eval `%{l_rc} monit status 2>/dev/null`
  141. [ ".$monit_active" = .yes ] && %{l_rc} monit restart
  142. exit 0
  143. %preun
  144. # before erase, stop service and remove log files
  145. [ $1 -eq 0 ] || exit 0
  146. %{l_rc} monit stop 2>/dev/null
  147. rm -f $RPM_INSTALL_PREFIX/var/monit/*
  148. exit 0