From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] busybox: fix upgrade problem with deb packages
Date: Tue, 7 Oct 2014 15:00:30 -0500 [thread overview]
Message-ID: <1412712030-12657-1-git-send-email-anibal.limon@linux.intel.com> (raw)
Busybox prerm scripts create temp directory and fill with
symlinks to common utilities in order to upgrade itself, PATH
is exported but dpkg didn't take a look of this links and fails.
In order to fix,
Changed temp directory to /usr/loca/bin in debian packages.
Added missing links for utilities tar, find, tail, cut.
Busybox syslog prerm script tries to stop the daemon but if already
stopped returns 1 then causes that dpkg fails because it expects 0.
In order to fix,
Added workaround to exit 0 in debian packages.
[YOCTO #6768]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
meta/recipes-core/busybox/busybox.inc | 46 ++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index bd66e4f..61f12b4 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -377,13 +377,46 @@ pkg_postinst_${PN} () {
fi
done
fi
+
+ # Workaround for deb packages, clean
+ if [ "$DPKG_MAINTSCRIPT_PACKAGE"x != x ]; then
+ tmpdir='/usr/local/bin'
+ rm -f $tmpdir/[
+ rm -f $tmpdir/test
+ rm -f $tmpdir/head
+ rm -f $tmpdir/sh
+ rm -f $tmpdir/basename
+ rm -f $tmpdir/echo
+ rm -f $tmpdir/mv
+ rm -f $tmpdir/ln
+ rm -f $tmpdir/dirname
+ rm -f $tmpdir/rm
+ rm -f $tmpdir/sed
+ rm -f $tmpdir/sort
+ rm -f $tmpdir/grep
+ rm -f $tmpdir/tar
+ rm -f $tmpdir/find
+ rm -f $tmpdir/tail
+ rm -f $tmpdir/cut
+ fi
}
pkg_prerm_${PN} () {
# This is so you can make busybox commit suicide - removing busybox with no other packages
# providing its files, this will make update-alternatives work, but the update-rc.d part
# for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
- tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
+
+ # Workaround for deb packages, dpkg don't take into account exported PATH variable,
+ # use instead local directory.
+ if [ "$DPKG_MAINTSCRIPT_PACKAGE"x == x ]; then
+ tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
+ else
+ tmpdir='/usr/local/bin'
+ if [ ! -e $tmpdir ]; then
+ mkdir -p $tmpdir
+ fi
+ fi
+
ln -s /bin/busybox $tmpdir/[
ln -s /bin/busybox $tmpdir/test
ln -s /bin/busybox $tmpdir/head
@@ -397,6 +430,11 @@ pkg_prerm_${PN} () {
ln -s /bin/busybox $tmpdir/sed
ln -s /bin/busybox $tmpdir/sort
ln -s /bin/busybox $tmpdir/grep
+ ln -s /bin/busybox $tmpdir/tar
+ ln -s /bin/busybox $tmpdir/find
+ ln -s /bin/busybox $tmpdir/tail
+ ln -s /bin/busybox $tmpdir/cut
+
export PATH=$PATH:$tmpdir
}
@@ -405,6 +443,12 @@ pkg_prerm_${PN}-syslog () {
if test "x$D" = "x"; then
if test "$1" = "upgrade" -o "$1" = "remove"; then
/etc/init.d/syslog stop
+
+ # Workaround for deb packages, if syslog is already stopped returns
+ # 1 but dpkg expects 0 and then fails.
+ if [ "$DPKG_MAINTSCRIPT_PACKAGE"x != x ]; then
+ exit 0
+ fi
fi
fi
}
--
1.9.1
next reply other threads:[~2014-10-07 19:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 20:00 Aníbal Limón [this message]
2014-10-07 20:36 ` [PATCH] busybox: fix upgrade problem with deb packages Andreas Oberritter
2014-10-07 22:49 ` Aníbal Limón
2014-10-07 23:39 ` Andreas Oberritter
2014-10-08 18:00 ` Aníbal Limón
2014-10-08 18:57 ` Andreas Oberritter
2014-10-09 22:42 ` Aníbal Limón
2014-10-09 23:31 ` Andreas Oberritter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412712030-12657-1-git-send-email-anibal.limon@linux.intel.com \
--to=anibal.limon@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox