From fed50f498a14f20b7d73029d89cd9c1d0881abf7 Mon Sep 17 00:00:00 2001 From: nyyu Date: Sun, 5 Mar 2023 09:52:17 +0100 Subject: [PATCH] feat: add freebox-exporter --- freebox-exporter/.SRCINFO | 16 +++++++ freebox-exporter/PKGBUILD | 54 +++++++++++++++++++++++ freebox-exporter/freebox-exporter.service | 18 ++++++++ 3 files changed, 88 insertions(+) create mode 100644 freebox-exporter/.SRCINFO create mode 100644 freebox-exporter/PKGBUILD create mode 100644 freebox-exporter/freebox-exporter.service diff --git a/freebox-exporter/.SRCINFO b/freebox-exporter/.SRCINFO new file mode 100644 index 0000000..2338b02 --- /dev/null +++ b/freebox-exporter/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = freebox-exporter + pkgdesc = Woodpecker is a community fork of the Drone CI system + pkgver = r25.24fc2a2 + pkgrel = 1 + url = https://github.com/trazfr/freebox-exporter + arch = x86_64 + license = MIT + makedepends = go + makedepends = git + options = !lto + source = git+https://git.nyyu.dev/nyyu/freebox-exporter.git + source = freebox-exporter.service + sha256sums = SKIP + sha256sums = 361bfba272b7933af35eabb761f677008472c8e74d9fbcfc9f76e92b77bcedee + +pkgname = freebox-exporter diff --git a/freebox-exporter/PKGBUILD b/freebox-exporter/PKGBUILD new file mode 100644 index 0000000..82b0dbc --- /dev/null +++ b/freebox-exporter/PKGBUILD @@ -0,0 +1,54 @@ +# Maintainer: nyyu + +pkgname=freebox-exporter +pkgver=r25.24fc2a2 +pkgrel=1 +pkgdesc="Woodpecker is a community fork of the Drone CI system" +arch=('x86_64') +url="https://github.com/trazfr/freebox-exporter" +license=('MIT') +makedepends=('go' 'git') +options=('!lto') +source=(git+https://git.nyyu.dev/nyyu/freebox-exporter.git + 'freebox-exporter.service') +sha256sums=('SKIP' + '361bfba272b7933af35eabb761f677008472c8e74d9fbcfc9f76e92b77bcedee') + +pkgver() { + cd "$pkgname" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" +} + +prepare() { + cd "$pkgname" + + go mod download +} + +build() { + cd "$pkgname" + + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + + go build \ + -trimpath \ + -buildmode=pie \ + -mod=readonly \ + -modcacherw \ + -ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \ + . +} + + +package() { + + # service + install -Dm644 freebox-exporter.service "$pkgdir/usr/lib/systemd/system/freebox-exporter.service" + + cd "$pkgbase" + + # binary + install -vDm755 freebox-exporter "$pkgdir/usr/bin/freebox-exporter" +} diff --git a/freebox-exporter/freebox-exporter.service b/freebox-exporter/freebox-exporter.service new file mode 100644 index 0000000..5f92af5 --- /dev/null +++ b/freebox-exporter/freebox-exporter.service @@ -0,0 +1,18 @@ +[Unit] +Description=Freebox exporter +Requires=network-online.target +After=network-online.target + + +[Service] +User=freebox-exporter +Type=simple +WorkingDirectory=/var/lib/freebox-exporter +ExecStart=/usr/bin/freebox-exporter token.json +Restart=on-failure +PrivateDevices=yes +DynamicUser=yes +StateDirectory=freebox-exporter + +[Install] +WantedBy=multi-user.target