PKGBUILD 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Maintainer: "Amhairghin" Oscar Garcia Amor (https://ogarcia.me)
  2. pkgname='telegraf'
  3. pkgver='1.10.0'
  4. pkgrel='1'
  5. pkgdesc='Plugin-driven server agent for reporting metrics into InfluxDB'
  6. arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
  7. url='http://influxdb.org/'
  8. license=('MIT')
  9. makedepends=('go' 'git')
  10. backup=('etc/telegraf/telegraf.conf')
  11. install="${pkgname}.install"
  12. source=("https://github.com/influxdata/${pkgname}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz"
  13. "${pkgname}.install"
  14. "${pkgname}.service"
  15. "${pkgname}.sysusers"
  16. "${pkgname}.tmpfiles")
  17. sha256sums=('83eedb62c771ef3854f79fcd6fbb7ecb4ddabf7b1aa45bcc11e9c6a1f1553ac6'
  18. 'b8494d35b868a256eace5f7baa7caa9d8561ee506aded3c47bd6b2ee031b0745'
  19. 'ef54a27c036f11c44f32a42c81787dd0253f84e77170c2e8f9e268aca8773c33'
  20. 'acf95397a51077b7684e8e4f4db7266c42cf82f24bc969ef2bc112a0f914f4cd'
  21. '95284d1e92f812c4c301cd1f35692850ae127397e33b910a5af7f54bbeb8986e')
  22. prepare() {
  23. export GOPATH="${srcdir}/gopath"
  24. export GOBIN="${GOPATH}/bin"
  25. export GOFLAGS="-gcflags=all=-trimpath=${PWD} -asmflags=all=-trimpath=${PWD} -ldflags=-extldflags=-zrelro -ldflags=-extldflags=-znow"
  26. export TELEGRAFPATH="${GOPATH}/src/github.com/influxdata/${pkgname}"
  27. mkdir -p ${TELEGRAFPATH%/*}
  28. ln -fsT ${srcdir}/${pkgname}-${pkgver} \
  29. ${GOPATH}/src/github.com/influxdata/${pkgname}
  30. cd ${TELEGRAFPATH}
  31. go get -v -u github.com/golang/dep/cmd/dep
  32. ${GOBIN}/dep ensure -v -vendor-only
  33. }
  34. build() {
  35. cd ${TELEGRAFPATH}
  36. go install -ldflags="-X main.version=${pkgver}" ./...
  37. }
  38. package() {
  39. # binary
  40. install -D -m755 "${GOBIN}/telegraf" "${pkgdir}/usr/bin/telegraf"
  41. # configuration files
  42. install -dD -m755 "${pkgdir}/etc/telegraf/telegraf.d"
  43. ${GOBIN}/telegraf -sample-config > "${pkgdir}/etc/telegraf/telegraf.conf"
  44. # license
  45. install -Dm644 "${TELEGRAFPATH}/LICENSE" \
  46. "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  47. # service
  48. install -D -m644 "${srcdir}/${pkgname}.service" \
  49. "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
  50. # systemd user and home directory
  51. install -D -m644 "${srcdir}/${pkgname}.sysusers" \
  52. "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
  53. install -D -m644 "${srcdir}/${pkgname}.tmpfiles" \
  54. "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
  55. }