All of lore.kernel.org
 help / color / mirror / Atom feed
* Postinstallation script for target throw warnings
@ 2018-01-05 11:21 Diaz de Grenu, Jose
  2018-01-11  5:33 ` Robert Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Diaz de Grenu, Jose @ 2018-01-05 11:21 UTC (permalink / raw)
  To: poky

Hi,

I am trying to create a recipe with a post installation script. I am using the following fragment of code (as documented in http://www.yoctoproject.org/docs/2.4/mega-manual/mega-manual.html#new-recipe-post-installation-scripts ):

pkg_postinst_PACKAGENAME() {
     if [ x"$D" = "x" ]; then
          # Actions to carry out on the device go here
     else
          exit 1
     fi
}

This was working fine in Yocto 2.2, but now in Yocto 2.4 I am getting these warnings:

WARNING: core-image-base-1.0-r0 do_rootfs: [log_check] core-image-base: found 3 warning messages in the logfile:
[log_check] warning: %post(init-ifupdown-1.0-r7.0.cortexa7hf_neon) scriptlet failed, exit status 1

How can I clean these warnings in Yocto 2.4? Is that still the correct way to create post installation script that must run on the target? Should I just replace 'exit 1' by 'exit 0'?

Thanks


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

* Re: Postinstallation script for target throw warnings
  2018-01-05 11:21 Postinstallation script for target throw warnings Diaz de Grenu, Jose
@ 2018-01-11  5:33 ` Robert Yang
  2018-01-11 11:40   ` Alexander Kanavin
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Yang @ 2018-01-11  5:33 UTC (permalink / raw)
  To: Diaz de Grenu, Jose, poky



On 01/05/2018 07:21 PM, Diaz de Grenu, Jose wrote:
> Hi,
> 
> I am trying to create a recipe with a post installation script. I am using the following fragment of code (as documented in http://www.yoctoproject.org/docs/2.4/mega-manual/mega-manual.html#new-recipe-post-installation-scripts ):
> 
> pkg_postinst_PACKAGENAME() {
>       if [ x"$D" = "x" ]; then
>            # Actions to carry out on the device go here
>       else
>            exit 1
>       fi
> }
> 
> This was working fine in Yocto 2.2, but now in Yocto 2.4 I am getting these warnings:
> 
> WARNING: core-image-base-1.0-r0 do_rootfs: [log_check] core-image-base: found 3 warning messages in the logfile:
> [log_check] warning: %post(init-ifupdown-1.0-r7.0.cortexa7hf_neon) scriptlet failed, exit status 1
> 
> How can I clean these warnings in Yocto 2.4? Is that still the correct way to create post installation script that must run on the target? Should I just replace 'exit 1' by 'exit 0'?

Yes, just remove the "else" block and use something like:

if [ -z "$D" ]; then
	# Actions
fi

But it would be better if you can make it work during do_rootfs rather
than firstboot.

// Robert

> 
> Thanks
> 


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

* Re: Postinstallation script for target throw warnings
  2018-01-11  5:33 ` Robert Yang
@ 2018-01-11 11:40   ` Alexander Kanavin
  2018-01-12  1:45     ` Robert Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2018-01-11 11:40 UTC (permalink / raw)
  To: Robert Yang, Diaz de Grenu, Jose, poky

On 01/11/2018 07:33 AM, Robert Yang wrote:
> Yes, just remove the "else" block and use something like:
> 
> if [ -z "$D" ]; then
>      # Actions
> fi
> 
> But it would be better if you can make it work during do_rootfs rather
> than firstboot.

This is not correct. If you do this, then the postinst will be executed 
once, during image creation, and Actions will never be taken.

Alex


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

* Re: Postinstallation script for target throw warnings
  2018-01-11 11:40   ` Alexander Kanavin
@ 2018-01-12  1:45     ` Robert Yang
  2018-01-12 12:49       ` Alexander Kanavin
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Yang @ 2018-01-12  1:45 UTC (permalink / raw)
  To: Alexander Kanavin, Diaz de Grenu, Jose, poky



On 01/11/2018 07:40 PM, Alexander Kanavin wrote:
> On 01/11/2018 07:33 AM, Robert Yang wrote:
>> Yes, just remove the "else" block and use something like:
>>
>> if [ -z "$D" ]; then
>>      # Actions
>> fi
>>
>> But it would be better if you can make it work during do_rootfs rather
>> than firstboot.
> 
> This is not correct. If you do this, then the postinst will be executed once, 
> during image creation, and Actions will never be taken.

Sorry, I think that the 'Action' will be executed when first boot ?

// Robert

> 
> Alex
> 


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

* Re: Postinstallation script for target throw warnings
  2018-01-12  1:45     ` Robert Yang
@ 2018-01-12 12:49       ` Alexander Kanavin
  2018-01-16  9:22         ` Robert Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2018-01-12 12:49 UTC (permalink / raw)
  To: Robert Yang, Diaz de Grenu, Jose, poky

On 01/12/2018 03:45 AM, Robert Yang wrote:
>>> But it would be better if you can make it work during do_rootfs rather
>>> than firstboot.
>>
>> This is not correct. If you do this, then the postinst will be 
>> executed once, during image creation, and Actions will never be taken.
> 
> Sorry, I think that the 'Action' will be executed when first boot ?

Before that happens, the script needs to be deferred to first boot by 
issuing 'exit 1'. There's special magic to extract it from rpm and place 
in a separate execute-on-first-boot location in the target filesystem 
that gets triggered by 'exit 1'.

Alex


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

* Re: Postinstallation script for target throw warnings
  2018-01-12 12:49       ` Alexander Kanavin
@ 2018-01-16  9:22         ` Robert Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Yang @ 2018-01-16  9:22 UTC (permalink / raw)
  To: Alexander Kanavin, Diaz de Grenu, Jose, poky



On 01/12/2018 08:49 PM, Alexander Kanavin wrote:
> On 01/12/2018 03:45 AM, Robert Yang wrote:
>>>> But it would be better if you can make it work during do_rootfs rather
>>>> than firstboot.
>>>
>>> This is not correct. If you do this, then the postinst will be executed once, 
>>> during image creation, and Actions will never be taken.
>>
>> Sorry, I think that the 'Action' will be executed when first boot ?
> 
> Before that happens, the script needs to be deferred to first boot by issuing 
> 'exit 1'. There's special magic to extract it from rpm and place in a separate 
> execute-on-first-boot location in the target filesystem that gets triggered by 
> 'exit 1'.

Ah, yes, thank you very much.

// Robert

> 
> Alex
> 


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

end of thread, other threads:[~2018-01-16  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05 11:21 Postinstallation script for target throw warnings Diaz de Grenu, Jose
2018-01-11  5:33 ` Robert Yang
2018-01-11 11:40   ` Alexander Kanavin
2018-01-12  1:45     ` Robert Yang
2018-01-12 12:49       ` Alexander Kanavin
2018-01-16  9:22         ` Robert Yang

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.