diff --git a/testing/oauth2-proxy/APKBUILD b/testing/oauth2-proxy/APKBUILD index 6beffee0510..f85833a3da8 100644 --- a/testing/oauth2-proxy/APKBUILD +++ b/testing/oauth2-proxy/APKBUILD @@ -1,15 +1,24 @@ # Contributor: Lauren N. Liberda # Maintainer: Lauren N. Liberda pkgname=oauth2-proxy -pkgver=7.4.0 +pkgver=7.4.0_git20221103 +_commit=86011e8ac7e41b522a17ae191bbb2a55b5f3eba3 pkgrel=0 pkgdesc="Reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers" url="https://oauth2-proxy.github.io/oauth2-proxy" arch="all" license="MIT" +install="$pkgname.pre-install" makedepends="go" -source="https://github.com/oauth2-proxy/oauth2-proxy/archive/refs/tags/v$pkgver/oauth2-proxy-$pkgver.tar.gz" +subpackages="$pkgname-openrc" +source=" + https://github.com/oauth2-proxy/oauth2-proxy/archive/$_commit/oauth2-proxy-$_commit.tar.gz + + oauth2-proxy.initd + oauth2-proxy.confd + " options="net" +builddir="$srcdir/oauth2-proxy-$_commit" build() { VERSION="$pkgver" make oauth2-proxy @@ -21,8 +30,13 @@ check() { package() { install -Dm755 oauth2-proxy "$pkgdir"/usr/bin/oauth2-proxy + install -Dm755 "$srcdir"/oauth2-proxy.initd "$pkgdir"/etc/init.d/oauth2-proxy + install -Dm755 "$srcdir"/oauth2-proxy.confd "$pkgdir"/etc/conf.d/oauth2-proxy + install -Dm644 contrib/oauth2-proxy.cfg.example "$pkgdir"/etc/oauth2-proxy/oauth2-proxy.cfg } sha512sums=" -5098e9773eb13dbc8f10b2335c28b3e0aada72fb80566f9475617c2892fd190a946b5fe9b6065f8c15416e9997d7ee1edacfa3217a634a7069ac6952e0b5311b oauth2-proxy-7.4.0.tar.gz +9927bafe728bcf6b653ae4e7df3d0da6df3432915e61655006b3fb10c79830d2bed578345d478dd07bafcb97b2e20997588342fe30305bc8defbdd37666be058 oauth2-proxy-86011e8ac7e41b522a17ae191bbb2a55b5f3eba3.tar.gz +4f91d8bff4ced7fca4d0795c2a0a89e0c8cb28f981db435f30b30f122757b8fe9d855a0d4d87497becedc543cdf48d20f3bc7813728bffaeac891d927157a237 oauth2-proxy.initd +56ec244414ecc96cad80b7c3f231c9e437350046ec80edc3661753bf24e194c51472acf2b097d893f3aed4200b0304e20e9c4d6edd05d698ff54524137c726e7 oauth2-proxy.confd " diff --git a/testing/oauth2-proxy/oauth2-proxy.confd b/testing/oauth2-proxy/oauth2-proxy.confd new file mode 100644 index 00000000000..bf95e6b8125 --- /dev/null +++ b/testing/oauth2-proxy/oauth2-proxy.confd @@ -0,0 +1,5 @@ +# comment to not use process supervisor +supervisor=supervise-daemon + +# extra args +#command_args="" diff --git a/testing/oauth2-proxy/oauth2-proxy.initd b/testing/oauth2-proxy/oauth2-proxy.initd new file mode 100644 index 00000000000..0c32bc2edbc --- /dev/null +++ b/testing/oauth2-proxy/oauth2-proxy.initd @@ -0,0 +1,37 @@ +#!/sbin/openrc-run + +command="/usr/bin/oauth2-proxy" +command_args="--config=/etc/oauth2-proxy/oauth2-proxy.cfg $command_args" +command_user="oa2proxy:oa2proxy" +command_background=true +directory="/var/lib/oauth2-proxy" +pidfile="/run/$RC_SVCNAME.pid" + +output_log="/var/log/oauth2-proxy.log" +error_log="/var/log/oauth2-proxy.log" + +extra_started_commands="reload" +description_reload="Reload configuration" + +depend() { + need net + after firewall +} + +start_pre() { + checkpath -d -m 755 -o $command_user /run/oauth2-proxy + checkpath -d -m 755 -o $command_user /var/lib/oauth2-proxy + + checkpath -f -m 640 -o $command_user /etc/oauth2-proxy/oauth2-proxy.cfg + checkpath -f -m 644 -o $command_user /var/log/oauth2-proxy.log +} + +reload() { + ebegin "Reloading configuration" + + if [ -n "$supervisor" ]; then + $supervisor $RC_SVCNAME --signal HUP + else + start-stop-daemon --signal HUP --pidfile "$pidfile" + fi +} diff --git a/testing/oauth2-proxy/oauth2-proxy.pre-install b/testing/oauth2-proxy/oauth2-proxy.pre-install new file mode 100644 index 00000000000..3f94b54e4c3 --- /dev/null +++ b/testing/oauth2-proxy/oauth2-proxy.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup -S oa2proxy 2>/dev/null +adduser -S -D -H -h /var/lib/oauth2-proxy -s /sbin/nologin -G oa2proxy -g oa2proxy oa2proxy 2>/dev/null + +exit 0