Advertisement
RobertBerger

Untitled

Jul 5th, 2021
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.35 KB | None | 0 0
  1. -----
  2. cat grafana_8.0.4.bb
  3. require grafana.inc
  4.  
  5. # --> armv7
  6. SRC_URI_armv7a = "https://dl.grafana.com/oss/release/${BPN}-${PV}.linux-armv7.tar.gz;\
  7. sha256sum=5e801cef79c6e92ef51d0fc7fb7330b342fc082bcf089bea68060a38206d3253 \
  8. file://LICENSE"
  9.  
  10. SRC_URI_einstein = "https://dl.grafana.com/oss/release/${BPN}-${PV}.linux-armv7.tar.gz;\
  11. sha256sum=5e801cef79c6e92ef51d0fc7fb7330b342fc082bcf089bea68060a38206d3253 \
  12. file://LICENSE"
  13.  
  14. SRC_URI_imx6q-phytec-mira-rdk-nand = "https://dl.grafana.com/oss/release/${BPN}-${PV}.linux-armv7.tar.gz;\
  15. sha256sum=5e801cef79c6e92ef51d0fc7fb7330b342fc082bcf089bea68060a38206d3253 \
  16. file://LICENSE"
  17.  
  18. # <-- armv7
  19.  
  20. # --> amd64
  21. SRC_URI_x86-64 = "https://dl.grafana.com/oss/release/${BPN}-${PV}.linux-amd64.tar.gz;\
  22. sha256sum=194567c3690ac557f3b6f7ec34cc112f13d3a916336f15f3a07d86926641d891 \
  23. file://LICENSE"
  24. # <-- amd64
  25.  
  26. LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=31f6db4579f7bbf48d02bff8c5c3a6eb"
  27.  
  28. LICENSE = "Apache-2.0"
  29.  
  30. #DEPENDS_x86-64 = "zlib fontconfig freetype"
  31. -----
  32. cat grafana.inc
  33. DESCRIPTION = "The tool for beautiful monitoring and metric analytics & dashboards for Graphite, InfluxDB & Prometheus & More"
  34.  
  35. SRC_URI_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://grafana.service', 'file://init.d-grafana-server', d)}"
  36.  
  37. SRC_URI_append = " file://grafana-server"
  38.  
  39. # --> user/group
  40. inherit useradd
  41.  
  42. # create grafana group
  43. # --system create a system account
  44. GROUPADD_PARAM_${PN} = "--system grafana"
  45.  
  46. # create influxdb user
  47. # --system create a system account
  48. # --gid GROUP name or ID of the primary group of the new
  49. # account
  50. USERADD_PARAM_${PN} += "grafana \
  51. --system \
  52. --no-create-home \
  53. --home-dir /var/run/${BPN} \
  54. --shell /bin/false \
  55. --gid grafana \
  56. "
  57. ##########################################################
  58. # e.g.
  59. #
  60. # id grafana
  61. # uid=996(grafana) gid=995(grafana) groups=995(grafana)
  62. #
  63. # cat /etc/group | grep grafana
  64. # grafana:x:995:
  65. #
  66. # cat /etc/passwd | grep grafana
  67. # grafana:x:996:995::/var/run/grafana:/bin/false
  68. #
  69. # cat /etc/shadow | grep grafana
  70. # grafana:!:18810:0:99999:7:::
  71. ##########################################################
  72.  
  73. # USERADD_PACKAGES specifies the output packages
  74. # which include custom users/groups.
  75. USERADD_PACKAGES = "${PN}"
  76. # <-- user/group
  77.  
  78. inherit update-rc.d systemd
  79.  
  80. do_configure[noexec] = "1"
  81. do_compile[noexec] = "1"
  82.  
  83. do_install () {
  84. install -d ${D}${bindir}
  85. install -m 0755 ${S}/bin/grafana-cli ${D}${bindir}/grafana-cli
  86. install -m 0755 ${S}/bin/grafana-server ${D}${bindir}/grafana-server
  87.  
  88. # Only install the script if 'sysvinit' is in DISTRO_FEATURES
  89. # systemd would be the other choice
  90. if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
  91. install -d ${D}${sysconfdir}/init.d/
  92. install -D -m 0755 ${WORKDIR}/init.d-grafana-server ${D}${sysconfdir}/init.d/grafana-server
  93. fi # sysvinit
  94.  
  95. # Only install the script if 'systemd' is in DISTRO_FEATURES
  96. # systemd
  97. if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd','true','false',d)}; then
  98. install -d ${D}${systemd_unitdir}/system
  99. install -m 0644 ${WORKDIR}/grafana.service ${D}${systemd_system_unitdir}/grafana.service
  100. fi # systemd
  101.  
  102. install -d ${D}${sysconfdir}/default
  103. install -m 0644 ${WORKDIR}/grafana-server ${D}${sysconfdir}/default/
  104.  
  105. install -d ${D}${sysconfdir}/grafana
  106. install -m 0644 ${S}/conf/sample.ini ${D}${sysconfdir}/grafana/grafana.ini
  107.  
  108. for d in dashboards datasources notifiers
  109. do
  110. install -d ${D}${sysconfdir}/grafana/provisioning/${d}
  111. install -m 0644 ${S}/conf/provisioning/${d}/sample.yaml ${D}${sysconfdir}/grafana/provisioning/${d}/sample.yaml
  112. done
  113.  
  114. # install frontend
  115. install -d ${D}${datadir}/grafana
  116. cp -R --no-dereference --preserve=mode,links -v \
  117. ${S}/public \
  118. ${D}${datadir}/grafana/
  119.  
  120. cp -R --no-dereference --preserve=mode,links -v \
  121. ${S}/conf \
  122. ${D}${datadir}/grafana/
  123.  
  124. # grafana 6.5.2, !7.5.2
  125. if [ -d ${S}/tools ]; then
  126. cp -R --no-dereference --preserve=mode,links -v \
  127. ${S}/tools \
  128. ${D}${datadir}/grafana/
  129. fi
  130.  
  131. # grafana 7.5.2, !6.5.2
  132. if [ -d ${S}/plugins-bundled ]; then
  133. cp -R --no-dereference --preserve=mode,links -v \
  134. ${S}/plugins-bundled \
  135. ${D}${datadir}/grafana/
  136. fi
  137.  
  138. cp -R --no-dereference --preserve=mode,links -v \
  139. ${S}/LICENSE \
  140. ${D}${datadir}/grafana/
  141.  
  142. cp -R --no-dereference --preserve=mode,links -v \
  143. ${S}/VERSION \
  144. ${D}${datadir}/grafana/
  145.  
  146. # this works for grafana 6.5.2:
  147. # cp -R --no-dereference --preserve=mode,links -v \
  148. # ${S}/public \
  149. # ${S}/conf \
  150. # ${S}/tools \
  151. # ${S}/LICENSE \
  152. # ${S}/VERSION \
  153. # ${D}${datadir}/grafana/
  154. }
  155.  
  156.  
  157. INHIBIT_PACKAGE_STRIP = "1"
  158. INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
  159. # explicitly tell do_package not to strip those files
  160. INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${bindir}/grafana-cli \
  161. ${PKGD}${bindir}/grafana-server \
  162. "
  163. #INSANE_SKIP_${PN} = "already-stripped"
  164.  
  165. #INSANE_SKIP_${PN} = "ldflags already-stripped build-deps"
  166.  
  167. # --> systemd service
  168. # please note, that above
  169. # we already copy files depeding on sysvinit/systemd
  170. # we already inherited systemd
  171. SYSTEMD_AUTO_ENABLE = "enable"
  172. # disable for manual testing
  173. # e.g. on target:
  174. # systemctl start influxdb.service
  175. #SYSTEMD_AUTO_ENABLE = "disable"
  176. SYSTEMD_PACKAGES = "${PN}"
  177. SYSTEMD_SERVICE_${PN} = "${PN}.service"
  178. # <-- systemd service
  179.  
  180. # --> sysvinit scripts
  181. # please note, that above
  182. # we already copy files depeding on sysvinit/systemd
  183. # we already inherited update-rc.d
  184. INITSCRIPT_PACKAGES = "${PN}"
  185. INITSCRIPT_NAME_${PN} = "grafana-server"
  186. # script has a runlevel of: 99
  187. # starts in initlevels: 2 3 4 5
  188. # stops in initlevels: 0 1 6
  189. INITSCRIPT_PARAMS_${PN} = "start 99 2 3 4 5 . stop 99 0 1 6 ."
  190. # <-- sysvinit scripts
  191.  
  192. #SYSTEMD_SERVICE_${PN} = "\
  193. # grafana.service \
  194. #"
  195. #
  196. #SYSTEMD_AUTO_ENABLE_${PN} = "disable"
  197.  
  198. FILES_${PN} += "\
  199. ${sysconfdir}/grafana \
  200. ${sysconfdir}/default \
  201. "
  202.  
  203. # files we only need with systemd
  204. FILES_${PN} += " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}', '', d)}"
  205. student@e450-10:/workdir/sources/meta-tig-master/recipes-prebuilt/grafana⟫
  206.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement