fluentd.spec 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ##
  2. ## fluentd.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2022 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 information
  24. Name: fluentd
  25. Summary: Log Collector Daemon
  26. URL: https://fluentd.org/
  27. Vendor: FURUHASHI Sadayuki, NAKAGAWA Masahiro
  28. Packager: OpenPKG Project
  29. Distribution: OpenPKG Community
  30. Class: EVAL
  31. Group: Logging
  32. License: Apache
  33. Version: 1.14.6
  34. Release: 20220429
  35. # list of sources
  36. Source0: http://download.openpkg.org/components/versioned/fluentd/fluentd-%{version}.tar.xz
  37. Source1: fluentd.conf
  38. Source2: rc.fluentd
  39. # build information
  40. BuildPreReq: OpenPKG, openpkg >= 20160101, ruby, ruby-gems
  41. PreReq: OpenPKG, openpkg >= 20160101, ruby
  42. %description
  43. Fluentd collects events from various data sources and writes them to
  44. files, RDBMS, NoSQL, IaaS, SaaS, Hadoop and so on. Fluentd helps you
  45. unify your logging infrastructure.
  46. %track
  47. prog fluentd = {
  48. version = %{version}
  49. url = https://github.com/fluent/fluentd/releases
  50. regex = v(\d+\.\d+\.\d+)\.tar\.gz
  51. }
  52. %prep
  53. %setup -q
  54. %build
  55. %install
  56. # install program
  57. %{l_prefix}/bin/gem install \
  58. --local \
  59. --force \
  60. --build-root $RPM_BUILD_ROOT \
  61. *.gem
  62. # install default configuration
  63. %{l_shtool} mkdir -p -m 755 \
  64. $RPM_BUILD_ROOT%{l_prefix}/etc/fluentd
  65. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  66. %{SOURCE fluentd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/fluentd/
  67. # install run-command script
  68. %{l_shtool} mkdir -p -m 755 \
  69. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  70. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  71. %{SOURCE rc.fluentd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  72. # create run-time directories
  73. %{l_shtool} mkdir -p -m 755 \
  74. $RPM_BUILD_ROOT%{l_prefix}/var/fluentd/log \
  75. $RPM_BUILD_ROOT%{l_prefix}/var/fluentd/run
  76. # determine installation files
  77. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  78. %{l_files_std} \
  79. '%config %{l_prefix}/etc/fluentd/*' \
  80. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/fluentd' \
  81. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/fluentd/*'
  82. %files -f files
  83. %clean
  84. %post
  85. if [ $1 -eq 2 ]; then
  86. # after upgrade, restart service
  87. eval `%{l_rc} fluentd status 2>/dev/null`
  88. [ ".$fluentd_active" = .yes ] && %{l_rc} fluentd restart
  89. fi
  90. exit 0
  91. %preun
  92. if [ $1 -eq 0 ]; then
  93. # stop service and remove run-time files
  94. %{l_rc} fluentd stop 2>/dev/null
  95. rm -f $RPM_INSTALL_PREFIX/var/fluentd/log/* >/dev/null 2>&1 || true
  96. rm -f $RPM_INSTALL_PREFIX/var/fluentd/run/* >/dev/null 2>&1 || true
  97. fi
  98. exit 0