reset update info after short-circuit

This commit is contained in:
girish@cloudron.io
2016-01-25 16:46:54 -08:00
parent ba6f05b119
commit 4b54e776cc
2 changed files with 21 additions and 5 deletions

View File

@@ -515,10 +515,10 @@ function update(boxUpdateInfo, callback) {
// initiate the update/upgrade but do not wait for it
if (config.version().match(/[-+]/) !== null && config.version().replace(/[-+].*/, '') === boxUpdateInfo.version) {
debug('Starting short-circuit from prerelease version %s to release version %s', config.version(), boxUpdateInfo.version);
config.setVersion(boxUpdateInfo.version);
progress.clear(progress.UPDATE);
locker.unlock(locker.OP_BOX_UPDATE);
doShortCircuitUpdate(boxUpdateInfo, function (error) {
if (error) debug('Short-circuit update failed', error);
locker.unlock(locker.OP_BOX_UPDATE);
});
} else if (boxUpdateInfo.upgrade) {
debug('Starting upgrade');
doUpgrade(boxUpdateInfo, function (error) {
@@ -550,6 +550,16 @@ function updateToLatest(callback) {
update(boxUpdateInfo, callback);
}
function doShortCircuitUpdate(boxUpdateInfo, callback) {
assert(boxUpdateInfo !== null && typeof boxUpdateInfo === 'object');
debug('Starting short-circuit from prerelease version %s to release version %s', config.version(), boxUpdateInfo.version);
config.setVersion(boxUpdateInfo.version);
progress.clear(progress.UPDATE);
updatechecker.resetUpdateInfo();
callback();
}
function doUpgrade(boxUpdateInfo, callback) {
assert(boxUpdateInfo !== null && typeof boxUpdateInfo === 'object');