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