sys-process/glances: revbump 3.1.4.1, add missing doc dep
[gentoo.git] / app-emulation / grub-xen-host / grub-xen-host-1.0.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 DESCRIPTION="Grub2 built as a PV grub per the Xen PV Boot Protocol"
7 HOMEPAGE="https://blog.xenproject.org/2015/01/07/using-grub-2-as-a-bootloader-for-xen-pv-guests/"
8 SRC_URI=""
9
10 LICENSE="BSD-2"
11 SLOT="0"
12 KEYWORDS="amd64"
13 IUSE=""
14
15 DEPEND="sys-boot/grub:2=[grub_platforms_xen]
16         app-emulation/xen-tools:="
17 RDEPEND="${DEPEND}"
18
19 S="${WORKDIR}"
20
21 RESTRICT="binchecks strip test"
22
23 src_configure() {
24         :
25 }
26
27 src_compile() {
28         cat > "${S}/grub-bootstrap.cfg" <<- EOF || die
29                 normal (memdisk)/grub.cfg
30         EOF
31
32         cat > "${S}/grub.cfg" <<- EOF || die
33                 if search -s -f /boot/xen/pvboot-x86_64.elf ; then
34                         echo "Chainloading (${root})/boot/xen/pvboot-x86_64.elf"
35                         multiboot "/boot/xen/pvboot-x86_64.elf"
36                         boot
37                 fi
38
39                 if search -s -f /xen/pvboot-x86_64.elf ; then
40                         echo "Chainloading (${root})/xen/pvboot-x86_64.elf"
41                         multiboot "/xen/pvboot-x86_64.elf"
42                         boot
43                 fi
44
45                 if search -s -f /boot/grub/grub.cfg ; then
46                         echo "Reading (${root})/boot/grub/grub.cfg"
47                         configfile /boot/grub/grub.cfg
48                 fi
49
50                 if search -s -f /grub/grub.cfg ; then
51                         echo "Reading (${root})/grub/grub.cfg"
52                         configfile /grub/grub.cfg
53                 fi
54         EOF
55
56         tar cf memdisk.tar grub.cfg || die "failed to tar"
57
58         local grub_mkimage=grub-mkimage
59         if type grub2-mkimage &> /dev/null; then
60                 grub_mkimage=grub2-mkimage
61         fi
62
63         local args=(
64                 "${grub_mkimage}"
65                 -O x86_64-xen
66                 -c grub-bootstrap.cfg
67                 -m memdisk.tar
68                 -o grub-x86_64-xen.bin
69                 /usr/lib/grub/x86_64-xen/*.mod
70         )
71
72         echo "${args[@]}"
73         "${args[@]}" || die "failed to grub-mkimage"
74 }
75
76 src_install() {
77         exeinto /usr/libexec/xen/bin
78         doexe grub-x86_64-xen.bin
79 }