From: WXbet <[email protected]>

On the target, the postinst of kernel-image-<type> creates the
${KERNEL_IMAGEDEST}/<type> link with a path relative to the current
directory, and the postrm removes it the same way. opkg runs package
scripts in the directory of its caller, so an upgrade started from any
directory other than / makes ln fail. The fallback then copies the image
with install, which the busybox defconfig does not enable:

  sh: install: command not found

and the postrm leaves the link behind.

Anchor the link location at / as the rootfs-time case anchors it at $D.
The link target stays relative to ${KERNEL_IMAGEDEST}.

Signed-off-by: WXbet <[email protected]>
---

Notes:
    The relative path seems to date back to bb946b8cdb ("classes/kernel: Use
    a copy of image for kernel*.rpm if fs doesn't support symlinks"), which
    moved the link from do_install into the postinst. When $D is set at rootfs
    time, the link is still anchored at $D. If the on-target case is meant to
    be relative to the current directory, please let me know how package
    managers are expected to call it.

 meta/classes-recipe/kernel.bbclass | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/classes-recipe/kernel.bbclass 
b/meta/classes-recipe/kernel.bbclass
index 0a6d754108..8d8af113f7 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -136,17 +136,17 @@ python __anonymous () {
 if [ -n "$D" ]; then
     ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
 else
-    ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+    ln -sf %s-${KERNEL_VERSION} /${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
     if [ $? -ne 0 ]; then
-        echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, 
falling back to copied image (%s)."
-        install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} 
${KERNEL_IMAGEDEST}/%s
+        echo "Filesystem on /${KERNEL_IMAGEDEST}/ doesn't support symlinks, 
falling back to copied image (%s)."
+        install -m 0644 /${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} 
/${KERNEL_IMAGEDEST}/%s
     fi
 fi
 set -e
 """ % (type, type, type, type, type, type, type))
             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
+if [ -f "/${KERNEL_IMAGEDEST}/%s" -o -L "/${KERNEL_IMAGEDEST}/%s" ]; then
+    rm -f /${KERNEL_IMAGEDEST}/%s  > /dev/null 2>&1
 fi
 set -e
 """ % (type, type, type))
-- 
2.47.1.windows.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245792): 
https://lists.openembedded.org/g/openembedded-core/message/245792
Mute This Topic: https://lists.openembedded.org/mt/121247994/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to