Looks like my "solution" also isn't working well at least for images with
read-only-rootfs in IMAGE_FEATURES.

pkg_postinst_ontarget_${PN} is always forced to run on the target, which
for read-only-rootfs results in:
log.do_rootfs:
...
NOTE: If an image is being built, the postinstalls for the following
packages will be postponed for first boot: nss
...
ERROR: The following packages could not be configured offline and rootfs is
read-only: ['nss']

and now looking at the /usr/bin/signlibs.sh:

CHK_FILES=`ls /lib*/*.chk /usr/lib*/*.chk 2>/dev/null`
SIGN_BINARY=`which shlibsign`
for I in $CHK_FILES
do
       DN=`dirname $I`
       BN=`basename $I .chk`
       FN=$DN/$BN.so
       $SIGN_BINARY -i $FN
done

it does pretty much the same as the postinst script when D isn't empty.

>From oe-core git history it shows that signlibs.sh was added first:
https://git.openembedded.org/openembedded-core/commit/?id=a4580f967c8064294a06d406acf5deb24aee2acc
then the offline version of postinst was added to support read-only-rootfs
in:
https://git.openembedded.org/openembedded-core/commit/?id=64e87fc6e99bc1d4807034166735034b1f92bad8
and nss-native should always provide the shlibsign since:
https://git.openembedded.org/openembedded-core/commit/?id=88540c5b08dea069660d1a68e506aebdd68e6ae0
and only after
https://git.openembedded.org/openembedded-core/commit/?id=8f782f7095e718dd9452055af53363beb6bdbece
it looked like signlibs.sh was something special only for target.

So it looks to me, that we should just remove signlibs.sh script and let
the same postinst be used on target and offline
(with or without D being empty).

Cheers,

On Mon, Aug 31, 2020 at 9:45 AM <[email protected]> wrote:

> Hi,
>
> On Fri, Aug 28, 2020 at 09:01:34PM +0200, Martin Jansa wrote:
> > Partially revert "nss: fix postinst script for nativesdk build"
> >
> > This reverts commit 31552510b15c1c97aa6cbe180c2bb53d139efbcc.
> >
> > When running in do_rootfs we need to run shlibsign provided
> > by nss-native, otherwise it fails when /usr/bin/shlibsign
> > doesn't exist on host builder:
> >
> > do_rootfs: Postinstall scriptlets of ['nss'] have failed. If the
> intention is to defer them to first boot,
> > then please place them into pkg_postinst_ontarget_${PN} ().
> > Deferring to first boot via 'exit 1' is no longer supported.
>
> Thanks for this, it fixes all issues.
>
> I didn't properly test my patch. Sorry!
>
> -Mikko
>
> > Signed-off-by: Martin Jansa <[email protected]>
> > ---
> >  meta-oe/recipes-support/nss/nss_3.54.bb | 26 ++++++++++++-------------
> >  1 file changed, 13 insertions(+), 13 deletions(-)
> >
> > diff --git a/meta-oe/recipes-support/nss/nss_3.54.bb
> b/meta-oe/recipes-support/nss/nss_3.54.bb
> > index 882145c1ef..81b2538813 100644
> > --- a/meta-oe/recipes-support/nss/nss_3.54.bb
> > +++ b/meta-oe/recipes-support/nss/nss_3.54.bb
> > @@ -240,19 +240,19 @@ do_install_append_class-target() {
> >
> >  PACKAGE_WRITE_DEPS += "nss-native"
> >  pkg_postinst_${PN} () {
> > -    if [ -n "$D" ]; then
> > -        for I in $D${libdir}/lib*.chk; do
> > -            DN=`dirname $I`
> > -            BN=`basename $I .chk`
> > -            FN=$DN/$BN.so
> > -            ${bindir}/shlibsign -i $FN
> > -            if [ $? -ne 0 ]; then
> > -                exit 1
> > -            fi
> > -        done
> > -    else
> > -        ${bindir}/signlibs.sh
> > -    fi
> > +    for I in $D${libdir}/lib*.chk; do
> > +        DN=`dirname $I`
> > +        BN=`basename $I .chk`
> > +        FN=$DN/$BN.so
> > +        shlibsign -i $FN
> > +        if [ $? -ne 0 ]; then
> > +            echo "shlibsign -i $FN failed"
> > +        fi
> > +    done
> > +}
> > +
> > +pkg_postinst_ontarget_${PN} () {
> > +    ${bindir}/signlibs.sh
> >  }
> >
> >  PACKAGES =+ "${PN}-smime"
> > --
> > 2.25.1
> >
>
> > 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#86764): 
https://lists.openembedded.org/g/openembedded-devel/message/86764
Mute This Topic: https://lists.openembedded.org/mt/76480784/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to