11eb513b535ea23efe38cccf33bacf788bfadaf3
[AGL/meta-agl-devel.git] / meta-agl-lxc / recipes-platform / images / lxc-host-image-minimal.bb
1 SUMMARY = "A minimal container host image"
2
3 require recipes-platform/images/agl-image-boot.inc
4
5 IMAGE_INSTALL += " \
6     lxc \
7     ${LXC_CONTAINER_CONFIGS} \
8 "
9
10 CONTAINER_IMAGES ??= ""
11
12 LXC_CONTAINER_CONFIGS ?= ""
13
14 IMAGE_LINGUAS = " "
15
16 NO_RECOMMENDATIONS = "1"
17
18 # Handle modification of IMAGE_LINK_NAME done by ULCB builds with Kingfisher support
19 MACHINE_SUFFIX = "${@bb.utils.contains('AGL_FEATURES', 'kingfisher', '-kf', '', d)}"
20
21 python __anonymous() {
22     for c in (d.getVar('CONTAINER_IMAGES') or "").split():
23         (mc, image) = c.split(':')
24         dependency = 'mc::' + mc + ':' + image + ':do_image_complete'
25         d.setVarFlag('do_rootfs', 'mcdepends', dependency)
26
27         # Assume there is a X-lxc-config package for guest-image-X
28         config = image
29         if config.startswith('guest-image-'):
30             config = config[len('guest-image-'):]
31         d.appendVar('LXC_CONTAINER_CONFIGS', 'lxc-config-' + config)
32 }
33
34 install_container_images() {
35     for c in ${CONTAINER_IMAGES}; do
36         config=${c%:*}
37         image=${c#*:}
38         name=${image#guest-image-}
39         rm -rf  ${IMAGE_ROOTFS}/var/lib/machines/${name}
40         install -m 0755 -d ${IMAGE_ROOTFS}/var/lib/machines/${name}
41         src="${TOPDIR}/tmp-${config}/deploy/images/${MACHINE}/${image}-${MACHINE}${MACHINE_SUFFIX}.tar.bz2"
42         bbnote "Installing ${src}"
43         tar -C ${IMAGE_ROOTFS}/var/lib/machines/${name} -xf ${src}
44     done
45 }
46
47 #
48 # Force rebuild of rootfs on every build to work around mcdepends issue
49 #
50 # NOTE:
51 # This is currently required as bitbake fails to trigger do_rootfs
52 # sometimes even when the guest image has in fact rebuilt.  This is
53 # being investigated with upstream.
54 #
55 do_rootfs[nostamp] = "1"
56
57 ROOTFS_POSTPROCESS_COMMAND += "install_container_images; "
58
59 IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
60