Advertisement
RobertBerger

github.com-influxdata-telegraf_1.18.0.bb

Mar 18th, 2021
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. DESCRIPTION = "Telegraf"
  2. SUMMARY = "Telegraf is the open source server agent to help you collect metrics from your stacks, sensors and systems."
  3. HOMEPAGE = "https://www.influxdata.com/time-series-platform/telegraf/"
  4.  
  5. LICENSE = "MIT"
  6. LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=c5d3aeddd4f7a4c4993bbdc4a41aec44"
  7.  
  8. GO_IMPORT = "github.com/influxdata/telegraf"
  9.  
  10. #GOBUILDFLAGS_remove = "-buildmode=pie"
  11. # don't check out modules read only - se we can clean/cleanall
  12. GOBUILDFLAGS_append = " -modcacherw"
  13. inherit go go-mod
  14.  
  15. BRANCH = "nobranch=1"
  16. SRCREV = "ac5c7f6a1a7402b6825857939fb02014300cb16a"
  17.  
  18. SRC_URI = "git://github.com/influxdata/telegraf;${BRANCH};protocol=https;destsuffix=${BPN}-${PV}/src/${GO_IMPORT}"
  19. #
  20. # file://influxdb.service \
  21. # file://influxdb.conf \
  22. #"
  23.  
  24. # I think we need go-native for ${GO} underneath
  25. # I thought that inherit go would take care about it
  26. do_compile[depends] += "go-native:do_populate_sysroot"
  27.  
  28. #export GO111MODULE="on"
  29. export CGO_ENABLED="1"
  30.  
  31. # custom do_compile, which is similar to building it
  32. # from commandline
  33. do_compile() {
  34. ${GO} build ./cmd/telegraf
  35. }
  36.  
  37. SRC_ROOT="${S}/src/${GO_IMPORT}"
  38.  
  39. do_install_append() {
  40. # --> etc
  41. # /etc
  42. install -d ${D}${sysconfdir}/logrotate.d
  43. install -d ${D}${sysconfdir}/telegraf
  44. install -d ${D}${sysconfdir}/telegraf/telegraf.d
  45.  
  46. install -m 0644 ${SRC_ROOT}/etc/logrotate.d/telegraf ${D}${sysconfdir}/logrotate.d/
  47. install -m 0644 ${SRC_ROOT}/etc/telegraf.conf ${D}${sysconfdir}/telegraf/
  48. # <-- etc
  49.  
  50. # --> telegraf exe
  51. # /usr/bin
  52. install -d ${D}${bindir}
  53.  
  54. # if I build it this funny way (as by hand) the exe ends up here:
  55. install -m 0755 ${SRC_ROOT}/telegraf ${D}${bindir}/
  56. # <-- telegraf exe
  57.  
  58. # --> sysvinit
  59. # Only install the script if 'sysvinit' is in DISTRO_FEATURES
  60. # systemd would be the other choice
  61. if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
  62. install -d ${D}${sysconfdir}/init.d/
  63. # not sure we always have bash, so we replace it with /bin/sh
  64. # please note, that below we created a telegraf user/group for this to work
  65. sed -i 's,#! /usr/bin/env bash,#! /bin/sh,g' ${SRC_ROOT}/scripts/init.sh
  66. install -D -m 0755 ${SRC_ROOT}/scripts/init.sh ${D}${sysconfdir}/init.d/telegraf
  67. fi
  68. # <-- sysvinit
  69.  
  70. # --> systemd
  71. # Only install the script if 'systemd' is in DISTRO_FEATURES
  72. # systemd
  73. if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd','true','false',d)}; then
  74. install -d ${D}${systemd_unitdir}/system
  75. # please note, that below we created a telegraf user/group for this to work
  76. install -m 0644 ${SRC_ROOT}/scripts/telegraf.service ${D}${systemd_unitdir}/system/telegraf.service
  77. fi
  78. # <-- systemd
  79.  
  80. # /var - for /var/log/telegraf/telegraf.log
  81. install -d ${D}${localstatedir}/log/telegraf
  82. }
  83.  
  84. # fix a qa issue:
  85. RDEPENDS_${PN}-dev += "\
  86. bash \
  87. "
  88.  
  89. # --> we need a more complete ps for init script
  90. RDEPENDS_${PN} += "procps"
  91. # <-- we need a more complete ps for init script
  92.  
  93. # --> user/group
  94. inherit useradd
  95.  
  96. # create telegraf group
  97. # --system create a system account
  98. GROUPADD_PARAM_${PN} = "--system telegraf"
  99.  
  100. # create telegraf user
  101. # --system create a system account
  102. # --gid GROUP name or ID of the primary group of the new
  103. # account
  104. USERADD_PARAM_${PN} += "telegraf \
  105. --system \
  106. --gid telegraf \
  107. "
  108. # USERADD_PACKAGES specifies the output packages
  109. # which include custom users/groups.
  110. USERADD_PACKAGES = "${PN}"
  111. # <-- user/group
  112.  
  113.  
  114. # --> systemd service
  115. # please note, that above we already copy files depeding on sysvinit/systemd
  116. #REQUIRED_DISTRO_FEATURES= "systemd"
  117. inherit systemd
  118. SYSTEMD_AUTO_ENABLE = "enable"
  119. # disable for manual testing
  120. # e.g. on target:
  121. # systemctl start telegraf.service
  122. #SYSTEMD_AUTO_ENABLE = "disable"
  123. SYSTEMD_PACKAGES = "${PN}"
  124. SYSTEMD_SERVICE_${PN} = "${PN}.service"
  125. # <-- systemd service
  126.  
  127. # --> sysvinit scripts
  128. # please note, that above we already copy files depeding on sysvinit/systemd
  129. INITSCRIPT_PACKAGES = "${PN}"
  130. INITSCRIPT_NAME_${PN} = "${PN}"
  131. # script has a runlevel of: 99
  132. # starts in initlevels: 2 3 4 5
  133. # stops in initlevels: 0 1 6
  134. INITSCRIPT_PARAMS_${PN} = "start 99 2 3 4 5 . stop 99 0 1 6 ."
  135. # <-- sysvinit scripts
  136.  
  137.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement