refactor: rename bundle identifiers to com.clawdis
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
export const GATEWAY_LAUNCH_AGENT_LABEL = "com.steipete.clawdis.gateway";
|
||||
export const GATEWAY_LAUNCH_AGENT_LABEL = "com.clawdis.gateway";
|
||||
export const GATEWAY_SYSTEMD_SERVICE_NAME = "clawdis-gateway";
|
||||
export const GATEWAY_WINDOWS_TASK_NAME = "Clawdis Gateway";
|
||||
|
||||
@@ -6,6 +6,7 @@ import { promisify } from "node:util";
|
||||
import { GATEWAY_LAUNCH_AGENT_LABEL } from "./constants.js";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const LEGACY_GATEWAY_LAUNCH_AGENT_LABEL = "com.steipete.clawdis.gateway";
|
||||
|
||||
function resolveHomeDir(env: Record<string, string | undefined>): string {
|
||||
const home = env.HOME?.trim() || env.USERPROFILE?.trim();
|
||||
@@ -25,6 +26,18 @@ export function resolveLaunchAgentPlistPath(
|
||||
);
|
||||
}
|
||||
|
||||
function resolveLegacyLaunchAgentPlistPath(
|
||||
env: Record<string, string | undefined>,
|
||||
): string {
|
||||
const home = resolveHomeDir(env);
|
||||
return path.join(
|
||||
home,
|
||||
"Library",
|
||||
"LaunchAgents",
|
||||
`${LEGACY_GATEWAY_LAUNCH_AGENT_LABEL}.plist`,
|
||||
);
|
||||
}
|
||||
|
||||
export function resolveGatewayLogPaths(
|
||||
env: Record<string, string | undefined>,
|
||||
): {
|
||||
@@ -246,6 +259,16 @@ export async function installLaunchAgent({
|
||||
const { logDir, stdoutPath, stderrPath } = resolveGatewayLogPaths(env);
|
||||
await fs.mkdir(logDir, { recursive: true });
|
||||
|
||||
const legacyPlistPath = resolveLegacyLaunchAgentPlistPath(env);
|
||||
const domain = resolveGuiDomain();
|
||||
await execLaunchctl(["bootout", domain, legacyPlistPath]);
|
||||
await execLaunchctl(["unload", legacyPlistPath]);
|
||||
try {
|
||||
await fs.unlink(legacyPlistPath);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
const plistPath = resolveLaunchAgentPlistPath(env);
|
||||
await fs.mkdir(path.dirname(plistPath), { recursive: true });
|
||||
|
||||
@@ -258,7 +281,6 @@ export async function installLaunchAgent({
|
||||
});
|
||||
await fs.writeFile(plistPath, plist, "utf8");
|
||||
|
||||
const domain = resolveGuiDomain();
|
||||
await execLaunchctl(["bootout", domain, plistPath]);
|
||||
await execLaunchctl(["unload", plistPath]);
|
||||
const boot = await execLaunchctl(["bootstrap", domain, plistPath]);
|
||||
|
||||
Reference in New Issue
Block a user