summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2019-07-01 12:15:33 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-02 08:13:07 +0100
commitda263d9c7af86c6cdd1b119080c9fd685183a396 (patch)
tree5a449b27996160e595641dc7a2a049172713b054
parent8c53f5e956e5236825e4b58036043db3fa9626b7 (diff)
downloadpoky-da263d9c7af86c6cdd1b119080c9fd685183a396.tar.gz
image.bbclass: fix systemd_preset_all
Check the existence of systemd before using systemctl to preset units. This is because even if 'systemd' is in DISTRO_FEATURES, it's possible that systemd is not even installed. e.g. container-test-image in meta-selftest layer. As systemd DEPENDS on systemd-systemctl-native, the existence of systemd also ensures the existence of systemd-systemctl-native. This would fix the following test case when using systemd as the init manager. containerimage.ContainerImageTests.test_expected_files Also remove the IMAGE_EXTRADEPENDS setting, as nothing references this variable. (From OE-Core rev: c9854a4ab6af9e60b1a588a87b9a062624af6fae) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image.bbclass5
1 files changed, 3 insertions, 2 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d2b2fb979e..7daa97effb 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -666,10 +666,11 @@ reproducible_final_image_task () {
666} 666}
667 667
668systemd_preset_all () { 668systemd_preset_all () {
669 systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all 669 if [ -e ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; then
670 systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all
671 fi
670} 672}
671 673
672IMAGE_EXTRADEPENDS += "${@ 'systemd-systemctl-native' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''}"
673IMAGE_PREPROCESS_COMMAND_append = " ${@ 'systemd_preset_all;' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''} reproducible_final_image_task; " 674IMAGE_PREPROCESS_COMMAND_append = " ${@ 'systemd_preset_all;' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''} reproducible_final_image_task; "
674 675
675CVE_PRODUCT = "" 676CVE_PRODUCT = ""