image.bbclass: add ability to set systemd default target
v2 cover image.bbclass: add ability to set systemd default target
From: Chen Qi <[email protected]>
Changes since V1:
1. Fix a problem when building live images
The following changes since commit 9daa1de753e58b7f678e68cf307f6028c0c79a6a:
qemu/local.conf.sample: Add sdl PACKAGECONFIG (2013-12-16 12:13:59 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib ChenQi/systemd-default-target
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/systemd-default-target
Chen Qi (1):
image.bbclass: add ability to set systemd default target
meta/classes/image.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)
Signature · 1 line
1.7.9.5
PATCH v2 1/1 image.bbclass: add ability to set systemd default target
From: Chen Qi <[email protected]>
Add ability to set the default target for systemd images.
The default value for the target is derived from checking whether IMAGE_FEATRUES contains 'x11-base' or not. Each image could override this value in its own recipe. For now, we don't need to do any change, because all images that support graphical environment has 'x11-base' in its IMAGE_FEATRUES.
[YOCTO #3816]
--- meta/classes/image.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/classes/image.bbclass +10 -0
@@ -186,6 +186,9 @@ IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest" 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 ?= '${@base_contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}' +ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}' # some default locales IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
@@ -596,6 +599,13 @@ postinst_enable_logging () { echo "LOGFILE=${POSTINST_LOGFILE}" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst } +# Modify systemd default target +set_systemd_default_target () { + if [ -d ${IMAGE_ROOTFS}${sysconfdir}/systemd/system -a -e ${IMAGE_ROOTFS}${systemd_unitdir}/system/${SYSTEMD_DEFAULT_TARGET} ]; then + ln -sf ${systemd_unitdir}/system/${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${sysconfdir}/systemd/system/default.target + fi +} + # Turn any symbolic /sbin/init link into a file remove_init_link () { if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
Signature · 1 line
1.7.9.5
Op 18 dec. 2013, om 08:49 heeft [email protected] het volgende geschreven:
Quoted 6 lines
From: Chen Qi <[email protected]>
Add ability to set the default target for systemd images.
The default value for the target is derived from checking whether
IMAGE_FEATRUES
typo
Quoted 4 lines
contains 'x11-base' or not. Each image could override
this value in its own recipe. For now, we don't need to do any change, because all images that support graphical environment has 'x11-base' in itsIMAGE_FEATRUES.
typo
And you're missing the actual SYSTEMD_DEFAULT_TARGET in the description. If it only works on images, please to something like IMAGE_SYSTEMD_DEFAULT_TARGET
Quoted 44 lines
[YOCTO #3816]
Signed-off-by Chen Qi <[email protected]>---
meta/classes/image.bbclass | 10 ++++++++++1 file changed, 10 insertions(+)meta/classes/image.bbclass +0
-0@@ -186,6 +186,9 @@ IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest"
ROOTFS_POSTPROCESS_COMMAND=+ "write_image_manifest; " # Set default postinst log filePOSTINST_LOGFILE?= "${localstatedir}/log/postinstall.log"meta/classes/image.bbclass +3
-0+# Set default target for systemd images +SYSTEMD_DEFAULT_TARGET ?= '${@base_contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}' +ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}'# some default locales IMAGE_LINGUAS ?= "de-de fr-fr en-gb"meta/classes/image.bbclass +7
-0@@ -596,6 +599,13 @@ postinst_enable_logging () { echo "LOGFILE=${POSTINST_LOGFILE}" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst } +# Modify systemd default target +set_systemd_default_target () { + if [ -d ${IMAGE_ROOTFS}${sysconfdir}/systemd/system -a -e ${IMAGE_ROOTFS}${systemd_unitdir}/system/${SYSTEMD_DEFAULT_TARGET} ]; then + ln -sf ${systemd_unitdir}/system/${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${sysconfdir}/systemd/system/default.target + fi +} + # Turn any symbolic /sbin/init link into a file remove_init_link () { if [ -h ${IMAGE_ROOTFS}/sbin/init ]; thenSignature · 6 lines
1.7.9.5 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 8 lines · Koen Kooi
Op 18 dec. 2013, om 08:49 heeft [email protected] het volgende geschreven:
Quoted 6 lines
From: Chen Qi <[email protected]>
Add ability to set the default target for systemd images.
The default value for the target is derived from checking whether
IMAGE_FEATRUES
Quoted 7 lines
typo
Quoted 4 lines
contains 'x11-base' or not. Each image could override
this value in its own recipe. For now, we don't need to do any change, because all images that support graphical environment has 'x11-base' in itsIMAGE_FEATRUES.typo
Thanks for pointing it out.
Quoted 1 line
And you're missing the actual
SYSTEMD_DEFAULT_TARGETin the description.
I'll modify the commit message and send out a new version.
Quoted 1 line
If it only works on images, please to something like
IMAGE_SYSTEMD_DEFAULT_TARGET
What do you mean by "it only works on images"?
Best Regards,
Chen Qi
Quoted 45 lines
Quoted 43 lines
[YOCTO #3816]
Signed-off-by Chen Qi <[email protected]>---
meta/classes/image.bbclass | 10 ++++++++++1 file changed, 10 insertions(+)meta/classes/image.bbclass +0
-0@@ -186,6 +186,9 @@ IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest"
ROOTFS_POSTPROCESS_COMMAND=+ "write_image_manifest; " # Set default postinst log filePOSTINST_LOGFILE?= "${localstatedir}/log/postinstall.log"meta/classes/image.bbclass +3
-0+# Set default target for systemd images +SYSTEMD_DEFAULT_TARGET ?= '${@base_contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}' +ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}'# some default locales IMAGE_LINGUAS ?= "de-de fr-fr en-gb"meta/classes/image.bbclass +7
-0@@ -596,6 +599,13 @@ postinst_enable_logging () { echo "LOGFILE=${POSTINST_LOGFILE}" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst } +# Modify systemd default target +set_systemd_default_target () { + if [ -d ${IMAGE_ROOTFS}${sysconfdir}/systemd/system -a -e ${IMAGE_ROOTFS}${systemd_unitdir}/system/${SYSTEMD_DEFAULT_TARGET} ]; then + ln -sf ${systemd_unitdir}/system/${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${sysconfdir}/systemd/system/default.target + fi +} + # Turn any symbolic /sbin/init link into a file remove_init_link () { if [ -h ${IMAGE_ROOTFS}/sbin/init ]; thenSignature · 6 lines
1.7.9.5 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core