Unsupported OS Dialog

This commit is contained in:
Fedor Indutny 2023-01-18 15:31:10 -08:00 committed by GitHub
parent c6e184016b
commit ac50af52d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 776 additions and 224 deletions

33
ts/updater/linux.ts Normal file
View file

@ -0,0 +1,33 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { version as osVersion } from 'os';
import type { LoggerType } from '../types/Logging';
const MIN_UBUNTU_VERSION = '16.04';
export function getUbuntuVersion(): string | undefined {
if (process.platform !== 'linux') {
return undefined;
}
const match = osVersion().match(/^#\d+~([\d.]+)-Ubuntu\s/);
if (!match) {
return undefined;
}
return match[1];
}
export function isLinuxVersionSupported(logger?: LoggerType): boolean {
const ubuntu = getUbuntuVersion();
if (ubuntu !== undefined && ubuntu < MIN_UBUNTU_VERSION) {
logger?.warn(
`updater/isLinuxVersionSupported: unsupported Ubuntu version ${ubuntu}`
);
return false;
}
return true;
}