diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts index 392940e8534..ce67ccbb7eb 100644 --- a/scripts/build-desktop-artifact.test.ts +++ b/scripts/build-desktop-artifact.test.ts @@ -34,7 +34,6 @@ import { resolveDesktopProductName, resolveDesktopUpdateChannel, resolveDesktopWebAssetBrand, - renderLinuxHeadlessLauncher, resolveLinuxTargets, resolveResourceMonitorRustTargets, resourceMonitorExecutableName, @@ -570,7 +569,6 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { false, undefined, undefined, - "/tmp/t3", ); const appImageOnly = yield* createBuildConfig( "linux", @@ -587,10 +585,9 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { "deb", "rpm", ]); - // Both fpm-backed formats are configured from the one run, each with its - // own dependency list and the headless launcher. - assert.deepStrictEqual((all.deb as Record).fpm, ["/tmp/t3=/usr/bin/t3"]); - assert.deepStrictEqual((all.rpm as Record).fpm, ["/tmp/t3=/usr/bin/t3"]); + // Both fpm-backed formats are configured from the one run. + assert.property(all, "deb"); + assert.property(all, "rpm"); // An AppImage-only build stays free of package-format sections. assert.notProperty(appImageOnly, "deb"); @@ -608,7 +605,6 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { false, undefined, undefined, - "/tmp/t3", ); const linux = config.linux as Record; @@ -633,11 +629,10 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { "libsecret-1-0", "libasound2t64 | libasound2", ]); - assert.deepStrictEqual(deb.fpm, ["/tmp/t3=/usr/bin/t3"]); }).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))), ); - it.effect("includes runtime dependencies and the headless launcher in RPM packages", () => + it.effect("includes runtime dependencies in RPM packages", () => Effect.gen(function* () { const config = yield* createBuildConfig( "linux", @@ -647,7 +642,6 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { false, undefined, undefined, - "/tmp/t3", ); const rpm = config.rpm as Record; @@ -664,24 +658,9 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { "libsecret", "mesa-libgbm", ]); - assert.deepStrictEqual(rpm.fpm, ["/tmp/t3=/usr/bin/t3"]); }).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))), ); - it("renders a headless launcher for production and nightly packages", () => { - assert.equal( - renderLinuxHeadlessLauncher("1.2.3"), - [ - "#!/bin/sh", - "set -eu", - "export ELECTRON_RUN_AS_NODE=1", - `exec '/opt/T3 Code (Alpha)/t3code' '/opt/T3 Code (Alpha)/resources/app.asar.unpacked/apps/server/dist/bin.mjs' "$@"`, - "", - ].join("\n"), - ); - assert.match(renderLinuxHeadlessLauncher("1.2.3-nightly.20260720.1"), /T3 Code \(Nightly\)/); - }); - it("stages the resource monitor as an external executable resource", () => { assert.deepStrictEqual(DESKTOP_EXTRA_RESOURCES, [ { diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index f00d5fbc468..848ccdab849 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -1551,10 +1551,6 @@ export function resolveDesktopProductName(version: string): string { : (desktopPackageJson.productName ?? "T3 Code"); } -function quotePosixShellArgument(value: string): string { - return `'${value.replaceAll("'", `'\\''`)}'`; -} - /** * Splits a comma-separated Linux target string, for example "AppImage,deb,rpm", * so one electron-builder run emits every package from the same staged app. @@ -1572,20 +1568,6 @@ export function resolveLinuxTargets(target: string): ReadonlyArray { .filter((entry) => entry.length > 0); } -export function renderLinuxHeadlessLauncher(version: string): string { - const installDir = `/opt/${resolveDesktopProductName(version)}`; - const desktopExecutable = `${installDir}/t3code`; - const serverEntry = `${installDir}/resources/app.asar.unpacked/apps/server/dist/bin.mjs`; - - return [ - "#!/bin/sh", - "set -eu", - "export ELECTRON_RUN_AS_NODE=1", - `exec ${quotePosixShellArgument(desktopExecutable)} ${quotePosixShellArgument(serverEntry)} "$@"`, - "", - ].join("\n"); -} - export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( platform: typeof BuildPlatform.Type, target: string, @@ -1599,7 +1581,6 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( readonly provisioningProfilePath: string; } | undefined, - linuxHeadlessLauncherPath?: string, ) { const buildConfig: Record = { appId: DESKTOP_APP_ID, @@ -1679,14 +1660,12 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( if (linuxTargets.includes("deb")) { buildConfig.deb = { depends: [...DEB_DEPENDENCIES], - ...(linuxHeadlessLauncherPath ? { fpm: [`${linuxHeadlessLauncherPath}=/usr/bin/t3`] } : {}), }; } if (linuxTargets.includes("rpm")) { buildConfig.rpm = { depends: [...RPM_DEPENDENCIES], - ...(linuxHeadlessLauncherPath ? { fpm: [`${linuxHeadlessLauncherPath}=/usr/bin/t3`] } : {}), }; } } @@ -1972,17 +1951,6 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( yield* fs.writeFileString(macEntitlementsPath, renderMacPasskeyEntitlements(macPasskeySigning)); } - const linuxPackageTargets = resolveLinuxTargets(options.target); - const linuxHeadlessLauncherPath = - options.platform === "linux" && - (linuxPackageTargets.includes("deb") || linuxPackageTargets.includes("rpm")) - ? path.join(stageRoot, "t3") - : undefined; - if (linuxHeadlessLauncherPath) { - yield* fs.writeFileString(linuxHeadlessLauncherPath, renderLinuxHeadlessLauncher(appVersion)); - yield* fs.chmod(linuxHeadlessLauncherPath, 0o755); - } - const stageDependencies = { ...resolvedServerDependencies, ...resolvedDesktopRuntimeDependencies, @@ -2033,7 +2001,6 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( provisioningProfilePath: macPasskeySigning.provisioningProfilePath, } : undefined, - linuxHeadlessLauncherPath, ), dependencies: stageDependencies, devDependencies: {