bitwarden-estensione-browser/apps/desktop/scripts/after-pack.js

27 lines
959 B
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires, no-console */
require("dotenv").config();
const path = require("path");
const fse = require("fs-extra");
exports.default = run;
async function run(context) {
console.log("## After pack");
console.log(context);
if (context.electronPlatformName === "linux") {
console.log("Creating memory-protection wrapper script");
const appOutDir = context.appOutDir;
const oldBin = path.join(appOutDir, context.packager.executableName);
const newBin = path.join(appOutDir, "bitwarden-app");
fse.moveSync(oldBin, newBin);
console.log("Moved binary to bitwarden-app");
const wrapperScript = path.join(__dirname, "../resources/memory-dump-wrapper.sh");
const wrapperBin = path.join(appOutDir, context.packager.executableName);
fse.copyFileSync(wrapperScript, wrapperBin);
fse.chmodSync(wrapperBin, "755");
console.log("Copied memory-protection wrapper script");
}
}