All of lore.kernel.org
 help / color / mirror / Atom feed
* postinst scripts and opkg configure
@ 2010-04-09 10:26 Sergey Lapin
  2010-04-09 10:39 ` Roman I Khimov
  0 siblings, 1 reply; 9+ messages in thread
From: Sergey Lapin @ 2010-04-09 10:26 UTC (permalink / raw)
  To: openembedded-devel, Discussion of the angstrom distribution development

Hi, all!

If I understand properly, during image preparation, postinst scripts
for each package are run.
If they fail, package gets status 'unpacked'. Otherwise, it gets
status 'installed'.

So, with recent images I have to run all postinst scripts again on
device for services
like udev or dropbear to work. These packages get 'installed' status,
so postinst
scripts won't normally run during 'opkg configure', but /etc/rc*d
links are not created for them during
image build. Any ideas on fixing, or what is really being wrong here?
I build quite
small image, so very few packages need this, but for bigger one there
might be lots of them. Any ideas on fixing?
Also, 'configure' runs as S99configure in 'S' runlevel. That means
that if package installs something there
like update-rc.d S 01 . that will be executed only on reboot, so it
needs to execute these init scripts directly from postinst.
Am I right?

Thanks a lot,
S.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: postinst scripts and opkg configure
  2010-04-09 10:26 postinst scripts and opkg configure Sergey Lapin
@ 2010-04-09 10:39 ` Roman I Khimov
  2010-04-09 10:53   ` Sergey Lapin
  2010-04-09 11:19   ` [PATCH] rootfs_ipk.bbclass: run preinst/postinst scripts with "-e" Roman I Khimov
  0 siblings, 2 replies; 9+ messages in thread
From: Roman I Khimov @ 2010-04-09 10:39 UTC (permalink / raw)
  To: openembedded-devel

В сообщении от Пятница 09 апреля 2010 14:26:22 автор Sergey Lapin написал:
> So, with recent images I have to run all postinst scripts again on
> device for services
> like udev or dropbear to work. These packages get 'installed' status,
> so postinst
> scripts won't normally run during 'opkg configure', but /etc/rc*d
> links are not created for them during
> image build. Any ideas on fixing, or what is really being wrong here?

Do "set -e" in the beginning of postinst if it can only do its job on target. 
I have some patches adding that in queue.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: postinst scripts and opkg configure
  2010-04-09 10:39 ` Roman I Khimov
@ 2010-04-09 10:53   ` Sergey Lapin
  2010-04-09 11:26     ` Roman I Khimov
  2010-04-09 11:19   ` [PATCH] rootfs_ipk.bbclass: run preinst/postinst scripts with "-e" Roman I Khimov
  1 sibling, 1 reply; 9+ messages in thread
From: Sergey Lapin @ 2010-04-09 10:53 UTC (permalink / raw)
  To: openembedded-devel

On Fri, Apr 9, 2010 at 2:39 PM, Roman I Khimov <khimov@altell.ru> wrote:
> В сообщении от Пятница 09 апреля 2010 14:26:22 автор Sergey Lapin написал:
>> So, with recent images I have to run all postinst scripts again on
>> device for services
>> like udev or dropbear to work. These packages get 'installed' status,
>> so postinst
>> scripts won't normally run during 'opkg configure', but /etc/rc*d
>> links are not created for them during
>> image build. Any ideas on fixing, or what is really being wrong here?
>
> Do "set -e" in the beginning of postinst if it can only do its job on target.
> I have some patches adding that in queue.
I can't understand why creation of links won't work on host,
because that will be a problem for filesystems like squashfs.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] rootfs_ipk.bbclass: run preinst/postinst scripts with "-e"
  2010-04-09 10:39 ` Roman I Khimov
  2010-04-09 10:53   ` Sergey Lapin
@ 2010-04-09 11:19   ` Roman I Khimov
  2010-04-09 15:48     ` Chris Larson
  1 sibling, 1 reply; 9+ messages in thread
From: Roman I Khimov @ 2010-04-09 11:19 UTC (permalink / raw)
  To: openembedded-devel

There are scripts that can and should work when being ran on build
host (for example, simple update-rc.d), but there are also many which
can't and won't ever (for example, anything adding users/groups).
The second group sometimes doesn't get "unpacked" flag because
scripts throw errors in the middle and return something nice from
the last command.

It can be considered as a bug in pre/postinst script (as it should
either explicitly check for "${D}" or just do "set -e" at start),
but it is common enough.

There is also another aspect to this as in general we can't be sure
that everything is OK wrt preinst/postinst if script commands throw
errors.

