[yocto] [RFC][PATCH 1/1] kernel.bbclass: Do not overwrite pre/postinst
Oliver Stäbler
oliver.staebler at bytesatwork.ch
Mon Aug 21 05:55:18 PDT 2017
If a recipe sets a custom pre/postinst function for kernel-image, this
function gets discarded, which means there is no possibility to set a
custom pre/postinst function.
We check if there is a custom pre/postinst function and only set the
default function if nothing is set.
Signed-off-by: Oliver Stäbler <oliver.staebler at bytesatwork.ch>
---
meta/classes/kernel.bbclass | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 2a765547ac..e553460566 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -66,11 +66,13 @@ python __anonymous () {
d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
priority = d.getVar('KERNEL_PRIORITY')
- postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
- d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
+ if not d.getVar('pkg_postinst_kernel-image-' + typelower):
+ postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
+ d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
- postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
- d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
+ if not d.getVar('pkg_postrm_kernel-image-' + typelower):
+ postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
+ d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
image = d.getVar('INITRAMFS_IMAGE')
if image:
--
2.13.5
More information about the yocto
mailing list