"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MakerDeb = exports.debianArch = void 0;
const path_1 = __importDefault(require("path"));
const maker_base_1 = require("@electron-forge/maker-base");
function debianArch(nodeArch) {
    switch (nodeArch) {
        case 'ia32':
            return 'i386';
        case 'x64':
            return 'amd64';
        case 'armv7l':
            return 'armhf';
        case 'arm':
            return 'armel';
        default:
            return nodeArch;
    }
}
exports.debianArch = debianArch;
class MakerDeb extends maker_base_1.MakerBase {
    constructor() {
        super(...arguments);
        this.name = 'deb';
        this.defaultPlatforms = ['linux'];
        this.requiredExternalBinaries = ['dpkg', 'fakeroot'];
    }
    isSupportedOnCurrentPlatform() {
        return this.isInstalled('electron-installer-debian');
    }
    async make({ dir, makeDir, targetArch }) {
        // eslint-disable-next-line node/no-missing-require
        const installer = require('electron-installer-debian');
        const outDir = path_1.default.resolve(makeDir, 'deb', targetArch);
        await this.ensureDirectory(outDir);
        const { packagePaths } = await installer({
            options: {},
            ...this.config,
            arch: debianArch(targetArch),
            src: dir,
            dest: outDir,
            rename: undefined,
        });
        return packagePaths;
    }
}
exports.default = MakerDeb;
exports.MakerDeb = MakerDeb;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFrZXJEZWIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvTWFrZXJEZWIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsZ0RBQXdCO0FBRXhCLDJEQUFxRTtBQUtyRSxTQUFnQixVQUFVLENBQUMsUUFBbUI7SUFDNUMsUUFBUSxRQUFRLEVBQUU7UUFDaEIsS0FBSyxNQUFNO1lBQ1QsT0FBTyxNQUFNLENBQUM7UUFDaEIsS0FBSyxLQUFLO1lBQ1IsT0FBTyxPQUFPLENBQUM7UUFDakIsS0FBSyxRQUFRO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