Determine update type in state script

Hi,

I need to have the state scripts do 2 different things when its an app update vs rootfs update.

How can I get that info (meaning - which artifact type is it) from inside the state script?
thanks

Hi @zivkapl,

As the state script needs to be shipped with the artifact anyways in most cases, the simplest solution is to have two variants and pack those accordingly.

Greetz,
Josef

Thank you @TheYoctoJester

However, not all state scripts are shipped with the artifacts - and this is extemely relvant for rootfs upgrade type.

The pre-steps for rootfs upgrade are very much different and might even comflict with the custom upgrade module.

How would you approach that matter?

Is there any difference between Download_Leave and ArtifactInstall_Enter?
Do you suggest to use only ArtifactInstall_Enter states and later?

Thanks

Hi @zivkapl,

Based on that information, its basically impossible to give any meaningful advice. I obviously don’t know which kind of conflict you are seeing, or in which context.

So just a few hopefully helpful pointers:

  • Download_Leave is definitely different form ArtifactInstall_Enter. Examples: in a situation where there installation is delayed by a control map, the latter will not run until it is actually started. Also, Download_Leave will not run on a local artifact installation.
  • you can also provide a custom rootfs Update Module, if you have specific needs.
  • we offer support and professional services

Greetz,
Josef

Thanks @TheYoctoJester for your responses!

Also, Download_Leave will not run on a local artifact installation.

I followed the simple simple single-file module tutorial, and installed it locally (mender install <artifact>), which did triggered the existing Download_Leave that were already on the machine (as part of the. rootfs upgrade I configured).

Is it a bug? Is it a configuration I missed?

No, this is the correct behaviour @zivkapl :slight_smile:

See here: State scripts | Mender documentation for more information