Fix update progress display

This commit is contained in:
Girish Ramakrishnan
2025-09-10 21:35:26 +02:00
parent c2e5f19226
commit 2f4766af9d
2 changed files with 21 additions and 8 deletions
+4 -1
View File
@@ -187,7 +187,7 @@ async function updateBox(boxUpdateInfo, options, progressCallback) {
await locks.wait(locks.TYPE_BOX_UPDATE);
debug(`Updating box with ${boxUpdateInfo.sourceTarballUrl}`);
progressCallback({ percent: 70, message: 'Installing update' });
progressCallback({ percent: 70, message: 'Installing update...' });
const [error] = await safe(shell.sudo([ UPDATE_CMD, packageInfo.file, process.stdout.logFile ], {})); // run installer.sh from new box code as a separate service
if (error) await locks.release(locks.TYPE_BOX_UPDATE);
@@ -252,9 +252,12 @@ async function notifyBoxUpdate() {
const version = safe.fs.readFileSync(paths.VERSION_FILE, 'utf8');
if (version === constants.VERSION) return;
safe.fs.unlinkSync(paths.BOX_UPDATE_FILE);
if (!version) {
await eventlog.add(eventlog.ACTION_INSTALL_FINISH, AuditSource.CRON, { version: constants.VERSION });
} else {
debug(`notifyBoxUpdate: update finished from ${version} to ${constants.VERSION}`);
await eventlog.add(eventlog.ACTION_UPDATE_FINISH, AuditSource.CRON, { errorMessage: '', oldVersion: version || 'dev', newVersion: constants.VERSION });
await notifications.unpin(notifications.TYPE_BOX_UPDATE, { context: constants.VERSION });
const [error] = await safe(tasks.setCompletedByType(tasks.TASK_BOX_UPDATE, { error: null }));