Self-update application

Can I use Software Update API to update application itself? This is the code I’m trying to use for testing purposes:


try {
Path updPath = Paths.get(“/home/appfx30/fx30.upd”);
File pack = new File(updPath.toUri());
logger.log(Level.INFO, “Opening…”);
FileInputStream fis = new FileInputStream(pack);
update.AddProgressHandler(new Update.ProgressHandler() {
@Override
public void handle(Update.State updateState, int percentDone) {
switch (updateState) {
case STATE_APPLYING:
logger.log(Level.INFO, “Applying…” + percentDone);
break;
case STATE_FAILED:
logger.log(Level.INFO, “Failed…” + percentDone);
break;
case STATE_SUCCESS:
logger.log(Level.INFO, “Success…” + percentDone);
break;
case STATE_UNPACKING:
logger.log(Level.INFO, “Unpacking…” + percentDone);
break;
}
}
});
logger.log(Level.INFO, “Starting…”);
update.Start(fis.getFD());
logger.log(Level.INFO, "Started: " + update.GetErrorCode());
} catch (IOException e) {
logger.log(Level.INFO, "Error: " + e, e);
}

It hangs on update.Start().

# sdir list
...
WAITING CLIENTS

        [pid  7671] fx30.Update UNBOUND  (protocol ID = 'aa0702b2ee62b2e6b86f1b71708b329e')

Part of cdef:

requires:
{
	api:
	{
		Update = le_update.api
	}
}

Part of adef:

bindings:
{
    fx30.App.Update -> .le_update
}

So two questions:

  • why it is unbound?
  • is it even possible to self-update?

Thanks.

Hi @unhit,

any chance you could provide the rest of the sdir list | grep -i update ?

I’m not sure it’s possible to self-update. It’s an edge case and I’m not sure if we ever tested this.

Regarding the binding issue, I wonder if the protocol aa0702b2ee62b2e6b86f1b71708b329e is provided by anybody.
Can you eventually try with:

bindings
    fx30.Update -> <root>.le_update