# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="A portable system updater utility designed for immutable/image based systems."
HOMEPAGE="https://git.pinkro.se/Rose/gardenhouse/sysupdate.git/about/"
SRC_URI="https://git.pinkro.se/Rose/gardenhouse/sysupdate.git/snapshot/sysupdate-1.0.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="* -~*"
IUSE=""

DEPEND="
	>=dev-util/xdelta-3.0.11
	>=sys-apps/pv-1.10.3
"
RDEPEND="${DEPEND}"

src_configure() {
	sed -i 's|@LIBEXEC@|/usr/libexec/|g' usr/bin/sysupdate
}

src_install() {
	exeinto /usr/bin/
	doexe usr/bin/*

	exeinto /usr/libexec/sysupdate/Helpers
	doexe usr/libexec/sysupdate/Helpers/*

	exeinto /usr/libexec/sysupdate/SourceTypes
	doexe usr/libexec/sysupdate/SourceTypes/*

	exeinto /usr/libexec/sysupdate/TargetTypes
	doexe usr/libexec/sysupdate/TargetTypes/*
}

pkg_postinst() {
	if [[ -z "${REPLACING_VERSIONS}" ]]; then
		elog "Please note that sysupdate requires further configuration."
		elog ""
		elog "For details see https://git.pinkro.se/Rose//gardenhouse/sysupdate.git/about/"
	fi
}