or, Adventures in Regressions and Crazy Ideas
This work is now done.
The rest of this page is kept only for reference and historical purposes.
Two Problems
opkg-lede
and the Outsourced Inflation
opkg-lede
now relies on an external gzip
executable.
When upgrading a package, it tries to execute gzip
to unpack maintainer
scripts and data files after removing the old version of the
package. When the package being upgraded is busybox
, which provides gzip
,
opkg
crashes and leaves behind a completely broken system.
To reiterate, opkg-lede
is (and has been for as long as it has been in
ProteanOS) currently unable to upgrade busybox
, due to its own design.
The Amazing Alternatives of busybox
Instead of adding alternatives one at a time, it would be
nice to manage all of busybox
's utility links using
update-alternatives
. Unfortunately, the maintainer script that runs
update-alternatives
(as well as the update-alternatives
script
itself) needs a few busybox
utilities (/bin/sh
for a start). Thus, after an
older version of busybox
is deconfigured, a newer version can't be configured.
busybox
also can't be configured when first unpacked by prokit
.
One Solution
The next version of src:opkg-lede
(likely 0+git20190131.d4ba162-7) already
will have a wrapper script called opkg
that executes opkg-cl
(the
actual binary executable). The script can be extended to first save a copy of
/bin/busybox
to an empty temporary directory, generate utility links to it in
the directory, and add the directory to PATH
. Until all of this setup is
complete, the wrapper script must be careful to execute utilities as busybox
$util
(a full path to busybox
won't be necessary, as the usual /bin/busybox
will be available at that point). This includes the interpreter line, which
will need to be changed to #!/bin/busybox sh
. ash
built-in utilities can be
used as usual.
The busybox
package can't use update-alternatives
to manage all of its
utility links until an opkg-lede
with this wrapper script functionality is
uploaded. This is because, even if busybox
's postinst
script is modified to
use the busybox
executable directly, other packages' maintainer scripts may be
executed first, while busybox
is unpacked but not yet configured (and
therefore utility links are not yet created).
Once this new opkg-lede
package is uploaded and busybox
uses
update-alternatives
for everything, busybox
would need to declare that it
Breaks
older versions of opkg-lede
, to ensure that opkg-lede
will preserve
a copy of the busybox
executable and its utility links. However, this is
still insufficient, as the version of opkg
that is running must have already
set up this environment before busybox
is upgraded. busybox
's prerm
script will need to check for this somehow and abort the upgrade if opkg
is
too old to have prepared for a safe upgrade. One solution is for the opkg
script to set an OPKG_BUSYBOX_SAVED
environment variable.
The opkg
script of the opkg-lede
package will need to read busybox
's list
of alternatives links. This is currently located at
/usr/share/busybox/alternatives
. The file's format will change when
busybox
uses update-alternatives
for everything: the last two columns (name
and priority) will be dropped. opkg
however can simply read the first column,
so it will maintain compatibility.