summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/rootfs-postcommands.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/rootfs-postcommands.bbclass')
-rw-r--r--meta/classes-recipe/rootfs-postcommands.bbclass25
1 files changed, 18 insertions, 7 deletions
diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass
index 70ad3670d7..8b5822a0b5 100644
--- a/meta/classes-recipe/rootfs-postcommands.bbclass
+++ b/meta/classes-recipe/rootfs-postcommands.bbclass
@@ -43,7 +43,7 @@ ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest"
43POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log" 43POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
44# Set default target for systemd images 44# Set default target for systemd images
45SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains_any("IMAGE_FEATURES", [ "x11-base", "weston" ], "graphical.target", "multi-user.target", d)}' 45SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains_any("IMAGE_FEATURES", [ "x11-base", "weston" ], "graphical.target", "multi-user.target", d)}'
46ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target systemd_sysusers_check", "", d)}' 46ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target systemd_sysusers_check systemd_handle_machine_id", "", d)}'
47 47
48ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile' 48ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile'
49 49
@@ -173,6 +173,23 @@ python systemd_sysusers_check() {
173 check_group_exists(d, sid) 173 check_group_exists(d, sid)
174} 174}
175 175
176systemd_handle_machine_id() {
177 if ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false", d)}; then
178 # Create machine-id
179 # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
180 touch ${IMAGE_ROOTFS}${sysconfdir}/machine-id
181 fi
182 # In order to be backward compatible with the previous OE-core specific (re)implementation of systemctl
183 # we need to touch machine-id when handling presets and when the rootfs is NOT stateless
184 if ${@ 'true' if not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else 'false'}; then
185 touch ${IMAGE_ROOTFS}${sysconfdir}/machine-id
186 if [ -e ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; then
187 systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all
188 systemctl --root="${IMAGE_ROOTFS}" --global --preset-mode=enable-only preset-all
189 fi
190 fi
191}
192
176# 193#
177# A hook function to support read-only-rootfs IMAGE_FEATURES 194# A hook function to support read-only-rootfs IMAGE_FEATURES
178# 195#
@@ -224,12 +241,6 @@ read_only_rootfs_hook () {
224 ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh 241 ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
225 fi 242 fi
226 fi 243 fi
227
228 if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
229 # Create machine-id
230 # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
231 touch ${IMAGE_ROOTFS}${sysconfdir}/machine-id
232 fi
233} 244}
234 245
235# 246#