From 7ccf44d5f9cfe6c76d95275dbb5f16c511d5c5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Mon, 19 Sep 2022 23:40:42 +0200 Subject: [PATCH] Add twitch-bot package --- twitch-bot/PKGBUILD | 42 +++++++++++++++++++++++++++++++++++ twitch-bot/sysusers.conf | 1 + twitch-bot/twitch-bot.service | 13 +++++++++++ 3 files changed, 56 insertions(+) create mode 100644 twitch-bot/PKGBUILD create mode 100644 twitch-bot/sysusers.conf create mode 100644 twitch-bot/twitch-bot.service diff --git a/twitch-bot/PKGBUILD b/twitch-bot/PKGBUILD new file mode 100644 index 0000000..37fdb93 --- /dev/null +++ b/twitch-bot/PKGBUILD @@ -0,0 +1,42 @@ +# Maintainer: Thorben Günther + +pkgname=twitch-bot +pkgver=0.1.0 +pkgrel=1 +pkgdesc='twitch chat bot' +arch=('x86_64') +url='https://git.xenrox.net/~xenrox/twitch-bot' +license=('MIT') +depends=('postgresql') +makedepends=('go') +source=( + "$pkgname-$pkgver.tar.gz::https://git.xenrox.net/~xenrox/${pkgname}/archive/v${pkgver}.tar.gz" + "twitch-bot.service" + "sysusers.conf" +) +sha256sums=('dccd66f784b8583ff1403778e7db985660b191cd1c9e5a13b0bd77539c90bd95' + 'bcb9f10aee3dfa47961ebe0127dd1b8f8923d96b26fed899518aa616d522f39c' + 'b5a86129a439f4d4215ead2592c5d53256c86b07493f11d87ccbcec028eea6ef') + +check() { + cd "$srcdir/$pkgname-v$pkgver" + go test ./... +} + +build() { + cd "$srcdir/$pkgname-v$pkgver" + export CGO_LDFLAGS="${LDFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + + go build -o twitch-bot +} + +package() { + cd "$srcdir/$pkgname-v$pkgver" + install -Dm755 twitch-bot "$pkgdir"/usr/bin/twitch-bot + install -Dm644 ../twitch-bot.service -t "$pkgdir"/usr/lib/systemd/system/ + install -Dm644 ../sysusers.conf "$pkgdir"/usr/lib/sysusers.d/twitchbot.conf +} diff --git a/twitch-bot/sysusers.conf b/twitch-bot/sysusers.conf new file mode 100644 index 0000000..794f4ab --- /dev/null +++ b/twitch-bot/sysusers.conf @@ -0,0 +1 @@ +u twitchbot - "twitch-bot user" diff --git a/twitch-bot/twitch-bot.service b/twitch-bot/twitch-bot.service new file mode 100644 index 0000000..5ac4ed0 --- /dev/null +++ b/twitch-bot/twitch-bot.service @@ -0,0 +1,13 @@ +[Unit] +Description=twitch bot service +Requires=postgresql.service network-online.target +After=postgresql.service network-online.target + +[Service] +Type=simple +User=twitchbot +Restart=always +ExecStart=/usr/bin/twitch-bot + +[Install] +WantedBy=multi-user.target -- 2.44.0