From 3be8743d2d9acf36ca9f7fa9c530ab7c33f636b6 Mon Sep 17 00:00:00 2001 From: Dhruvin Gandhi Date: Tue, 27 Aug 2024 21:10:58 +0530 Subject: [PATCH] testing/do-agent: new aport --- testing/do-agent/APKBUILD | 38 +++++++++++++++++++++++++++ testing/do-agent/do-agent.confd | 2 ++ testing/do-agent/do-agent.initd | 11 ++++++++ testing/do-agent/do-agent.pre-install | 5 ++++ 4 files changed, 56 insertions(+) create mode 100644 testing/do-agent/APKBUILD create mode 100644 testing/do-agent/do-agent.confd create mode 100755 testing/do-agent/do-agent.initd create mode 100644 testing/do-agent/do-agent.pre-install diff --git a/testing/do-agent/APKBUILD b/testing/do-agent/APKBUILD new file mode 100644 index 00000000000..9ae982ce26f --- /dev/null +++ b/testing/do-agent/APKBUILD @@ -0,0 +1,38 @@ +# Contributor: Dhruvin Gandhi +# Maintainer: Dhruvin Gandhi +pkgname=do-agent +pkgver=3.16.9 +_git_rev=1bdbf1a95cab594fb29c2d354f71f029e9c8624f +pkgrel=0 +pkgdesc="Collects system metrics from DigitalOcean Droplets" +url="https://github.com/digitalocean/do-agent" +arch="x86_64" # limited by digital ocean +license="Apache-2.0" +makedepends="go" +install="$pkgname.pre-install" +subpackages="$pkgname-doc $pkgname-openrc" +source="https://github.com/digitalocean/do-agent/archive/refs/tags/$pkgver/do-agent-$pkgver.tar.gz + do-agent.initd + do-agent.confd" + +build() { + go build -ldflags "-X 'main.version=$pkgver' -X 'main.revision=$_git_rev' -X 'main.buildDate=$(date)'" \ + -o bin/do-agent ./cmd/do-agent +} + +check() { + go test -v ./... +} + +package() { + install -Dm755 bin/do-agent "$pkgdir/usr/sbin/do-agent" + install -Dm644 LICENSE "$pkgdir/usr/share/doc/do-agent/LICENSE" + install -Dm755 "$srcdir/do-agent.initd" "$pkgdir/etc/init.d/do-agent" + install -Dm644 "$srcdir/do-agent.confd" "$pkgdir/etc/conf.d/do-agent" +} + +sha512sums=" +90418343a49fb3312abc63c8913d644a12a44a372a25028cee211dacefe626c35c1586b98a6a50b733ac56db6a2d4f2446349ac66ebc4d2fbed3a179c8e21bf3 do-agent-3.16.9.tar.gz +cb89ceeb17767f1cf30055649d7f1fa1496a6a763b23c501a440bea871d6f43abec8901d5ab18d96b170bb95c374c2f5e468fd12496178d218cd13ab299527c4 do-agent.initd +3ad8d9223de1c99c1f231ca9b6500f932c14fbea38093d28231c6c805632ae0594dfd20dba678061e07ae13e8b0d20cc79185fd05b17522f69b768178866347c do-agent.confd +" diff --git a/testing/do-agent/do-agent.confd b/testing/do-agent/do-agent.confd new file mode 100644 index 00000000000..a07ccbb2037 --- /dev/null +++ b/testing/do-agent/do-agent.confd @@ -0,0 +1,2 @@ +command_args=--syslog +rc_need=logger diff --git a/testing/do-agent/do-agent.initd b/testing/do-agent/do-agent.initd new file mode 100755 index 00000000000..2d07109ca33 --- /dev/null +++ b/testing/do-agent/do-agent.initd @@ -0,0 +1,11 @@ +#!/sbin/openrc-run +name="DigitalOcean Monitoring Agent" +command=/usr/sbin/do-agent +command_user=do-agent +command_background=true +pidfile="/run/$RC_SVCNAME.pid" +start_stop_daemon_args="--exec $RC_SVCNAME" + +depend() { + need net +} diff --git a/testing/do-agent/do-agent.pre-install b/testing/do-agent/do-agent.pre-install new file mode 100644 index 00000000000..cc1e3629031 --- /dev/null +++ b/testing/do-agent/do-agent.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +adduser -h /dev/null -g do-agent -s /sbin/nologin -SDH do-agent 2>/dev/null + +exit 0