* [PATCH] busybox: fix upgrade problem with deb packages
@ 2014-10-07 20:00 Aníbal Limón
2014-10-07 20:36 ` Andreas Oberritter
0 siblings, 1 reply; 8+ messages in thread
From: Aníbal Limón @ 2014-10-07 20:00 UTC (permalink / raw)
To: openembedded-core
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] busybox: fix upgrade problem with deb packages
2014-10-07 20:00 [PATCH] busybox: fix upgrade problem with deb packages Aníbal Limón
@ 2014-10-07 20:36 ` Andreas Oberritter
2014-10-07 22:49 ` Aníbal Limón
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Oberritter @ 2014-10-07 20:36 UTC (permalink / raw)
To: openembedded-core
Hello Aníbal,
On 07.10.2014 22:00, Aníbal Limón wrote:
> 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]
please don't overwrite files in /usr/local/bin! People may have their
own tools there.
This, and the creation of these symlinks in a tmpdir in the first place,
looks wrong to me.
I think you'd better get rid of update-alternatives-cworth and use an
implementation written in C.
See
http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dora
for many dpkg-related fixes including an offline-capable version of
dpkg's update-alternatives. I couldn't test these with master, but this
branch contains most if not all patches to dpkg backported from master
to dora.
Regards,
Andreas
>
> 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
> }
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] busybox: fix upgrade problem with deb packages
2014-10-07 20:36 ` Andreas Oberritter
@ 2014-10-07 22:49 ` Aníbal Limón
2014-10-07 23:39 ` Andreas Oberritter
0 siblings, 1 reply; 8+ messages in thread
From: Aníbal Limón @ 2014-10-07 22:49 UTC (permalink / raw)
To: openembedded-core
HI Andreas,
I reviewed the patches and looks good, only i have a comment
in this file,
http://git.openembedded.org/openembedded-core-contrib/commit/?h=obi/dora&id=a5f18409d1bf2877f898b902cafc317cbf7462e4
I didn't know if the same apply for rpm and ipk.
There are a lot of patches, Do you have a plan to port them to master?
I can help with that.
Best regards.
On 07/10/14 15:36, Andreas Oberritter wrote:
> Hello Aníbal,
>
> On 07.10.2014 22:00, Aníbal Limón wrote:
>> 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]
> please don't overwrite files in /usr/local/bin! People may have their
> own tools there.
>
> This, and the creation of these symlinks in a tmpdir in the first place,
> looks wrong to me.
>
> I think you'd better get rid of update-alternatives-cworth and use an
> implementation written in C.
>
> See
> http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dora
> for many dpkg-related fixes including an offline-capable version of
> dpkg's update-alternatives. I couldn't test these with master, but this
> branch contains most if not all patches to dpkg backported from master
> to dora.
>
> Regards,
> Andreas
>
>> 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
>> }
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] busybox: fix upgrade problem with deb packages
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
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Oberritter @ 2014-10-07 23:39 UTC (permalink / raw)
To: openembedded-core
On 08.10.2014 00:49, Aníbal Limón wrote:
> I reviewed the patches and looks good, only i have a comment
> in this file,
>
> http://git.openembedded.org/openembedded-core-contrib/commit/?h=obi/dora&id=a5f18409d1bf2877f898b902cafc317cbf7462e4
>
>
> I didn't know if the same apply for rpm and ipk.
I guess so. I'm pretty certain that opkg behaves just like dpkg in this
regard. I never used rpm, though.
To reproduce the problem, boot an image containing busybox, but not
bash. Then install bash and deinstall it again. Deinstallation fails,
resulting in a dangling symlink (/bin/sh -> /bin/bash).
> There are a lot of patches, Do you have a plan to port them to master?
>
> I can help with that.
I'd like to, but I won't have time to do any testing with master during
the next weeks. I could rebase my patches onto master and provide a tree
for you to test. Or you could cherry-pick whatever patches you like and
submit them to the mailing list after testing. Most patches should apply
without changes, but those touching rootfs_deb.bbclass and
package_deb.bbclass will need some porting. What do you think?
Regards,
Andreas
> Best regards.
>
> On 07/10/14 15:36, Andreas Oberritter wrote:
>> Hello Aníbal,
>>
>> On 07.10.2014 22:00, Aníbal Limón wrote:
>>> 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]
>> please don't overwrite files in /usr/local/bin! People may have their
>> own tools there.
>>
>> This, and the creation of these symlinks in a tmpdir in the first place,
>> looks wrong to me.
>>
>> I think you'd better get rid of update-alternatives-cworth and use an
>> implementation written in C.
>>
>> See
>> http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dora
>> for many dpkg-related fixes including an offline-capable version of
>> dpkg's update-alternatives. I couldn't test these with master, but this
>> branch contains most if not all patches to dpkg backported from master
>> to dora.
>>
>> Regards,
>> Andreas
>>
>>> 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
>>> }
>>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] busybox: fix upgrade problem with deb packages
2014-10-07 23:39 ` Andreas Oberritter
@ 2014-10-08 18:00 ` Aníbal Limón
2014-10-08 18:57 ` Andreas Oberritter
0 siblings, 1 reply; 8+ messages in thread
From: Aníbal Limón @ 2014-10-08 18:00 UTC (permalink / raw)
To: openembedded-core
On 07/10/14 18:39, Andreas Oberritter wrote:
> On 08.10.2014 00:49, Aníbal Limón wrote:
>> I reviewed the patches and looks good, only i have a comment
>> in this file,
>>
>> http://git.openembedded.org/openembedded-core-contrib/commit/?h=obi/dora&id=a5f18409d1bf2877f898b902cafc317cbf7462e4
>>
>>
>> I didn't know if the same apply for rpm and ipk.
> I guess so. I'm pretty certain that opkg behaves just like dpkg in this
> regard. I never used rpm, though.
>
> To reproduce the problem, boot an image containing busybox, but not
> bash. Then install bash and deinstall it again. Deinstallation fails,
> resulting in a dangling symlink (/bin/sh -> /bin/bash).
>
>> There are a lot of patches, Do you have a plan to port them to master?
>>
>> I can help with that.
> I'd like to, but I won't have time to do any testing with master during
> the next weeks. I could rebase my patches onto master and provide a tree
> for you to test. Or you could cherry-pick whatever patches you like and
> submit them to the mailing list after testing. Most patches should apply
> without changes, but those touching rootfs_deb.bbclass and
> package_deb.bbclass will need some porting. What do you think?
I think we need to port these patches in small changes in order to do
a good review,
I propose,
1. dpkg update-alternatives offline
2. apt-get upgrade version
3. another minor changes like pkg-config
Makes sense?
>
> Regards,
> Andreas
>
>
>> Best regards.
>>
>> On 07/10/14 15:36, Andreas Oberritter wrote:
>>> Hello Aníbal,
>>>
>>> On 07.10.2014 22:00, Aníbal Limón wrote:
>>>> 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]
>>> please don't overwrite files in /usr/local/bin! People may have their
>>> own tools there.
>>>
>>> This, and the creation of these symlinks in a tmpdir in the first place,
>>> looks wrong to me.
>>>
>>> I think you'd better get rid of update-alternatives-cworth and use an
>>> implementation written in C.
>>>
>>> See
>>> http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dora
>>> for many dpkg-related fixes including an offline-capable version of
>>> dpkg's update-alternatives. I couldn't test these with master, but this
>>> branch contains most if not all patches to dpkg backported from master
>>> to dora.
>>>
>>> Regards,
>>> Andreas
>>>
>>>> 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
>>>> }
>>>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] busybox: fix upgrade problem with deb packages
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
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Oberritter @ 2014-10-08 18:57 UTC (permalink / raw)
To: openembedded-core
On 08.10.2014 20:00, Aníbal Limón wrote:
>
> On 07/10/14 18:39, Andreas Oberritter wrote:
>> On 08.10.2014 00:49, Aníbal Limón wrote:
>>> I reviewed the patches and looks good, only i have a comment
>>> in this file,
>>>
>>> http://git.openembedded.org/openembedded-core-contrib/commit/?h=obi/dora&id=a5f18409d1bf2877f898b902cafc317cbf7462e4
>>>
>>>
>>>
>>> I didn't know if the same apply for rpm and ipk.
>> I guess so. I'm pretty certain that opkg behaves just like dpkg in this
>> regard. I never used rpm, though.
>>
>> To reproduce the problem, boot an image containing busybox, but not
>> bash. Then install bash and deinstall it again. Deinstallation fails,
>> resulting in a dangling symlink (/bin/sh -> /bin/bash).
>>
>>> There are a lot of patches, Do you have a plan to port them to master?
>>>
>>> I can help with that.
>> I'd like to, but I won't have time to do any testing with master during
>> the next weeks. I could rebase my patches onto master and provide a tree
>> for you to test. Or you could cherry-pick whatever patches you like and
>> submit them to the mailing list after testing. Most patches should apply
>> without changes, but those touching rootfs_deb.bbclass and
>> package_deb.bbclass will need some porting. What do you think?
>
> I think we need to port these patches in small changes in order to do
> a good review,
I already rebased all patches today, and just pushed it to this untested
branch:
http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/master
>
> I propose,
>
> 1. dpkg update-alternatives offline
> 2. apt-get upgrade version
> 3. another minor changes like pkg-config
>
> Makes sense?
OK. Here are some topic branches:
http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dpkg-ua
http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/apt
http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dpkg-misc
Regards,
Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] busybox: fix upgrade problem with deb packages
2014-10-08 18:57 ` Andreas Oberritter
@ 2014-10-09 22:42 ` Aníbal Limón
2014-10-09 23:31 ` Andreas Oberritter
0 siblings, 1 reply; 8+ messages in thread
From: Aníbal Limón @ 2014-10-09 22:42 UTC (permalink / raw)
To: openembedded-core
Andreas,
Now i'm testing dpkg-ua changes, my first impressions are,
Some work in order to use dpkg-ua version instead of opkg-utils (default),
files meta/conf/layer.con and
meta/recipes-core/packagegroups/packagegroup-self-hosted.bb.
Currently isn't created symlinks for tools in target image.
Comments?
Best regards.
On 08/10/14 13:57, Andreas Oberritter wrote:
> On 08.10.2014 20:00, Aníbal Limón wrote:
>> On 07/10/14 18:39, Andreas Oberritter wrote:
>>> On 08.10.2014 00:49, Aníbal Limón wrote:
>>>> I reviewed the patches and looks good, only i have a comment
>>>> in this file,
>>>>
>>>> http://git.openembedded.org/openembedded-core-contrib/commit/?h=obi/dora&id=a5f18409d1bf2877f898b902cafc317cbf7462e4
>>>>
>>>>
>>>>
>>>> I didn't know if the same apply for rpm and ipk.
>>> I guess so. I'm pretty certain that opkg behaves just like dpkg in this
>>> regard. I never used rpm, though.
>>>
>>> To reproduce the problem, boot an image containing busybox, but not
>>> bash. Then install bash and deinstall it again. Deinstallation fails,
>>> resulting in a dangling symlink (/bin/sh -> /bin/bash).
>>>
>>>> There are a lot of patches, Do you have a plan to port them to master?
>>>>
>>>> I can help with that.
>>> I'd like to, but I won't have time to do any testing with master during
>>> the next weeks. I could rebase my patches onto master and provide a tree
>>> for you to test. Or you could cherry-pick whatever patches you like and
>>> submit them to the mailing list after testing. Most patches should apply
>>> without changes, but those touching rootfs_deb.bbclass and
>>> package_deb.bbclass will need some porting. What do you think?
>> I think we need to port these patches in small changes in order to do
>> a good review,
> I already rebased all patches today, and just pushed it to this untested
> branch:
>
> http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/master
>
>> I propose,
>>
>> 1. dpkg update-alternatives offline
>> 2. apt-get upgrade version
>> 3. another minor changes like pkg-config
>>
>> Makes sense?
> OK. Here are some topic branches:
>
> http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dpkg-ua
> http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/apt
> http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dpkg-misc
>
> Regards,
> Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] busybox: fix upgrade problem with deb packages
2014-10-09 22:42 ` Aníbal Limón
@ 2014-10-09 23:31 ` Andreas Oberritter
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Oberritter @ 2014-10-09 23:31 UTC (permalink / raw)
To: openembedded-core
On 10.10.2014 00:42, Aníbal Limón wrote:
> Now i'm testing dpkg-ua changes, my first impressions are,
>
> Some work in order to use dpkg-ua version instead of opkg-utils (default),
> files meta/conf/layer.con and
> meta/recipes-core/packagegroups/packagegroup-self-hosted.bb.
>
> Currently isn't created symlinks for tools in target image.
>
> Comments?
Sounds like this problem:
http://comments.gmane.org/gmane.comp.handhelds.openembedded.core/47626
Did update-alternatives get staged correctly into your native sysroot?
If opkg-utils-native was built after dpkg-native, it may have
overwritten update-alternatives. To avoid this I've put the following
into my local.conf:
INHERIT += "blacklist"
PNBLACKLIST[opkg-utils-native] = "opkg-utils-native must not be built
when using debian packages"
I'm not sure whether this may cause a similar effect.
Regards,
Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-10-09 23:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07 20:00 [PATCH] busybox: fix upgrade problem with deb packages Aníbal Limón
2014-10-07 20:36 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox