A twitch-bot/PKGBUILD => twitch-bot/PKGBUILD +42 -0
@@ 0,0 1,42 @@
+# Maintainer: Thorben Günther <echo YWRtaW5AeGVucm94Lm5ldAo= | base64 -d>
+
+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
+}
A twitch-bot/sysusers.conf => twitch-bot/sysusers.conf +1 -0
@@ 0,0 1,1 @@
+u twitchbot - "twitch-bot user"
A twitch-bot/twitch-bot.service => twitch-bot/twitch-bot.service +13 -0
@@ 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