@songsid/agend 2.2.0-beta.15 → 2.2.0-beta.16

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/dist/cli.js CHANGED
@@ -1966,6 +1966,25 @@ program
1966
1966
  console.log(` ${outcome.message}`);
1967
1967
  return;
1968
1968
  }
1969
+ // #1884: a legacy system unit is the service a root fleet runs under; the refresh brings its ExecStart to this
1970
+ // install's selection too, or `agend restart` refuses it after an update (see refreshSystemUnitExecStart).
1971
+ const systemUnit = opts.activate === false && detectPlatform() !== "macos" ? getSystemServicePath() : null;
1972
+ if (systemUnit) {
1973
+ const { refreshSystemUnitExecStart } = await import("./service-installer.js");
1974
+ try {
1975
+ const refreshed = refreshSystemUnitExecStart(systemUnit, serviceVars, dirname(dirname(execPath)));
1976
+ if (refreshed.kind === "updated")
1977
+ console.log(` ✓ ${systemUnit}: ExecStart=${refreshed.execStart}`);
1978
+ else if (refreshed.kind === "foreign")
1979
+ console.log(` ℹ ${systemUnit} left as it is: ${refreshed.reason}.`);
1980
+ else if (refreshed.kind === "unreadable")
1981
+ console.log(` ⚠ ${systemUnit} could not be read; left as it is.`);
1982
+ }
1983
+ catch (err) {
1984
+ console.error(` ✗ ${systemUnit} could not be updated (${err.message}); \`agend restart\` will refuse until its ExecStart starts this install. Run the update as root, or: sudo agend install --no-activate`);
1985
+ process.exitCode = 1;
1986
+ }
1987
+ }
1969
1988
  const svcPath = installService(serviceVars);
1970
1989
  console.log(t("install.path", svcPath));
1971
1990
  if (opts.activate !== false) {