Hi!
After reading State Scripts section in docs I’m still unclear about its behavior.
Is there difference where to put state-scripts: /etc/mender/scripts or /data/mender/scripts?
If I want to run an ArtifactInstall_Enter script (single script for any artifact), should I provide it with each Artifact or I can just put it in one of directories above?
Can I write state script for (Enter/Leave) Cleanup state? Not a single word about it in docs
You do not put scripts here directly, they are supposed to come bundled with an Artifact.
The difference between the directories, is that one type of script (namely all having the Artifact prefix), are installed and run only during an update, and afterwards removed.
non-Artifact scripts (such as Idle_Enter etc), stay persistent on the device after the update.
Yes, then you do need to provide it with every Artifact you deploy.
No, the states that have script hooks can be seen here
But how should I deliver state script that will run before ArtifactInstall if not put them directly to the necessary folder? The only way I see is to put them by hand
But the intuition behind the decision to provide Artifact* script only with artifacts is still unclear.
What if I want to implement something similar to dbus-notification (notify custom components about current installation state ) ?
So in current situation I can put Download_Leave script in persistent storage, but ArtifactInstall_Enter and ArtifactCommit_Leave scripts, for example, should always be provided with each artifact. That is not critical, but pretty annoying. It is obvious that they also can be stored in persistent
The idea initially was that these are supposed to customize a single update.
That is correct.
I see where you’re coming from. But what would you do if you are running multiple different updates, and they each only need a sub-set of the scripts present in say ArtifactInstall ?
An idea could perhaps to have like a tag for each script, where the script itself decides whether or not it should be persistent.
Yeah, tag idea is cool (tag even can be integrated in the name of the script ArtifactInstall_Enter_00_T/P_custom-name, T - temporal, P - persistent, or some other way)
But at first it would be cool to be able just put Artifact* script by hand at /data/mender/scripts and make it persistent that way