mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(install-deps): install deps on mint (#6569)
This commit is contained in:
parent
0678f48289
commit
9b0aeeffae
@ -24,7 +24,9 @@ const readFileAsync = util.promisify(fs.readFile.bind(fs));
|
||||
export async function getUbuntuVersion(): Promise<string> {
|
||||
if (os.platform() !== 'linux')
|
||||
return '';
|
||||
const osReleaseText = await readFileAsync('/etc/os-release', 'utf8').catch(e => '');
|
||||
let osReleaseText = await readFileAsync('/etc/upstream-release/lsb-release', 'utf8').catch(e => '');
|
||||
if (!osReleaseText)
|
||||
osReleaseText = await readFileAsync('/etc/os-release', 'utf8').catch(e => '');
|
||||
if (!osReleaseText)
|
||||
return '';
|
||||
return getUbuntuVersionInternal(osReleaseText);
|
||||
@ -34,7 +36,11 @@ export function getUbuntuVersionSync(): string {
|
||||
if (os.platform() !== 'linux')
|
||||
return '';
|
||||
try {
|
||||
const osReleaseText = fs.readFileSync('/etc/os-release', 'utf8');
|
||||
let osReleaseText: string;
|
||||
if (fs.existsSync('/etc/upstream-release/lsb-release'))
|
||||
osReleaseText = fs.readFileSync('/etc/upstream-release/lsb-release', 'utf8');
|
||||
else
|
||||
osReleaseText = fs.readFileSync('/etc/os-release', 'utf8');
|
||||
if (!osReleaseText)
|
||||
return '';
|
||||
return getUbuntuVersionInternal(osReleaseText);
|
||||
@ -55,6 +61,10 @@ function getUbuntuVersionInternal(osReleaseText: string): string {
|
||||
continue;
|
||||
fields.set(name.toLowerCase(), value);
|
||||
}
|
||||
// For Linux mint
|
||||
if (fields.get('distrib_id') && fields.get('distrib_id').toLowerCase() === 'ubuntu')
|
||||
return fields.get('distrib_release') || '';
|
||||
|
||||
if (!fields.get('name') || fields.get('name').toLowerCase() !== 'ubuntu')
|
||||
return '';
|
||||
return fields.get('version_id') || '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user