ok, here’s the update module for reference. As could be seen in the
ArtifactReboot state mender makes a blocking call to custom update agent. The custom update agent would show a notification on the UI and wait for user to accept the update and then proceeds with the update and reboot. Note, mender as such does nothing in this stage except making the blocking call to exe. When the system reboots ,
ArtifactVerifyReboot Is used to verify the update status by comparing the artifact_info file.
case "$STATE" in
echo "Files: $FILES, Dest: $DEST"
cp "$FILES"/files/*.zip $DEST/ota.zip
cp "$FILES"/files/artifact_info $DEST/artifact_info
ARTIFACT=`basename "$FILES"/files/*.zip` #extract artifact name from file present in artifact
VERSION=$(cat $DEST/artifact_info | cut -d "=" -f 2)
echo "ARTIFACT: $ARTIFACT, VERSION: $VERSION"
/system/bin/call-updater -artifactFile $DEST/$ARTIFACT -artifactVersion $VERSION
cmp -s $DEST/artifact_info $SYS_ARTIFACT_FILE || exit 1
Now , if a reboot happens when mender is in
ArtifactReboot state (not triggered by the custom agent), let’s say user just reboots the system
ArtifactVerifyReboot state fails and the deployment is marked failed. What I would want is a way by which unless the user consents and the agent reboots ,all other reboots should be kind of ignored(?) and the mender should resume at the blocking call after reboot.
Here are the possible solutions I can think of
- Use exit code 21 in
ArtifactVerifyReboot if the comparison fails, this would enable the retry the stage but the notification to custom agent would still be missing(may be I should call the updater here as well ?)
- Move the call to custom agent to Download stage and handle validation in later stages(?)
Any other idea’s or even a hint at doing this in a better would be much appreciated.