Running preinst/postinst scripts on host with "-e" should solve
that.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
---
 classes/rootfs_ipk.bbclass |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/classes/rootfs_ipk.bbclass b/classes/rootfs_ipk.bbclass
index 3a73ed8..5483c7e 100644
--- a/classes/rootfs_ipk.bbclass
+++ b/classes/rootfs_ipk.bbclass
@@ -70,12 +70,12 @@ fakeroot rootfs_ipk_do_rootfs () {
 	fi
 
 	for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do
-		if [ -f $i ] && ! sh $i; then
+		if [ -f $i ] && ! sh -e $i; then
 			opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst`
 		fi
 	done
 	for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.postinst; do
-		if [ -f $i ] && ! sh $i configure; then
+		if [ -f $i ] && ! sh -e $i configure; then
 			opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst`
 		fi
 	done
-- 
1.5.6.5




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: postinst scripts and opkg configure
  2010-04-09 10:53   ` Sergey Lapin
@ 2010-04-09 11:26     ` Roman I Khimov
  2010-04-09 13:58       ` Sergey Lapin
  0 siblings, 1 reply; 9+ messages in thread
From: Roman I Khimov @ 2010-04-09 11:26 UTC (permalink / raw)
  To: openembedded-devel

В сообщении от Пятница 09 апреля 2010 14:53:22 автор Sergey Lapin написал:
> On Fri, Apr 9, 2010 at 2:39 PM, Roman I Khimov <khimov@altell.ru> wrote:
> > В сообщении от Пятница 09 апреля 2010 14:26:22 автор Sergey Lapin написал:
> >> So, with recent images I have to run all postinst scripts again on
> >> device for services
> >> like udev or dropbear to work. These packages get 'installed' status,
> >> so postinst
> >> scripts won't normally run during 'opkg configure', but /etc/rc*d
> >> links are not created for them during
> >> image build. Any ideas on fixing, or what is really being wrong here?
> >
> > Do "set -e" in the beginning of postinst if it can only do its job on
> > target. I have some patches adding that in queue.
> 
> I can't understand why creation of links won't work on host,
> because that will be a problem for filesystems like squashfs.

Actually, update-rc.d scripts should work on build host (that "$OPT" in script 
is exactly for that purpose) and so are update-alternatives (thanks to 
OPKG_OFFLINE_ROOT magic), so there might be something wrong with your setup.

What I was talking about is something more like postfix.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: postinst scripts and opkg configure
  2010-04-09 11:26     ` Roman I Khimov
@ 2010-04-09 13:58       ` Sergey Lapin
  2010-04-09 14:26         ` Mike Westerhof
  0 siblings, 1 reply; 9+ messages in thread
From: Sergey Lapin @ 2010-04-09 13:58 UTC (permalink / raw)
  To: openembedded-devel

>
> Actually, update-rc.d scripts should work on build host (that "$OPT" in script
> is exactly for that purpose) and so are update-alternatives (thanks to
> OPKG_OFFLINE_ROOT magic), so there might be something wrong with your setup.
I found the reason for that error - update-rc.d is not being staged,
so scripts fail.
bitbake update-rc.d update-rc.d-native -c rebuild doesn't help either.
Can't see why, because copying it from workdir to staging bin fixes
this problem.
Any ideas?

S.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: postinst scripts and opkg configure
  2010-04-09 13:58       ` Sergey Lapin
@ 2010-04-09 14:26         ` Mike Westerhof
  2010-04-09 14:52           ` [PATCH] update-rc.d.bbclass: add dependency on update-rc.d-native Roman I Khimov
  0 siblings, 1 reply; 9+ messages in thread
From: Mike Westerhof @ 2010-04-09 14:26 UTC (permalink / raw)
  To: openembedded-devel

Sergey Lapin wrote:
>> Actually, update-rc.d scripts should work on build host (that "$OPT" in script
>> is exactly for that purpose) and so are update-alternatives (thanks to
>> OPKG_OFFLINE_ROOT magic), so there might be something wrong with your setup.
> I found the reason for that error - update-rc.d is not being staged,
> so scripts fail.

Same problem encountered here - this commit fixed it for SlugOS (which
has its own initscripts which explicitly invoke update-rc.d, thus
causing an obvious build failure): c906fd7faa8517ca565faba90887d10ebb90e092
Basically, adding RDEPENDS="update-rc.d" and
DEPENDS="update-rc.d-native" resolved the issue.

(I glanced at the other initscripts BB files, and didn't change those
because there wasn't an obvious reference to update-rc.d in the recipes
-- I didn't consider the use case you described or I would have fixed
those recipes as well.)

> bitbake update-rc.d update-rc.d-native -c rebuild doesn't help either.
> Can't see why, because copying it from workdir to staging bin fixes
> this problem.
> Any ideas?
> 
> S.

-Mike (mwester)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] update-rc.d.bbclass: add dependency on update-rc.d-native
  2010-04-09 14:26         ` Mike Westerhof
@ 2010-04-09 14:52           ` Roman I Khimov
  0 siblings, 0 replies; 9+ messages in thread
From: Roman I Khimov @ 2010-04-09 14:52 UTC (permalink / raw)
  To: openembedded-devel

Recipes are using update-rc.d to do postinst and postinst scripts are being
ran on build hosts where native version is needed to run properly. It is
needed only at image build stage, but it's easier to have it in DEPENDS,
build time for it is almost zero anyway.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
---
 classes/update-rc.d.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/classes/update-rc.d.bbclass b/classes/update-rc.d.bbclass
index b6491ed..4594d0f 100644
--- a/classes/update-rc.d.bbclass
+++ b/classes/update-rc.d.bbclass
@@ -1,4 +1,4 @@
-DEPENDS_append = " update-rc.d"
+DEPENDS_append = " update-rc.d update-rc.d-native"
 RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
 
 INITSCRIPT_PARAMS ?= "defaults"
-- 
1.5.6.5




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] rootfs_ipk.bbclass: run preinst/postinst scripts with "-e"
  2010-04-09 11:19   ` [PATCH] rootfs_ipk.bbclass: run preinst/postinst scripts with "-e" Roman I Khimov
@ 2010-04-09 15:48     ` Chris Larson
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Larson @ 2010-04-09 15:48 UTC (permalink / raw)
  To: openembedded-devel

Looks good to me.  The script could always set +e to disable it anyway if it
really wanted to :)

Acked-by: Chris Larson <clarson@kergoth.com>

On Fri, Apr 9, 2010 at 4:19 AM, Roman I Khimov <khimov@altell.ru> wrote:

> There are scripts that can and should work when being ran on build
> host (for example, simple update-rc.d), but there are also many which
> can't and won't ever (for example, anything adding users/groups).
> The second group sometimes doesn't get "unpacked" flag because
> scripts throw errors in the middle and return something nice from
> the last command.
>
> It can be considered as a bug in pre/postinst script (as it should
> either explicitly check for "${D}" or just do "set -e" at start),
> but it is common enough.
>
> There is also another aspect to this as in general we can't be sure
> that everything is OK wrt preinst/postinst if script commands throw
> errors.
>
> Running preinst/postinst scripts on host with "-e" should solve
> that.
>
> Signed-off-by: Roman I Khimov <khimov@altell.ru>
> ---
>  classes/rootfs_ipk.bbclass |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/classes/rootfs_ipk.bbclass b/classes/rootfs_ipk.bbclass
> index 3a73ed8..5483c7e 100644
> --- a/classes/rootfs_ipk.bbclass
> +++ b/classes/rootfs_ipk.bbclass
> @@ -70,12 +70,12 @@ fakeroot rootfs_ipk_do_rootfs () {
>        fi
>
>        for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do
> -               if [ -f $i ] && ! sh $i; then
> +               if [ -f $i ] && ! sh -e $i; then
>                        opkg-cl ${IPKG_ARGS} flag unpacked `basename $i
> .preinst`
>                fi
>        done
>        for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.postinst; do
> -               if [ -f $i ] && ! sh $i configure; then
> +               if [ -f $i ] && ! sh -e $i configure; then
>                        opkg-cl ${IPKG_ARGS} flag unpacked `basename $i
> .postinst`
>                fi
>        done
> --
> 1.5.6.5
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>



-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-04-09 15:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-09 10:26 postinst scripts and opkg configure Sergey Lapin
2010-04-09 10:39 ` Roman I Khimov
2010-04-09 10:53   ` Sergey Lapin
2010-04-09 11:26     ` Roman I Khimov
2010-04-09 13:58       ` Sergey Lapin
2010-04-09 14:26         ` Mike Westerhof
2010-04-09 14:52           ` [PATCH] update-rc.d.bbclass: add dependency on update-rc.d-native Roman I Khimov
2010-04-09 11:19   ` [PATCH] rootfs_ipk.bbclass: run preinst/postinst scripts with "-e" Roman I Khimov
2010-04-09 15:48     ` Chris Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.