supervisord-go.spec 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ##
  2. ## supervisord-go.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/>
  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 version
  24. %define V_opkg 0.6.8
  25. %define V_dist 20200830
  26. # package information
  27. Name: supervisord-go
  28. Summary: Supervisor Daemon (Go Version)
  29. URL: https://github.com/ochinchina/supervisord
  30. Vendor: Steven Ou
  31. Packager: OpenPKG Project
  32. Distribution: OpenPKG Community
  33. Class: EVAL
  34. Group: System
  35. License: MIT
  36. Version: %{V_opkg}.%{V_dist}
  37. Release: 20200830
  38. # list of sources
  39. Source0: http://download.openpkg.org/components/versioned/supervisord/supervisord-%{V_dist}.tar.xz
  40. Source1: rc.supervisord
  41. Source2: supervisord.conf
  42. Patch0: supervisord-go.patch
  43. # build information
  44. BuildPreReq: OpenPKG, openpkg >= 20160101, go
  45. PreReq: OpenPKG, openpkg >= 20160101
  46. %description
  47. Supervisor is a client/server system that allows its users to
  48. monitor and control a number of processes on UNIX-like operating
  49. systems. This is the Go-based re-implementation of the original
  50. Python-based implementation for small environments.
  51. %track
  52. prog supervisord-go:release = {
  53. version = %{V_opkg}
  54. url = https://github.com/ochinchina/supervisord/releases
  55. regex = v(\d+\.\d+\.\d+)\.tar\.gz
  56. }
  57. prog supervisord-go:snapshot = {
  58. version = %{V_dist}
  59. url = http://download.openpkg.org/components/versioned/supervisord/
  60. regex = supervisord-(__VER__)\.tar\.xz
  61. }
  62. %prep
  63. %setup -q -n supervisord
  64. %patch -p0
  65. %build
  66. # build program
  67. export GOPATH=`pwd`
  68. cd src/github.com/ochinchina/supervisord
  69. go build -v
  70. %install
  71. # create installation hierarchy
  72. %{l_shtool} mkdir -f -p -m 755 \
  73. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  74. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  75. $RPM_BUILD_ROOT%{l_prefix}/etc/supervisord \
  76. $RPM_BUILD_ROOT%{l_prefix}/etc/supervisord/supervisord.d \
  77. $RPM_BUILD_ROOT%{l_prefix}/var/supervisord/log \
  78. $RPM_BUILD_ROOT%{l_prefix}/var/supervisord/run
  79. # install program
  80. %{l_shtool} install -c -s -m 755 \
  81. src/github.com/ochinchina/supervisord/supervisord \
  82. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  83. # install configuration
  84. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  85. %{SOURCE supervisord.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/supervisord/
  86. # install run-command script
  87. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  88. %{SOURCE rc.supervisord} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  89. # determine installation files
  90. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  91. %{l_files_std} \
  92. '%config %{l_prefix}/etc/supervisord/*'
  93. %files -f files
  94. %clean
  95. %post
  96. if [ $1 -eq 2 ]; then
  97. # after upgrade, restart service
  98. eval `%{l_rc} supervisord status 2>/dev/null`
  99. [ ".$supervisord_active" = .yes ] && %{l_rc} supervisord restart
  100. fi
  101. exit 0
  102. %preun
  103. if [ $1 -eq 0 ]; then
  104. # stop service
  105. %{l_rc} supervisord stop 2>/dev/null
  106. # remove run-time files
  107. rm -f $RPM_INSTALL_PREFIX/var/supervisord/log/* >/dev/null 2>&1 || true
  108. rm -f $RPM_INSTALL_PREFIX/var/supervisord/run/* >/dev/null 2>&1 || true
  109. fi
  110. exit 0