66 lines
2.0 KiB
Bash
66 lines
2.0 KiB
Bash
# Template file for 'grafana'
|
|
pkgname=grafana
|
|
version=8.3.3
|
|
revision=1
|
|
build_style=go
|
|
go_import_path=github.com/grafana/grafana
|
|
go_package="${go_import_path}/pkg/cmd/grafana-cli ${go_import_path}/pkg/cmd/grafana-server"
|
|
hostmakedepends="tar make"
|
|
short_desc="Open platform for beautiful analytics and monitoring"
|
|
maintainer="Michael Aldridge <maldridge@voidlinux.org>"
|
|
license="Apache-2.0"
|
|
homepage="https://grafana.com"
|
|
distfiles="https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz
|
|
https://github.com/grafana/grafana/archive/v${version}.tar.gz"
|
|
checksum="89428c520e004bcb9faf7618dd4c81ff62496064cbf2ead3e1b9dbcf476c6f18
|
|
c79e19f056b9c2fc6d29c622edfaf8aff4985cec28ea6a9e74dce5eac077e735"
|
|
|
|
system_accounts="_grafana"
|
|
_grafana_homedir="/var/lib/grafana"
|
|
make_dirs="/var/log/grafana 0755 _grafana _grafana"
|
|
|
|
conf_files="/etc/grafana/grafana.ini"
|
|
|
|
go_ldflags="-w -X main.version=${version}"
|
|
|
|
post_extract() {
|
|
# remove prebuilt binaries
|
|
rm bin/*
|
|
}
|
|
|
|
pre_build() {
|
|
CGO_ENABLED=0 GOARCH= make gen-go
|
|
}
|
|
|
|
do_install() {
|
|
# only install grafana binaries - GOPATH/bin contains eg. wire used at
|
|
# buildtime, which we don't want in the package
|
|
for f in ${GOPATH}/bin/grafana-* ${GOPATH}/bin/*/grafana-*; do
|
|
if [ -f "$f" ] && [ -x "$f" ]; then
|
|
vbin "$f"
|
|
fi
|
|
done
|
|
}
|
|
|
|
post_install() {
|
|
vmkdir var/lib/grafana
|
|
touch ${DESTDIR}/var/lib/grafana/.empty
|
|
|
|
vmkdir usr/share/grafana
|
|
vcopy public usr/share/grafana/
|
|
vcopy conf usr/share/grafana/
|
|
|
|
# This next step is an aweful hack, we need to create the base
|
|
# config file to allow this to startup out of the box, but we
|
|
# don't want to version the config file.
|
|
vmkdir etc/grafana
|
|
vinstall conf/defaults.ini 0644 etc/grafana grafana.ini
|
|
vsed -i "s:data = data:data = /var/lib/grafana/data:" ${DESTDIR}/etc/grafana/grafana.ini
|
|
vsed -i "s:data/log:/var/log/grafana:" ${DESTDIR}/etc/grafana/grafana.ini
|
|
vsed -i "s:data/plugins:/var/lib/grafana/plugins:" ${DESTDIR}/etc/grafana/grafana.ini
|
|
vsed -i "s:grafana.db:/var/lib/grafana/grafana.db:" ${DESTDIR}/etc/grafana/grafana.ini
|
|
|
|
# And finally, the service directory
|
|
vsv grafana
|
|
}
|