# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module

EGIT_COMMIT=358aae69
DESCRIPTION="Fast and secure initramfs generator"
HOMEPAGE="https://git.sr.ht/~adrian-blx/minisnap"
SRC_URI="https://git.sr.ht/~adrian-blx/minisnap/archive/${EGIT_COMMIT}.tar.gz -> ${PN}-${EGIT_COMMIT}.tar.gz
		https://git.millerson.name/alex/gentoo-artifacts/releases/download/${PN}-${EGIT_COMMIT}-vendor/${PN}-${EGIT_COMMIT}-vendor.tar.xz"

S="${WORKDIR}/${PN}-${EGIT_COMMIT}"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"

src_compile() {
	ego build cmd/msnap.go cmd/conf.go || die
}

src_install() {
	dodoc *.conf
	dobin msnap
}

pkg_postinst() {
	elog "To configure schedule for each volume define them"
	elog "in the /etc/minisnap.conf configuration file"
	elog "See /usr/share/doc/${P}/ for examples."
}
