summaryrefslogtreecommitdiffstats
path: root/meta-sota/recipes-sota/ostree-initramfs/ostree-initramfs.bb
blob: 5b3818cc8f69fc10b2a88d3c8965e436c99e4134 (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
# Small hook to call ostree-prepare-root on initrd-switch-root

LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=751419260aa954499f7abaabaa882bbe"

S = "${WORKDIR}"

SRC_URI = "file://COPYING.GPL"

DEPENDS += " ostree"

FILES_${PN} += "${systemd_unitdir} \
		${systemd_unitdir}/system \
		${systemd_unitdir}/system/initrd-switch-root.target.wants \
		${systemd_unitdir}/system/initrd-switch-root.target.wants/ostree-prepare-root.service \
		${sysconfdir}/initrd-release \
		"

export OSTREE_INITRAMFS_IMAGE

do_install() {
	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
		install -d ${D}${sysconfdir}
		echo "NAME=${OSTREE_INITRAMFS_IMAGE}" > ${D}/${sysconfdir}/initrd-release
		install -d ${D}${systemd_unitdir}
		install -d ${D}${systemd_unitdir}/system

		install -d ${D}${systemd_unitdir}/system/initrd-switch-root.target.wants
		ln -s ${systemd_unitdir}/system/ostree-prepare-root.service  \
			"${D}${systemd_unitdir}/system/initrd-switch-root.target.wants/ostree-prepare-root.service"
	fi
}