Add prometheus-rtorrent-exporter

This commit is contained in:
2024-01-17 00:14:37 -07:00
parent 81eeabcb43
commit 001f56c9fc
6 changed files with 82 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
pkgbase = prometheus-rtorrent-exporter
pkgver = 1.2.1
pkgrel = 1
url = https://github.com/thde/rtorrent_exporter
arch = x86_64
license = Apache-2.0
makedepends = go
makedepends = git
backup = etc/conf.d/rtorrent_exporter
source = rtorrent_exporter-1.2.1.tar.gz::https://github.com/thde/rtorrent_exporter/archive/refs/tags/v1.2.1.tar.gz
sha256sums = 6fcebabc804b9aba32e90b82b869135184f030b82fd7b73b62167a6075de4384
pkgname = prometheus-rtorrent-exporter
+4
View File
@@ -0,0 +1,4 @@
pkg/*
src/*
*.tar.*
ping_exporter/
+52
View File
@@ -0,0 +1,52 @@
# Maintainer: restitux <restitux at ohea dot xyz>
_pkgbase=rtorrent_exporter
pkgname=prometheus-rtorrent-exporter
pkgver=1.2.1
pkgrel=1
pkgdsc='Expose prometheus metrics from a rtorrent instance.'
arch=('x86_64')
url="https://github.com/thde/${_pkgbase}"
license=('Apache-2.0')
makedepends=('go')
source=("${_pkgbase}-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('6fcebabc804b9aba32e90b82b869135184f030b82fd7b73b62167a6075de4384')
backup=("etc/conf.d/$_pkgbase")
prepare(){
mkdir -p "$srcdir/gopath"
export GOPATH="$srcdir/gopath"
cd "$srcdir/$_pkgbase-$pkgver"
mkdir -p build/
}
build() {
cd "$srcdir/$_pkgbase-$pkgver"
local _goldflags="-w -s"
go build \
-trimpath -mod=readonly -modcacherw \
-o "build/$_pkgbase" \
-ldflags "$_goldflags" \
.
}
package() {
# install rtorrent_exporter
install -Dm755 "$srcdir/$_pkgbase-$pkgver/build/$_pkgbase" "$pkgdir/usr/bin/$_pkgbase"
# install conf.d
install -Dm600 "$startdir/$_pkgbase.conf.d" "$pkgdir/etc/conf.d/$_pkgbase"
# install systemd units
install -Dm644 "$startdir/$_pkgbase.service" "$pkgdir/usr/lib/systemd/system/$_pkgbase.service"
# install sys user
install -Dm644 "$startdir/$_pkgbase.sysusers" "$pkgdir/usr/lib/sysusers.d/$_pkgbase.conf"
# install license
install -Dm644 "$srcdir/$_pkgbase-$pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# install README.md
install -Dm644 "$srcdir/$_pkgbase-$pkgver/README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
}
@@ -0,0 +1 @@
ARGS=""
@@ -0,0 +1,11 @@
[Unit]
Description=rtorrent Exporter
After=network.target
[Service]
User=rtorrent_exporter
EnvironmentFile=/etc/conf.d/rtorrent_exporter
ExecStart=/usr/bin/rtorrent_exporter $ARGS
[Install]
WantedBy=default.target
@@ -0,0 +1 @@
u rtorrent_exporter - "Prometheus rtorrent-exporter user"