Best approach for updating firmware on device that already runs a custom server

I have a device that runs a custom server that shows a frotend to a user which can be used to do some changes to the device itself. I now also want to add a functionality in that frotend for the user to upload and install a new firmware version to update the device itself.

My first idea was to use my custom frontend/server to upload an artifact in some folder and then to use the mender commands to install this artifact on the device. However to properly then install and start the new firmware I would have to reboot the device and also do some checks to verify proper reboot/restart with the new firmware and potentially then also do a rollback. This all seems to be supported by mender looking at the state diagram, however, I then found this statement in the documentation:

Calling the Mender client from the command line with the install command will only invoke the two first states, Download and ArtifactInstall. Additionally, ArtifactFailure may be executed if there is an error.

Calling the Mender client from the command line with the commit command will only invoke the two last states, ArtifactCommit and Cleanup. Additionally, ArtifactRollback and ArtifactFailure may be executed if there is an error.

The ArtifactReboot, ArtifactVerifyReboot and ArtifactRollbackReboot states are never invoked when calling the Mender client from the command line.

Here: https://raw.githubusercontent.com/mendersoftware/mender/master/support/modules/directory

I am now a little bit confused. It seems I cannot do a reboot with checks and potential rollback with the mender client commands.

How am I supposed to implement a proper logic/architecture like I want to have?

Am I maybe on the wrong track and instead should better use the D-BUS API to control the mender deamon to check for a new update under a specifiy folder instead of using the mender client commands?

Hi @marcel1991,

In standalone mode you need to conduct the checks and decision if a rollback is required manually, and then instruct the client accordingly by issuing mender-update rollback (for the 4.0 client).

Greets,
Josef

Hi @TheYoctoJester,

So if i do a

sudo mender install 
sudo reboot

Will after reboot the state script ArtifactReboot_Leave still be reached automatically and I could do some checks there, potentially then doing a mender rollback?