Affects Version/s: None
Fix Version/s: None
- Each one of the states in the script API (
MEN-1174) must map to one of Mender's internal states.
- It's permitted that not all internal states map to a state in the API. Use best judgment here, and think about what the public state API needs.
- Each script should be located in the directory that is appropriate for that script group, according to the table under "Script locations" in
- Before executing any script in var/lib/mender/script, check that the version file in the same directory corresponds to a version the client understands. The same should not be done for scripts in /etc/mender/scripts (because there is no recovery path if it is wrong).
- Upon entering a new state, but before carrying out any actions in that state, execute the corresponding <state>.Enter scripts, in ascending order of the two leading digits.
- After script has returned 0, carry on with the normal actions for that state.
- When entering a new state and thereby leaving the old one, execute the corresponding <state>.Leave scripts, in ascending order of the two leading digits.
- For most states, a return code of 1 should make the client enter the ArtifactFailure state
- Except: Idle, Rollback, RollbackReboot and ArtifactFailure should ignore return codes
- Other non-zero return codes should also have the same behavior, but only error code 1 should be documented (to allow for more diverse behavior later)
- If an Enter script fails, this will cause later Enter scripts in the same group not to be executed. However, if a Leave script fails, other Leave scripts will still execute.
- Logs and return codes from each script must be kept on data partition so they can be submitted to server later
- Deployment log is not sent to server until the ArtifactCommit.Enter script has completed, and after the normal actions for the Commit state have completed (necessary because the log report is the final verification step, and thus all the scripts must have finished by then).