[OpenWrt-Devel] Future of opkg -d ; broken in BB, CC & LEDE17

Matthias Strubel Matthias.Strubel at aod-rpg.de
Fri Jun 9 10:52:36 EDT 2017

Hi OpenWrt developers,
I am writing this email to the OpenWrt-Dev mailing list only because I have the hope OpenWrt & LEDE will merge soon.. both versions are affected of the following.

On PirateBox & LibraryBox we are not using extroot techniques to enhance the firmware space, but we make use of the command

  opkg -d <dest>

We put the extended space into a file on the mounted FAT-USB stick, which is mounted via a looback device. The advantage for the Linux inexperienced PirateBox/LibraryBox users (focused group) is that they can easily exchange the USB stick (copy & paste) instead of dd'ing partitions or handling ext4 filesystems.

Yes, not every package has support for this, so I created a bunch of packages which bring those packages to life and it worked quite well on AA. 
I created shell extension to honour additional lib folder and extended PATH variable.. in additional to various linking from the rootfs to the extended space (/usr/local).
Mostly all of this handling was done in the postinst package step.

opkg propagates the -d destination to the package via the environment variable PKG_ROOT , not IPKG_INSTROOT . 
The package relevant information (opkg/info folder) is stored in $PKG_ROOT/usr/lib/opkg/info/

As far as I traced back the changes, with BB (or CC) a change was introduced and the package-postinst step was divided into postinst and postinst.pkg. 

How the default postinst function is written, it does not use PKG_ROOT in any case.
This change broke the -d function nearly completely, because

 a) PKG_ROOT is not used for the access to the info & control files
 b) postinst.pkg scripts are only executed from the / folder and $IPKG_INSTROOT  ; but the 

BTW: in current trunk (https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/functions.sh)is a merge error @line 223 ; the section is duplicated in the source.

I am close to manually patch the file during our imagebuilder processing to solve the issues for the LibraryBox & PirateBox projects... but I am willing to provide a proper solution upstream.

Does it makes sense for you to fix that, or is "opkg -d" more like an unwanted feature which will be removed in the future? 
(because classical extroot is "more convenient") 

Thank you,
Best regards
Matthias Strubel

BTW2: In addition, the default_postinst automatically enables new init.d .. even this is an unwanted behaviour, there is no way to avoid the auto-activation :-/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20170609/9059cd1d/attachment.sig>
-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list