Better update handling on Linux

This commit is contained in:
Fedor Indutny
2025-05-01 07:04:48 -07:00
committed by GitHub
parent 9e70387a9e
commit 0d89e7b01a
4 changed files with 38 additions and 22 deletions

View File

@@ -64,12 +64,19 @@ export function initLinux({ logger, getMainWindow }: UpdaterOptionsType): void {
app.quit();
});
// In `postinst` script we run `touch .signal-postinst`.
// See our patch for app-builder-lib.
//
// /opt/Signal/resources/app.asar
const asarPath = join(__dirname, '..', '..');
if (!asarPath.endsWith('.asar')) {
throw new Error('updater/linux: not running from ASAR');
}
watch(asarPath, event => {
// /opt/Signal/.signal-postinst
const postinstFile = join(asarPath, '..', '..', '.signal-postinst');
watch(postinstFile, event => {
if (event !== 'change') {
return;
}
@@ -86,6 +93,11 @@ export function initLinux({ logger, getMainWindow }: UpdaterOptionsType): void {
return;
}
if (version === app.getVersion()) {
logger?.info('updater/linux: ignoring asar update, no version change');
return;
}
logger?.info(`updater/linux: asar updated to version=${version}`);
getMainWindow()?.webContents.send(
'show-update-dialog',