[v2] classes/kernel.bbclass: allow disabling symlink creation also for pkg_postinst

Message ID 20220513110449.167244-1-jonas.hoeppner@garz-fricke.com
State New
Headers show
Series [v2] classes/kernel.bbclass: allow disabling symlink creation also for pkg_postinst | expand

Commit Message

Jonas Höppner May 13, 2022, 11:04 a.m. UTC
From: Jonas Höppner <jonas.hoeppner@garz-fricke.com>

The commit d7341f1f22c32ff6cc95d7127f26f87d7fc9c6bd has introduced a
variable to disable the symlink creation for kernel images.
kernel.bbclass contains code to generate a pkg_posinst step for the
kernel-image package which will generate a symlink after installation
on target/during rootfs creation. This part didn't checked the
KERNEL_IMAGETYPE_SYMLINK variable.

This patch adds this check, so that it is possible to disable this
symlink also.

Signed-off-by: Jonas Höppner <jonas.hoeppner@garz-fricke.com>
---
 meta/classes/kernel.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 8299b394a7..87e0970f00 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -93,6 +93,7 @@  python __anonymous () {
 
     kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
     imagedest = d.getVar('KERNEL_IMAGEDEST')
+    kernel_imagetype_symlink = d.getVar('KERNEL_IMAGETYPE_SYMLINK')
 
     for type in types.split():
         if bb.data.inherits_class('nopackages', d):
@@ -110,7 +111,8 @@  python __anonymous () {
 
         d.setVar('PKG:%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
         d.setVar('ALLOW_EMPTY:%s-image-%s' % (kname, typelower), '1')
-        d.setVar('pkg_postinst:%s-image-%s' % (kname,typelower), """set +e
+        if kernel_imagetype_symlink == 1:
+            d.setVar('pkg_postinst:%s-image-%s' % (kname,typelower), """set +e
 if [ -n "$D" ]; then
     ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
 else
@@ -122,7 +124,7 @@  else
 fi
 set -e
 """ % (type, type, type, type, type, type, type))
-        d.setVar('pkg_postrm:%s-image-%s' % (kname,typelower), """set +e
+            d.setVar('pkg_postrm:%s-image-%s' % (kname,typelower), """set +e
 if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then
     rm -f ${KERNEL_IMAGEDEST}/%s  > /dev/null 2>&1
 fi