app-builder-lib 26.12.0 → 26.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/asar/asarFileChecker.d.ts +2 -2
- package/out/asar/asarFileChecker.js +3 -2
- package/out/asar/asarFileChecker.js.map +1 -1
- package/out/asar/asarUtil.js +3 -2
- package/out/asar/asarUtil.js.map +1 -1
- package/out/binDownload.js +36 -9
- package/out/binDownload.js.map +1 -1
- package/out/codeSign/certInfo.d.ts +54 -0
- package/out/codeSign/certInfo.js +466 -0
- package/out/codeSign/certInfo.js.map +1 -0
- package/out/codeSign/macCodeSign.d.ts +1 -1
- package/out/codeSign/macCodeSign.js +10 -9
- package/out/codeSign/macCodeSign.js.map +1 -1
- package/out/codeSign/windowsSignToolManager.js +3 -9
- package/out/codeSign/windowsSignToolManager.js.map +1 -1
- package/out/configuration.d.ts +5 -0
- package/out/configuration.js.map +1 -1
- package/out/electron/ElectronFramework.js +4 -1
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/electron/electronVersion.js +9 -4
- package/out/electron/electronVersion.js.map +1 -1
- package/out/fileTransformer.js +2 -1
- package/out/fileTransformer.js.map +1 -1
- package/out/forge-maker.js +6 -2
- package/out/forge-maker.js.map +1 -1
- package/out/mac/MacTargetHelper.d.ts +24 -0
- package/out/mac/MacTargetHelper.js +269 -0
- package/out/mac/MacTargetHelper.js.map +1 -0
- package/out/macPackager.d.ts +21 -7
- package/out/macPackager.js +219 -346
- package/out/macPackager.js.map +1 -1
- package/out/node-module-collector/moduleManager.d.ts +12 -2
- package/out/node-module-collector/moduleManager.js +3 -0
- package/out/node-module-collector/moduleManager.js.map +1 -1
- package/out/options/linuxOptions.d.ts +4 -3
- package/out/options/linuxOptions.js.map +1 -1
- package/out/options/macOptions.d.ts +6 -0
- package/out/options/macOptions.js.map +1 -1
- package/out/options/metadata.d.ts +2 -0
- package/out/options/metadata.js.map +1 -1
- package/out/packager.js +4 -4
- package/out/packager.js.map +1 -1
- package/out/platformPackager.d.ts +1 -1
- package/out/platformPackager.js +27 -21
- package/out/platformPackager.js.map +1 -1
- package/out/targets/AppxTarget.js +2 -1
- package/out/targets/AppxTarget.js.map +1 -1
- package/out/targets/FlatpakTarget.js +2 -4
- package/out/targets/FlatpakTarget.js.map +1 -1
- package/out/targets/FpmTarget.js +30 -6
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.d.ts +1 -1
- package/out/targets/LinuxTargetHelper.js +79 -14
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +1 -1
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/MsiWrappedTarget.js +1 -1
- package/out/targets/MsiWrappedTarget.js.map +1 -1
- package/out/targets/appimage/AppImageTarget.d.ts +0 -2
- package/out/targets/appimage/AppImageTarget.js +27 -42
- package/out/targets/appimage/AppImageTarget.js.map +1 -1
- package/out/targets/appimage/appImageUtil.d.ts +3 -1
- package/out/targets/appimage/appImageUtil.js +33 -0
- package/out/targets/appimage/appImageUtil.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +15 -5
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/WebInstallerTarget.js +2 -2
- package/out/targets/nsis/WebInstallerTarget.js.map +1 -1
- package/out/targets/nsis/nsisScriptGenerator.js +2 -3
- package/out/targets/nsis/nsisScriptGenerator.js.map +1 -1
- package/out/targets/pkg.js +1 -1
- package/out/targets/pkg.js.map +1 -1
- package/out/targets/snap/SnapTarget.js +2 -1
- package/out/targets/snap/SnapTarget.js.map +1 -1
- package/out/targets/snap/core24.js +5 -4
- package/out/targets/snap/core24.js.map +1 -1
- package/out/targets/snap/coreLegacy.js +5 -5
- package/out/targets/snap/coreLegacy.js.map +1 -1
- package/out/targets/snap/snapcraftBuilder.js +4 -3
- package/out/targets/snap/snapcraftBuilder.js.map +1 -1
- package/out/toolsets/linux.d.ts +3 -1
- package/out/toolsets/linux.js +49 -21
- package/out/toolsets/linux.js.map +1 -1
- package/out/toolsets/windows.js +7 -17
- package/out/toolsets/windows.js.map +1 -1
- package/out/util/bundledTool.js +2 -1
- package/out/util/bundledTool.js.map +1 -1
- package/out/util/config/config.js +4 -3
- package/out/util/config/config.js.map +1 -1
- package/out/util/dynamicImport.d.ts +1 -0
- package/out/util/dynamicImport.js +14 -0
- package/out/util/dynamicImport.js.map +1 -0
- package/out/util/electronGet.d.ts +2 -0
- package/out/util/electronGet.js +38 -2
- package/out/util/electronGet.js.map +1 -1
- package/out/util/packageMetadata.js +2 -1
- package/out/util/packageMetadata.js.map +1 -1
- package/out/util/rebuild.d.ts +1 -1
- package/out/util/rebuild.js.map +1 -1
- package/out/util/yarn.js +1 -1
- package/out/util/yarn.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/package.json +11 -8
- package/scheme.json +22 -1
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../src/targets/MsiTarget.ts"],"names":[],"mappings":";;AAAA,+CAAmE;AACnE,+DAA2C;AAC3C,mCAAmC;AACnC,2BAA0B;AAC1B,0CAAiD;AACjD,uCAA+B;AAC/B,6BAA4B;AAE5B,gDAA8C;AAC9C,kCAAgC;AAChC,wGAAuJ;AACvJ,0DAAkD;AAClD,qDAAqD;AACrD,iCAAoC;AACpC,yCAA4C;AAE5C,qDAAqD;AACrD,6CAA4E;AAE5E,MAAM,qCAAqC,GAAG,2BAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AAChG,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,mHAAmH;AACnH,MAAqB,SAAU,SAAQ,aAAM;IAK3C,YACqB,QAAqB,EAC/B,MAAc,EACvB,IAAI,GAAG,KAAK,EACZ,gBAAgB,GAAG,IAAI;QAEvB,KAAK,CAAC,IAAI,E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,MAAM,KACzG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,EAC3D,KAAK,CAAA;wBACL,MAAM,IAAI,GAAG,SAAS,sBAAsB,GAAG,sBAAsB,CAAA;wBACrE,MAAM,IAAI,GAAG,SAAS,4CAA4C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,iCAAiC,CAAA;wBAC7I,MAAM,IAAI,GAAG,SAAS,oBAAoB,CAAA;wBAC1C,MAAM,IAAI,GAAG,SAAS,eAAe,CAAA;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,GAAG,MAAM,KAAK,SAAS,cAAc,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAA;IACvE,CAAC;CACF;AAvRD,4BAuRC;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,WAAmB;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC/H,CAAC","sourcesContent":["import { Arch, asArray, deepAssign, log, walk } from \"builder-util\"\nimport { UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { withToolsetLock } from \"../util/toolsetLock\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager()\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n // wix 4.0.0.5512.2 doesn't support the arm64 architecture so default to x64 when building for arm64.\n // This will result in an x64 MSI installer that installs an arm64 version of the application. This is a\n // stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixArch = arch == Arch.arm64 ? Arch.x64 : arch\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.info.emitMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromUrl(\"wix-4.0.0.5512.2\", \"wix-4.0.0.5512.2.7z\", \"fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", wixArch === Arch.ia32 ? \"x86\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array<string>, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\",\n vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n return {\n ...commonOptions,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n }\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = (await walk(appOutDir)).map(file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${dirName.replace(/\\//g, \"\\\\\")}\\\\\"/>`)\n }\n } else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = `<Component${directoryId === null ? \"\" : ` Directory=\"${directoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${xmlAttr(fileName)}\" Source=\"$(var.appDir)${path.sep}${xmlAttr(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n } else if (directoryId === null) {\n result += ` Id=\"${path.basename(packagePath)}_f\"`\n }\n\n const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER\n if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {\n result += `>\\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} <Shortcut Id=\"desktopShortcut\" Directory=\"DesktopFolder\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\"/>\\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${commonOptions.menuCategory}\\\\\"/>`)\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\">\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${xmlAttr(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${ext}\" Advertise=\"yes\" Icon=\"${this.iconId}\" ${\n item.description ? `Description=\"${item.description}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${ext}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${xmlAttr(this.packager.appInfo.productName)}\" Argument=\""%1"\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n\nfunction xmlAttr(str: string) {\n return str.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\").replace(/'/g, \"'\")\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../src/targets/MsiTarget.ts"],"names":[],"mappings":";;AAAA,+CAAuD;AACvD,+DAAuD;AACvD,mCAAmC;AACnC,2BAA0B;AAC1B,0CAAiD;AACjD,uCAA+B;AAC/B,6BAA4B;AAE5B,gDAA8C;AAC9C,kCAAgC;AAChC,wGAAuJ;AACvJ,0DAAkD;AAClD,qDAAqD;AACrD,iCAAoC;AACpC,yCAA4C;AAE5C,qDAAqD;AACrD,6CAA4E;AAE5E,MAAM,qCAAqC,GAAG,2BAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AAChG,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,mHAAmH;AACnH,MAAqB,SAAU,SAAQ,aAAM;IAK3C,YACqB,QAAqB,EAC/B,MAAc,EACvB,IAAI,GAAG,KAAK,EACZ,gBAAgB,GAAG,IAAI;QAEvB,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;QALV,aAAQ,GAAR,QAAQ,CAAa;QAC/B,WAAM,GAAN,MAAM,CAAQ;QANN,OAAE,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,cAAS,EAAE,CAAC,CAAC,CAAC,IAAI,sBAAa,EAAE,CAAA;QAEnF,YAAO,GAAe,IAAA,iCAAU,EAAC,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,IAAI,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,MAAM,IAAI,GAAG,SAAS,oBAAoB,CAAA;wBAC1C,MAAM,IAAI,GAAG,SAAS,eAAe,CAAA;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,GAAG,MAAM,KAAK,SAAS,cAAc,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAA;IACvE,CAAC;CACF;AAvRD,4BAuRC;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,WAAmB;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC/H,CAAC","sourcesContent":["import { Arch, asArray, log, walk } from \"builder-util\"\nimport { deepAssign, UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { withToolsetLock } from \"../util/toolsetLock\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager()\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n // wix 4.0.0.5512.2 doesn't support the arm64 architecture so default to x64 when building for arm64.\n // This will result in an x64 MSI installer that installs an arm64 version of the application. This is a\n // stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixArch = arch == Arch.arm64 ? Arch.x64 : arch\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.info.emitMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromUrl(\"wix-4.0.0.5512.2\", \"wix-4.0.0.5512.2.7z\", \"fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", wixArch === Arch.ia32 ? \"x86\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array<string>, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\",\n vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n return {\n ...commonOptions,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n }\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = (await walk(appOutDir)).map(file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${dirName.replace(/\\//g, \"\\\\\")}\\\\\"/>`)\n }\n } else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = `<Component${directoryId === null ? \"\" : ` Directory=\"${directoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${xmlAttr(fileName)}\" Source=\"$(var.appDir)${path.sep}${xmlAttr(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n } else if (directoryId === null) {\n result += ` Id=\"${path.basename(packagePath)}_f\"`\n }\n\n const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER\n if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {\n result += `>\\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} <Shortcut Id=\"desktopShortcut\" Directory=\"DesktopFolder\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\"/>\\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${commonOptions.menuCategory}\\\\\"/>`)\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\">\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${xmlAttr(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${ext}\" Advertise=\"yes\" Icon=\"${this.iconId}\" ${\n item.description ? `Description=\"${item.description}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${ext}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${xmlAttr(this.packager.appInfo.productName)}\" Argument=\""%1"\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n\nfunction xmlAttr(str: string) {\n return str.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\").replace(/'/g, \"'\")\n}\n"]}
|
|
@@ -10,7 +10,7 @@ class MsiWrappedTarget extends MsiTarget_1.default {
|
|
|
10
10
|
// must be synchronous so it can run after nsis
|
|
11
11
|
super(packager, outDir, "msiWrapped", false);
|
|
12
12
|
this.outDir = outDir;
|
|
13
|
-
this.options = (0,
|
|
13
|
+
this.options = (0, builder_util_runtime_1.deepAssign)(this.packager.platformSpecificBuildOptions, this.packager.config.msiWrapped);
|
|
14
14
|
/** @private */
|
|
15
15
|
this.archs = new Map();
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsiWrappedTarget.js","sourceRoot":"","sources":["../../src/targets/MsiWrappedTarget.ts"],"names":[],"mappings":";;AAAA,+
|
|
1
|
+
{"version":3,"file":"MsiWrappedTarget.js","sourceRoot":"","sources":["../../src/targets/MsiWrappedTarget.ts"],"names":[],"mappings":";;AAAA,+CAAsE;AACtE,+DAAuD;AACvD,6BAA4B;AAK5B,2CAAmC;AAEnC,MAAM,4BAA4B,GAAG,2BAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AAEvF,MAAqB,gBAAiB,SAAQ,mBAAS;IAMrD,YACE,QAAqB,EACZ,MAAc;QAEvB,+CAA+C;QAC/C,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;QAHnC,WAAM,GAAN,MAAM,CAAQ;QAPhB,YAAO,GAAsB,IAAA,iCAAU,EAAC,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QAE7H,eAAe;QACE,UAAK,GAAsB,IAAI,GAAG,EAAE,CAAA;IAQrD,CAAC;IAED,IAAY,SAAS;QACnB,kDAAkD;QAClD,mDAAmD;QACnD,uBAAuB;QACvB,OAAO,2BAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAA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,CAAC,SAAS;YACzB,WAAW,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACxD,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;SACnD,CAAC,CAAA;IACJ,CAAC;CACF;AA7FD,mCA6FC","sourcesContent":["import { Arch, exists, InvalidConfigurationError } from \"builder-util\"\nimport { deepAssign, UUID } from \"builder-util-runtime\"\nimport * as path from \"path\"\nimport { MsiWrappedOptions } from \"../\"\nimport { TargetConfiguration } from \"../core\"\nimport { FinalCommonWindowsInstallerOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { WinPackager } from \"../winPackager\"\nimport MsiTarget from \"./MsiTarget\"\n\nconst ELECTRON_MSI_WRAPPED_NS_UUID = UUID.parse(\"467f7bb2-a83c-442f-b776-394d316e8e53\")\n\nexport default class MsiWrappedTarget extends MsiTarget {\n readonly options: MsiWrappedOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msiWrapped)\n\n /** @private */\n private readonly archs: Map<Arch, string> = new Map()\n\n constructor(\n packager: WinPackager,\n readonly outDir: string\n ) {\n // must be synchronous so it can run after nsis\n super(packager, outDir, \"msiWrapped\", false)\n }\n\n private get productId(): string {\n // this id is only required to build the installer\n // however it serves no purpose as this msi is just\n // a wrapper for an exe\n return UUID.v5(this.packager.appInfo.id, ELECTRON_MSI_WRAPPED_NS_UUID).toUpperCase()\n }\n\n private validatePrerequisites(): void {\n const config = this.packager.config\n // this target requires nsis to be configured and executed\n // as this build re-bundles the nsis executable and wraps it in an msi\n\n if (!config.win || !config.win.target || !Array.isArray(config.win.target)) {\n throw new Error(\"No windows target found!\")\n }\n\n const target = config.win.target\n const nsisTarget = \"nsis\"\n if (\n !target\n .map((t: TargetConfiguration | string): string => {\n const result: string = typeof t === \"string\" ? t : t.target\n return result.toLowerCase().trim()\n })\n .some(t => t === nsisTarget)\n ) {\n throw new Error(\"No nsis target found! Please specify an nsis target\")\n }\n }\n\n build(appOutDir: string, arch: Arch): Promise<any> {\n this.archs.set(arch, appOutDir)\n return Promise.resolve()\n }\n\n async finishBuild(): Promise<any> {\n await super.finishBuild()\n const [arch, appOutDir] = this.archs.entries().next().value!\n\n this.validatePrerequisites()\n\n const exeSourcePath = this.getExeSourcePath(arch)\n\n if (!(await exists(exeSourcePath))) {\n throw new InvalidConfigurationError(\n `NSIS executable not found at ${exeSourcePath} - ensure the NSIS target builds before msiWrapped. Try listing 'nsis' before 'msiWrapped' in your target configuration.`\n )\n }\n\n return super.build(appOutDir, arch)\n }\n\n protected get installerFilenamePattern(): string {\n // big assumption is made here for the moment that the pattern didn't change\n // tslint:disable:no-invalid-template-strings\n return \"${productName} Setup ${version}.${ext}\"\n }\n\n private getExeSourcePath(arch: Arch) {\n const packager = this.packager\n // in this case, we want .exe, this way we can wrap the existing package if it exists\n const artifactName = packager.expandArtifactNamePattern(this.options, \"exe\", arch, this.installerFilenamePattern, false, this.packager.platformSpecificBuildOptions.defaultArch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n return artifactPath\n }\n\n protected async writeManifest(_appOutDir: string, arch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const exeSourcePath = this.getExeSourcePath(arch)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n exeSourcePath: exeSourcePath,\n productId: this.productId,\n impersonate: options.impersonate === true ? \"yes\" : \"no\",\n wrappedInstallerArgs: options.wrappedInstallerArgs,\n })\n }\n}\n"]}
|
|
@@ -12,6 +12,4 @@ export default class AppImageTarget extends Target {
|
|
|
12
12
|
private readonly desktopEntry;
|
|
13
13
|
constructor(_ignored: string, packager: LinuxPackager, helper: LinuxTargetHelper, outDir: string);
|
|
14
14
|
build(appOutDir: string, arch: Arch): Promise<any>;
|
|
15
|
-
/** Builds via the legacy FUSE2 toolset (mksquashfs); used when no static-runtime appimage tool is configured. */
|
|
16
|
-
private buildFuse2AppImage;
|
|
17
15
|
}
|
|
@@ -7,10 +7,10 @@ const lazy_val_1 = require("lazy-val");
|
|
|
7
7
|
const path = require("path");
|
|
8
8
|
const core_1 = require("../../core");
|
|
9
9
|
const PublishManager_1 = require("../../publish/PublishManager");
|
|
10
|
-
const appBuilder_1 = require("../../util/appBuilder");
|
|
11
10
|
const license_1 = require("../../util/license");
|
|
12
11
|
const targetUtil_1 = require("../targetUtil");
|
|
13
12
|
const appImageUtil_1 = require("./appImageUtil");
|
|
13
|
+
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
14
14
|
// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file
|
|
15
15
|
exports.APP_RUN_ENTRYPOINT = "AppRun";
|
|
16
16
|
class AppImageTarget extends core_1.Target {
|
|
@@ -19,7 +19,7 @@ class AppImageTarget extends core_1.Target {
|
|
|
19
19
|
this.packager = packager;
|
|
20
20
|
this.helper = helper;
|
|
21
21
|
this.outDir = outDir;
|
|
22
|
-
this.options = {
|
|
22
|
+
this.options = (0, builder_util_runtime_1.deepAssign)({}, this.packager.platformSpecificBuildOptions, this.packager.config[this.name]);
|
|
23
23
|
this.desktopEntry = new lazy_val_1.Lazy(() => {
|
|
24
24
|
var _a, _b;
|
|
25
25
|
const appimageTool = (_a = packager.config.toolsets) === null || _a === void 0 ? void 0 : _a.appimage;
|
|
@@ -63,7 +63,31 @@ class AppImageTarget extends core_1.Target {
|
|
|
63
63
|
try {
|
|
64
64
|
const appimageTool = (_a = this.packager.config.toolsets) === null || _a === void 0 ? void 0 : _a.appimage;
|
|
65
65
|
if (appimageTool == null || appimageTool === "0.0.0") {
|
|
66
|
-
updateInfo = await
|
|
66
|
+
updateInfo = await (0, appImageUtil_1.buildLegacyFuse2AppImage)({
|
|
67
|
+
appDir: appOutDir,
|
|
68
|
+
stageDir: stageDir.dir,
|
|
69
|
+
arch,
|
|
70
|
+
output: artifactPath,
|
|
71
|
+
options: {
|
|
72
|
+
productName: packager.appInfo.productName,
|
|
73
|
+
productFilename: packager.appInfo.productFilename,
|
|
74
|
+
executableName: packager.executableName,
|
|
75
|
+
license,
|
|
76
|
+
desktopEntry,
|
|
77
|
+
icons,
|
|
78
|
+
fileAssociations: packager.fileAssociations,
|
|
79
|
+
compression: (() => {
|
|
80
|
+
const c = options.compression;
|
|
81
|
+
if (c === "xz" || c === "gzip") {
|
|
82
|
+
return c;
|
|
83
|
+
}
|
|
84
|
+
if (packager.compression === "maximum") {
|
|
85
|
+
return "xz";
|
|
86
|
+
}
|
|
87
|
+
return undefined; // normal/store/unset/zstd → mksquashfs defaults to gzip
|
|
88
|
+
})(),
|
|
89
|
+
},
|
|
90
|
+
});
|
|
67
91
|
}
|
|
68
92
|
else {
|
|
69
93
|
updateInfo = await (0, appImageUtil_1.buildStaticRuntimeAppImage)(appimageTool, {
|
|
@@ -113,45 +137,6 @@ class AppImageTarget extends core_1.Target {
|
|
|
113
137
|
updateInfo,
|
|
114
138
|
});
|
|
115
139
|
}
|
|
116
|
-
/** Builds via the legacy FUSE2 toolset (mksquashfs); used when no static-runtime appimage tool is configured. */
|
|
117
|
-
async buildFuse2AppImage(props) {
|
|
118
|
-
const { stageDir, arch, artifactPath, appOutDir, options, desktopEntry, icons, license } = props;
|
|
119
|
-
const args = [
|
|
120
|
-
"appimage",
|
|
121
|
-
"--stage",
|
|
122
|
-
stageDir.dir,
|
|
123
|
-
"--arch",
|
|
124
|
-
builder_util_1.Arch[arch],
|
|
125
|
-
"--output",
|
|
126
|
-
artifactPath,
|
|
127
|
-
"--app",
|
|
128
|
-
appOutDir,
|
|
129
|
-
"--configuration",
|
|
130
|
-
JSON.stringify({
|
|
131
|
-
productName: this.packager.appInfo.productName,
|
|
132
|
-
productFilename: this.packager.appInfo.productFilename,
|
|
133
|
-
desktopEntry,
|
|
134
|
-
executableName: this.packager.executableName,
|
|
135
|
-
icons,
|
|
136
|
-
fileAssociations: this.packager.fileAssociations,
|
|
137
|
-
...options,
|
|
138
|
-
}),
|
|
139
|
-
];
|
|
140
|
-
(0, appBuilder_1.objectToArgs)(args, {
|
|
141
|
-
license,
|
|
142
|
-
});
|
|
143
|
-
// app-builder --compression enum for FUSE2 is xz/lzo/zstd; gzip is mksquashfs's default and must not be passed explicitly
|
|
144
|
-
const FUSE2_VALID = ["xz"];
|
|
145
|
-
const explicitComp = options.compression;
|
|
146
|
-
if (explicitComp != null && FUSE2_VALID.includes(explicitComp)) {
|
|
147
|
-
args.push("--compression", explicitComp);
|
|
148
|
-
}
|
|
149
|
-
else if (this.packager.compression === "maximum") {
|
|
150
|
-
args.push("--compression", "xz");
|
|
151
|
-
}
|
|
152
|
-
const updateInfo = await (0, appBuilder_1.executeAppBuilderAsJson)(args);
|
|
153
|
-
return updateInfo;
|
|
154
|
-
}
|
|
155
140
|
}
|
|
156
141
|
exports.default = AppImageTarget;
|
|
157
142
|
//# sourceMappingURL=AppImageTarget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppImageTarget.js","sourceRoot":"","sources":["../../../src/targets/appimage/AppImageTarget.ts"],"names":[],"mappings":";;;AACA,+CAAyD;AACzD,uCAAqC;AACrC,uCAA+B;AAC/B,6BAA4B;AAC5B,qCAAmC;AAGnC,iEAA+E;AAC/E,sDAA6E;AAC7E,gDAA+D;AAE/D,8CAAwD;AACxD,iDAA2D;AAG3D,+FAA+F;AAElF,QAAA,kBAAkB,GAAG,QAAQ,CAAA;AAE1C,MAAqB,cAAe,SAAQ,aAAM;IAKhD,YACE,QAAgB,EACC,QAAuB,EACvB,MAAyB,EACjC,MAAc;QAEvB,KAAK,CAAC,UAAU,CAAC,CAAA;QAJA,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAmB;QACjC,WAAM,GAAN,MAAM,CAAQ;QARhB,YAAO,GAAoB,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,GAAI,IAAI,CAAC,QAAQ,CAAC,MAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAA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AAC;YACtF,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;QAC1C,CAAC;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,IAAA,oCAAuB,EAAqB,IAAI,CAAC,CAAA;QAC1E,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AAhKD,iCAgKC","sourcesContent":["import { IconInfo } from \"../../platformPackager\"\nimport { Arch, log, serializeToYaml } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../../core\"\nimport { LinuxPackager } from \"../../linuxPackager\"\nimport { AppImageOptions } from \"../../options/linuxOptions\"\nimport { getAppUpdatePublishConfiguration } from \"../../publish/PublishManager\"\nimport { executeAppBuilderAsJson, objectToArgs } from \"../../util/appBuilder\"\nimport { getNotLocalizedLicenseFile } from \"../../util/license\"\nimport { LinuxTargetHelper } from \"../LinuxTargetHelper\"\nimport { createStageDir, StageDir } from \"../targetUtil\"\nimport { buildStaticRuntimeAppImage } from \"./appImageUtil\"\nimport { BlockMapDataHolder } from \"builder-util-runtime\"\n\n// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file\n\nexport const APP_RUN_ENTRYPOINT = \"AppRun\"\n\nexport default class AppImageTarget extends Target {\n readonly options: AppImageOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n private readonly desktopEntry: Lazy<string>\n\n constructor(\n _ignored: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(\"appImage\")\n\n this.desktopEntry = new Lazy<string>(() => {\n const appimageTool = packager.config.toolsets?.appimage\n const defaultArgs = appimageTool == null || appimageTool === \"0.0.0\" ? [\"--no-sandbox\"] : []\n const args = this.options.executableArgs ?? defaultArgs\n const exec = [APP_RUN_ENTRYPOINT, ...args, \"%U\"].join(\" \")\n return helper.computeDesktopEntry(this.options, exec, {\n \"X-AppImage-Version\": `${packager.appInfo.buildVersion}`,\n })\n })\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n\n const options = this.options\n // https://github.com/electron-userland/electron-builder/issues/775\n // https://github.com/electron-userland/electron-builder/issues/1726\n const artifactName = packager.expandArtifactNamePattern(options, \"AppImage\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"AppImage\",\n file: artifactPath,\n arch,\n })\n\n // Parallelize independent async operations\n const [publishConfig, stageDir, desktopEntry, icons, license] = await Promise.all([\n getAppUpdatePublishConfiguration(packager, options, arch, false),\n createStageDir(this, packager, arch),\n this.desktopEntry.value,\n this.helper.icons,\n getNotLocalizedLicenseFile(options.license, this.packager, [\"txt\", \"html\"]),\n ])\n\n if (publishConfig != null) {\n await outputFile(path.join(packager.getResourcesDir(appOutDir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: desktopEntry }))) {\n await stageDir.cleanup()\n return\n }\n\n let updateInfo: BlockMapDataHolder\n try {\n const appimageTool = this.packager.config.toolsets?.appimage\n if (appimageTool == null || appimageTool === \"0.0.0\") {\n updateInfo = await this.buildFuse2AppImage({ stageDir, arch, artifactPath, appOutDir, options, packager, desktopEntry, icons, license })\n } else {\n updateInfo = await buildStaticRuntimeAppImage(appimageTool, {\n appDir: appOutDir,\n stageDir: stageDir.dir,\n arch,\n output: artifactPath,\n options: {\n productName: packager.appInfo.productName,\n productFilename: packager.appInfo.productFilename,\n executableName: packager.executableName,\n license,\n desktopEntry,\n icons,\n fileAssociations: packager.fileAssociations,\n compression: (() => {\n const c = options.compression\n if (c === \"gzip\" || c === \"zstd\") {\n return c\n }\n if (c === \"xz\") {\n return \"zstd\" // nearest equivalent; static runtime does not support xz\n }\n if (packager.compression === \"store\") {\n return \"gzip\"\n }\n return \"zstd\" // maximum/normal/unset → zstd for static runtime\n })(),\n },\n })\n }\n } catch (error: any) {\n log.error({ error: error.message }, \"failed to build AppImage\")\n throw error\n } finally {\n await stageDir.cleanup().catch(() => {})\n }\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"AppImage\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: true,\n updateInfo,\n })\n }\n\n /** Builds via the legacy FUSE2 toolset (mksquashfs); used when no static-runtime appimage tool is configured. */\n private async buildFuse2AppImage(props: {\n stageDir: StageDir\n arch: Arch\n artifactPath: string\n appOutDir: string\n options: AppImageOptions\n packager: LinuxPackager\n desktopEntry: string\n icons: IconInfo[]\n license: string | null\n }): Promise<BlockMapDataHolder> {\n const { stageDir, arch, artifactPath, appOutDir, options, desktopEntry, icons, license } = props\n\n const args = [\n \"appimage\",\n \"--stage\",\n stageDir.dir,\n \"--arch\",\n Arch[arch],\n \"--output\",\n artifactPath,\n \"--app\",\n appOutDir,\n \"--configuration\",\n JSON.stringify({\n productName: this.packager.appInfo.productName,\n productFilename: this.packager.appInfo.productFilename,\n desktopEntry,\n executableName: this.packager.executableName,\n icons,\n fileAssociations: this.packager.fileAssociations,\n ...options,\n }),\n ]\n objectToArgs(args, {\n license,\n })\n // app-builder --compression enum for FUSE2 is xz/lzo/zstd; gzip is mksquashfs's default and must not be passed explicitly\n const FUSE2_VALID = [\"xz\"] as const\n const explicitComp = options.compression\n if (explicitComp != null && (FUSE2_VALID as readonly string[]).includes(explicitComp)) {\n args.push(\"--compression\", explicitComp)\n } else if (this.packager.compression === \"maximum\") {\n args.push(\"--compression\", \"xz\")\n }\n\n const updateInfo = await executeAppBuilderAsJson<BlockMapDataHolder>(args)\n return updateInfo\n }\n}\n"]}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E,GAAE,CAAC,CAAC,CAAA;QAC1C,CAAC;QAED,MAAM,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC;YAC7C,IAAI,EAAE,YAAY;YAClB,gBAAgB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC;YACzF,MAAM,EAAE,IAAI;YACZ,IAAI;YACJ,QAAQ;YACR,iBAAiB,EAAE,IAAI;YACvB,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;CACF;AArID,iCAqIC","sourcesContent":["import { Arch, log, serializeToYaml } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../../core\"\nimport { LinuxPackager } from \"../../linuxPackager\"\nimport { AppImageOptions } from \"../../options/linuxOptions\"\nimport { getAppUpdatePublishConfiguration } from \"../../publish/PublishManager\"\nimport { getNotLocalizedLicenseFile } from \"../../util/license\"\nimport { LinuxTargetHelper } from \"../LinuxTargetHelper\"\nimport { createStageDir } from \"../targetUtil\"\nimport { buildLegacyFuse2AppImage, buildStaticRuntimeAppImage } from \"./appImageUtil\"\nimport { BlockMapDataHolder, deepAssign } from \"builder-util-runtime\"\n\n// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file\n\nexport const APP_RUN_ENTRYPOINT = \"AppRun\"\n\nexport default class AppImageTarget extends Target {\n readonly options: AppImageOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, (this.packager.config as any)[this.name])\n\n private readonly desktopEntry: Lazy<string>\n\n constructor(\n _ignored: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(\"appImage\")\n\n this.desktopEntry = new Lazy<string>(() => {\n const appimageTool = packager.config.toolsets?.appimage\n const defaultArgs = appimageTool == null || appimageTool === \"0.0.0\" ? [\"--no-sandbox\"] : []\n const args = this.options.executableArgs ?? defaultArgs\n const exec = [APP_RUN_ENTRYPOINT, ...args, \"%U\"].join(\" \")\n return helper.computeDesktopEntry(this.options, exec, {\n \"X-AppImage-Version\": `${packager.appInfo.buildVersion}`,\n })\n })\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n\n const options = this.options\n // https://github.com/electron-userland/electron-builder/issues/775\n // https://github.com/electron-userland/electron-builder/issues/1726\n const artifactName = packager.expandArtifactNamePattern(options, \"AppImage\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"AppImage\",\n file: artifactPath,\n arch,\n })\n\n // Parallelize independent async operations\n const [publishConfig, stageDir, desktopEntry, icons, license] = await Promise.all([\n getAppUpdatePublishConfiguration(packager, options, arch, false),\n createStageDir(this, packager, arch),\n this.desktopEntry.value,\n this.helper.icons,\n getNotLocalizedLicenseFile(options.license, this.packager, [\"txt\", \"html\"]),\n ])\n\n if (publishConfig != null) {\n await outputFile(path.join(packager.getResourcesDir(appOutDir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: desktopEntry }))) {\n await stageDir.cleanup()\n return\n }\n\n let updateInfo: BlockMapDataHolder\n try {\n const appimageTool = this.packager.config.toolsets?.appimage\n if (appimageTool == null || appimageTool === \"0.0.0\") {\n updateInfo = await buildLegacyFuse2AppImage({\n appDir: appOutDir,\n stageDir: stageDir.dir,\n arch,\n output: artifactPath,\n options: {\n productName: packager.appInfo.productName,\n productFilename: packager.appInfo.productFilename,\n executableName: packager.executableName,\n license,\n desktopEntry,\n icons,\n fileAssociations: packager.fileAssociations,\n compression: (() => {\n const c = options.compression\n if (c === \"xz\" || c === \"gzip\") {\n return c\n }\n if (packager.compression === \"maximum\") {\n return \"xz\"\n }\n return undefined // normal/store/unset/zstd → mksquashfs defaults to gzip\n })(),\n },\n })\n } else {\n updateInfo = await buildStaticRuntimeAppImage(appimageTool, {\n appDir: appOutDir,\n stageDir: stageDir.dir,\n arch,\n output: artifactPath,\n options: {\n productName: packager.appInfo.productName,\n productFilename: packager.appInfo.productFilename,\n executableName: packager.executableName,\n license,\n desktopEntry,\n icons,\n fileAssociations: packager.fileAssociations,\n compression: (() => {\n const c = options.compression\n if (c === \"gzip\" || c === \"zstd\") {\n return c\n }\n if (c === \"xz\") {\n return \"zstd\" // nearest equivalent; static runtime does not support xz\n }\n if (packager.compression === \"store\") {\n return \"gzip\"\n }\n return \"zstd\" // maximum/normal/unset → zstd for static runtime\n })(),\n },\n })\n }\n } catch (error: any) {\n log.error({ error: error.message }, \"failed to build AppImage\")\n throw error\n } finally {\n await stageDir.cleanup().catch(() => {})\n }\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"AppImage\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: true,\n updateInfo,\n })\n }\n}\n"]}
|
|
@@ -13,13 +13,14 @@ interface Options {
|
|
|
13
13
|
fileAssociations: FileAssociation[];
|
|
14
14
|
/**
|
|
15
15
|
* The compression type available for static runtime is limited as it's only compiled with support for gzip and zstd.
|
|
16
|
+
* "xz" is only valid for the legacy FUSE2 (0.0.0) toolset.
|
|
16
17
|
*
|
|
17
18
|
* [stderr] Squashfs image uses lzo compression, this version supports only zlib, zstd.
|
|
18
19
|
* Failed to open squashfs image
|
|
19
20
|
* Failed to extract AppImage
|
|
20
21
|
*
|
|
21
22
|
*/
|
|
22
|
-
compression?: "gzip" | "zstd";
|
|
23
|
+
compression?: "gzip" | "zstd" | "xz";
|
|
23
24
|
}
|
|
24
25
|
export interface AppImageBuilderOptions {
|
|
25
26
|
appDir: string;
|
|
@@ -29,6 +30,7 @@ export interface AppImageBuilderOptions {
|
|
|
29
30
|
options: Options;
|
|
30
31
|
}
|
|
31
32
|
export declare function buildStaticRuntimeAppImage(appimageToolVersion: ToolsetConfig["appimage"], opts: AppImageBuilderOptions): Promise<BlockMapDataHolder>;
|
|
33
|
+
export declare function buildLegacyFuse2AppImage(opts: AppImageBuilderOptions): Promise<BlockMapDataHolder>;
|
|
32
34
|
/**
|
|
33
35
|
* Validates that critical path fields (executable name, product filename, license filename)
|
|
34
36
|
* contain only characters that are safe for use in filesystem paths and embedded bash strings.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildStaticRuntimeAppImage = buildStaticRuntimeAppImage;
|
|
4
|
+
exports.buildLegacyFuse2AppImage = buildLegacyFuse2AppImage;
|
|
4
5
|
exports.validateCriticalPathString = validateCriticalPathString;
|
|
5
6
|
exports.generateAppRunScript = generateAppRunScript;
|
|
6
7
|
const builder_util_1 = require("builder-util");
|
|
@@ -44,6 +45,38 @@ async function buildStaticRuntimeAppImage(appimageToolVersion, opts) {
|
|
|
44
45
|
throw error;
|
|
45
46
|
}
|
|
46
47
|
}
|
|
48
|
+
async function buildLegacyFuse2AppImage(opts) {
|
|
49
|
+
const { stageDir, output, appDir, options, arch } = opts;
|
|
50
|
+
try {
|
|
51
|
+
await fs.remove(output);
|
|
52
|
+
await writeAppLauncherAndRelatedFiles(opts);
|
|
53
|
+
const { runtime, mksquashfs, runtimeLibraries } = await (0, linux_1.getAppImageTools)("0.0.0", arch);
|
|
54
|
+
// Mirror the app-builder-lib Go implementation: bundle lib/<arch> into usr/lib for x64 and ia32.
|
|
55
|
+
// arm targets don't have a dedicated lib dir in the FUSE2 toolset.
|
|
56
|
+
if (arch === builder_util_1.Arch.x64 || arch === builder_util_1.Arch.ia32) {
|
|
57
|
+
await (0, builder_util_1.copyDir)(runtimeLibraries, path.join(stageDir, "usr", "lib"));
|
|
58
|
+
}
|
|
59
|
+
await (0, builder_util_1.copyDir)(appDir, stageDir);
|
|
60
|
+
const runtimeData = await fs.readFile(runtime);
|
|
61
|
+
const args = [stageDir, output, "-offset", runtimeData.length.toString(), "-all-root", "-noappend", "-no-progress", "-quiet", "-no-xattrs", "-no-fragments"];
|
|
62
|
+
if (options.compression) {
|
|
63
|
+
args.push("-comp", options.compression);
|
|
64
|
+
if (options.compression === "xz") {
|
|
65
|
+
// Match the dictionary/block-size settings used by the original app-builder Go implementation
|
|
66
|
+
args.push("-Xdict-size", "100%", "-b", "1048576");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
await (0, builder_util_1.exec)(mksquashfs, args, { cwd: stageDir });
|
|
70
|
+
await writeRuntimeData(output, runtimeData);
|
|
71
|
+
await fs.chmod(output, 0o755);
|
|
72
|
+
const updateInfo = await (0, differentialUpdateInfoBuilder_1.appendBlockmap)(output);
|
|
73
|
+
return updateInfo;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
await fs.remove(output).catch(() => { });
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
47
80
|
async function writeRuntimeData(filePath, runtimeData) {
|
|
48
81
|
const fd = await fs.open(filePath, "r+");
|
|
49
82
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appImageUtil.js","sourceRoot":"","sources":["../../../src/targets/appimage/appImageUtil.ts"],"names":[],"mappings":";;AAuCA,gEAyCC;AAiCD,gEAMC;AAqFD,oDA+JC;AA3WD,+CAAoG;AACpG,+BAA8B;AAC9B,6BAA4B;AAG5B,gDAAuD;AACvD,+CAAwD;AACxD,oFAAiE;AAEjE,qDAAqD;AA8B9C,KAAK,UAAU,0BAA0B,CAAC,mBAA8C,EAAE,IAA4B;IAC3H,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAExD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAEvB,0CAA0C;QAC1C,MAAM,+BAA+B,CAAC,IAAI,CAAC,CAAA;QAE3C,MAAM,EAA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AAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;;;2CAGtK,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,MAAM,CAAC,QAAQ;;;;;sDAKhE,MAAM,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;GAoBlE;QACC,CAAC,CAAC,EACN;CACC,CAAA;AACD,CAAC","sourcesContent":["import { Arch, copyDir, copyFile, exec, exists, InvalidConfigurationError, log } from \"builder-util\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport { FileAssociation } from \"../../options/FileAssociation\"\nimport { IconInfo } from \"../../platformPackager\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { copyIcons, copyMimeTypes } from \"./appLauncher\"\nimport { appendBlockmap } from \"../differentialUpdateInfoBuilder\"\nimport { BlockMapDataHolder } from \"builder-util-runtime\"\nimport { APP_RUN_ENTRYPOINT } from \"./AppImageTarget\"\nimport { ToolsetConfig } from \"app-builder-lib/src/configuration\"\n\ninterface Options {\n productName: string\n productFilename: string\n executableName: string\n desktopEntry: string\n icons: IconInfo[]\n license?: string | null\n fileAssociations: FileAssociation[]\n /**\n * The compression type available for static runtime is limited as it's only compiled with support for gzip and zstd.\n *\n * [stderr] Squashfs image uses lzo compression, this version supports only zlib, zstd.\n * Failed to open squashfs image\n * Failed to extract AppImage\n *\n */\n compression?: \"gzip\" | \"zstd\"\n}\n\nexport interface AppImageBuilderOptions {\n appDir: string\n stageDir: string\n arch: Arch\n output: string\n options: Options\n}\n\nexport async function buildStaticRuntimeAppImage(appimageToolVersion: ToolsetConfig[\"appimage\"], opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n // Write AppRun launcher and related files\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtimeLibraries: libraries, runtime, mksquashfs } = await getAppImageTools(appimageToolVersion, arch)\n await copyDir(libraries, path.join(stageDir, \"usr\", \"lib\"))\n\n // Copy app directory to stage\n // mksquashfs doesn't support merging, so we copy the entire app dir\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n // Create squashfs with offset for runtime\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n }\n await exec(mksquashfs, args, {\n cwd: stageDir,\n })\n\n // Write runtime data at the beginning of the file\n await writeRuntimeData(output, runtimeData)\n\n // Make executable\n await fs.chmod(output, 0o755)\n\n // Append blockmap inside try block to ensure cleanup on failure\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n // Clean up partial build on failure\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nasync function writeRuntimeData(filePath: string, runtimeData: Buffer): Promise<void> {\n const fd = await fs.open(filePath, \"r+\")\n try {\n await fs.write(fd, runtimeData, 0, runtimeData.length, 0)\n } finally {\n try {\n await fs.close(fd)\n } catch (closeError: any) {\n // Log but don't throw - preserve original error if any\n log.warn({ message: closeError.message, file: filePath }, `failed to close file descriptor`)\n }\n }\n}\n\n/**\n * Escapes a string for safe use in shell scripts by wrapping in single quotes\n * and escaping any single quotes within the string.\n *\n * This allows strings with spaces, special characters, etc. to be safely used.\n */\nfunction escapeShellString(str: string): string {\n // Escape single quotes by replacing ' with '\\''\n // Then wrap the whole string in single quotes\n return `'${str.replace(/'/g, \"'\\\\''\")}'`\n}\n\n/**\n * Validates that critical path fields (executable name, product filename, license filename)\n * contain only characters that are safe for use in filesystem paths and embedded bash strings.\n * Allowed: Unicode letters, digits, dots, underscores, hyphens, and spaces.\n */\nexport function validateCriticalPathString(str: string, fieldName: string): void {\n if (!/^[\\p{L}\\p{N}._\\- ]+$/u.test(str)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, and spaces.`\n )\n }\n}\n\nasync function writeAppLauncherAndRelatedFiles(opts: AppImageBuilderOptions): Promise<void> {\n const {\n stageDir,\n options: { license, executableName, productFilename, productName, desktopEntry },\n } = opts\n\n // executableName and productFilename are embedded directly into double-quoted bash strings\n // and used as filesystem paths, so they must pass the whitelist.\n // productName is not validated here because it is only ever passed through escapeShellString().\n validateCriticalPathString(executableName, \"executableName\")\n validateCriticalPathString(productFilename, \"productFilename\")\n\n // Write desktop file\n const desktopFileName = `${executableName}.desktop`\n await fs.writeFile(path.join(stageDir, desktopFileName), desktopEntry, { mode: 0o644 })\n await copyIcons(opts)\n\n const templateConfig: AppRunScriptBase = {\n DesktopFileName: desktopFileName,\n ExecutableName: executableName,\n ProductName: productName,\n ProductFilename: productFilename,\n ResourceName: `appimagekit-${executableName}`,\n }\n\n const mimeTypeFile = await copyMimeTypes(stageDir, opts.options)\n if (mimeTypeFile) {\n templateConfig.MimeTypeFile = mimeTypeFile\n }\n\n let finalConfig: AppRunScript = templateConfig\n\n // Copy license file if provided\n if (license) {\n // Validate license file exists\n if (!(await exists(license))) {\n throw new InvalidConfigurationError(`License file not found: ${license}`)\n }\n\n const licenseBaseName = path.basename(license)\n const ext = path.extname(license).toLowerCase()\n\n // Validate license filename for path safety\n validateCriticalPathString(licenseBaseName, \"licenseBaseName\")\n\n // Validate extension\n if (![\".txt\", \".html\"].includes(ext)) {\n log.warn({ license, expected: \".txt or .html\" }, `license file has unexpected extension`)\n }\n\n await copyFile(license, path.join(stageDir, licenseBaseName))\n\n finalConfig = {\n ...templateConfig,\n EulaFile: licenseBaseName,\n IsHtmlEula: ext === \".html\",\n }\n }\n\n const appRunContent = generateAppRunScript(finalConfig)\n await fs.writeFile(path.join(stageDir, APP_RUN_ENTRYPOINT), appRunContent, { mode: 0o755 })\n}\n\nexport type AppRunScriptBase = {\n ExecutableName: string\n DesktopFileName: string\n ProductFilename: string\n ProductName: string\n ResourceName: string\n MimeTypeFile?: string\n}\n\nexport type AppRunScriptWithEula = AppRunScriptBase & {\n EulaFile: string\n IsHtmlEula: boolean\n}\n\nexport type AppRunScript = AppRunScriptBase | AppRunScriptWithEula\n\nfunction hasEula(config: AppRunScript): config is AppRunScriptWithEula {\n return \"EulaFile\" in config && typeof config.EulaFile === \"string\"\n}\n\nexport function generateAppRunScript(config: AppRunScript): string {\n const eulaEnabled = hasEula(config)\n\n return `#!/usr/bin/env bash\nset -e\n\nTHIS=\"$0\"\n# http://stackoverflow.com/questions/3190818/\nargs=(\"$@\")\nNUMBER_OF_ARGS=\"$#\"\n\nif [ -z \"$APPDIR\" ] ; then\n # Find the AppDir. It is the directory that contains AppRun.\n # This assumes that this script resides inside the AppDir or a subdirectory.\n # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR\n path=\"$(dirname \"$(readlink -f \"\\${THIS}\")\")\"\n while [[ \"$path\" != \"\" && ! -e \"$path/${APP_RUN_ENTRYPOINT}\" ]]; do\n path=\\${path%/*}\n done\n APPDIR=\"$path\"\nfi\n\nif [ -z \"$APPDIR\" ] ; then\n echo \"ERROR: could not locate the AppDir. Ensure this script is run from within a properly structured AppImage.\" >&2\n exit 1\nfi\n\nexport PATH=\"\\${APPDIR}:\\${APPDIR}/usr/sbin\\${PATH:+:\\${PATH}}\"\nexport XDG_DATA_DIRS=\"\\${APPDIR}/usr/share/\\${XDG_DATA_DIRS:+:\\${XDG_DATA_DIRS}}:/usr/share/gnome:/usr/local/share/:/usr/share/\"\nexport LD_LIBRARY_PATH=\"\\${APPDIR}/usr/lib\\${LD_LIBRARY_PATH:+:\\${LD_LIBRARY_PATH}}\"\nexport GSETTINGS_SCHEMA_DIR=\"\\${APPDIR}/usr/share/glib-2.0/schemas\\${GSETTINGS_SCHEMA_DIR:+:\\${GSETTINGS_SCHEMA_DIR}}\"\n\nBIN=\"$APPDIR/${config.ExecutableName}\"\n\nif [ -z \"$APPIMAGE_EXIT_AFTER_INSTALL\" ] ; then\n trap atexit EXIT\nfi\n\nisEulaAccepted=1\n\nHAVE_NO_SANDBOX=0\nfor arg in \"\\${args[@]}\" ; do\n if [ \"$arg\" = --no-sandbox ] ; then\n HAVE_NO_SANDBOX=1\n break\n fi\ndone\nNO_SANDBOX=()\n# Use 'unshare -Ur true' as a heuristic to detect whether user namespaces are available.\n# Notes:\n# - When running as root, this check will always succeed even if the sandbox configuration\n# actually relies on unprivileged user namespaces. In practice, Chrome/Electron usually\n# disables or adjusts the sandbox separately when running as root, so this probe is mostly\n# a no-op in that scenario.\n# - On minimal systems (e.g. Alpine or stripped-down containers) 'unshare' may not exist.\n# In that case the shell will return exit code 127 (\"command not found\"), which will cause\n# us to add '--no-sandbox'. This is an intentional fail-safe: we prefer the app to start\n# without sandboxing rather than crash on startup.\nif [ $HAVE_NO_SANDBOX -eq 0 ] && ! unshare -Ur true 2>/dev/null ; then\n NO_SANDBOX=(--no-sandbox)\nfi\n\natexit()\n{\n if [ $isEulaAccepted == 1 ] ; then\n if [ $NUMBER_OF_ARGS -eq 0 ] ; then\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\"\n else\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\" \"\\${args[@]}\"\n fi\n fi\n}\n\nerror()\n{\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --error --text \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --msgbox \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --msgbox \"\\${1}\" 2>/dev/null\n else\n echo \"\\${1}\"\n fi\n exit 1\n}\n\nyesno()\n{\n TITLE=$1\n TEXT=$2\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --question --title=\"$TITLE\" --text=\"$TEXT\" 2>/dev/null || exit 0\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --title \"$TITLE\" --yesno \"$TEXT\" || exit 0\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --title \"$TITLE\" --clear --yesno \"$TEXT\" 10 80 || exit 0\n else\n echo \"zenity, kdialog, Xdialog missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\ncheck_dep()\n{\n DEP=$1\n if ! command -v \"$DEP\" &>/dev/null ; then\n echo \"$DEP is missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\nif [ -z \"$APPIMAGE\" ] ; then\n APPIMAGE=\"$APPDIR/${APP_RUN_ENTRYPOINT}\"\n # not running from within an AppImage; hence using the AppRun for Exec=\nfi\n\n${\n eulaEnabled\n ? `if [ -z \"$APPIMAGE_SILENT_INSTALL\" ] ; then\n EULA_MARK_DIR=\"\\${XDG_CONFIG_HOME:-$HOME/.config}/${config.ProductFilename}\"\n EULA_MARK_FILE=\"$EULA_MARK_DIR/eulaAccepted\"\n # show EULA only if desktop file doesn't exist\n if [ ! -e \"$EULA_MARK_FILE\" ] ; then\n if [ -x /usr/bin/zenity ] ; then\n # on cancel simply exits and our trap handler launches app, so, $isEulaAccepted is set here to 0 and then to 1 if EULA accepted\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" zenity --text-info --title=${escapeShellString(config.ProductName)} --filename=\"$APPDIR/${config.EulaFile}\" --ok-label=Agree --cancel-label=Disagree ${config.IsHtmlEula ? \"--html\" : \"\"}\n elif [ -x /usr/bin/Xdialog ] ; then\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" Xdialog --title ${escapeShellString(config.ProductName)} --textbox \"$APPDIR/${config.EulaFile}\" 30 80 --ok-label Agree --cancel-label Disagree\n elif [ -x /usr/bin/kdialog ] ; then\n # cannot find any option to force Agree/Disagree buttons for kdialog. And official example exactly with OK button https://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs#Example_21._--textbox_dialog_box\n # in any case we pass labels text\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" kdialog --textbox \"$APPDIR/${config.EulaFile}\" --yes-label Agree --cancel-label \"Disagree\"\n fi\n\n case $? in\n 0)\n isEulaAccepted=1\n echo \"License accepted\"\n mkdir -p \"$EULA_MARK_DIR\"\n touch \"$EULA_MARK_FILE\"\n ;;\n 1)\n echo \"License not accepted\"\n exit 0\n ;;\n -1)\n echo \"An unexpected error has occurred.\"\n isEulaAccepted=1\n ;;\n esac\n fi\nfi`\n : \"\"\n}\n`\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appImageUtil.js","sourceRoot":"","sources":["../../../src/targets/appimage/appImageUtil.ts"],"names":[],"mappings":";;AAwCA,gEAyCC;AAED,4DAqCC;AAiCD,gEAMC;AAqFD,oDA+JC;AAnZD,+CAAoG;AACpG,+BAA8B;AAC9B,6BAA4B;AAG5B,gDAAuD;AACvD,+CAAwD;AACxD,oFAAiE;AAEjE,qDAAqD;AA+B9C,KAAK,UAAU,0BAA0B,CAAC,mBAA8C,EAAE,IAA4B;IAC3H,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAExD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAEvB,0CAA0C;QAC1C,MAAM,+BAA+B,CAAC,IAAI,CAAC,CAAA;QAE3C,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,wBAAgB,EAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA;QAC9G,MAAM,IAAA,sBAAO,EAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;QAE3D,8BAA8B;QAC9B,oEAAoE;QACpE,MAAM,IAAA,sBAAO,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAE/B,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC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AAW;QACT,CAAC,CAAC;sDACgD,MAAM,CAAC,eAAe;;;;;;;sDAOtB,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,wBAAwB,MAAM,CAAC,QAAQ,8CAA8C,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;;;2CAGtK,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,MAAM,CAAC,QAAQ;;;;;sDAKhE,MAAM,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;GAoBlE;QACC,CAAC,CAAC,EACN;CACC,CAAA;AACD,CAAC","sourcesContent":["import { Arch, copyDir, copyFile, exec, exists, InvalidConfigurationError, log } from \"builder-util\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport { FileAssociation } from \"../../options/FileAssociation\"\nimport { IconInfo } from \"../../platformPackager\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { copyIcons, copyMimeTypes } from \"./appLauncher\"\nimport { appendBlockmap } from \"../differentialUpdateInfoBuilder\"\nimport { BlockMapDataHolder } from \"builder-util-runtime\"\nimport { APP_RUN_ENTRYPOINT } from \"./AppImageTarget\"\nimport { ToolsetConfig } from \"app-builder-lib/src/configuration\"\n\ninterface Options {\n productName: string\n productFilename: string\n executableName: string\n desktopEntry: string\n icons: IconInfo[]\n license?: string | null\n fileAssociations: FileAssociation[]\n /**\n * The compression type available for static runtime is limited as it's only compiled with support for gzip and zstd.\n * \"xz\" is only valid for the legacy FUSE2 (0.0.0) toolset.\n *\n * [stderr] Squashfs image uses lzo compression, this version supports only zlib, zstd.\n * Failed to open squashfs image\n * Failed to extract AppImage\n *\n */\n compression?: \"gzip\" | \"zstd\" | \"xz\"\n}\n\nexport interface AppImageBuilderOptions {\n appDir: string\n stageDir: string\n arch: Arch\n output: string\n options: Options\n}\n\nexport async function buildStaticRuntimeAppImage(appimageToolVersion: ToolsetConfig[\"appimage\"], opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n // Write AppRun launcher and related files\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtimeLibraries: libraries, runtime, mksquashfs } = await getAppImageTools(appimageToolVersion, arch)\n await copyDir(libraries, path.join(stageDir, \"usr\", \"lib\"))\n\n // Copy app directory to stage\n // mksquashfs doesn't support merging, so we copy the entire app dir\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n // Create squashfs with offset for runtime\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n }\n await exec(mksquashfs, args, {\n cwd: stageDir,\n })\n\n // Write runtime data at the beginning of the file\n await writeRuntimeData(output, runtimeData)\n\n // Make executable\n await fs.chmod(output, 0o755)\n\n // Append blockmap inside try block to ensure cleanup on failure\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n // Clean up partial build on failure\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nexport async function buildLegacyFuse2AppImage(opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtime, mksquashfs, runtimeLibraries } = await getAppImageTools(\"0.0.0\", arch)\n // Mirror the app-builder-lib Go implementation: bundle lib/<arch> into usr/lib for x64 and ia32.\n // arm targets don't have a dedicated lib dir in the FUSE2 toolset.\n if (arch === Arch.x64 || arch === Arch.ia32) {\n await copyDir(runtimeLibraries, path.join(stageDir, \"usr\", \"lib\"))\n }\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n if (options.compression === \"xz\") {\n // Match the dictionary/block-size settings used by the original app-builder Go implementation\n args.push(\"-Xdict-size\", \"100%\", \"-b\", \"1048576\")\n }\n }\n await exec(mksquashfs, args, { cwd: stageDir })\n\n await writeRuntimeData(output, runtimeData)\n await fs.chmod(output, 0o755)\n\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nasync function writeRuntimeData(filePath: string, runtimeData: Buffer): Promise<void> {\n const fd = await fs.open(filePath, \"r+\")\n try {\n await fs.write(fd, runtimeData, 0, runtimeData.length, 0)\n } finally {\n try {\n await fs.close(fd)\n } catch (closeError: any) {\n // Log but don't throw - preserve original error if any\n log.warn({ message: closeError.message, file: filePath }, `failed to close file descriptor`)\n }\n }\n}\n\n/**\n * Escapes a string for safe use in shell scripts by wrapping in single quotes\n * and escaping any single quotes within the string.\n *\n * This allows strings with spaces, special characters, etc. to be safely used.\n */\nfunction escapeShellString(str: string): string {\n // Escape single quotes by replacing ' with '\\''\n // Then wrap the whole string in single quotes\n return `'${str.replace(/'/g, \"'\\\\''\")}'`\n}\n\n/**\n * Validates that critical path fields (executable name, product filename, license filename)\n * contain only characters that are safe for use in filesystem paths and embedded bash strings.\n * Allowed: Unicode letters, digits, dots, underscores, hyphens, and spaces.\n */\nexport function validateCriticalPathString(str: string, fieldName: string): void {\n if (!/^[\\p{L}\\p{N}._\\- ]+$/u.test(str)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, and spaces.`\n )\n }\n}\n\nasync function writeAppLauncherAndRelatedFiles(opts: AppImageBuilderOptions): Promise<void> {\n const {\n stageDir,\n options: { license, executableName, productFilename, productName, desktopEntry },\n } = opts\n\n // executableName and productFilename are embedded directly into double-quoted bash strings\n // and used as filesystem paths, so they must pass the whitelist.\n // productName is not validated here because it is only ever passed through escapeShellString().\n validateCriticalPathString(executableName, \"executableName\")\n validateCriticalPathString(productFilename, \"productFilename\")\n\n // Write desktop file\n const desktopFileName = `${executableName}.desktop`\n await fs.writeFile(path.join(stageDir, desktopFileName), desktopEntry, { mode: 0o644 })\n await copyIcons(opts)\n\n const templateConfig: AppRunScriptBase = {\n DesktopFileName: desktopFileName,\n ExecutableName: executableName,\n ProductName: productName,\n ProductFilename: productFilename,\n ResourceName: `appimagekit-${executableName}`,\n }\n\n const mimeTypeFile = await copyMimeTypes(stageDir, opts.options)\n if (mimeTypeFile) {\n templateConfig.MimeTypeFile = mimeTypeFile\n }\n\n let finalConfig: AppRunScript = templateConfig\n\n // Copy license file if provided\n if (license) {\n // Validate license file exists\n if (!(await exists(license))) {\n throw new InvalidConfigurationError(`License file not found: ${license}`)\n }\n\n const licenseBaseName = path.basename(license)\n const ext = path.extname(license).toLowerCase()\n\n // Validate license filename for path safety\n validateCriticalPathString(licenseBaseName, \"licenseBaseName\")\n\n // Validate extension\n if (![\".txt\", \".html\"].includes(ext)) {\n log.warn({ license, expected: \".txt or .html\" }, `license file has unexpected extension`)\n }\n\n await copyFile(license, path.join(stageDir, licenseBaseName))\n\n finalConfig = {\n ...templateConfig,\n EulaFile: licenseBaseName,\n IsHtmlEula: ext === \".html\",\n }\n }\n\n const appRunContent = generateAppRunScript(finalConfig)\n await fs.writeFile(path.join(stageDir, APP_RUN_ENTRYPOINT), appRunContent, { mode: 0o755 })\n}\n\nexport type AppRunScriptBase = {\n ExecutableName: string\n DesktopFileName: string\n ProductFilename: string\n ProductName: string\n ResourceName: string\n MimeTypeFile?: string\n}\n\nexport type AppRunScriptWithEula = AppRunScriptBase & {\n EulaFile: string\n IsHtmlEula: boolean\n}\n\nexport type AppRunScript = AppRunScriptBase | AppRunScriptWithEula\n\nfunction hasEula(config: AppRunScript): config is AppRunScriptWithEula {\n return \"EulaFile\" in config && typeof config.EulaFile === \"string\"\n}\n\nexport function generateAppRunScript(config: AppRunScript): string {\n const eulaEnabled = hasEula(config)\n\n return `#!/usr/bin/env bash\nset -e\n\nTHIS=\"$0\"\n# http://stackoverflow.com/questions/3190818/\nargs=(\"$@\")\nNUMBER_OF_ARGS=\"$#\"\n\nif [ -z \"$APPDIR\" ] ; then\n # Find the AppDir. It is the directory that contains AppRun.\n # This assumes that this script resides inside the AppDir or a subdirectory.\n # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR\n path=\"$(dirname \"$(readlink -f \"\\${THIS}\")\")\"\n while [[ \"$path\" != \"\" && ! -e \"$path/${APP_RUN_ENTRYPOINT}\" ]]; do\n path=\\${path%/*}\n done\n APPDIR=\"$path\"\nfi\n\nif [ -z \"$APPDIR\" ] ; then\n echo \"ERROR: could not locate the AppDir. Ensure this script is run from within a properly structured AppImage.\" >&2\n exit 1\nfi\n\nexport PATH=\"\\${APPDIR}:\\${APPDIR}/usr/sbin\\${PATH:+:\\${PATH}}\"\nexport XDG_DATA_DIRS=\"\\${APPDIR}/usr/share/\\${XDG_DATA_DIRS:+:\\${XDG_DATA_DIRS}}:/usr/share/gnome:/usr/local/share/:/usr/share/\"\nexport LD_LIBRARY_PATH=\"\\${APPDIR}/usr/lib\\${LD_LIBRARY_PATH:+:\\${LD_LIBRARY_PATH}}\"\nexport GSETTINGS_SCHEMA_DIR=\"\\${APPDIR}/usr/share/glib-2.0/schemas\\${GSETTINGS_SCHEMA_DIR:+:\\${GSETTINGS_SCHEMA_DIR}}\"\n\nBIN=\"$APPDIR/${config.ExecutableName}\"\n\nif [ -z \"$APPIMAGE_EXIT_AFTER_INSTALL\" ] ; then\n trap atexit EXIT\nfi\n\nisEulaAccepted=1\n\nHAVE_NO_SANDBOX=0\nfor arg in \"\\${args[@]}\" ; do\n if [ \"$arg\" = --no-sandbox ] ; then\n HAVE_NO_SANDBOX=1\n break\n fi\ndone\nNO_SANDBOX=()\n# Use 'unshare -Ur true' as a heuristic to detect whether user namespaces are available.\n# Notes:\n# - When running as root, this check will always succeed even if the sandbox configuration\n# actually relies on unprivileged user namespaces. In practice, Chrome/Electron usually\n# disables or adjusts the sandbox separately when running as root, so this probe is mostly\n# a no-op in that scenario.\n# - On minimal systems (e.g. Alpine or stripped-down containers) 'unshare' may not exist.\n# In that case the shell will return exit code 127 (\"command not found\"), which will cause\n# us to add '--no-sandbox'. This is an intentional fail-safe: we prefer the app to start\n# without sandboxing rather than crash on startup.\nif [ $HAVE_NO_SANDBOX -eq 0 ] && ! unshare -Ur true 2>/dev/null ; then\n NO_SANDBOX=(--no-sandbox)\nfi\n\natexit()\n{\n if [ $isEulaAccepted == 1 ] ; then\n if [ $NUMBER_OF_ARGS -eq 0 ] ; then\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\"\n else\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\" \"\\${args[@]}\"\n fi\n fi\n}\n\nerror()\n{\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --error --text \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --msgbox \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --msgbox \"\\${1}\" 2>/dev/null\n else\n echo \"\\${1}\"\n fi\n exit 1\n}\n\nyesno()\n{\n TITLE=$1\n TEXT=$2\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --question --title=\"$TITLE\" --text=\"$TEXT\" 2>/dev/null || exit 0\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --title \"$TITLE\" --yesno \"$TEXT\" || exit 0\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --title \"$TITLE\" --clear --yesno \"$TEXT\" 10 80 || exit 0\n else\n echo \"zenity, kdialog, Xdialog missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\ncheck_dep()\n{\n DEP=$1\n if ! command -v \"$DEP\" &>/dev/null ; then\n echo \"$DEP is missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\nif [ -z \"$APPIMAGE\" ] ; then\n APPIMAGE=\"$APPDIR/${APP_RUN_ENTRYPOINT}\"\n # not running from within an AppImage; hence using the AppRun for Exec=\nfi\n\n${\n eulaEnabled\n ? `if [ -z \"$APPIMAGE_SILENT_INSTALL\" ] ; then\n EULA_MARK_DIR=\"\\${XDG_CONFIG_HOME:-$HOME/.config}/${config.ProductFilename}\"\n EULA_MARK_FILE=\"$EULA_MARK_DIR/eulaAccepted\"\n # show EULA only if desktop file doesn't exist\n if [ ! -e \"$EULA_MARK_FILE\" ] ; then\n if [ -x /usr/bin/zenity ] ; then\n # on cancel simply exits and our trap handler launches app, so, $isEulaAccepted is set here to 0 and then to 1 if EULA accepted\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" zenity --text-info --title=${escapeShellString(config.ProductName)} --filename=\"$APPDIR/${config.EulaFile}\" --ok-label=Agree --cancel-label=Disagree ${config.IsHtmlEula ? \"--html\" : \"\"}\n elif [ -x /usr/bin/Xdialog ] ; then\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" Xdialog --title ${escapeShellString(config.ProductName)} --textbox \"$APPDIR/${config.EulaFile}\" 30 80 --ok-label Agree --cancel-label Disagree\n elif [ -x /usr/bin/kdialog ] ; then\n # cannot find any option to force Agree/Disagree buttons for kdialog. And official example exactly with OK button https://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs#Example_21._--textbox_dialog_box\n # in any case we pass labels text\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" kdialog --textbox \"$APPDIR/${config.EulaFile}\" --yes-label Agree --cancel-label \"Disagree\"\n fi\n\n case $? in\n 0)\n isEulaAccepted=1\n echo \"License accepted\"\n mkdir -p \"$EULA_MARK_DIR\"\n touch \"$EULA_MARK_FILE\"\n ;;\n 1)\n echo \"License not accepted\"\n exit 0\n ;;\n -1)\n echo \"An unexpected error has occurred.\"\n isEulaAccepted=1\n ;;\n esac\n fi\nfi`\n : \"\"\n}\n`\n}\n"]}
|
|
@@ -44,7 +44,7 @@ class NsisTarget extends core_1.Target {
|
|
|
44
44
|
...this.packager.config.nsis,
|
|
45
45
|
};
|
|
46
46
|
if (targetName !== "nsis") {
|
|
47
|
-
|
|
47
|
+
(0, builder_util_runtime_1.deepAssign)(this.options, this.packager.config[targetName === "nsis-web" ? "nsisWeb" : targetName]);
|
|
48
48
|
}
|
|
49
49
|
const deps = packager.info.metadata.dependencies;
|
|
50
50
|
if (deps != null && deps["electron-squirrel-startup"] != null) {
|
|
@@ -252,7 +252,7 @@ class NsisTarget extends core_1.Target {
|
|
|
252
252
|
defines.REQUEST_EXECUTION_LEVEL = requestExecutionLevel || "user";
|
|
253
253
|
// https://github.com/electron-userland/electron-builder/issues/5764
|
|
254
254
|
if (typeof unpackDirName === "string" || !unpackDirName) {
|
|
255
|
-
defines.UNPACK_DIR_NAME = unpackDirName || (
|
|
255
|
+
defines.UNPACK_DIR_NAME = unpackDirName || (0, builder_util_1.generateKsuid)();
|
|
256
256
|
}
|
|
257
257
|
if (splashImage != null) {
|
|
258
258
|
defines.SPLASH_IMAGE = path.resolve(packager.projectDir, splashImage);
|
|
@@ -515,7 +515,17 @@ class NsisTarget extends core_1.Target {
|
|
|
515
515
|
args.push(`-D${name}`);
|
|
516
516
|
}
|
|
517
517
|
else {
|
|
518
|
-
|
|
518
|
+
// nsisEscapeString prevents three classes of injection:
|
|
519
|
+
// 1. Newlines → replaced with spaces; a bare \n in a define value
|
|
520
|
+
// would terminate the current script line and let whatever follows
|
|
521
|
+
// be parsed as a new preprocessor directive (e.g. !system, !include).
|
|
522
|
+
// 2. bare $ → escaped to $$; unescaped $ in a define value would cause
|
|
523
|
+
// NSIS to expand an unintended variable reference. ${...} references
|
|
524
|
+
// are left intact so NSIS compile-time defines like ${NSISDIR} still
|
|
525
|
+
// expand correctly.
|
|
526
|
+
// 3. " chars → escaped to $\"; an unescaped " would break out of
|
|
527
|
+
// double-quoted NSIS string literals where ${DEFINE} is expanded.
|
|
528
|
+
args.push(`-D${name}=${(0, nsisScriptGenerator_1.nsisEscapeString)(String(value))}`);
|
|
519
529
|
}
|
|
520
530
|
}
|
|
521
531
|
for (const name of Object.keys(commands)) {
|
|
@@ -614,7 +624,7 @@ class NsisTarget extends core_1.Target {
|
|
|
614
624
|
const customIcon = await packager.getResource((0, builder_util_1.getPlatformIconFileName)(item.icon, false), `${extensions[0]}.ico`);
|
|
615
625
|
let installedIconPath = "$appExe,0";
|
|
616
626
|
if (customIcon != null) {
|
|
617
|
-
installedIconPath = `$INSTDIR\\resources\\${path.basename(customIcon)}`;
|
|
627
|
+
installedIconPath = `$INSTDIR\\resources\\${(0, nsisScriptGenerator_1.nsisEscapeString)(path.basename(customIcon))}`;
|
|
618
628
|
registerFileAssociationsScript.file(installedIconPath, customIcon);
|
|
619
629
|
}
|
|
620
630
|
const icon = `"${installedIconPath}"`;
|
|
@@ -657,7 +667,7 @@ async function generateForPreCompressed(preCompressedFileExtensions, dir, arch,
|
|
|
657
667
|
if (preCompressedAssets.length !== 0) {
|
|
658
668
|
const macro = new nsisScriptGenerator_1.NsisScriptGenerator();
|
|
659
669
|
for (const file of preCompressedAssets) {
|
|
660
|
-
macro.file(`$INSTDIR\\${path.relative(dir, file).replace(/\//g, "\\")}`, file);
|
|
670
|
+
macro.file(`$INSTDIR\\${(0, nsisScriptGenerator_1.nsisEscapeString)(path.relative(dir, file).replace(/\//g, "\\"))}`, file);
|
|
661
671
|
}
|
|
662
672
|
scriptGenerator.macro(`customFiles_${builder_util_1.Arch[arch]}`, macro);
|
|
663
673
|
}
|