# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=prometheus-sql-exporter
pkgver=0.5
pkgrel=0
pkgdesc="Database agnostic SQL exporter for Prometheus"
url="https://github.com/free/sql_exporter"
arch="all"
license="MIT"
install="prometheus-sql-exporter.pre-install"
makedepends="go"
source="
$pkgname-$pkgver.tar.gz::https://github.com/free/sql_exporter/archive/$pkgver.tar.gz
prometheus-sql-exporter.initd
prometheus-sql-exporter.confd
sql_exporter.yml
"
subpackages="$pkgname-openrc"
builddir="$srcdir/sql_exporter-$pkgver"
build() {
go mod init github.com/free/sql_exporter
go mod vendor
go build \
-trimpath \
-mod=vendor \
-ldflags "-extldflags $LDFLAGS" \
-tags netgo,builtinassets \
./cmd/sql_exporter
}
check() {
go test ./...
}
package() {
mkdir -p "$pkgdir"/usr/bin
mkdir -p "$pkgdir"/etc/init.d
mkdir -p "$pkgdir"/etc/conf.d
mkdir -p "$pkgdir"/etc/prometheus
install -Dm755 sql_exporter "$pkgdir"/usr/bin/prometheus_sql_exporter
install -Dm755 "$srcdir"/prometheus-sql-exporter.initd \
"$pkgdir"/etc/init.d/prometheus-sql-exporter
install -Dm644 "$srcdir"/prometheus-sql-exporter.confd \
"$pkgdir"/etc/conf.d/prometheus-sql-exporter
install -Dm644 "$srcdir"/sql_exporter.yml \
"$pkgdir"/etc/prometheus/sql_exporter.yml
}
sha512sums="0c260bd1f6716e1b2d8fdc9be511533279eca102e7117d71c123457aeb63613804e0762f83e6231cad94b31a63d07ad29c56d96dbeae07a3f07f1a2d28d6d7c9 prometheus-sql-exporter-0.5.tar.gz
b4c7e2229777e46fad3f30f342fd13cf3c2628a3845bc89fb8d4df9f1e058533c7344a053e5ca581edc065bdc59fed88d57787d8e2bcf9fe1b8741b2394e66a2 prometheus-sql-exporter.initd
a7d40104e925be144f9dd36e59659b0bdc1577cd433adc31a4d971fc1486c62f8485cd7b1b2d169ab01ab9e8252d89bdad70fa5a73e17b5db47b0c62f9dffe8f prometheus-sql-exporter.confd
981b612fda17d10ded35b072eec627be429900128225f464c81bb253a73bf1f024afbff5ef138e4130163819d35874d1e80c3fffd781709bb75eb8cb7f8362de sql_exporter.yml"