[yocto] Bitbake recipe Post install script not executed once the package is installed

Bipnesh, Abhinav (Abhinav) abhinavbipnesh at avaya.com
Sun Mar 15 22:15:45 PDT 2015


________________________________________
From: Paul Eggleton [paul.eggleton at linux.intel.com]
Sent: Saturday, March 14, 2015 5:55 PM
To: Bipnesh, Abhinav (Abhinav)
Cc: yocto at yoctoproject.org
Subject: Re: [yocto] Bitbake recipe Post install script not executed once the package is installed

On Saturday 14 March 2015 11:37:51 Bipnesh, Abhinav wrote:
> Paul Eggleton wrote:
> > On Saturday 14 March 2015 10:39:59 Bipnesh, Abhinav wrote:
> > > I was trying to perform a post install activity as part of the recipe
> > > using pkg_postinst_PACKAGENAME() but seems it's not working. Below is
> > > the sample function we have written as part of the recipe
> > >
> > > pkg_postinst_test (){
> > >
> > >     #!/bin/sh -xe
> > >     echo " we are calling post install for test"
> > >     mkdir -p /test/logs/1
> > >     touch /test/test1/test2/test3/sample.txt
> > >
> > > }
> > > testX directory exists as they are created as part of the install
> > > activity.
> > > When we verify the post install we did find the file being created as
> > > below is the output
> > >
> > > ls /test/test1/test2/test3/.txt ls: cannot access
> > > /test/test1/test2/test3/.txt: No such file or directory
> >
> > I assume you meant *.txt as .txt wouldn't exist even if the postinstall
> > script had run.
> >
> > > Also didn't see the echo output on the console when the package is being
> > > installed or post installation activity is being performed.
> >
> > Is the output package that you are installing actually called "test"?
>
> Yes, Basically I did install manually using below command
> rpm -i test.rpm

I meant at the build system end. Is there a "test" directory under packages-
split under the workdir for the recipe? You can find the workdir by running:

 bitbake -e recipename | grep ^WORKDIR=

$ bitbake -e test| grep ^WORKDIR=
WORKDIR="/<home dir>/QorIQ-SDK-yocto/build_t1040rdb_release/tmp/work/ppce5500-fsl-linux/test/1.0"
Above is the output of the command. Also  I do see the same directory path being created as part of the packages-split directory
$pwd
/<home directory>/QorIQ-SDK-yocto/build_t1040rdb_release/tmp/work/ppce5500-fsl-linux/test/1.0/packages-split/<package name i.e. test>/test/test1/test2/test3

Along with that we see  rpm in deploy-rpm directory and also in tmp/deploy/rpms/ directory. When I do a rpm -qp test.rpm I can see the directory structure being created and all the files present in respective directory.

Just checking, is DISTRO or MACHINE set to "test"? Does "test" appear anywhere
in the value of OVERRIDES? You can check by running:

 bitbake -e | grep ^OVERRIDES=
$ bitbake -e | grep ^OVERRIDES=
OVERRIDES="linux:powerpc:build-linux:pn-defaultpkgname:t1:t1040:t1040rdb:qoriq-ppc:e5500:fsl-networking:class-target:forcevariable:libc-glibc"

The machine type is set to t1040rdb (as we are using Freescale processors) in local.conf file. The package test.rpm is included as part of the IMAGE_INSTAL_APPEND or in the image definition file. As we need to install it separately and not as part of rootfs. 
But still I will get the output of above command

> One thing to add here is we are running Busybox on which I am trying to
> perform the installation.

That shouldn't matter.
The reason for asking this is due to this answer on stackoverflow (http://stackoverflow.com/a/11316251/570200) and also the mailing list of busybox says this
"The busybox rpm command is more "rpm2cpio --install" than anything else.  It 
doesn't support pre or post scripts, doesn't maintain a repository...

(http://lists.busybox.net/pipermail/busybox/2006-November/059507.html)"

Also the rpm command didn't list -e or other such option which I can see on other distribution. Below is sample output
# rpm
BusyBox v1.22.1 (2015-03-03 14:40:56 IST) multi-call binary.

Usage: rpm -i PACKAGE.rpm; rpm -qp[ildc] PACKAGE.rpm

Please note that simple echo command is also not working for which I expect to echo the output on the console during the installation process.

Cheers,
Abhinav

--

Paul Eggleton
Intel Open Source Technology Centre



More information about the yocto mailing list