aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-ic-container/recipes-platform/images/lxc-host-image-minimal.bb
blob: 38fc7b26b6cc9fe394fd58d3f3eb61f3ecaeb982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
SUMMARY = "A minimal container host image"

require recipes-platform/images/agl-image-boot.inc

IMAGE_INSTALL += " \
    kernel-image \
    lxc \
    ${LXC_CONTAINER_CONFIGS} \
    drm-lease-manager \
"

CONTAINER_IMAGES ??= ""

LXC_CONTAINER_CONFIGS ?= ""

IMAGE_LINGUAS = " "

NO_RECOMMENDATIONS = "1"

# Handle modification of IMAGE_LINK_NAME done by ULCB builds with Kingfisher support
MACHINE_SUFFIX = "${@bb.utils.contains('AGL_FEATURES', 'kingfisher', '-kf', '', d)}"

python __anonymous() {
    for c in (d.getVar('CONTAINER_IMAGES') or "").split():
        (mc, image) = c.split(':')
        dependency = 'mc::' + mc + ':' + image + ':do_image_complete'
        d.appendVarFlag('do_rootfs', 'mcdepends', ' ' + dependency)

        # Assume there is a X-lxc-config package for guest-image-X
        config = image
        if config.startswith('guest-image-'):
            config = config[len('guest-image-'):]
        d.appendVar('LXC_CONTAINER_CONFIGS', ' ' + 'lxc-config-' + config)
}

install_container_images() {
    for c in ${CONTAINER_IMAGES}; do
        config=${c%:*}
        image=${c#*:}
        name=${image#guest-image-}
        rm -rf  ${IMAGE_ROOTFS}/var/lib/machines/${name}
        install -m 0755 -d ${IMAGE_ROOTFS}/var/lib/machines/${name}
        src="${TOPDIR}/tmp-${config}/deploy/images/${MACHINE}/${image}-${MACHINE}${MACHINE_SUFFIX}.tar.bz2"
        bbnote "Installing ${src}"
        tar -C ${IMAGE_ROOTFS}/var/lib/machines/${name} -xf ${src}
    done
}

#
# Force rebuild of rootfs on every build to work around mcdepends issue
#
# NOTE:
# This is currently required as bitbake fails to trigger do_rootfs
# sometimes even when the guest image has in fact rebuilt.  This is
# being investigated with upstream.
#
do_rootfs[nostamp] = "1"

ROOTFS_POSTPROCESS_COMMAND += "install_container_images; "

IMAGE_ROOTFS_EXTRA_SPACE:append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"