Yocto Project Discussions
 help / color / mirror / Atom feed
* Question regarding executing an install script during the build of an image
@ 2024-10-19 11:50 Felix Kuhlmann
  2024-10-20  9:19 ` [yocto] " Marco Cavallini
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Kuhlmann @ 2024-10-19 11:50 UTC (permalink / raw)
  To: yocto

Hello everybody,

I need your help with a project I'm currently working on.
I want to create an image that contains the OpenPLC runtime, which is an
open source soft PLC solution.

The creators of this project provide a handy install script, which can
be aquired through their project's GitHub repository.

My question now is, what would I have to write in a custom recipe in
order to install this piece of software? From what I can tell, it also
compiles code on the go, so Bitbake would have to do that with the
cross compiler used for other aspects of the build as well.

The solutions I've found online so far mostly centered around
post-install scripts, which isn't what I'm looking for.

My goal is to have a soft PLC system that boots up and starts the
necessary services straight away. Usually, this is taken care of by the
script.

If you have any better ideas or if you need further information, feel
free to reply.

Thanks in advance and best regards
Felix Kuhlmann


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

* Re: [yocto] Question regarding executing an install script during the build of an image
  2024-10-19 11:50 Question regarding executing an install script during the build of an image Felix Kuhlmann
@ 2024-10-20  9:19 ` Marco Cavallini
  2024-10-21  9:39   ` Josef Holzmayr
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Cavallini @ 2024-10-20  9:19 UTC (permalink / raw)
  To: Felix Kuhlmann, yocto

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

Hello Felix,
probably I don't have enough details to give you a complete hint.
However, the solution usually suggested is to create your own recipe, perhaps using "recipetool create" [1] and then adapt its content (this is what I usually explain during my Yocto training courses).
Then you can include in your recipe the installation and the management of a launcher script and its systemd service for example (if you are using systemd) [2].

[1] https://docs.yoctoproject.org/next/dev-manual/new-recipe.html?highlight=systemd
[2] https://wiki.koansoftware.com/index.php/Add_a_systemd_service_file_into_a_Yocto_image

Marco Cavallini
Yocto Project ambassador

[-- Attachment #2: Type: text/html, Size: 1047 bytes --]

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

* Re: [yocto] Question regarding executing an install script during the build of an image
  2024-10-20  9:19 ` [yocto] " Marco Cavallini
@ 2024-10-21  9:39   ` Josef Holzmayr
  2024-10-21 11:40     ` Felix Kuhlmann
  0 siblings, 1 reply; 4+ messages in thread
From: Josef Holzmayr @ 2024-10-21  9:39 UTC (permalink / raw)
  To: yocto, koansoftware; +Cc: Felix Kuhlmann

