# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=docker-volume-local-persist
pkgver=1.3.0
pkgrel=33
pkgdesc="Local Persist Volume Plugin for Docker"
url="https://github.com/MatchbookLab/local-persist"
arch="all"
license="MIT"
depends="docker"
makedepends="go"
subpackages="$pkgname-openrc"
source="
	docker-local-persist-$pkgver.tar.gz::https://github.com/MatchbookLab/local-persist/archive/v$pkgver.tar.gz
	docker-volume-local-persist.initd
	gomod.patch
	"
builddir="$srcdir/local-persist-$pkgver"

export GOPATH="$startdir"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

prepare() {
	default_prepare
	go mod download
}

build() {
	go build -o bin/local-persist
}

package() {
	install -Dm755 "$builddir"/bin/local-persist \
		"$pkgdir"/usr/bin/docker-volume-local-persist
	install -Dm755 "$srcdir"/docker-volume-local-persist.initd \
		"$pkgdir"/etc/init.d/docker-volume-local-persist
}

sha512sums="
43a061c937c84eaab817dc62e4be5adfee960e357a2eea504e87c8e5fda32f5a835dc6d145f7d787f4907cd592a04c0159455d8d28d40e158f5a93c4e4fc060a  docker-local-persist-1.3.0.tar.gz
806b53e97b52d7ec2517cd978ddce6de14321519a64a4f309e3ea233f77b0c6cb1c9ec6bd9431ebe6d1eef83c7fe6ab2b8720bc4e552b64f3741a1fcd0df4bac  docker-volume-local-persist.initd
28f0a16f90ea90b908b117c185801b1b7d7ef569221db08f89b1b4fad48bef708b8effc1fc2a6e60a0cccaea02f5fc62694be0e15271f1953b8b3687be3dabde  gomod.patch
"
