# Copyright Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=6

EGIT_REPO_URI="https://dev.unitas-network.de/r/VA/virtual-appliance.git"
EGIT_COMMIT="${PVR}"

inherit eutils linux-info toolchain-funcs git-r3

DESCRIPTION="Programatically (re)create Gentoo Virtual Appliances"
HOMEPAGE="https://bitbucket.org/marduk/virtual-appliance/wiki/Home"

LICENSE="unknown"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND="app-emulation/qemu
        app-emulation/open-vmdk
        sys-block/parted"
RDEPEND="${DEPEND}"

pkg_setup() {
	CONFIG_CHECK="BLK_DEV_NBD"
	linux-info_pkg_setup
}

src_compile() {
	einfo "Nothing to compile"
}

src_install() {
	dodir /opt/${PN}/appliances
	cp -r appliances ${D}/opt/${PN}/appliances-examples
	cp -r configs ${D}/opt/${PN}/configs
	cp -r scripts ${D}/opt/${PN}/scripts
	cp -r Makefile ${D}/opt/${PN}/Makefile

	echo "CONFIG_PROTECT=\"/opt/${PN}/configs\"" > "${T}"/99${PN}
	doenvd "${T}"/99${PN}
}
