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A9B;AACA,WAAK,IAAL,CAAU,GAAG,eAAe,4BAA4B,OAAK,QAAL,CAAc,cAAc,UAApF;;AAEA,UAAI,OAAK,QAAL,CAAc,eAAd,CAA8B,uBAA9B,IAAyD,IAAzD,KAAiE,MAAM,OAAK,QAAL,CAAc,eAAd,CAA8B,uBAA9B,CAAsD,CAAC,IAAD,EAAO,eAAP,CAAtD,CAAvE,CAAJ,EAA2J;AACzJ;AACD;;AAED,YAAM,MAAG,OAAA,MAAA,CAAA,EAAA,EACJ,QAAQ,GADJ,EACO;AACd,8BAAsB,+BADR;AAEd,kBAAU,iBAFI;AAGd,+BAAuB,SAAS,WAAT,KAAyB,OAAzB,GAAmC,GAAnC,GAAyC,GAHlD;AAId,0BAAkB;AAJJ,OADP,CAAT,CA7HuC,CAqIvC;AACA;;AACA,UAAI,WAAW,KAAX,KAAoB,MAAM,mCAA1B,CAAJ,EAA+C;AAC7C,cAAM,iBAAiB,MAAM,iCAA7B;AACA,eAAO,MAAP,CAAc,GAAd,EAAmB;AACjB,gBAAM,+BAAW,QAAQ,GAAR,CAAY,IAAvB,EAA6B,CAAC,KAAK,IAAL,CAAU,cAAV,EAA0B,KAA1B,CAAD,CAA7B,CADW;AAEjB,6BAAmB,+BAAW,QAAQ,GAAR,CAAY,iBAAvB,EAA0C,CAAC,KAAK,IAAL,CAAU,cAAV,EAA0B,KAA1B,CAAD,CAA1C;AAFF,SAAnB;AAID;;AACD,YAAM,0BAAK,MAAM,iBAAQ,KAAnB,GAA0B,IAA1B,EAAgC;AAAC;AAAD,OAAhC,CAAN;;AAEA,aAAK,QAAL,CAAc,uBAAd,CAAsC,YAAtC,EAAoD,MAApD,EAA0D,IAA1D;AAhJuC;AAiJxC;;AArN0C","sourcesContent":["import { path7za } from \"7zip-bin\"\nimport { appBuilderPath } from \"app-builder-bin\"\nimport { Arch, debug, exec, isMacOsSierra, log, smarten, TmpDir, toLinuxArchString, use } from \"builder-util\"\nimport { computeEnv } from \"builder-util/out/bundledTool\"\nimport { unlinkIfExists } from \"builder-util/out/fs\"\nimport { ensureDir, outputFile, readFile } from \"fs-extra-p\"\nimport * as path from \"path\"\nimport { DebOptions, LinuxTargetSpecificOptions } from \"..\"\nimport { Target } from \"../core\"\nimport * as errorMessages from \"../errorMessages\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { installPrefix, LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { fpmPath, getLinuxToolsPath } from \"./tools\"\n\ninterface FpmOptions {\n maintainer: string | undefined\n vendor: string\n url: string\n}\n\nexport default class FpmTarget extends Target {\n readonly options: LinuxTargetSpecificOptions = {...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name]}\n\n private readonly scriptFiles: Promise<Array<string>>\n\n constructor(name: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(name, false)\n\n this.scriptFiles = this.createScripts()\n }\n\n private async createScripts(): Promise<Array<string>> {\n const defaultTemplatesDir = getTemplatePath(\"linux\")\n\n const packager = this.packager\n const templateOptions = {\n // old API compatibility\n executable: packager.executableName,\n productFilename: packager.appInfo.productFilename, ...packager.platformSpecificBuildOptions}\n\n function getResource(value: string | null | undefined, defaultFile: string) {\n if (value == null) {\n return path.join(defaultTemplatesDir, defaultFile)\n }\n return path.resolve(packager.projectDir, value)\n }\n\n return await Promise.all<string>([\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, \"after-install.tpl\"), templateOptions),\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, \"after-remove.tpl\"), templateOptions)\n ])\n }\n\n checkOptions(): Promise<any> {\n return this.computeFpmMetaInfoOptions()\n }\n\n private async computeFpmMetaInfoOptions(): Promise<FpmOptions> {\n const packager = this.packager\n const projectUrl = await packager.appInfo.computePackageUrl()\n const errors: Array<string> = []\n if (projectUrl == null) {\n errors.push(\"Please specify project homepage, see https://electron.build/configuration/configuration#Metadata-homepage\")\n }\n\n const options = this.options\n let author = options.maintainer\n if (author == null) {\n const a = packager.info.metadata.author\n if (a == null || a.email == null) {\n errors.push(errorMessages.authorEmailIsMissed)\n }\n else {\n author = `${a.name} <${a.email}>`\n }\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\\n\"))\n }\n\n return {\n maintainer: author!!,\n url: projectUrl!!,\n vendor: options.vendor || author!!,\n }\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const fpmMetaInfoOptions = await this.computeFpmMetaInfoOptions()\n\n const target = this.name\n\n // tslint:disable:no-invalid-template-strings\n let nameFormat = \"${name}-${version}-${arch}.${ext}\"\n let isUseArchIfX64 = false\n if (target === \"deb\") {\n nameFormat = \"${name}_${version}_${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n else if (target === \"rpm\") {\n nameFormat = \"${name}-${version}.${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n\n const artifactPath = path.join(this.outDir, this.packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64))\n\n this.logBuilding(target, artifactPath, arch)\n\n await unlinkIfExists(artifactPath)\n if (this.packager.packagerOptions.prepackaged != null) {\n await ensureDir(this.outDir)\n }\n\n const scripts = await this.scriptFiles\n const packager = this.packager\n const appInfo = packager.appInfo\n const options = this.options\n const synopsis = options.synopsis\n const args = [\n \"-s\", \"dir\",\n \"-t\", target,\n \"--architecture\", (target === \"pacman\" && arch === Arch.ia32) ? \"i686\" : toLinuxArchString(arch),\n \"--name\", appInfo.name,\n \"--force\",\n \"--after-install\", scripts[0],\n \"--after-remove\", scripts[1],\n \"--description\", smarten(target === \"rpm\" ? this.helper.getDescription(options)! : `${synopsis || \"\"}\\n ${this.helper.getDescription(options)}`),\n \"--version\", appInfo.version,\n \"--package\", artifactPath,\n ]\n\n for (const key of Object.keys(fpmMetaInfoOptions)) {\n const value = (fpmMetaInfoOptions as any)[key]\n if (value != null) {\n args.push(`--${key}`, value)\n }\n }\n\n if (debug.enabled) {\n args.push(\n \"--log\", \"debug\",\n \"--debug\")\n }\n\n const packageCategory = options.packageCategory\n if (packageCategory != null && packageCategory !== null) {\n args.push(\"--category\", packageCategory)\n }\n\n const compression = options.compression\n if (target === \"deb\") {\n args.push(\"--deb-compression\", compression || \"xz\")\n use((options as DebOptions).priority, it => args.push(\"--deb-priority\", it!))\n }\n else if (target === \"rpm\") {\n args.push(\"--rpm-compression\", (compression === \"xz\" ? \"xzmt\" : compression) || \"xzmt\")\n args.push(\"--rpm-os\", \"linux\")\n\n if (synopsis != null) {\n args.push(\"--rpm-summary\", smarten(synopsis))\n }\n }\n\n // noinspection JSDeprecatedSymbols\n let depends = options.depends || this.packager.platformSpecificBuildOptions.depends\n if (depends == null) {\n if (target === \"deb\") {\n depends = [\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\", \"libxss1\"]\n }\n else if (target === \"pacman\") {\n // noinspection SpellCheckingInspection\n depends = [\"c-ares\", \"ffmpeg\", \"gtk3\", \"http-parser\", \"libevent\", \"libvpx\", \"libxslt\", \"libxss\", \"minizip\", \"nss\", \"re2\", \"snappy\", \"libnotify\", \"libappindicator-gtk2\", \"libappindicator-gtk3\", \"libappindicator-sharp\"]\n }\n else if (target === \"rpm\") {\n // noinspection SpellCheckingInspection\n depends = [\"libnotify\", \"libappindicator\", \"libXScrnSaver\"]\n }\n else {\n depends = []\n }\n }\n else if (!Array.isArray(depends)) {\n // noinspection SuspiciousTypeOfGuard\n if (typeof depends === \"string\") {\n depends = [depends as string]\n }\n else {\n throw new Error(`depends must be Array or String, but specified as: ${depends}`)\n }\n }\n\n for (const dep of depends) {\n args.push(\"--depends\", dep)\n }\n\n use(packager.info.metadata.license, it => args.push(\"--license\", it!))\n use(appInfo.buildNumber, it => args.push(\"--iteration\", it!))\n\n use(options.fpm, it => args.push(...it as any))\n\n args.push(`${appOutDir}/=${installPrefix}/${appInfo.productFilename}`)\n for (const icon of (await this.helper.icons)) {\n args.push(`${icon.file}=/usr/share/icons/hicolor/${icon.size}x${icon.size}/apps/${packager.executableName}.png`)\n }\n\n const desktopFilePath = await this.helper.writeDesktopEntry(this.options)\n args.push(`${desktopFilePath}=/usr/share/applications/${this.packager.executableName}.desktop`)\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && await this.packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath])) {\n return\n }\n\n const env = {\n ...process.env,\n FPM_COMPRESS_PROGRAM: appBuilderPath,\n SZA_PATH: path7za,\n SZA_COMPRESSION_LEVEL: packager.compression === \"store\" ? \"0\" : \"9\",\n SZA_ARCHIVE_TYPE: \"xz\",\n }\n\n // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)\n // so, for now, brew install rpm is still required.\n if (target !== \"rpm\" && await isMacOsSierra()) {\n const linuxToolsPath = await getLinuxToolsPath()\n Object.assign(env, {\n PATH: computeEnv(process.env.PATH, [path.join(linuxToolsPath, \"bin\")]),\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, \"lib\")]),\n })\n }\n await exec(await fpmPath.value, args, {env})\n\n this.packager.dispatchArtifactCreated(artifactPath, this, arch)\n }\n}\n\nasync function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise<string> {\n //noinspection JSUnusedLocalSymbols\n function replacer(match: string, p1: string) {\n if (p1 in options) {\n return options[p1]\n }\n else {\n throw new Error(`Macro ${p1} is not defined`)\n }\n }\n const config = (await readFile(templatePath, \"utf8\"))\n .replace(/\\${([a-zA-Z]+)}/g, replacer)\n .replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => {\n log.warn(\"<%= varName %> is deprecated, please use ${varName} instead\")\n return replacer(match, p1.trim())\n })\n\n const outputPath = await tmpDir.getTempFile({suffix: path.basename(templatePath, \".tpl\")})\n await outputFile(outputPath, config)\n return outputPath\n}\n"],"sourceRoot":""}