Files
privacy.sexy/scripts/check-desktop-runtime-errors/app/extractors/linux.ts
undergroundwires f4d86fccfd Fix Windows artifact naming in desktop packaging
- Fix the naming convention in Electron output to align with previous
  artifact naming to not break external/internal URLs.
- In desktop execution tests, make artifact locator logic stricter to
  test regression.
2023-08-30 13:34:30 +02:00

41 lines
1.1 KiB
TypeScript

import { access, chmod } from 'fs/promises';
import { constants } from 'fs';
import { log } from '../../utils/log';
import { ExtractionResult } from './common/extraction-result';
import { findByFilePattern } from './common/app-artifact-locator';
export async function prepareLinuxApp(
desktopDistPath: string,
projectRootDir: string,
): Promise<ExtractionResult> {
const { absolutePath: appFile } = await findByFilePattern(
// eslint-disable-next-line no-template-curly-in-string
'${name}-${version}.AppImage',
desktopDistPath,
projectRootDir,
);
await makeExecutable(appFile);
return {
appExecutablePath: appFile,
};
}
async function makeExecutable(appFile: string): Promise<void> {
if (!appFile) { throw new Error('missing file'); }
if (await isExecutable(appFile)) {
log('AppImage is already executable.');
return;
}
log('Making it executable...');
await chmod(appFile, 0o755);
}
async function isExecutable(file: string): Promise<boolean> {
try {
await access(file, constants.X_OK);
return true;
} catch {
return false;
}
}