mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 20:32:45 -04:00

# Conflicts: # package.json Former-commit-id: 1bde8063a8e6eb10b26a439329d9a54114274b43 [formerly 45efb7473fcf576c45475f862907c53c967cee31] [formerly 060a8c1558d66161d982535070b05008d4d598ec] [formerly db20644154051f805d9df2c330757f121df32409 [formerly 31e6f10ff7adbf502d9558dbe7010fd923355806 [formerly 518cb603c66ecd0325db61aabd7f5332159e4713]]] Former-commit-id: 6139a94209f184a8c9e5b4af79e1ba615ddc522c [formerly 6464d662db9c53dd6311e03b23dc3a244cb9c4e0 [formerly a164d906a84b4aa3af740fb0d2f29716df84f073]] Former-commit-id: 6659ee3e8424dd18232c55cf2fea6c97153c562d [formerly 168044d1ffa7de7d6e3f4905c526abce360311b8] Former-commit-id: e9c34e07b4bea9f538d462865af76c7daeea7d2b
27 lines
902 B
JavaScript
27 lines
902 B
JavaScript
const child_process = require('child_process'),
|
|
fs = require('fs'),
|
|
path = require('path');
|
|
|
|
const appName = "kiwix-js-wikimed";
|
|
|
|
function isLinux (targets) {
|
|
const re = /AppImage|snap|deb|rpm|freebsd|pacman/i;
|
|
return !!targets.find ( target => re.test (target.name));
|
|
}
|
|
|
|
async function afterPack ({targets, appOutDir}) {
|
|
if ( !isLinux ( targets ) ) return;
|
|
const scriptPath = path.join(appOutDir, appName),
|
|
script = '#!/bin/bash\n"${BASH_SOURCE%/*}"/' + appName + '.bin "$@" --no-sandbox';
|
|
new Promise((resolve) => {
|
|
const child = child_process.exec(`mv ${appName} ${appName}.bin`, {cwd: appOutDir});
|
|
child.on('exit', () => {
|
|
resolve();
|
|
});
|
|
}).then(() => {
|
|
fs.writeFileSync (scriptPath, script);
|
|
child_process.exec(`chmod +x ${appName}`, {cwd: appOutDir});
|
|
});
|
|
}
|
|
|
|
module.exports = afterPack; |