# Contributor: Jake Buchholz Göktürk <tomalok@gmail.com>
# Maintainer: Jake Buchholz Göktürk <tomalok@gmail.com>
pkgname=efs-utils
pkgver=2.0.3
pkgrel=2
pkgdesc="Utilities for Amazon Elastic File System (EFS)"
url="https://github.com/aws/efs-utils"
license="MIT"
depends="nfs-utils openssl py3-botocore stunnel"
makedepends="git make cargo rust openssl-dev"
arch="all !s390x !loongarch64"
options="!check net"
source="$pkgname-$pkgver.tar.gz::https://github.com/aws/efs-utils/archive/refs/tags/v$pkgver.tar.gz
	efs-utils_openrc.patch
	amazon-efs-mount-watchdog.initd
	"
subpackages="
	$pkgname-doc
	$pkgname-openrc
	"

build() {
	cd src/proxy
	cargo build --release --manifest-path Cargo.toml
}

package() {
	mkdir -p "$pkgdir"/var/log/amazon/efs
	install -Dm644 -t "$pkgdir"/etc/amazon/efs dist/efs-utils.conf
	install -Dm444 -t "$pkgdir"/etc/amazon/efs dist/efs-utils.crt
	install -Dm755 src/watchdog/__init__.py "$pkgdir"/usr/bin/amazon-efs-mount-watchdog
	install -Dm755 src/mount_efs/__init__.py "$pkgdir"/sbin/mount.efs
	install -Dm755 src/proxy/target/release/efs-proxy "$pkgdir"/usr/bin/efs-proxy
	install -Dm644 -t "$pkgdir"/usr/share/man/man8 man/mount.efs.8
	install -Dm755 "$srcdir"/amazon-efs-mount-watchdog.initd "$pkgdir"/etc/init.d/amazon-efs-mount-watchdog
}

sha512sums="
753d821efc17e63e61324f0afb8315f0b5bfb510d2974a49b4efaf83664f058eb04910fa7a98bff0c8a5f1d1c2e4b2e383d254aef03ff4b124c9264c8fa9c1d0  efs-utils-2.0.3.tar.gz
73c6617ad2ffd6cc647fbd6ec1c0fa677ae2703152aada2d92ed0476dccaffc14568b3641f13a1278005709fefadbae58170bb7c305a463a99553addb1be926a  efs-utils_openrc.patch
2fa52d7d722b224cd4e2bad43f0996f1e855321b388c226c4d5c1ecdd7182e7b95d5a930cd19e2df9af061128129a751b69c5cff0f3b95004c2d7fdb5daef795  amazon-efs-mount-watchdog.initd
"
