Patchwork [3/9] image.bbclass: set the proper default target

login
register
mail settings
Submitter Valentin Popa
Date July 15, 2014, 8 a.m.
Message ID <1405411250-10594-3-git-send-email-valentin.popa@intel.com>
Download mbox | patch
Permalink /patch/75513/
State New
Headers show

Comments

Valentin Popa - July 15, 2014, 8 a.m.
Check also for "wayland" presence in DISTRO_FEATURES
before creating default.target.

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 meta/classes/image.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index a03b880..04aa14b 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -153,7 +153,6 @@  ROOTFS_POSTPROCESS_COMMAND =+ "write_image_manifest ; "
 # Set default postinst log file
 POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
 # Set default target for systemd images
-SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}'
 ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}'
 
 # some default locales
@@ -171,6 +170,17 @@  do_rootfs[cleandirs] += "${S}"
 # task, so that we have a single fakeroot context for the whole process.
 do_rootfs[umask] = "022"
 
+def determine_default_target(d):
+      graphical_target =  bb.utils.contains("IMAGE_FEATURES", "x11-base", True, False, d) or \
+                       bb.utils.contains("DISTRO_FEATURES", "wayland", True, False, d)
+      if graphical_target:
+         return "graphical.target"
+      else:
+        return "multi-user.target"
+
+
+SYSTEMD_DEFAULT_TARGET ?= '${@determine_default_target(d)}'
+
 # A hook function to support read-only-rootfs IMAGE_FEATURES
 # Currently, it only supports sysvinit system.
 read_only_rootfs_hook () {