[-- Attachment #1: Type: text/plain, Size: 2651 bytes --]

Hi Felix,

I presume you are talking about
https://github.com/thiagoralves/OpenPLC_v3/tree/master? In that case, what
*actually* runs in that installation script is
https://github.com/thiagoralves/OpenPLC_v3/blob/master/background_installer.sh,
which is a highly general purpose distribution targeted approach, which
basically relies on being able to pull in packages at random. This is
nowhere near reproducible, and therefore will cause you a lot of pain if
you want to put it into a recipe. So what you really need to do is:
1. make sure that all dependencies are already available as recipes so you
can treat them as DEPENDS/RDEPENDS. The entry point for working through it
is probably
https://github.com/thiagoralves/OpenPLC_v3/blob/b2ef6d15d0ec92110cf44ad3f58e364db60dec72/background_installer.sh#L241
2. factor out the hidden systemd service into a proper file and use the
systemd.bbclass mechanisms to install it:
https://github.com/thiagoralves/OpenPLC_v3/blob/b2ef6d15d0ec92110cf44ad3f58e364db60dec72/background_installer.sh#L215
3. understand whatever magic is needed additionally, starting point
probably is
https://github.com/thiagoralves/OpenPLC_v3/blob/b2ef6d15d0ec92110cf44ad3f58e364db60dec72/background_installer.sh#L250

Plus whatever goes wrong along the way. :-(

Greetz,
Josef

On Sun, Oct 20, 2024 at 11:20 AM Marco Cavallini via lists.yoctoproject.org
<koansoftware=gmail.com@lists.yoctoproject.org> wrote:

> Hello Felix,
> probably I don't have enough details to give you a complete hint.
> However, the solution usually suggested is to create your own recipe,
> perhaps using "recipetool create" [1] and then adapt its content (this is
> what I usually explain during my Yocto training courses).
> Then you can include in your recipe the installation and the management of
> a launcher script and its systemd service for example (if you are using
> systemd) [2].
>
> [1]
> https://docs.yoctoproject.org/next/dev-manual/new-recipe.html?highlight=systemd
> [2]
> https://wiki.koansoftware.com/index.php/Add_a_systemd_service_file_into_a_Yocto_image
>
> Marco Cavallini
> Yocto Project ambassador
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> You automatically follow any topics you start or reply to.
> View/Reply Online (#64055):
> https://lists.yoctoproject.org/g/yocto/message/64055
> Mute This Topic: https://lists.yoctoproject.org/mt/109099192/4689568
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> jester@theyoctojester.info]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 4464 bytes --]

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

* Re: [yocto] Question regarding executing an install script during the build of an image
  2024-10-21  9:39   ` Josef Holzmayr
@ 2024-10-21 11:40     ` Felix Kuhlmann
  0 siblings, 0 replies; 4+ messages in thread
From: Felix Kuhlmann @ 2024-10-21 11:40 UTC (permalink / raw)
  To: yocto, Josef Holzmayr

Hi Marco, hi Josef,

thank you very much for your input.

I greatly underestimated the work needed for using the given installer script in the yocto context.
I'm glad that you showed me the implications of my plan beforehand, this saves me a few wasted hours :D

Greetings,
Felix

Am Mon, Oct 21, 2024 at 11:39:14AM +0200 schrieb Josef Holzmayr:
> Hi Felix,
>
> I presume you are talking about
> https://github.com/thiagoralves/OpenPLC_v3/tree/master? In that case, what
> *actually* runs in that installation script is
> https://github.com/thiagoralves/OpenPLC_v3/blob/master/background_installer.sh,
> which is a highly general purpose distribution targeted approach, which
> basically relies on being able to pull in packages at random. This is
> nowhere near reproducible, and therefore will cause you a lot of pain if
> you want to put it into a recipe. So what you really need to do is:
> 1. make sure that all dependencies are already available as recipes so you
> can treat them as DEPENDS/RDEPENDS. The entry point for working through it
> is probably
> https://github.com/thiagoralves/OpenPLC_v3/blob/b2ef6d15d0ec92110cf44ad3f58e364db60dec72/background_installer.sh#L241
> 2. factor out the hidden systemd service into a proper file and use the
> systemd.bbclass mechanisms to install it:
> https://github.com/thiagoralves/OpenPLC_v3/blob/b2ef6d15d0ec92110cf44ad3f58e364db60dec72/background_installer.sh#L215
> 3. understand whatever magic is needed additionally, starting point
> probably is
> https://github.com/thiagoralves/OpenPLC_v3/blob/b2ef6d15d0ec92110cf44ad3f58e364db60dec72/background_installer.sh#L250
>
> Plus whatever goes wrong along the way. :-(
>
> Greetz,
> Josef
>
> On Sun, Oct 20, 2024 at 11:20 AM Marco Cavallini via lists.yoctoproject.org
> <koansoftware=gmail.com@lists.yoctoproject.org> wrote:
>
> > Hello Felix,
> > probably I don't have enough details to give you a complete hint.
> > However, the solution usually suggested is to create your own recipe,
> > perhaps using "recipetool create" [1] and then adapt its content (this is
> > what I usually explain during my Yocto training courses).
> > Then you can include in your recipe the installation and the management of
> > a launcher script and its systemd service for example (if you are using
> > systemd) [2].
> >
> > [1]
> > https://docs.yoctoproject.org/next/dev-manual/new-recipe.html?highlight=systemd
> > [2]
> > https://wiki.koansoftware.com/index.php/Add_a_systemd_service_file_into_a_Yocto_image
> >
> > Marco Cavallini
> > Yocto Project ambassador
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > You automatically follow any topics you start or reply to.
> > View/Reply Online (#64055):
> > https://lists.yoctoproject.org/g/yocto/message/64055
> > Mute This Topic: https://lists.yoctoproject.org/mt/109099192/4689568
> > Group Owner: yocto+owner@lists.yoctoproject.org
> > Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> > jester@theyoctojester.info]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
> >


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

end of thread, other threads:[~2024-10-21 11:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-19 11:50 Question regarding executing an install script during the build of an image Felix Kuhlmann
2024-10-20  9:19 ` [yocto] " Marco Cavallini
2024-10-21  9:39   ` Josef Holzmayr
2024-10-21 11:40     ` Felix Kuhlmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox