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

EAPI=8

# Generated by scripts/os-image-ebuilds.py from codexctl's version list.
# The update image reMarkable serves to the tablet: the complete root
# filesystem as a compressed ext4 image.  It is installed unchanged, to
# mount with rmufuse (dev-python/remarkable-update-fuse) or install on the
# tablet with codexctl (app-misc/codexctl).

DESCRIPTION="reMarkable OS update image for the reMarkable Paper Pro"
HOMEPAGE="https://remarkable.com/"
SRC_URI="https://remarkable-software.s3.us-east-2.amazonaws.com/remarkable-production-image-${PV}-ferrari-public.swu"
S="${WORKDIR}"

# The image bundles GPL/LGPL parts alongside reMarkable's own software;
# reMarkable publishes no license terms for the whole
LICENSE="all-rights-reserved GPL-2 GPL-3 LGPL-2.1 LGPL-3 MIT BSD"
# One slot per X.Y release, so several releases can be compared side by side
SLOT="$(ver_cut 1-2)"
KEYWORDS="~amd64 ~arm64"
RESTRICT="bindist mirror"

src_unpack() {
	# Installed as downloaded
	:
}

src_install() {
	insinto /usr/share/remarkable-os/${PV}
	doins "${DISTDIR}/${A}"
}

pkg_postinst() {
	elog "The image is in ${EROOT}/usr/share/remarkable-os/${PV}."
	elog "Mount it read-only with rmufuse (dev-python/remarkable-update-fuse):"
	elog "  rmufuse <image> <mountpoint>"
	elog "Install it on the tablet over SSH with codexctl (app-misc/codexctl),"
	elog "so the tablet doesn't download the update from reMarkable:"
	elog "  codexctl install <image>"
}