Subject: [PATCH] community/minio: re-introduce aport

From: Drew DeVault <[email-masked]>
Date: Sat, 2 Jul 2022 21:52:34 +0200

This aport was removed citing concerns over the licensing change. Per
discussions on IRC, the license change was poorly executed, but not
actually a violation of anyone's licensing or copyright obligations.

This reverts commit 2f3cbd59cffd32e4c9c2c18daf33a331c5bfd091.
---
 community/minio/APKBUILD          | 77 +++++++++++++++++++++++++++++++
 community/minio/minio.confd       | 13 ++++++
 community/minio/minio.initd       | 25 ++++++++++
 community/minio/minio.pre-install |  6 +++
 4 files changed, 121 insertions(+)
 create mode 100644 community/minio/APKBUILD
 create mode 100644 community/minio/minio.confd
 create mode 100644 community/minio/minio.initd
 create mode 100644 community/minio/minio.pre-install

diff --git a/community/minio/APKBUILD b/community/minio/APKBUILD
new file mode 100644
index 0000000000..b25319d098
--- /dev/null
+++ b/community/minio/APKBUILD
@@ -0,0 +1,77 @@
+# Maintainer: Drew DeVault <[email-masked]>
+# Contributor: Carlo Landmeter <[email-masked]>
+# Contributor: Chloe Kudryavtsev <[email-masked]>
+pkgname=minio
+_pkgver='RELEASE.2022-06-30T20-58-09Z'
+pkgver=${_pkgver#*.}
+pkgver=${pkgver%T*}
+pkgver=0.${pkgver//-}
+pkgrel=3
+pkgdesc="An open source object storage server compatible with Amazon S3"
+pkgusers="minio"
+pkggroups="minio"
+url="https://minio.io/"
+license="Apache-2.0"
+arch="all !x86 !armv7 !armhf" # test failures
+arch="$arch !riscv64" # fails to build cpuinfo module
+install="minio.pre-install"
+makedepends="go"
+source="
+	minio.initd
+	minio.confd
+	$pkgname-$pkgver.tar.gz::https://github.com/minio/minio/archive/$_pkgver.tar.gz
+"
+builddir="$srcdir/$pkgname-$_pkgver"
+options="net"
+subpackages="$pkgname-openrc"
+
+export GOPATH="$srcdir"
+export CGO_ENABLED=0
+
+# secfixes:
+#   0.20200423-r0:
+#     - CVE-2020-11012
+
+build() {
+	local _ldflags=$(go run buildscripts/gen-ldflags.go 2> /dev/null)
+	go build -tags kqueue --ldflags "$_ldflags" -o bin/minio
+}
+
+check() {
+	# cmd: disk usage errors, like same as pkg/disk
+	# pkg/disk: doesn't know what btrfs is
+	# pkg/s3select: fails on 32bit systems
+	# pkg/event/target: fails on aarch64
+	# pkg/sys: fails on aarch64
+	# cmd/http: fails on aarch64, suspect ipv6 problem
+	# pkg/dsync: fails on armv7
+	go test -tags kqueue $(go list ./... | grep -v \
+		-e 'cmd$' \
+		-e pkg/disk \
+		-e pkg/s3select \
+		-e pkg/event/target \
+		-e pkg/sys \
+		-e cmd/http \
+		-e pkg/dsync
+		)
+}
+
+package() {
+	install -Dm755 "$builddir"/bin/minio \
+		"$pkgdir"/usr/bin/minio
+	install -Dm755 "$srcdir"/"$pkgname".initd \
+		"$pkgdir"/etc/init.d/"$pkgname"
+	install -Dm644 "$srcdir"/"$pkgname".confd \
+		"$pkgdir"/etc/conf.d/"$pkgname"
+}
+
+cleanup_srcdir() {
+	go clean -modcache
+	default_cleanup_srcdir
+}
+
+sha512sums="
+6427a225d4e6c51cc5de077ccd29ddf52556722cf958e83e480df1c5882aa4fa7daebfeb970e80f8f9c3176594d8e427e8c8dbf268ce945647a11bdf1e69affd  minio.initd
+ed9790fbadfb38e4d660eb1befd87e803d70dec04d936e8cd26def4a9c21240bb7cae8750ae3395aa4761e6738b9e346c86ba57761cfde30efe46d2cb459a7e4  minio.confd
+283ba5ebd02b0d1946ea2992ac6f5ae9f79f9d2bd047b1069f211f1a46b04499bc7995cc1aa289bef4d4899f929542839020fae766d631fa6e21028a723f45fc  minio-0.20220630.tar.gz
+"
diff --git a/community/minio/minio.confd b/community/minio/minio.confd
new file mode 100644
index 0000000000..952ce13564
--- /dev/null
+++ b/community/minio/minio.confd
@@ -0,0 +1,13 @@
+# defaults to storing data in /srv/minio
+# but you can run multiple instances, e.g minio.home in /srv/minio.home
+MINIO_VOLUMES="/srv/${RC_SVCNAME}"
+
+#export MINIO_ACCESS_KEY=myUser
+#export MINIO_SECRET_KEY=mySecretKey
+
+# recommended for production setups
+#MINIO_OPTS='--quiet --anonymous'
+
+# optional additional settings
+#address=minio.example.com:9000
+#export MINIO_DOMAIN=minio.example.com
diff --git a/community/minio/minio.initd b/community/minio/minio.initd
new file mode 100644
index 0000000000..7a8afcbb0d
--- /dev/null
+++ b/community/minio/minio.initd
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+respawn_delay=5
+respawn_max=0
+healthcheck_timer=30
+
+name='Minio Block Storage Server'
+command=/usr/bin/minio
+command_args="server \
+    ${address:+--address=$address} \
+    $MINIO_OPTS \
+    $MINIO_VOLUMES"
+command_user="minio:minio"
+
+start_pre() {
+    # the conf.d file might contain secrets!
+    [ -f "/etc/conf.d/${RC_SVCNAME}" ] && checkpath --file --mode 0600 --owner root:root "/etc/conf.d/${RC_SVCNAME}"
+    # make sure the default volume exists
+    checkpath --directory --mode 0700 --owner minio:minio "/srv/${RC_SVCNAME}"
+}
+
+healthcheck() {
+    [ -x /usr/bin/curl ] || return 0
+    /usr/bin/curl -q "${address:-localhost:9000}"/minio/health/ready
+}
diff --git a/community/minio/minio.pre-install b/community/minio/minio.pre-install
new file mode 100644
index 0000000000..3015873c0f
--- /dev/null
+++ b/community/minio/minio.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S minio 2>/dev/null
+adduser -S -D -h /var/lib/minio -s /sbin/nologin -G minio -g minio minio 2>/dev/null
+
+exit 0

base-commit: 649c88dcec15c8e9c8f11a8c97a427a9fe2388b7
-- 
2.37.0