systemd-ts 261.2.1 → 262.0.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/dist/{index-gV6lNweL.d.mts → index-4VL-jAGf.d.mts} +31 -22
- package/dist/index-4VL-jAGf.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{main-DqJ5f7Al.mjs → main-BlzhT1eg.mjs} +5 -1
- package/dist/main-BlzhT1eg.mjs.map +1 -0
- package/dist/test.d.mts +15 -15
- package/dist/test.d.mts.map +1 -1
- package/dist/test.mjs +5 -5
- package/dist/test.mjs.map +1 -1
- package/package.json +5 -5
- package/src/main/notify.ts +4 -0
- package/src/main/types.ts +26 -21
- package/dist/index-gV6lNweL.d.mts.map +0 -1
- package/dist/main-DqJ5f7Al.mjs.map +0 -1
|
@@ -213,10 +213,11 @@ interface CustomDirectiveSection {
|
|
|
213
213
|
/**
|
|
214
214
|
* Generic unit-level directives shared by service and timer units.
|
|
215
215
|
*
|
|
216
|
-
* References in this file are grounded in cached upstream systemd
|
|
216
|
+
* References in this file are grounded in cached upstream systemd manpages,
|
|
217
|
+
* reviewed through v262. Individual directives identify their documentation source.
|
|
217
218
|
*
|
|
218
219
|
* Sources:
|
|
219
|
-
* - systemd
|
|
220
|
+
* - systemd v262, `systemd.unit(5)`
|
|
220
221
|
*/
|
|
221
222
|
interface SystemdUnitSection extends CustomDirectiveSection {
|
|
222
223
|
/** Units that should be ordered before this unit starts. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
@@ -227,7 +228,7 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
227
228
|
readonly AssertACPower?: boolean | readonly boolean[];
|
|
228
229
|
/** Assertion form of `ConditionArchitecture=`. Check whether the system is running on a specific architecture. Takes one of x86, x86-64, ppc, ppc-le, ppc64, ppc64-le, ia64, parisc, parisc64, s390, s390x, sparc, sparc64, mips, mips-le, mips64, mips64-le, alpha, arm, arm-be, arm64, arm64-be, sh, sh64, m68k, tilegx, cris, arc, arc-be, or native. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
229
230
|
readonly AssertArchitecture?: string | readonly string[];
|
|
230
|
-
/** Assertion form of `ConditionCPUFeature=`.
|
|
231
|
+
/** Assertion form of `ConditionCPUFeature=`. Checks CPU features via CPUID on i386 and x86-64, or ELF hardware capabilities on arm64. Accepts architecture-qualified names such as `arm64.bti`; a mismatched architecture prefix evaluates to false. On other architectures, features are assumed unsupported. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v262, `systemd.unit(5)`. */
|
|
231
232
|
readonly AssertCPUFeature?: string | readonly string[];
|
|
232
233
|
/** Assertion form of `ConditionCPUPressure=`. Verify that the overall system (memory, CPU or IO) pressure is below or equal to a threshold. This setting takes a threshold value as argument. It can be specified as a simple percentage value, suffixed with %, in which case the pressure will be measured as an average over the last five minutes before the attempt to start the unit is performed. Alternatively, the average timespan can also be specified using / as a separator, for example: 10%/1min. The supported timespans match what the kernel provides, and are limited to 10sec, 1min and 5min. The full PSI will be checked first, and if not found some will be checked. For more details, see the documentation on PSI (Pressure Stall Information) . Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
233
234
|
readonly AssertCPUPressure?: string | readonly string[];
|
|
@@ -263,7 +264,7 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
263
264
|
readonly AssertKernelModuleLoaded?: string | readonly string[];
|
|
264
265
|
/** Assertion form of `ConditionKernelVersion=`. May be used to check whether the kernel version (as reported by uname -r) matches a certain expression, or if prefixed with the exclamation mark, does not match. The argument must be a list of (potentially quoted) expressions. Each expression starts with one of = or != for string comparisons, <, <=, ==, <>, >=, > for version comparisons, or $=, !$= for a shell-style glob match. If no operator is specified, $= is implied. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
265
266
|
readonly AssertKernelVersion?: string | readonly string[];
|
|
266
|
-
/** Assertion form of `ConditionMachineTag=`. Matches machine tags
|
|
267
|
+
/** Assertion form of `ConditionMachineTag=`. Matches machine tags using shell-style patterns, optionally negated with `!`. Parameterized tags include their value in the match: `role=web` matches exactly, `role=*` matches any value for that key, and `role` does not match `role=web`. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v262, `systemd.unit(5)`. */
|
|
267
268
|
readonly AssertMachineTag?: string | readonly string[];
|
|
268
269
|
/** Assertion form of `ConditionMemory=`. Verify that the specified amount of system memory is available to the current system. Takes a memory size in bytes as argument, optionally prefixed with a comparison operator <, <=, = (or ==), != (or <>), >=, >. On bare-metal systems compares the amount of physical memory in the system with the specified size, adhering to the specified comparison operator. In containers compares the amount of memory assigned to the container instead. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
269
270
|
readonly AssertMemory?: number | string | readonly (number | string)[];
|
|
@@ -273,7 +274,7 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
273
274
|
readonly AssertNeedsUpdate?: string | readonly string[];
|
|
274
275
|
/** Assertion form of `ConditionOSRelease=`. Verify that a specific key=value pair is set in the host's os-release5. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
275
276
|
readonly AssertOSRelease?: string | readonly string[];
|
|
276
|
-
/** Assertion form of `ConditionPathExists=`.
|
|
277
|
+
/** Assertion form of `ConditionPathExists=`. Checks for any file system object at an absolute path, including directories, device nodes, FIFOs, and sockets. Symbolic links are followed, so broken symbolic links do not count as existing. Prefix the path with `!` to require its absence. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v262, `systemd.unit(5)`. */
|
|
277
278
|
readonly AssertPathExists?: string | readonly string[];
|
|
278
279
|
/** Assertion form of `ConditionPathExistsGlob=`. Similar to `ConditionPathExists=`, but checks for the existence of at least one file or directory matching the specified globbing pattern. Unlike conditions, a mismatch fails the start job instead of skipping it. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
279
280
|
readonly AssertPathExistsGlob?: string | readonly string[];
|
|
@@ -307,7 +308,7 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
307
308
|
readonly ConditionACPower?: boolean | readonly boolean[];
|
|
308
309
|
/** Check whether the system is running on a specific architecture. Takes one of x86, x86-64, ppc, ppc-le, ppc64, ppc64-le, ia64, parisc, parisc64, s390, s390x, sparc, sparc64, mips, mips-le, mips64, mips64-le, alpha, arm, arm-be, arm64, arm64-be, sh, sh64, m68k, tilegx, cris, arc, arc-be, or native. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
309
310
|
readonly ConditionArchitecture?: string | readonly string[];
|
|
310
|
-
/**
|
|
311
|
+
/** Checks CPU features via CPUID on i386 and x86-64, or ELF hardware capabilities on arm64. Accepts architecture-qualified names such as `arm64.bti`; a mismatched architecture prefix evaluates to false. On other architectures, features are assumed unsupported. Source: systemd v262, `systemd.unit(5)`. */
|
|
311
312
|
readonly ConditionCPUFeature?: string | readonly string[];
|
|
312
313
|
/** Verify that the overall system (memory, CPU or IO) pressure is below or equal to a threshold. This setting takes a threshold value as argument. It can be specified as a simple percentage value, suffixed with %, in which case the pressure will be measured as an average over the last five minutes before the attempt to start the unit is performed. Alternatively, the average timespan can also be specified using / as a separator, for example: 10%/1min. The supported timespans match what the kernel provides, and are limited to 10sec, 1min and 5min. The full PSI will be checked first, and if not found some will be checked. For more details, see the documentation on PSI (Pressure Stall Information) . Source: systemd v260.1, `systemd.unit(5)`. */
|
|
313
314
|
readonly ConditionCPUPressure?: string | readonly string[];
|
|
@@ -345,7 +346,7 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
345
346
|
readonly ConditionKernelModuleLoaded?: string | readonly string[];
|
|
346
347
|
/** May be used to check whether the kernel version (as reported by uname -r) matches a certain expression, or if prefixed with the exclamation mark, does not match. The argument must be a list of (potentially quoted) expressions. Each expression starts with one of = or != for string comparisons, <, <=, ==, <>, >=, > for version comparisons, or $=, !$= for a shell-style glob match. If no operator is specified, $= is implied. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
347
348
|
readonly ConditionKernelVersion?: string | readonly string[];
|
|
348
|
-
/** Matches machine tags
|
|
349
|
+
/** Matches machine tags from `machine-info(5)` using shell-style patterns, optionally negated with `!`. Parameterized tags include their value in the match: `role=web` matches exactly, `role=*` matches any value for that key, and `role` does not match `role=web`. Source: systemd v262, `systemd.unit(5)`. */
|
|
349
350
|
readonly ConditionMachineTag?: string | readonly string[];
|
|
350
351
|
/** Verify that the specified amount of system memory is available to the current system. Takes a memory size in bytes as argument, optionally prefixed with a comparison operator <, <=, = (or ==), != (or <>), >=, >. On bare-metal systems compares the amount of physical memory in the system with the specified size, adhering to the specified comparison operator. In containers compares the amount of memory assigned to the container instead. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
351
352
|
readonly ConditionMemory?: number | string | readonly (number | string)[];
|
|
@@ -355,7 +356,7 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
355
356
|
readonly ConditionNeedsUpdate?: string | readonly string[];
|
|
356
357
|
/** Verify that a specific key=value pair is set in the host's os-release5. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
357
358
|
readonly ConditionOSRelease?: string | readonly string[];
|
|
358
|
-
/**
|
|
359
|
+
/** Checks for any file system object at an absolute path, including directories, device nodes, FIFOs, and sockets. Symbolic links are followed, so broken symbolic links do not count as existing. Prefix the path with `!` to require its absence. Source: systemd v262, `systemd.unit(5)`. */
|
|
359
360
|
readonly ConditionPathExists?: string | readonly string[];
|
|
360
361
|
/** Similar to `ConditionPathExists=`, but checks for the existence of at least one file or directory matching the specified globbing pattern. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
361
362
|
readonly ConditionPathExistsGlob?: string | readonly string[];
|
|
@@ -387,7 +388,7 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
387
388
|
readonly Description?: string;
|
|
388
389
|
/** A space-separated list of URIs referencing documentation for this unit or its configuration. Accepted are only URIs of the types http://, https://, file:, info:, man:. For more information about the syntax of these URIs, see uri(7). The URIs should be listed in order of relevance, starting with the most relevant. It is a good idea to first reference documentation that explains what the unit's purpose is, followed by how it is configured, followed by any other related documentation. This option may be specified more than once, in which case the specified list of URIs is merged. If the empty string is assigned to this option, the list is reset and all prior assignments will have no effect. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
389
390
|
readonly Documentation?: string | readonly string[];
|
|
390
|
-
/** Action to take when the unit stops in a failed state. Source: systemd
|
|
391
|
+
/** Action to take when the unit stops in a failed state. For `exit` and `exit-force`, the manager returns the main process exit status, or 255 if none is available, unless overridden by `FailureActionExitStatus=`. Source: systemd v261.3, `systemd.unit(5)`. */
|
|
391
392
|
readonly FailureAction?: UnitActionDirectiveValue;
|
|
392
393
|
/** Exit status to propagate when `FailureAction=` triggers `exit` or `exit-force`. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
393
394
|
readonly FailureActionExitStatus?: string | number;
|
|
@@ -437,13 +438,13 @@ interface SystemdUnitSection extends CustomDirectiveSection {
|
|
|
437
438
|
readonly StartLimitAction?: UnitActionDirectiveValue;
|
|
438
439
|
/** See systemd.unit(5) for StartLimitBurst=. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
439
440
|
readonly StartLimitBurst?: number;
|
|
440
|
-
/** Configure unit start rate limiting. Units which are started more than burst times within an interval time span are not permitted to start any more. Use StartLimitIntervalSec= to configure the checking interval and StartLimitBurst= to configure how many starts per interval are allowed.
|
|
441
|
+
/** Configure unit start rate limiting. Units which are started more than burst times within an interval time span are not permitted to start any more. Use StartLimitIntervalSec= to configure the checking interval and StartLimitBurst= to configure how many starts per interval are allowed. Since systemd v262, time spent suspended counts toward the interval. Sources: systemd v262, `systemd.unit(5)` and `NEWS`. */
|
|
441
442
|
readonly StartLimitIntervalSec?: number | string;
|
|
442
443
|
/** Units whose stop requests should also stop this unit. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
443
444
|
readonly StopPropagatedFrom?: string | readonly string[];
|
|
444
445
|
/** If true, this unit will be stopped when it is no longer used. Note that, in order to minimize the work to be executed, systemd will not stop units by default unless they are conflicting with other units, or the user explicitly requested their shut down. If this option is set, a unit will be automatically cleaned up if no other active unit requires it. Defaults to false. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
445
446
|
readonly StopWhenUnneeded?: boolean;
|
|
446
|
-
/** Action to take when the unit stops in an inactive state. Source: systemd
|
|
447
|
+
/** Action to take when the unit stops in an inactive state. For `exit` and `exit-force`, the manager returns the main process exit status, or leaves its exit status unchanged if none is available, unless overridden by `SuccessActionExitStatus=`. Source: systemd v261.3, `systemd.unit(5)`. */
|
|
447
448
|
readonly SuccessAction?: UnitActionDirectiveValue;
|
|
448
449
|
/** Exit status to propagate when `SuccessAction=` triggers `exit` or `exit-force`. Source: systemd v260.1, `systemd.unit(5)`. */
|
|
449
450
|
readonly SuccessActionExitStatus?: string | number;
|
|
@@ -524,7 +525,7 @@ interface SystemdTimerSection extends CustomDirectiveSection {
|
|
|
524
525
|
*
|
|
525
526
|
* This interface includes directives from `systemd.service(5)`,
|
|
526
527
|
* `systemd.exec(5)`, `systemd.kill(5)`, and
|
|
527
|
-
* `systemd.resource-control(5)
|
|
528
|
+
* `systemd.resource-control(5)`, reviewed through systemd v262.
|
|
528
529
|
*/
|
|
529
530
|
interface SystemdServiceSection extends CustomDirectiveSection {
|
|
530
531
|
/** This setting controls the cpuset controller in the unified hierarchy. Source: systemd v260.1, `systemd.resource-control(5)`. */
|
|
@@ -755,6 +756,8 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
755
756
|
readonly LogsDirectoryMode?: string;
|
|
756
757
|
/** Storage quota for directories created by `LogsDirectory=`. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
757
758
|
readonly LogsDirectoryQuota?: number | string;
|
|
759
|
+
/** Creates named Live Update Orchestrator (LUO) sessions and passes their file descriptors through the service's file descriptor store. Takes whitespace-separated names; repeated assignments are combined, and an empty string resets the list. Implies `FileDescriptorStoreMax=` is at least the number of sessions. Use `FileDescriptorStorePreserve=true` to preserve them across kexec. Existing sessions with the same name are reused. If `/dev/liveupdate` is unavailable, the service starts normally without sessions. Only supported by the system service manager. Source: systemd v262, `systemd.service(5)`. */
|
|
760
|
+
readonly LUOSession?: string | readonly string[];
|
|
758
761
|
/** See systemd.service(5) for ManagedOOMMemoryPressure=. Source: systemd v260.1, `systemd.service(5)`. */
|
|
759
762
|
readonly ManagedOOMMemoryPressure?: ManagedOOMDirectiveValue;
|
|
760
763
|
/** Overrides the default memory pressure duration set by oomd.conf5 for the cgroup of this unit. The specified value supports a time unit such as ms or μs, see systemd.time(7) for details on the permitted syntax. Must be set to either empty or a value of at least 1s. Defaults to empty, which means to use the default set by oomd.conf5. This property is ignored unless ManagedOOMMemoryPressure=kill. Source: systemd v260.1, `systemd.resource-control(5)`. */
|
|
@@ -803,7 +806,7 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
803
806
|
readonly NFTSet?: string | readonly string[];
|
|
804
807
|
/** Controls the NUMA node list which will be applied alongside with selected NUMA policy. Takes a list of NUMA nodes and has the same syntax as a list of CPUs for CPUAffinity= option or special "all" value which will include all available NUMA nodes in the mask. Note that the list of NUMA nodes is not required for default and local policies and for preferred policy we expect a single NUMA node. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
805
808
|
readonly NUMAMask?: string | readonly string[];
|
|
806
|
-
/** Controls the NUMA memory policy
|
|
809
|
+
/** Controls the NUMA memory policy: `default`, `preferred`, `bind`, `interleave`, `local`, `preferred-many` (Linux 5.15 or newer), or `weighted-interleave` (Linux 6.9 or newer). Configure associated nodes with `NUMAMask=` and weighted-interleave weights through `/sys/kernel/mm/mempolicy/weighted_interleave/`. Unsupported kernel policies log a warning and are ignored. Source: systemd v262, `systemd.exec(5)`. */
|
|
807
810
|
readonly NUMAPolicy?: string | readonly string[];
|
|
808
811
|
/** Takes an absolute file system path referring to a Linux network namespace pseudo-file (i.e. a file like /proc/$PID/ns/net or a bind mount or symlink to one). When set the invoked processes are added to the network namespace referenced by that path. The path has to point to a valid namespace file at the moment the processes are forked off. If this option is used PrivateNetwork= has no effect. If this option is used together with JoinsNamespaceOf= then it only has an effect if this unit is started before any of the listed units that have PrivateNetwork= or NetworkNamespacePath= configured, as otherwise the network namespace of those units is reused. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
809
812
|
readonly NetworkNamespacePath?: string;
|
|
@@ -875,7 +878,7 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
875
878
|
readonly ReadWritePaths?: string | readonly string[];
|
|
876
879
|
/** Supports either booleans or a space-separated list of refreshable resource kinds such as `extensions` and `credentials`. Source: systemd v260.1, `systemd.service(5)`. */
|
|
877
880
|
readonly RefreshOnReload?: boolean | string;
|
|
878
|
-
/**
|
|
881
|
+
/** Selects the signal sent to the main process to reload a `Type=notify-reload` service. Defaults to SIGHUP and has no effect for other service types. The main process must catch or block this signal before its initial `READY=1` notification, or startup fails. The handler is checked again before reloading; a missing handler then causes a warning, but the signal is still sent. Source: systemd v262, `systemd.service(5)`. */
|
|
879
882
|
readonly ReloadSignal?: NodeJS.Signals | number;
|
|
880
883
|
/** Takes a boolean value that specifies whether the service shall be considered active even when all its processes exited. Defaults to no. Source: systemd v260.1, `systemd.service(5)`. */
|
|
881
884
|
readonly RemainAfterExit?: boolean;
|
|
@@ -893,6 +896,8 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
893
896
|
readonly RestartMode?: ServiceRestartModeDirectiveValue;
|
|
894
897
|
/** Takes a list of exit status definitions that, when returned by the main service process, will prevent automatic service restarts, regardless of the restart setting configured with Restart=. Exit status definitions can be numeric termination statuses, termination status names, or termination signal names, separated by spaces. Defaults to the empty list, so that, by default, no exit status is excluded from the configured restart logic. A service with the RestartPreventExitStatus= setting RestartPreventExitStatus=TEMPFAIL 250 SIGKILL Exit status 75 (TEMPFAIL), 250, and the termination signal SIGKILL will not result in automatic service restarting. This option may appear more than once, in which case the list of restart-preventing statuses is merged. If the empty string is assigned to this option, the list is reset and all prior assignments of this option will have no effect. Source: systemd v260.1, `systemd.service(5)`. */
|
|
895
898
|
readonly RestartPreventExitStatus?: string | number | readonly (string | number)[];
|
|
899
|
+
/** Adds a uniformly distributed random delay between zero and this duration to automatic restarts, on top of `RestartSec=` and any exponential backoff configured by `RestartSteps=`/`RestartMaxDelaySec=`. Accepts seconds or a time span string. Defaults to 0, disabling the extra delay. Source: systemd v262, `systemd.service(5)`. */
|
|
900
|
+
readonly RestartRandomizedDelaySec?: number | string;
|
|
896
901
|
/** Configures the time to sleep before restarting a service (as configured with Restart=). Takes a unit-less value in seconds, or a time span value such as "5min 20s". Defaults to 100ms. Source: systemd v260.1, `systemd.service(5)`. */
|
|
897
902
|
readonly RestartSec?: number | string;
|
|
898
903
|
/** Configures the number of exponential steps to take to increase the interval of auto-restarts from RestartSec= to RestartMaxDelaySec=. Takes a positive integer or 0 to disable it. Defaults to 0. Hint: values between 3 and 5 are good choices when exponential backoff is desired. Source: systemd v260.1, `systemd.service(5)`. */
|
|
@@ -907,7 +912,7 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
907
912
|
readonly RestrictNetworkInterfaces?: string | readonly string[];
|
|
908
913
|
/** If set, any attempts to enable realtime scheduling in a process of the unit are refused. This restricts access to realtime task scheduling policies such as SCHED_FIFO, SCHED_RR or SCHED_DEADLINE. See sched7 for details about these scheduling policies. Realtime scheduling policies may be used to monopolize CPU time for longer periods of time, and may hence be used to lock up or otherwise trigger Denial-of-Service situations on the system. It is hence recommended to restrict access to realtime scheduling to the few programs that actually require them. Defaults to off. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
909
914
|
readonly RestrictRealtime?: boolean;
|
|
910
|
-
/** If set, any attempts to set the set-user-ID (SUID) or set-group-ID (SGID) bits on files or directories will be denied (for details on these bits see inode7). As the SUID/SGID bits are mechanisms to elevate privileges, and allow users to acquire the identity of other users, it is recommended to restrict creation of SUID/SGID files to the few programs that actually require them. Note that this restricts marking of any type of file system object with these bits, including both regular files and directories (where the SGID is a different meaning than for files, see documentation). This option is implied if DynamicUser= is enabled. Source: systemd
|
|
915
|
+
/** If set, any attempts to set the set-user-ID (SUID) or set-group-ID (SGID) bits on files or directories will be denied (for details on these bits see inode7). As the SUID/SGID bits are mechanisms to elevate privileges, and allow users to acquire the identity of other users, it is recommended to restrict creation of SUID/SGID files to the few programs that actually require them. Note that this restricts marking of any type of file system object with these bits, including both regular files and directories (where the SGID is a different meaning than for files, see documentation). This option is implied if DynamicUser= is enabled. Seccomp blocks calls with directly supplied mode bits only when SUID or SGID is requested, but blocks calls such as openat2() entirely because their mode bits cannot be inspected. Source: systemd v261.3, `systemd.exec(5)`. */
|
|
911
916
|
readonly RestrictSUIDSGID?: boolean;
|
|
912
917
|
/** Takes a directory path relative to the host's root directory (i.e. the root of the system running the service manager). Sets the root directory for executed processes, with the pivot_root2 or chroot2 system call. If this is used, it must be ensured that the process binary and all its auxiliary files are available in the new root. Note that setting this parameter might result in additional dependencies to be added to the unit (see above). Source: systemd v260.1, `systemd.exec(5)`. */
|
|
913
918
|
readonly RootDirectory?: string;
|
|
@@ -941,7 +946,7 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
941
946
|
readonly RuntimeRandomizedExtraSec?: number | string;
|
|
942
947
|
/** Set the SELinux security context of the executed process. If set, this will override the automated domain transition. However, the policy still needs to authorize the transition. This directive is ignored if SELinux is disabled. If prefixed by -, failing to set the SELinux security context will be ignored, but it is still possible that the subsequent execve() may fail if the policy does not allow the transition for the non-overridden context. This does not affect commands prefixed with +. See setexeccon3 for details. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
943
948
|
readonly SELinuxContext?: string;
|
|
944
|
-
/**
|
|
949
|
+
/** Sets a space-separated combination of secure bits: `keep-caps`, `no-setuid-fixup`, `noroot`, `no-cap-ambient-raise`, `exec-restrict-file`, `exec-deny-interactive`, and their `-locked` variants. Repeated assignments combine the bits; an empty string resets them to zero. Commands prefixed with `+` are unaffected. See capabilities(7) and the kernel executability-check documentation. Source: systemd v262, `systemd.exec(5)`. */
|
|
945
950
|
readonly SecureBits?: string | readonly string[];
|
|
946
951
|
/** Specifies whether to send SIGHUP to remaining processes immediately after sending the signal configured with KillSignal=. This is useful to indicate to shells and shell-like programs that their connection has been severed. Takes a boolean value. Defaults to no. Source: systemd v260.1, `systemd.kill(5)`. */
|
|
947
952
|
readonly SendSIGHUP?: boolean;
|
|
@@ -963,15 +968,15 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
963
968
|
readonly SocketBindDeny?: string | readonly string[];
|
|
964
969
|
/** Specifies the name of the socket units this service shall inherit socket file descriptors from when the service is started. Normally, it should not be necessary to use this setting, as all socket file descriptors whose unit shares the same name as the service (subject to the different unit name suffix of course) are passed to the spawned process. Source: systemd v260.1, `systemd.service(5)`. */
|
|
965
970
|
readonly Sockets?: string | readonly string[];
|
|
966
|
-
/** Controls where file descriptor 2 (stderr) of the executed processes is connected to. The available options are identical to those of StandardOutput=, with some exceptions: if set to inherit the file descriptor used for standard output is duplicated for standard error, while fd:name will use a default file descriptor name of stderr. Source: systemd
|
|
971
|
+
/** Controls where file descriptor 2 (stderr) of the executed processes is connected to. The available options are identical to those of StandardOutput=, with some exceptions: if set to inherit the file descriptor used for standard output is duplicated for standard error, while fd:name will use a default file descriptor name of stderr. File paths are opened by the service manager before SELinuxContext= or policy-defined transitions take effect; the process inherits the resulting descriptor. Source: systemd v261.3, `systemd.exec(5)`. */
|
|
967
972
|
readonly StandardError?: StandardErrorDirectiveValue;
|
|
968
|
-
/** Controls where file descriptor 0 (STDIN) of the executed processes is connected to. Takes one of null, tty, tty-force, tty-fail, data, file:path, socket or fd:name. Source: systemd
|
|
973
|
+
/** Controls where file descriptor 0 (STDIN) of the executed processes is connected to. Takes one of null, tty, tty-force, tty-fail, data, file:path, socket or fd:name. For file:path, the service manager opens the path before SELinuxContext= or policy-defined transitions take effect; the process inherits the resulting descriptor. Source: systemd v261.3, `systemd.exec(5)`. */
|
|
969
974
|
readonly StandardInput?: StandardInputDirectiveValue;
|
|
970
975
|
/** Configures arbitrary textual or binary data to pass via file descriptor 0 (STDIN) to the executed processes. These settings have no effect unless StandardInput= is set to data (which is the default if StandardInput= is not set otherwise, but StandardInputText=/StandardInputData= is). Use this option to embed process input data directly in the unit file. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
971
976
|
readonly StandardInputData?: string | readonly string[];
|
|
972
977
|
/** Configures arbitrary textual or binary data to pass via file descriptor 0 (STDIN) to the executed processes. These settings have no effect unless StandardInput= is set to data (which is the default if StandardInput= is not set otherwise, but StandardInputText=/StandardInputData= is). Use this option to embed process input data directly in the unit file. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
973
978
|
readonly StandardInputText?: string | readonly string[];
|
|
974
|
-
/** Controls where file descriptor 1 (stdout) of the executed processes is connected to. Takes one of inherit, null, tty, journal, kmsg, journal+console, kmsg+console, file:path, append:path, truncate:path, socket or fd:name. Source: systemd
|
|
979
|
+
/** Controls where file descriptor 1 (stdout) of the executed processes is connected to. Takes one of inherit, null, tty, journal, kmsg, journal+console, kmsg+console, file:path, append:path, truncate:path, socket or fd:name. For file:path, append:path, and truncate:path, the service manager opens the path before SELinuxContext= or policy-defined transitions take effect; the process inherits the resulting descriptor. Source: systemd v261.3, `systemd.exec(5)`. */
|
|
975
980
|
readonly StandardOutput?: StandardOutputDirectiveValue;
|
|
976
981
|
/** This setting controls the cpuset controller in the unified hierarchy. Source: systemd v260.1, `systemd.resource-control(5)`. */
|
|
977
982
|
readonly StartupAllowedCPUs?: string;
|
|
@@ -1059,7 +1064,7 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
1059
1064
|
readonly USBFunctionDescriptors?: string;
|
|
1060
1065
|
/** Configure the location of a file containing USB FunctionFS strings. Behavior is similar to USBFunctionDescriptors= above. Source: systemd v260.1, `systemd.service(5)`. */
|
|
1061
1066
|
readonly USBFunctionStrings?: string;
|
|
1062
|
-
/** Explicitly unset environment variable assignments that would normally be passed from the service manager to invoked processes of this unit. Takes a space-separated list of variable names or variable assignments. This option may be specified more than once, in which case all listed variables/assignments will be unset. If the empty string is assigned to this option, the list of environment variables/assignments to unset is reset. If a variable assignment is specified (that is: a variable name, followed by =, followed by its value), then any environment variable matching this precise assignment is removed. If a variable name is specified (that is a variable name without any following = or value), then any assignment matching the variable name, regardless of its value is removed. Note that the effect of UnsetEnvironment= is applied as final step when the environment list passed to executed processes is compiled. That means it may undo assignments from any configuration source, including assignments made through Environment= or EnvironmentFile=, inherited from the system manager's global set of environment variables, inherited via PassEnvironment=, set by the service manager itself (such as $NOTIFY_SOCKET and such), or set by a PAM module (in case PAMName= is used). Source: systemd
|
|
1067
|
+
/** Explicitly unset environment variable assignments that would normally be passed from the service manager to invoked processes of this unit. Takes a space-separated list of variable names or variable assignments. This option may be specified more than once, in which case all listed variables/assignments will be unset. If the empty string is assigned to this option, the list of environment variables/assignments to unset is reset. If a variable assignment is specified (that is: a variable name, followed by =, followed by its value), then any environment variable matching this precise assignment is removed. If a variable name is specified (that is a variable name without any following = or value), then any assignment matching the variable name, regardless of its value is removed. Note that the effect of UnsetEnvironment= is applied as final step when the environment list passed to executed processes is compiled. That means it may undo assignments from any configuration source, including assignments made through Environment= or EnvironmentFile=, inherited from the system manager's global set of environment variables, inherited via PassEnvironment=, set by the service manager itself (such as $NOTIFY_SOCKET and such), or set by a PAM module (in case PAMName= is used). Command-line variable expansion in ExecStart= and related directives happens before this removal and is unaffected. Source: systemd v261.3, `systemd.exec(5)`. */
|
|
1063
1068
|
readonly UnsetEnvironment?: string | readonly string[];
|
|
1064
1069
|
/** Set the UNIX user or group that the processes are executed as, respectively. Takes a single user or group name, or a numeric ID as argument. For system services (services run by the system service manager, i.e. managed by PID 1) and for user services of the root user (services managed by root's instance of systemd --user), the default is root, but this directive may be used to specify a different identity. For user services of any other user, switching user identity is not permitted, hence the only valid setting is the same user the user's service manager is running as. If no group is set, the default group of the user is used. This setting does not affect commands whose command line is prefixed with +. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
1065
1070
|
readonly User?: string;
|
|
@@ -1069,7 +1074,7 @@ interface SystemdServiceSection extends CustomDirectiveSection {
|
|
|
1069
1074
|
readonly UtmpIdentifier?: string;
|
|
1070
1075
|
/** Takes one of init, login or user. If UtmpIdentifier= is set, controls which type of utmp5/wtmp entries for this service are generated. This setting has no effect unless UtmpIdentifier= is set too. If init is set, only an INIT_PROCESS entry is generated and the invoked process must implement a getty-compatible utmp/wtmp logic. If login is set, first an INIT_PROCESS entry, followed by a LOGIN_PROCESS entry is generated. In this case, the invoked process must implement a login1-compatible utmp/wtmp logic. If user is set, first an INIT_PROCESS entry, then a LOGIN_PROCESS entry and finally a USER_PROCESS entry is generated. In this case, the invoked process may be any process that is suitable to be run as session leader. Defaults to init. Source: systemd v260.1, `systemd.exec(5)`. */
|
|
1071
1076
|
readonly UtmpMode?: UtmpModeDirectiveValue;
|
|
1072
|
-
/** Configures
|
|
1077
|
+
/** Configures how the service notifies the manager that startup has finished: `simple`, `exec`, `forking`, `oneshot`, `dbus`, `notify`, `notify-reload`, or `idle`. With `notify-reload`, the main process must catch or block `ReloadSignal=` before sending its initial `READY=1` notification, or startup fails. Source: systemd v262, `systemd.service(5)`. */
|
|
1073
1078
|
readonly Type?: ServiceTypeDirectiveValue;
|
|
1074
1079
|
/** Configures the watchdog timeout for a service. The watchdog is activated when the start-up is completed. The service must call sd_notify3 regularly with WATCHDOG=1 (i.e. the "keep-alive ping"). If the time between two such calls is larger than the configured time, then the service is placed in a failed state and it will be terminated with SIGABRT (or the signal specified by WatchdogSignal=). By setting Restart= to on-failure, on-watchdog, on-abnormal or always, the service will be automatically restarted. The time configured here will be passed to the executed service process in the WATCHDOG_USEC= environment variable. This allows daemons to automatically enable the keep-alive pinging logic if watchdog support is enabled for the service. If this option is used, NotifyAccess= (see below) should be set to open access to the notification socket provided by systemd. If NotifyAccess= is not set, it will be implicitly set to main. Defaults to 0, which disables this feature. The service can check whether the service manager expects watchdog keep-alive notifications. See sd_watchdog_enabled3 for details. sd_event_set_watchdog3 may be used to enable automatic watchdog notification support. Source: systemd v260.1, `systemd.service(5)`. */
|
|
1075
1080
|
readonly WatchdogSec?: number | string;
|
|
@@ -1359,6 +1364,10 @@ declare const notify: {
|
|
|
1359
1364
|
* Use this when a `Type=notify` service has completed its startup work and is
|
|
1360
1365
|
* ready to be considered fully started. If `options.status` is provided, it is
|
|
1361
1366
|
* sent as an additional `STATUS=...` field.
|
|
1367
|
+
*
|
|
1368
|
+
* With `Type=notify-reload`, the main process must catch or block its
|
|
1369
|
+
* `ReloadSignal=` (SIGHUP by default) before sending readiness. Since systemd
|
|
1370
|
+
* v262, startup fails if it does neither. Source: systemd v262, `systemd.service(5)`.
|
|
1362
1371
|
*/
|
|
1363
1372
|
ready(options?: NotifyOptions): Promise<Result<void, NotifySendError>>;
|
|
1364
1373
|
/**
|
|
@@ -1632,4 +1641,4 @@ declare function defaultSystemd(): Systemd;
|
|
|
1632
1641
|
declare const Internal: typeof internal_d_exports;
|
|
1633
1642
|
//#endregion
|
|
1634
1643
|
export { SystemdServiceOptions as $, CommandExecutionOptions as A, SystemctlActiveState as B, UnitLogsReadError as C, UnitStartError as D, UnitMaterializationErrorReason as E, MaterializedUnit as F, SystemctlOptions as G, SystemctlIsEnabledOptions as H, NotifyOptions as I, SystemctlStateQueryOptions as J, SystemctlServiceStatus as K, ServiceBaseName as L, CommandOutput as M, ExecutableOptions as N, AnySystemdService as O, LogsOptions as P, SystemdOptions as Q, ServiceFilename as R, UnitEnableError as S, UnitMaterializationError as T, SystemctlIsSystemRunningOptions as U, SystemctlEnablementState as V, SystemctlListTimersOptions as W, SystemctlSystemRunningState as X, SystemctlStatusOptions as Y, SystemctlTimerListEntry as Z, NotifySendErrorReason as _, SystemdTsAttachOptions as a, TimerTargetUnit as at, SystemdCommandEnvironmentReason as b, SystemdTsDetachOptions as c, SystemdTimer as ct, Systemctl as d, defineExecutable as dt, SystemdTimerOptions as et, notify as f, Result as ft, NotifySendError as g, NoUnitsProvidedError as h, SystemdTs as i, TimerTargetServiceName as it, CommandExecutor as j, AnySystemdTimer as k, SystemdTsReattachOptions as l, SystemdService as lt, InvalidExecDirectiveError as m, Systemd as n, TimerBaseName as nt, SystemdTsAttachmentResult as o, UnitValue as ot, ExecutableInferenceError as p, SystemctlShowOptions as q, SystemdMaterialization as r, TimerFilename as rt, SystemdTsAttachmentSelector as s, ValidInstallUnits as st, Internal as t, SystemdUnit as tt, defaultSystemd as u, Executable as ut, SystemctlCommandError as v, UnitLogsReadErrorReason as w, SystemdTsError as x, SystemctlCommandErrorReason as y, StartStatus as z };
|
|
1635
|
-
//# sourceMappingURL=index-
|
|
1644
|
+
//# sourceMappingURL=index-4VL-jAGf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-4VL-jAGf.d.mts","names":[],"sources":["../src/main/internal.ts","../src/main/executable.ts","../src/main/systemd-service.ts","../src/main/systemd-timer.ts","../src/main/types.ts","../src/main/errors.ts","../src/main/notify.ts","../src/main/systemctl.ts","../src/main/systemd.ts","../src/main/index.ts"],"mappings":";;;KAiBY,OAAO,QAAQ;WAEZ;WACA,OAAO;;WAGP;WACA,OAAO;;KAgBjB;iBAEW,kBAAkB,cAAc;iBAIhC,uBAAuB,SAAS;iBAShC,uBAAuB;iBAQvB,kBAAkB,iBAAiB,wBAAwB,qBACzE,SAAS,WACR,SAAS;iBAUI,iBAAiB,iBAAiB,yBAChD,SAAS,WACR;iBAgBa,uBACd,SAAS,wBACR,aAAa;iBAcA,iBAAiB,cAAc,iBAAiB;iBA4BhD,eACd,UAAU,gCAAgC,4BACzC,eAAe;iBAuDI,uBACpB,iBACA,yBACA,UAAS,0BACR,QAAQ;iBAYW,WAAW,eAAe;iBAS1B,WACpB,iCACA,SAAS,gBACR;iBAmDa,qBAAqB,iBAAiB;;;;;;;;;;;;;;;;cC3PzC;;WAEK;;WAEA,gBAAgB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;;cAkBE,uBACX,wBAAwB,yBAAyB;;WAGjC;;WAEA,uBAAuB,iBAAiB;EAExD,YAAmB,mBAAmB,uBAAuB,iBAAiB;;;;;;;;;;;;cAiBnE;;WAEK,UAAU;;WAEV;;WAEA;;WAEA,WAAW;;WAEX,IAAI;;WAEJ;;;;;;;;EAShB,YAAmB,UAAS;;;;;;;EAmB5B,kBAA+B,wBAAwB,kBAClD,OAAO,SAAS,kBAAkB,UACpC,QACD,OACE,uBAAuB,SACrB,2BACA,4BACA,uBACA;;;;;;;;EAaN,UACK,gBAAgB,gBAClB,QAAQ,aAAa,uBAAuB;;;;;;;;EAkD/C,MAAmB,MAAM,cAAc,QAAQ,OAAO,aAAa;;;;;;;;EAoEnE,KACE,MAAM,aACN,UAAU,cACT,QAAQ,eAAe;;EAsD1B,QAAe,MAAM;UAIP;UAiDN;UAIM;UA2CA;UAiBA;UA4DA;;;;;;;;;cA6BH;mBACM;EAEjB,YAAmB,SAAS;EAK5B,OACE,gBAAgB,eAChB,SAAS,yBACR,QACD,OACE,2BACE,2BACA,4BACA,uBACA,kBACA,2BACA;EAwDN,OACE,UAAU,6BACV,UAAS,yBACR,QACD;aAEa;aACA;aACA;aACA;aACA;KAEX;EA+CJ,SACE,gBAAgB,eAChB,SAAS,2BACR,QACD,OACE,2BACE,2BACA,4BACA,uBACA,kBACA,2BACA,iBACA;UA0FQ;UA0BA;UAiDA;UAMN;UAIM;UASA;UAQA;UAIN;UAIM;;;;;;;;iBAyCA,kBAAkB;;;;;;;cCl2BrB,iBAAiB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as SystemdServiceOptions, A as CommandExecutionOptions, B as SystemctlActiveState, C as UnitLogsReadError, D as UnitStartError, E as UnitMaterializationErrorReason, F as MaterializedUnit, G as SystemctlOptions, H as SystemctlIsEnabledOptions, I as NotifyOptions, J as SystemctlStateQueryOptions, K as SystemctlServiceStatus, L as ServiceBaseName, M as CommandOutput, N as ExecutableOptions, O as AnySystemdService, P as LogsOptions, Q as SystemdOptions, R as ServiceFilename, S as UnitEnableError, T as UnitMaterializationError, U as SystemctlIsSystemRunningOptions, V as SystemctlEnablementState, W as SystemctlListTimersOptions, X as SystemctlSystemRunningState, Y as SystemctlStatusOptions, Z as SystemctlTimerListEntry, _ as NotifySendErrorReason, a as SystemdTsAttachOptions, at as TimerTargetUnit, b as SystemdCommandEnvironmentReason, c as SystemdTsDetachOptions, ct as SystemdTimer, d as Systemctl, dt as defineExecutable, et as SystemdTimerOptions, f as notify, ft as Result, g as NotifySendError, h as NoUnitsProvidedError, i as SystemdTs, it as TimerTargetServiceName, j as CommandExecutor, k as AnySystemdTimer, l as SystemdTsReattachOptions, lt as SystemdService, m as InvalidExecDirectiveError, n as Systemd, nt as TimerBaseName, o as SystemdTsAttachmentResult, ot as UnitValue, p as ExecutableInferenceError, q as SystemctlShowOptions, r as SystemdMaterialization, rt as TimerFilename, s as SystemdTsAttachmentSelector, st as ValidInstallUnits, t as Internal, tt as SystemdUnit, u as defaultSystemd, ut as Executable, v as SystemctlCommandError, w as UnitLogsReadErrorReason, x as SystemdTsError, y as SystemctlCommandErrorReason, z as StartStatus } from "./index-
|
|
1
|
+
import { $ as SystemdServiceOptions, A as CommandExecutionOptions, B as SystemctlActiveState, C as UnitLogsReadError, D as UnitStartError, E as UnitMaterializationErrorReason, F as MaterializedUnit, G as SystemctlOptions, H as SystemctlIsEnabledOptions, I as NotifyOptions, J as SystemctlStateQueryOptions, K as SystemctlServiceStatus, L as ServiceBaseName, M as CommandOutput, N as ExecutableOptions, O as AnySystemdService, P as LogsOptions, Q as SystemdOptions, R as ServiceFilename, S as UnitEnableError, T as UnitMaterializationError, U as SystemctlIsSystemRunningOptions, V as SystemctlEnablementState, W as SystemctlListTimersOptions, X as SystemctlSystemRunningState, Y as SystemctlStatusOptions, Z as SystemctlTimerListEntry, _ as NotifySendErrorReason, a as SystemdTsAttachOptions, at as TimerTargetUnit, b as SystemdCommandEnvironmentReason, c as SystemdTsDetachOptions, ct as SystemdTimer, d as Systemctl, dt as defineExecutable, et as SystemdTimerOptions, f as notify, ft as Result, g as NotifySendError, h as NoUnitsProvidedError, i as SystemdTs, it as TimerTargetServiceName, j as CommandExecutor, k as AnySystemdTimer, l as SystemdTsReattachOptions, lt as SystemdService, m as InvalidExecDirectiveError, n as Systemd, nt as TimerBaseName, o as SystemdTsAttachmentResult, ot as UnitValue, p as ExecutableInferenceError, q as SystemctlShowOptions, r as SystemdMaterialization, rt as TimerFilename, s as SystemdTsAttachmentSelector, st as ValidInstallUnits, t as Internal, tt as SystemdUnit, u as defaultSystemd, ut as Executable, v as SystemctlCommandError, w as UnitLogsReadErrorReason, x as SystemdTsError, y as SystemctlCommandErrorReason, z as StartStatus } from "./index-4VL-jAGf.mjs";
|
|
2
2
|
export { type AnySystemdService, type AnySystemdTimer, type CommandExecutionOptions, type CommandExecutor, type CommandOutput, Executable, ExecutableInferenceError, type ExecutableOptions, Internal, InvalidExecDirectiveError, type LogsOptions, type MaterializedUnit, NoUnitsProvidedError, type NotifyOptions, NotifySendError, type NotifySendErrorReason, type Result, type ServiceBaseName, type ServiceFilename, type StartStatus, Systemctl, type SystemctlActiveState, SystemctlCommandError, type SystemctlCommandErrorReason, type SystemctlEnablementState, type SystemctlIsEnabledOptions, type SystemctlIsSystemRunningOptions, type SystemctlListTimersOptions, type SystemctlOptions, type SystemctlServiceStatus, type SystemctlShowOptions, type SystemctlStateQueryOptions, type SystemctlStatusOptions, type SystemctlSystemRunningState, type SystemctlTimerListEntry, Systemd, type SystemdCommandEnvironmentReason, SystemdMaterialization, type SystemdOptions, SystemdService, type SystemdServiceOptions, SystemdTimer, type SystemdTimerOptions, SystemdTs, type SystemdTsAttachOptions, type SystemdTsAttachmentResult, type SystemdTsAttachmentSelector, type SystemdTsDetachOptions, SystemdTsError, type SystemdTsReattachOptions, type SystemdUnit, type TimerBaseName, type TimerFilename, type TimerTargetServiceName, type TimerTargetUnit, UnitEnableError, UnitLogsReadError, type UnitLogsReadErrorReason, UnitMaterializationError, type UnitMaterializationErrorReason, UnitStartError, type UnitValue, type ValidInstallUnits, defaultSystemd, defineExecutable, notify };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as SystemdTsError, a as defaultSystemd, b as UnitMaterializationError, c as SystemdService, d as defineExecutable, f as ExecutableInferenceError, g as SystemctlCommandError, h as NotifySendError, i as SystemdTs, l as notify, m as NoUnitsProvidedError, n as Systemd, o as Systemctl, p as InvalidExecDirectiveError, r as SystemdMaterialization, s as SystemdTimer, t as Internal, u as Executable, v as UnitEnableError, x as UnitStartError, y as UnitLogsReadError } from "./main-
|
|
1
|
+
import { _ as SystemdTsError, a as defaultSystemd, b as UnitMaterializationError, c as SystemdService, d as defineExecutable, f as ExecutableInferenceError, g as SystemctlCommandError, h as NotifySendError, i as SystemdTs, l as notify, m as NoUnitsProvidedError, n as Systemd, o as Systemctl, p as InvalidExecDirectiveError, r as SystemdMaterialization, s as SystemdTimer, t as Internal, u as Executable, v as UnitEnableError, x as UnitStartError, y as UnitLogsReadError } from "./main-BlzhT1eg.mjs";
|
|
2
2
|
export { Executable, ExecutableInferenceError, Internal, InvalidExecDirectiveError, NoUnitsProvidedError, NotifySendError, Systemctl, SystemctlCommandError, Systemd, SystemdMaterialization, SystemdService, SystemdTimer, SystemdTs, SystemdTsError, UnitEnableError, UnitLogsReadError, UnitMaterializationError, UnitStartError, defaultSystemd, defineExecutable, notify };
|
|
@@ -601,6 +601,10 @@ const notify = {
|
|
|
601
601
|
* Use this when a `Type=notify` service has completed its startup work and is
|
|
602
602
|
* ready to be considered fully started. If `options.status` is provided, it is
|
|
603
603
|
* sent as an additional `STATUS=...` field.
|
|
604
|
+
*
|
|
605
|
+
* With `Type=notify-reload`, the main process must catch or block its
|
|
606
|
+
* `ReloadSignal=` (SIGHUP by default) before sending readiness. Since systemd
|
|
607
|
+
* v262, startup fails if it does neither. Source: systemd v262, `systemd.service(5)`.
|
|
604
608
|
*/
|
|
605
609
|
async ready(options = {}) {
|
|
606
610
|
try {
|
|
@@ -1609,4 +1613,4 @@ const Internal = internal_exports;
|
|
|
1609
1613
|
//#endregion
|
|
1610
1614
|
export { SystemdTsError as _, defaultSystemd as a, UnitMaterializationError as b, SystemdService as c, defineExecutable as d, ExecutableInferenceError as f, SystemctlCommandError as g, NotifySendError as h, SystemdTs as i, notify as l, NoUnitsProvidedError as m, Systemd as n, Systemctl as o, InvalidExecDirectiveError as p, SystemdMaterialization as r, SystemdTimer as s, Internal as t, Executable as u, UnitEnableError as v, UnitStartError as x, UnitLogsReadError as y };
|
|
1611
1615
|
|
|
1612
|
-
//# sourceMappingURL=main-
|
|
1616
|
+
//# sourceMappingURL=main-BlzhT1eg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-BlzhT1eg.mjs","names":["ok","err","I"],"sources":["../src/main/errors.ts","../src/main/executable.ts","../src/main/internal.ts","../src/main/notify.ts","../src/main/systemd-service.ts","../src/main/systemd-timer.ts","../src/main/systemctl.ts","../src/main/systemd.ts","../src/main/index.ts"],"sourcesContent":["import type { StartStatus } from \"./types.ts\";\n\nexport type SystemdTsErrorCode =\n | `SYSTEMD_TS_INVALID_EXEC_DIRECTIVE`\n | `SYSTEMD_TS_NO_UNITS_PROVIDED`\n | `SYSTEMD_TS_EXECUTABLE_INFERENCE`\n | `SYSTEMD_TS_UNIT_MATERIALIZATION`\n | `SYSTEMD_TS_UNIT_ENABLE`\n | `SYSTEMD_TS_UNIT_START`\n | `SYSTEMD_TS_UNIT_LOGS`\n | `SYSTEMD_TS_SYSTEMCTL`\n | `SYSTEMD_TS_NOTIFY_SEND`;\n\nexport interface SystemdTsErrorOptions {\n readonly cause?: unknown;\n}\n\nexport interface SystemdCommandErrorOptions extends SystemdTsErrorOptions {\n readonly args?: readonly string[];\n readonly command?: string;\n readonly environmentReason?: SystemdCommandEnvironmentReason;\n readonly stage?: string;\n readonly unitName?: string;\n readonly unitPath?: string;\n}\n\nexport interface UnitStartDiagnostics {\n readonly showOutput?: string;\n readonly showStatus?: StartStatus;\n readonly statusOutput?: string;\n}\n\nexport interface UnitStartErrorOptions extends SystemdCommandErrorOptions {\n readonly diagnostics?: UnitStartDiagnostics;\n}\n\nexport interface UnitMaterializationErrorOptions extends SystemdTsErrorOptions {\n readonly reason?: UnitMaterializationErrorReason;\n readonly operation?: `create-directory` | `write-file`;\n readonly unitName?: string;\n readonly unitPath?: string;\n}\n\nexport type UnitMaterializationErrorReason =\n | `file-system-failed`\n | `invalid-unit-directory`\n | `permission-denied`;\n\nexport interface UnitLogsReadErrorOptions extends SystemdCommandErrorOptions {\n readonly reason?: UnitLogsReadErrorReason;\n readonly unitPath?: string;\n}\n\nexport type UnitLogsReadErrorReason =\n | `missing-log-file`\n | `log-file-read-failed`\n | `status-command-failed`;\n\nexport interface NotifySendErrorOptions extends SystemdCommandErrorOptions {\n readonly reason?: NotifySendErrorReason;\n}\n\nexport type NotifySendErrorReason = `executor-failed` | `systemd-notify-failed`;\n\nexport interface SystemctlCommandErrorOptions extends SystemdCommandErrorOptions {\n readonly operation?: string;\n readonly reason?: SystemctlCommandErrorReason;\n}\n\nexport type SystemctlCommandErrorReason = `executor-failed` | `invalid-json`;\n\nexport type SystemdCommandEnvironmentReason =\n | `manager-unavailable`\n | `missing-command`\n | `permission-denied`;\n\nexport class SystemdTsError extends Error {\n public readonly code: SystemdTsErrorCode;\n\n public constructor(\n code: SystemdTsErrorCode,\n message: string,\n options: SystemdTsErrorOptions = {},\n ) {\n super(message, { cause: options.cause });\n this.code = code;\n this.name = new.target.name;\n }\n}\n\nexport class InvalidExecDirectiveError extends SystemdTsError {\n public readonly directive: string;\n\n public constructor(directive: string, options: SystemdTsErrorOptions = {}) {\n super(\n `SYSTEMD_TS_INVALID_EXEC_DIRECTIVE`,\n `${directive} must use an absolute executable path for systemd`,\n options,\n );\n this.directive = directive;\n }\n}\n\nexport class NoUnitsProvidedError extends SystemdTsError {\n public readonly operation: string;\n\n public constructor(operation: string, options: SystemdTsErrorOptions = {}) {\n super(\n `SYSTEMD_TS_NO_UNITS_PROVIDED`,\n `${operation} requires at least one service or timer`,\n options,\n );\n this.operation = operation;\n }\n}\n\nexport class ExecutableInferenceError extends SystemdTsError {\n public constructor(options: SystemdTsErrorOptions = {}) {\n super(\n `SYSTEMD_TS_EXECUTABLE_INFERENCE`,\n `Could not infer the calling module path for defineExecutable(); pass { modulePath } explicitly`,\n options,\n );\n }\n}\n\nexport class UnitMaterializationError extends SystemdTsError {\n public readonly operation: `create-directory` | `write-file` | undefined;\n public readonly reason: UnitMaterializationErrorReason | undefined;\n public readonly unitName: string | undefined;\n public readonly unitPath: string | undefined;\n\n public constructor(message: string, options: UnitMaterializationErrorOptions = {}) {\n super(`SYSTEMD_TS_UNIT_MATERIALIZATION`, message, options);\n this.operation = options.operation;\n this.reason = options.reason;\n this.unitName = options.unitName;\n this.unitPath = options.unitPath;\n }\n}\n\nexport class UnitEnableError extends SystemdTsError {\n public readonly args: readonly string[] | undefined;\n public readonly command: string | undefined;\n public readonly environmentReason: SystemdCommandEnvironmentReason | undefined;\n public readonly exitCode: number | undefined;\n public readonly stage: string | undefined;\n public readonly stderr: string | undefined;\n public readonly stdout: string | undefined;\n public readonly unitName: string | undefined;\n public readonly unitPath: string | undefined;\n\n public constructor(message: string, options: SystemdCommandErrorOptions = {}) {\n super(`SYSTEMD_TS_UNIT_ENABLE`, message, options);\n const details = extractCommandErrorDetails(options.cause);\n this.args = options.args;\n this.command = options.command;\n this.environmentReason =\n options.environmentReason ?? classifyCommandEnvironmentReason(options.cause);\n this.exitCode = details.exitCode;\n this.stage = options.stage;\n this.stderr = details.stderr;\n this.stdout = details.stdout;\n this.unitName = options.unitName;\n this.unitPath = options.unitPath;\n }\n}\n\nexport class UnitStartError extends SystemdTsError {\n public readonly args: readonly string[] | undefined;\n public readonly command: string | undefined;\n public readonly diagnostics: UnitStartDiagnostics | undefined;\n public readonly environmentReason: SystemdCommandEnvironmentReason | undefined;\n public readonly exitCode: number | undefined;\n public readonly stage: string | undefined;\n public readonly stderr: string | undefined;\n public readonly stdout: string | undefined;\n public readonly unitName: string | undefined;\n public readonly unitPath: string | undefined;\n\n public constructor(message: string, options: UnitStartErrorOptions = {}) {\n super(`SYSTEMD_TS_UNIT_START`, message, options);\n const details = extractCommandErrorDetails(options.cause);\n this.args = options.args;\n this.command = options.command;\n this.diagnostics = options.diagnostics;\n this.environmentReason =\n options.environmentReason ?? classifyCommandEnvironmentReason(options.cause);\n this.exitCode = details.exitCode;\n this.stage = options.stage;\n this.stderr = details.stderr;\n this.stdout = details.stdout;\n this.unitName = options.unitName;\n this.unitPath = options.unitPath;\n }\n}\n\nexport class UnitLogsReadError extends SystemdTsError {\n public readonly args: readonly string[] | undefined;\n public readonly command: string | undefined;\n public readonly environmentReason: SystemdCommandEnvironmentReason | undefined;\n public readonly exitCode: number | undefined;\n public readonly reason: UnitLogsReadErrorReason | undefined;\n public readonly stage: string | undefined;\n public readonly stderr: string | undefined;\n public readonly stdout: string | undefined;\n public readonly unitName: string | undefined;\n public readonly unitPath: string | undefined;\n\n public constructor(message: string, options: UnitLogsReadErrorOptions = {}) {\n super(`SYSTEMD_TS_UNIT_LOGS`, message, options);\n const details = extractCommandErrorDetails(options.cause);\n this.args = options.args;\n this.command = options.command;\n this.environmentReason =\n options.environmentReason ?? classifyCommandEnvironmentReason(options.cause);\n this.exitCode = details.exitCode;\n this.reason = options.reason;\n this.stage = options.stage;\n this.stderr = details.stderr;\n this.stdout = details.stdout;\n this.unitName = options.unitName;\n this.unitPath = options.unitPath;\n }\n}\n\nexport class NotifySendError extends SystemdTsError {\n public readonly args: readonly string[] | undefined;\n public readonly command: string | undefined;\n public readonly environmentReason: SystemdCommandEnvironmentReason | undefined;\n public readonly exitCode: number | undefined;\n public readonly reason: NotifySendErrorReason | undefined;\n public readonly stage: string | undefined;\n public readonly stderr: string | undefined;\n public readonly stdout: string | undefined;\n\n public constructor(message: string, options: NotifySendErrorOptions = {}) {\n super(`SYSTEMD_TS_NOTIFY_SEND`, message, options);\n const details = extractCommandErrorDetails(options.cause);\n this.args = options.args;\n this.command = options.command;\n this.environmentReason =\n options.environmentReason ?? classifyCommandEnvironmentReason(options.cause);\n this.exitCode = details.exitCode;\n this.reason = options.reason;\n this.stage = options.stage;\n this.stderr = details.stderr;\n this.stdout = details.stdout;\n }\n}\n\nexport class SystemctlCommandError extends SystemdTsError {\n public readonly args: readonly string[] | undefined;\n public readonly command: string | undefined;\n public readonly environmentReason: SystemdCommandEnvironmentReason | undefined;\n public readonly exitCode: number | undefined;\n public readonly operation: string | undefined;\n public readonly reason: SystemctlCommandErrorReason | undefined;\n public readonly stage: string | undefined;\n public readonly stderr: string | undefined;\n public readonly stdout: string | undefined;\n\n public constructor(message: string, options: SystemctlCommandErrorOptions = {}) {\n super(`SYSTEMD_TS_SYSTEMCTL`, message, options);\n const details = extractCommandErrorDetails(options.cause);\n this.args = options.args;\n this.command = options.command;\n this.environmentReason =\n options.environmentReason ?? classifyCommandEnvironmentReason(options.cause);\n this.exitCode = details.exitCode;\n this.operation = options.operation;\n this.reason = options.reason;\n this.stage = options.stage;\n this.stderr = details.stderr;\n this.stdout = details.stdout;\n }\n}\n\nexport function classifyCommandEnvironmentReason(\n cause: unknown,\n): SystemdCommandEnvironmentReason | undefined {\n if (cause === null || typeof cause !== `object`) {\n return undefined;\n }\n\n const record = cause as Record<string, unknown>;\n if (record[`code`] === `ENOENT`) {\n return `missing-command`;\n }\n\n if (record[`code`] === `EACCES` || record[`code`] === `EPERM`) {\n return `permission-denied`;\n }\n\n const combinedOutput = [record[`stderr`], record[`stdout`]]\n .filter((value): value is string => typeof value === `string` && value.length > 0)\n .join(`\\n`);\n\n if (\n combinedOutput.includes(`Failed to connect to bus`) ||\n combinedOutput.includes(`System has not been booted with systemd`) ||\n combinedOutput.includes(`Failed to get D-Bus connection`)\n ) {\n return `manager-unavailable`;\n }\n\n return undefined;\n}\n\nexport function classifyMaterializationReason(\n cause: unknown,\n): UnitMaterializationErrorReason | undefined {\n if (cause === null || typeof cause !== `object`) {\n return undefined;\n }\n\n const record = cause as Record<string, unknown>;\n if (record[`code`] === `EACCES` || record[`code`] === `EPERM` || record[`code`] === `EROFS`) {\n return `permission-denied`;\n }\n\n if (record[`code`] === `EEXIST` || record[`code`] === `ENOTDIR` || record[`code`] === `EISDIR`) {\n return `invalid-unit-directory`;\n }\n\n return `file-system-failed`;\n}\n\nfunction extractCommandErrorDetails(cause: unknown): {\n readonly exitCode: number | undefined;\n readonly stderr: string | undefined;\n readonly stdout: string | undefined;\n} {\n if (cause === null || typeof cause !== `object`) {\n return {\n exitCode: undefined,\n stderr: undefined,\n stdout: undefined,\n };\n }\n\n const record = cause as Record<string, unknown>;\n return {\n exitCode: typeof record[`code`] === `number` ? record[`code`] : undefined,\n stderr: typeof record[`stderr`] === `string` ? record[`stderr`] : undefined,\n stdout: typeof record[`stdout`] === `string` ? record[`stdout`] : undefined,\n };\n}\n","import { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { ExecutableInferenceError } from \"./errors.ts\";\nimport type { Result } from \"./internal.ts\";\nimport type { ExecutableOptions } from \"./types.ts\";\n\nconst currentModulePath = fileURLToPath(import.meta.url);\n\n/**\n * An immutable description of a runnable module entrypoint that can be used in\n * executable-valued systemd unit directives.\n *\n * `Executable` captures three pieces of information:\n * - the absolute runtime binary that should launch the module\n * - the absolute path to the module itself\n * - any additional arguments that should be passed after the module path\n *\n * Most consumers will create one via {@link defineExecutable} and then pass it\n * into a {@link SystemdService} directive such as `ExecStart`, `ExecStop`, or\n * `ExecReload`.\n */\nexport class Executable {\n /** Additional arguments passed after the module path. */\n public readonly args: readonly string[];\n /** Inference issue captured when no explicit module path was provided. */\n public readonly inferenceError: ExecutableInferenceError | undefined;\n /** Absolute path to the module that should be executed. */\n public readonly modulePath: string;\n /** Absolute path to the runtime binary that should launch the module. */\n public readonly runtimeEntrypoint: string;\n\n /**\n * Creates an executable description.\n *\n * When `modulePath` is omitted, the calling module is inferred from the\n * current stack so `defineExecutable()` can be used inline from the module\n * that should become runnable.\n *\n * When `runtimeEntrypoint` is omitted, the current process executable is\n * used. This works well for the common case where the same runtime that is\n * evaluating your module should also be used by systemd.\n */\n public constructor(options: ExecutableOptions = {}) {\n this.runtimeEntrypoint = options.runtimeEntrypoint ?? process.execPath;\n const inferredModulePath = options.modulePath ?? tryInferCallerModulePath();\n this.inferenceError =\n inferredModulePath === undefined && options.modulePath === undefined\n ? new ExecutableInferenceError()\n : undefined;\n this.modulePath = inferredModulePath ?? ``;\n this.args = Object.freeze([...(options.args ?? [])]);\n Object.freeze(this);\n }\n\n /**\n * Returns the executable as raw command parts.\n *\n * The first element is always the runtime entrypoint, followed by the module\n * path and any configured arguments.\n */\n public toCommandParts(): Result<readonly [string, ...string[]], ExecutableInferenceError> {\n if (this.inferenceError !== undefined) {\n return {\n ok: false,\n error: this.inferenceError,\n };\n }\n\n return {\n ok: true,\n value: [this.runtimeEntrypoint, this.modulePath, ...this.args],\n };\n }\n\n /**\n * Renders the executable as a shell-quoted command string suitable for\n * executable-valued systemd directives such as `ExecStart=`.\n */\n public toExecStart(): Result<string, ExecutableInferenceError> {\n const commandParts = this.toCommandParts();\n if (!commandParts.ok) {\n return commandParts;\n }\n\n return {\n ok: true,\n value: commandParts.value.map(shellQuote).join(` `),\n };\n }\n}\n\n/**\n * Defines a module as a runnable executable and returns its immutable\n * `Executable` description.\n *\n * This helper is designed for the pattern:\n *\n * ```ts\n * export default defineExecutable(async () => {\n * // do work here\n * });\n * ```\n *\n * When the defining module is executed as the main entrypoint, `fn` is invoked.\n * When the module is merely imported, `fn` is not run and only the executable\n * description is returned.\n *\n * Pass `options.runtimeEntrypoint` to override the default runtime binary when\n * the current process is not the exact runtime you want systemd to use.\n */\nexport function defineExecutable(\n fn: () => void | Promise<void>,\n options: ExecutableOptions = {},\n): Executable {\n const executable = new Executable(options);\n\n if (executable.inferenceError === undefined && isMainModule(executable.modulePath)) {\n void Promise.resolve(fn()).catch((error: unknown) => {\n process.exitCode = 1;\n throw error;\n });\n }\n\n return executable;\n}\n\nfunction tryInferCallerModulePath(): string | undefined {\n const stack = new Error().stack ?? ``;\n for (const line of stack.split(`\\n`).slice(1)) {\n const candidate = extractStackPath(line);\n if (candidate === undefined || candidate === currentModulePath) {\n continue;\n }\n\n return candidate;\n }\n\n return undefined;\n}\n\nfunction extractStackPath(line: string): string | undefined {\n const fileUrlMatch = line.match(/(file:\\/\\/\\/[^)\\s:]+(?:\\.[cm]?[jt]s)?)/u);\n if (fileUrlMatch !== null) {\n return fileURLToPath(fileUrlMatch[1]);\n }\n\n const pathMatch = line.match(/(\\/[^)\\s:]+(?:\\.[cm]?[jt]s)?)/u);\n if (pathMatch !== null) {\n return pathMatch[1];\n }\n\n return undefined;\n}\n\nfunction isMainModule(modulePath: string): boolean {\n const mainArg = process.argv[1];\n if (mainArg === undefined) {\n return false;\n }\n\n return normalizeFilePath(mainArg) === normalizeFilePath(modulePath);\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(`'`, `'\\\\''`)}'`;\n}\n\nfunction normalizeFilePath(path: string): string {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n}\n","import { execFile } from \"node:child_process\";\nimport { access } from \"node:fs/promises\";\nimport { promisify } from \"node:util\";\n\nimport { ExecutableInferenceError, InvalidExecDirectiveError, NotifySendError } from \"./errors.ts\";\nimport { Executable } from \"./executable.ts\";\nimport type {\n CommandExecutionOptions,\n CommandOutput,\n NotifyOptions,\n SystemdServiceSection,\n StartStatus,\n SystemdServiceOptions,\n SystemdTimerOptions,\n UnitValue,\n} from \"./types.ts\";\n\nexport type Result<TValue, TError> =\n | {\n readonly ok: true;\n readonly value: TValue;\n }\n | {\n readonly ok: false;\n readonly error: TError;\n };\n\ntype ExecDirectiveKey = (typeof EXEC_DIRECTIVE_KEYS)[number];\n\nconst EXEC_DIRECTIVE_KEYS = [\n `ExecCondition`,\n `ExecReload`,\n `ExecReloadPost`,\n `ExecStart`,\n `ExecStartPost`,\n `ExecStartPre`,\n `ExecStop`,\n `ExecStopPost`,\n] as const;\nconst execFileAsync = promisify(execFile);\ntype SectionLike = object;\n\nexport function normalizeUnitName(name: string, suffix: `.service` | `.timer`): string {\n return name.endsWith(suffix) ? name.slice(0, -suffix.length) : name;\n}\n\nexport function resolveTimerTargetUnit(options: SystemdTimerOptions): string {\n const explicitTarget = options.timer[`Unit`];\n if (typeof explicitTarget === `string` && explicitTarget.length > 0) {\n return explicitTarget;\n }\n\n return `${normalizeUnitName(options.name, `.timer`)}.service`;\n}\n\nexport function defaultUnitDirForScope(scope: `system` | `user`): string {\n if (scope === `user`) {\n return `${process.env[`HOME`] ?? `~`}/.config/systemd/user`;\n }\n\n return `/etc/systemd/system`;\n}\n\nexport function freezeUnitOptions<TOptions extends SystemdServiceOptions | SystemdTimerOptions>(\n options: TOptions,\n): Readonly<TOptions> {\n return Object.freeze({\n ...options,\n ...(options.unit === undefined ? {} : { unit: cloneUnitSection(options.unit) }),\n ...(options.install === undefined ? {} : { install: cloneUnitSection(options.install) }),\n ...(hasServiceSection(options) ? { service: cloneUnitSection(options.service) } : {}),\n ...(hasTimerSection(options) ? { timer: cloneUnitSection(options.timer) } : {}),\n }) as Readonly<TOptions>;\n}\n\nexport function cloneUnitSection<TSection extends SectionLike | undefined>(\n section: TSection,\n): TSection {\n if (section === undefined) {\n return section;\n }\n\n const entries = Object.entries(section).map(([key, value]) => {\n if (isUnitValueList(value)) {\n return [key, Object.freeze([...value])] as const;\n }\n\n return [key, value] as const;\n });\n\n return Object.freeze(Object.fromEntries(entries)) as TSection;\n}\n\nexport function validateServiceSection(\n service: SystemdServiceSection,\n): Result<void, InvalidExecDirectiveError> {\n for (const key of EXEC_DIRECTIVE_KEYS) {\n const validation = assertAbsoluteExecValue(key, service[key]);\n if (!validation.ok) {\n return validation;\n }\n }\n\n return {\n ok: true,\n value: undefined,\n };\n}\n\nexport function parseStartStatus(unit: string, output: string): StartStatus {\n const properties = Object.fromEntries(\n output\n .split(`\\n`)\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .map((line) => {\n const separatorIndex = line.indexOf(`=`);\n if (separatorIndex === -1) {\n return [line, ``] as const;\n }\n\n return [line.slice(0, separatorIndex), line.slice(separatorIndex + 1)] as const;\n }),\n );\n\n return {\n activeState: properties[`ActiveState`] ?? `unknown`,\n execMainStatus:\n properties[`ExecMainStatus`] === undefined || properties[`ExecMainStatus`] === ``\n ? undefined\n : Number(properties[`ExecMainStatus`]),\n result: properties[`Result`] ?? `unknown`,\n subState: properties[`SubState`] ?? `unknown`,\n unit: properties[`Id`] ?? unit,\n };\n}\n\nexport function renderUnitFile(\n sections: ReadonlyArray<readonly [string, SectionLike | undefined]>,\n): Result<string, ExecutableInferenceError> {\n try {\n const renderedSections = sections\n .flatMap(([sectionName, section]) => {\n if (section === undefined) {\n return [];\n }\n\n const lines: string[] = [];\n for (const [key, value] of Object.entries(section as Record<string, unknown>)) {\n if (value === undefined) {\n continue;\n }\n\n if (isUnitValueList(value)) {\n for (const entry of value) {\n const rendered = stringifyUnitValue(entry);\n if (!rendered.ok) {\n throw rendered.error;\n }\n lines.push(`${key}=${rendered.value}`);\n }\n continue;\n }\n\n const rendered = stringifyUnitValue(value as UnitValue);\n if (!rendered.ok) {\n throw rendered.error;\n }\n lines.push(`${key}=${rendered.value}`);\n }\n\n if (lines.length === 0) {\n return [];\n }\n\n return [`[${sectionName}]`, ...lines, ``];\n })\n .join(`\\n`);\n\n return {\n ok: true,\n value: renderedSections.endsWith(`\\n`) ? renderedSections : `${renderedSections}\\n`,\n };\n } catch (error) {\n return {\n ok: false,\n error:\n error instanceof ExecutableInferenceError\n ? error\n : new ExecutableInferenceError({ cause: error }),\n };\n }\n}\n\nexport async function defaultCommandExecutor(\n command: string,\n args: readonly string[],\n options: CommandExecutionOptions = {},\n): Promise<CommandOutput> {\n const result = await execFileAsync(\n command,\n [...args],\n options.env === undefined ? {} : { env: { ...process.env, ...options.env } },\n );\n return {\n stderr: result.stderr,\n stdout: result.stdout,\n };\n}\n\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function sendNotify(\n state: `READY=1` | `WATCHDOG=1`,\n options: NotifyOptions,\n): Promise<void> {\n const args: string[] = [`--no-block`, state];\n if (options.pid !== undefined) {\n args.push(`MAINPID=${options.pid}`);\n }\n if (options.status !== undefined) {\n args.push(`STATUS=${options.status}`);\n }\n\n if (options.executor !== undefined) {\n try {\n await options.executor(\n `systemd-notify`,\n args,\n options.socketPath === undefined ? {} : { env: { NOTIFY_SOCKET: options.socketPath } },\n );\n } catch (cause) {\n throw new NotifySendError(\n `Failed to send systemd notification through the configured executor`,\n {\n args,\n cause,\n command: `systemd-notify`,\n reason: `executor-failed`,\n stage: `executor`,\n },\n );\n }\n return;\n }\n\n try {\n const result = await execFileAsync(`systemd-notify`, args, {\n env: {\n ...process.env,\n ...(options.socketPath === undefined ? {} : { NOTIFY_SOCKET: options.socketPath }),\n },\n });\n\n void result;\n } catch (cause) {\n throw new NotifySendError(`Failed to send systemd notification with systemd-notify`, {\n args,\n cause,\n command: `systemd-notify`,\n reason: `systemd-notify-failed`,\n stage: `systemd-notify`,\n });\n }\n}\n\nexport function extractCommandOutput(cause: unknown): CommandOutput | undefined {\n if (cause === null || typeof cause !== `object`) {\n return undefined;\n }\n\n const record = cause as Record<string, unknown>;\n const stdout = typeof record[`stdout`] === `string` ? record[`stdout`] : undefined;\n const stderr = typeof record[`stderr`] === `string` ? record[`stderr`] : undefined;\n if (stdout === undefined && stderr === undefined) {\n return undefined;\n }\n\n return {\n stderr: stderr ?? ``,\n stdout: stdout ?? ``,\n };\n}\n\nfunction hasServiceSection(\n options: SystemdServiceOptions | SystemdTimerOptions,\n): options is SystemdServiceOptions {\n return `service` in options;\n}\n\nfunction hasTimerSection(\n options: SystemdServiceOptions | SystemdTimerOptions,\n): options is SystemdTimerOptions {\n return `timer` in options;\n}\n\nfunction assertAbsoluteExecValue(\n key: ExecDirectiveKey,\n value: unknown,\n): Result<void, InvalidExecDirectiveError> {\n if (isUnitValueList(value)) {\n for (const entry of value) {\n const validation = assertAbsoluteExecEntry(key, entry);\n if (!validation.ok) {\n return validation;\n }\n }\n\n return {\n ok: true,\n value: undefined,\n };\n }\n\n return assertAbsoluteExecEntry(key, value as UnitValue | undefined);\n}\n\nfunction assertAbsoluteExecEntry(\n key: ExecDirectiveKey,\n value: UnitValue | undefined,\n): Result<void, InvalidExecDirectiveError> {\n if (typeof value === `string` && value.length > 0 && !isAbsoluteExecCommand(value)) {\n return {\n ok: false,\n error: new InvalidExecDirectiveError(key),\n };\n }\n\n if (value instanceof Executable && !value.runtimeEntrypoint.startsWith(`/`)) {\n return {\n ok: false,\n error: new InvalidExecDirectiveError(key),\n };\n }\n\n return {\n ok: true,\n value: undefined,\n };\n}\n\nfunction stringifyUnitValue(value: UnitValue): Result<string, ExecutableInferenceError> {\n if (value instanceof Executable) {\n return value.toExecStart();\n }\n\n if (typeof value === `boolean`) {\n return {\n ok: true,\n value: value ? `true` : `false`,\n };\n }\n\n return {\n ok: true,\n value: String(value),\n };\n}\n\nfunction isUnitValueList(value: unknown): value is readonly UnitValue[] {\n return Array.isArray(value);\n}\n\nfunction isAbsoluteExecCommand(value: string): boolean {\n let index = 0;\n let hasPrivilegePrefix = false;\n\n while (index < value.length) {\n const prefix = value[index];\n if (prefix === `@` || prefix === `-` || prefix === `:`) {\n index += 1;\n continue;\n }\n\n if (prefix === `+`) {\n if (hasPrivilegePrefix) {\n return false;\n }\n\n hasPrivilegePrefix = true;\n index += 1;\n continue;\n }\n\n if (prefix === `!`) {\n if (hasPrivilegePrefix) {\n return false;\n }\n\n hasPrivilegePrefix = true;\n index += value[index + 1] === `!` ? 2 : 1;\n continue;\n }\n\n break;\n }\n\n return value[index] === `/`;\n}\n","import { NotifySendError } from \"./errors.ts\";\nimport { sendNotify, type Result } from \"./internal.ts\";\nimport type { NotifyOptions } from \"./types.ts\";\n\n/**\n * Helpers for sending `sd_notify` state updates to systemd.\n *\n * These helpers send notification payloads to the socket identified by\n * `NOTIFY_SOCKET`, or to `options.socketPath` when one is provided explicitly.\n * They are useful both in real services and in tests that want to observe\n * readiness or watchdog traffic directly.\n *\n * Source:\n * - https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html\n * - https://www.freedesktop.org/software/systemd/man/latest/systemd-notify.html\n */\nexport const notify = {\n /**\n * Sends `READY=1` to systemd.\n *\n * Use this when a `Type=notify` service has completed its startup work and is\n * ready to be considered fully started. If `options.status` is provided, it is\n * sent as an additional `STATUS=...` field.\n *\n * With `Type=notify-reload`, the main process must catch or block its\n * `ReloadSignal=` (SIGHUP by default) before sending readiness. Since systemd\n * v262, startup fails if it does neither. Source: systemd v262, `systemd.service(5)`.\n */\n async ready(options: NotifyOptions = {}): Promise<Result<void, NotifySendError>> {\n try {\n await sendNotify(`READY=1`, options);\n return { ok: true, value: undefined };\n } catch (error) {\n return {\n ok: false,\n error:\n error instanceof NotifySendError\n ? error\n : new NotifySendError(`Failed to send READY=1 notification`, {\n cause: error,\n stage: `ready`,\n }),\n };\n }\n },\n\n /**\n * Sends `WATCHDOG=1` to systemd.\n *\n * Use this when a service configured with `WatchdogSec=` needs to emit a\n * watchdog heartbeat. If `options.pid` is provided, it is sent as\n * `MAINPID=...`, and `options.status` is forwarded as `STATUS=...`.\n */\n async watchdog(options: NotifyOptions = {}): Promise<Result<void, NotifySendError>> {\n try {\n await sendNotify(`WATCHDOG=1`, options);\n return { ok: true, value: undefined };\n } catch (error) {\n return {\n ok: false,\n error:\n error instanceof NotifySendError\n ? error\n : new NotifySendError(`Failed to send WATCHDOG=1 notification`, {\n cause: error,\n stage: `watchdog`,\n }),\n };\n }\n },\n};\n","import {\n cloneUnitSection,\n freezeUnitOptions,\n normalizeUnitName,\n renderUnitFile,\n validateServiceSection,\n} from \"./internal.ts\";\nimport type { ExecutableInferenceError, InvalidExecDirectiveError } from \"./errors.ts\";\nimport type { Result } from \"./internal.ts\";\nimport type {\n ExactSystemdServiceOptions,\n ServiceBaseName,\n ServiceFilename,\n SystemdServiceOptions,\n} from \"./types.ts\";\n\n/**\n * An immutable definition of a `.service` unit.\n *\n * `SystemdService` is a pure value object: it captures the intended unit name\n * and section contents, but it does not write files or talk to `systemd`\n * directly. Operational actions such as installation or startup belong on\n * {@link Systemd}.\n *\n * Source:\n * - https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html\n */\nexport class SystemdService<const TOptions extends SystemdServiceOptions = SystemdServiceOptions> {\n /** Optional `[Install]` section for enable-time relationships. */\n public readonly install: TOptions[`install`] | undefined;\n /** The normalized base unit name, without the `.service` suffix. */\n public readonly name: ServiceBaseName<TOptions[`name`]>;\n /** The fully frozen original options used to construct this service. */\n public readonly options: Readonly<TOptions>;\n /** The `[Service]` section payload. */\n public readonly service: TOptions[`service`];\n /** Optional `[Unit]` section metadata and dependency configuration. */\n public readonly unit: TOptions[`unit`] | undefined;\n\n /**\n * Creates an immutable service definition.\n *\n * The constructor preserves literal types where possible and rejects unknown\n * directive names within the provided sections, while still allowing custom\n * `X-...` extension directives.\n */\n public constructor(options: TOptions & ExactSystemdServiceOptions<TOptions>) {\n this.options = freezeUnitOptions(options as unknown as TOptions);\n this.name = normalizeUnitName(options.name, `.service`) as ServiceBaseName<TOptions[`name`]>;\n this.unit = cloneUnitSection(options.unit) as TOptions[`unit`] | undefined;\n this.service = (cloneUnitSection(options.service) ?? {}) as TOptions[`service`];\n this.install = cloneUnitSection(options.install) as TOptions[`install`] | undefined;\n Object.freeze(this);\n }\n\n /** The canonical unit filename, including the `.service` suffix. */\n public get filename(): ServiceFilename<TOptions[`name`]> {\n return `${this.name}.service` as ServiceFilename<TOptions[`name`]>;\n }\n\n /**\n * Renders the service as a complete unit file.\n *\n * Rendering also validates executable-valued directives such as `ExecStart`\n * and `ExecStop`, ensuring they use absolute runtime entrypoints as required\n * by systemd.\n */\n public render(): Result<string, ExecutableInferenceError | InvalidExecDirectiveError> {\n const validation = validateServiceSection(this.service);\n if (!validation.ok) {\n return validation;\n }\n\n return renderUnitFile([\n [`Unit`, this.unit],\n [`Service`, this.service],\n [`Install`, this.install],\n ]);\n }\n}\n","import {\n cloneUnitSection,\n freezeUnitOptions,\n normalizeUnitName,\n renderUnitFile,\n resolveTimerTargetUnit,\n} from \"./internal.ts\";\nimport type { ExecutableInferenceError } from \"./errors.ts\";\nimport type { Result } from \"./internal.ts\";\nimport type {\n ExactSystemdTimerOptions,\n SystemdTimerOptions,\n TimerBaseName,\n TimerFilename,\n TimerTargetServiceName,\n TimerTargetUnit,\n} from \"./types.ts\";\n\n/**\n * An immutable definition of a `.timer` unit.\n *\n * Like {@link SystemdService}, this is a pure value object. It models the timer\n * configuration and its attachment target, but does not write files or interact\n * with the service manager directly.\n *\n * Source:\n * - https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html\n */\nexport class SystemdTimer<const TOptions extends SystemdTimerOptions = SystemdTimerOptions> {\n /** Optional `[Install]` section for enable-time relationships. */\n public readonly install: TOptions[`install`] | undefined;\n /** The normalized base unit name, without the `.timer` suffix. */\n public readonly name: TimerBaseName<TOptions[`name`]>;\n /** The fully frozen original options used to construct this timer. */\n public readonly options: Readonly<TOptions>;\n /** The attached service basename inferred from `targetUnit`. */\n public readonly targetServiceName: TimerTargetServiceName<TOptions>;\n /** The unit name this timer activates, explicit or implicit. */\n public readonly targetUnit: TimerTargetUnit<TOptions>;\n /** The `[Timer]` section payload. */\n public readonly timer: TOptions[`timer`];\n /** Optional `[Unit]` section metadata and dependency configuration. */\n public readonly unit: TOptions[`unit`] | undefined;\n\n /**\n * Creates an immutable timer definition.\n *\n * If no explicit `timer.Unit` is provided, the target defaults to the service\n * with the same basename, matching systemd's native timer behavior.\n */\n public constructor(options: TOptions & ExactSystemdTimerOptions<TOptions>) {\n this.options = freezeUnitOptions(options as unknown as TOptions);\n this.name = normalizeUnitName(options.name, `.timer`) as TimerBaseName<TOptions[`name`]>;\n this.unit = cloneUnitSection(options.unit) as TOptions[`unit`] | undefined;\n this.timer = (cloneUnitSection(options.timer) ?? {}) as TOptions[`timer`];\n this.install = cloneUnitSection(options.install) as TOptions[`install`] | undefined;\n this.targetUnit = resolveTimerTargetUnit(\n options as unknown as TOptions,\n ) as TimerTargetUnit<TOptions>;\n this.targetServiceName = normalizeUnitName(\n this.targetUnit,\n `.service`,\n ) as TimerTargetServiceName<TOptions>;\n Object.freeze(this);\n }\n\n /** The canonical unit filename, including the `.timer` suffix. */\n public get filename(): TimerFilename<TOptions[`name`]> {\n return `${this.name}.timer` as TimerFilename<TOptions[`name`]>;\n }\n\n /** Renders the timer as a complete unit file. */\n public render(): Result<string, ExecutableInferenceError> {\n return renderUnitFile([\n [`Unit`, this.unit],\n [`Timer`, this.timer],\n [`Install`, this.install],\n ]);\n }\n}\n","import { defaultCommandExecutor, parseStartStatus } from \"./internal.ts\";\nimport { SystemctlCommandError } from \"./errors.ts\";\nimport type { Result } from \"./internal.ts\";\nimport type {\n SystemctlActiveState,\n CommandExecutor,\n CommandOutput,\n StartStatus,\n SystemctlEnablementState,\n SystemctlIsEnabledOptions,\n SystemctlIsSystemRunningOptions,\n SystemctlListTimersOptions,\n SystemctlOptions,\n SystemctlServiceStatus,\n SystemctlStateQueryOptions,\n SystemctlShowOptions,\n SystemctlStatusOptions,\n SystemctlSystemRunningState,\n SystemctlTimerListEntry,\n} from \"./types.ts\";\n\n/**\n * A TypeScript-first client for invoking `systemctl` with structured argument\n * vectors instead of shell-composed command strings.\n *\n * This lower-level primitive is useful both on its own and as the subprocess\n * transport underneath higher-level abstractions such as {@link Systemd}.\n */\nexport class Systemctl {\n /** Command executor used for `systemctl` subprocesses. */\n public readonly executor: CommandExecutor;\n /** The target manager scope, either `system` or `user`. */\n public readonly scope: `system` | `user`;\n\n public constructor(options: SystemctlOptions = {}) {\n this.scope = options.scope ?? `system`;\n this.executor = options.executor ?? defaultCommandExecutor;\n Object.freeze(this);\n }\n\n /** Reloads the targeted systemd manager. */\n public async daemonReload(): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`daemon-reload`);\n }\n\n /** Enables a unit by filename. */\n public async enable(unit: string): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`enable`, unit);\n }\n\n /** Disables a unit by filename. */\n public async disable(unit: string): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`disable`, unit);\n }\n\n /** Links a unit file path into the targeted manager. */\n public async link(path: string): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`link`, path);\n }\n\n /**\n * Checks the install-time enablement state of a unit file.\n *\n * Source:\n * - systemd v260.1, `systemctl(1)`\n */\n public async isEnabled(\n unit: string,\n options: SystemctlIsEnabledOptions = {},\n ): Promise<Result<SystemctlEnablementState, SystemctlCommandError>> {\n const output = await this.run(\n `is-enabled`,\n ...(options.full ? [`--full`] : []),\n ...(options.quiet ? [`--quiet`] : []),\n unit,\n );\n if (!output.ok) {\n return output;\n }\n return ok(firstNonEmptyOutputLine(output.value) as SystemctlEnablementState);\n }\n\n /**\n * Checks the runtime active state of a unit.\n *\n * Unless `quiet` is set, this returns the state string printed by\n * `systemctl is-active`.\n */\n public async isActive(\n unit: string,\n options: SystemctlStateQueryOptions = {},\n ): Promise<Result<SystemctlActiveState, SystemctlCommandError>> {\n const output = await this.run(`is-active`, ...(options.quiet ? [`--quiet`] : []), unit);\n if (!output.ok) {\n return output;\n }\n return ok(firstNonEmptyOutputLine(output.value) as SystemctlActiveState);\n }\n\n /**\n * Checks whether a unit is in the failed state.\n *\n * Unless `quiet` is set, this returns the state string printed by\n * `systemctl is-failed`.\n */\n public async isFailed(\n unit: string,\n options: SystemctlStateQueryOptions = {},\n ): Promise<Result<SystemctlActiveState, SystemctlCommandError>> {\n const output = await this.run(`is-failed`, ...(options.quiet ? [`--quiet`] : []), unit);\n if (!output.ok) {\n return output;\n }\n return ok(firstNonEmptyOutputLine(output.value) as SystemctlActiveState);\n }\n\n /**\n * Queries the overall manager state reported by `systemctl is-system-running`.\n *\n * Source:\n * - systemd v260.1, `systemctl(1)`\n */\n public async isSystemRunning(\n options: SystemctlIsSystemRunningOptions = {},\n ): Promise<Result<SystemctlSystemRunningState, SystemctlCommandError>> {\n const output = await this.run(`is-system-running`, ...(options.wait ? [`--wait`] : []));\n if (!output.ok) {\n return output;\n }\n return ok(firstNonEmptyOutputLine(output.value) as SystemctlSystemRunningState);\n }\n\n /**\n * Queries `systemctl show` for a unit.\n *\n * When `properties` are provided, only those properties are requested.\n */\n public async show(\n unit: string,\n options: SystemctlShowOptions = {},\n ): Promise<Result<CommandOutput, SystemctlCommandError>> {\n const propertyFlag =\n options.properties === undefined || options.properties.length === 0\n ? []\n : [`--property=${options.properties.join(`,`)}`];\n return this.run(`show`, unit, ...propertyFlag);\n }\n\n /**\n * Queries `systemctl show` and parses the result into a key-value object.\n *\n * Properties are returned exactly as printed by `systemctl show`.\n */\n public async showProperties(\n unit: string,\n options: SystemctlShowOptions = {},\n ): Promise<Result<Readonly<Record<string, string>>, SystemctlCommandError>> {\n const output = await this.show(unit, options);\n if (!output.ok) {\n return output;\n }\n return ok(parseSystemctlShowOutput(output.value.stdout));\n }\n\n /**\n * Queries the standard status-related `show` properties for a unit and\n * returns a parsed snapshot.\n */\n public async showStatus(unit: string): Promise<Result<StartStatus, SystemctlCommandError>> {\n return this.showServiceStatus(unit);\n }\n\n /**\n * Queries the standard service-status `show` properties for a service unit\n * and returns a parsed snapshot.\n */\n public async showServiceStatus(\n unit: string,\n ): Promise<Result<SystemctlServiceStatus, SystemctlCommandError>> {\n const output = await this.show(unit, {\n properties: [`Id`, `ActiveState`, `SubState`, `Result`, `ExecMainStatus`],\n });\n if (!output.ok) {\n return output;\n }\n return ok(parseStartStatus(unit, output.value.stdout));\n }\n\n /**\n * Queries `systemctl list-timers` and returns the observed JSON payload\n * shape directly, with raw integer timestamps left intact.\n */\n public async listTimers(\n options: SystemctlListTimersOptions = {},\n ): Promise<Result<readonly SystemctlTimerListEntry[], SystemctlCommandError>> {\n const args = [\n `list-timers`,\n ...(options.all ? [`--all`] : []),\n ...((options.noPager ?? true) ? [`--no-pager`] : []),\n `--output=json`,\n ...(options.patterns ?? []),\n ] as const;\n const output = await this.run(...args);\n if (!output.ok) {\n return output;\n }\n try {\n return ok(JSON.parse(output.value.stdout) as readonly SystemctlTimerListEntry[]);\n } catch (cause) {\n return err(\n new SystemctlCommandError(`Failed to parse JSON output from systemctl list-timers`, {\n args: [...this.scopeArgs(), ...args],\n cause,\n command: `systemctl`,\n operation: `list-timers`,\n reason: `invalid-json`,\n }),\n );\n }\n }\n\n /** Starts a unit by filename. */\n public async start(unit: string): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`start`, unit);\n }\n\n /** Stops a unit by filename. */\n public async stop(unit: string): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`stop`, unit);\n }\n\n /** Restarts a unit by filename. */\n public async restart(unit: string): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`restart`, unit);\n }\n\n /**\n * Resets the failed state for matching units, or for all units when no\n * patterns are provided.\n */\n public async resetFailed(\n patterns: readonly string[] = [],\n ): Promise<Result<CommandOutput, SystemctlCommandError>> {\n return this.run(`reset-failed`, ...patterns);\n }\n\n /**\n * Queries `systemctl status` for a unit.\n *\n * This is primarily a human-oriented command and is best paired with\n * `show()` when structured state is needed.\n */\n public async status(\n unit: string,\n options: SystemctlStatusOptions = {},\n ): Promise<Result<CommandOutput, SystemctlCommandError>> {\n const args = [`status`, unit] as string[];\n if (options.noPager ?? true) {\n args.push(`--no-pager`);\n }\n if (options.lines !== undefined) {\n args.push(`--lines`, String(options.lines));\n }\n\n return this.run(...args);\n }\n\n /** Executes a raw `systemctl` invocation with scope-aware arguments. */\n public async run(\n ...args: readonly string[]\n ): Promise<Result<CommandOutput, SystemctlCommandError>> {\n const scopedArgs = [...this.scopeArgs(), ...args];\n try {\n return ok(await this.executor(`systemctl`, scopedArgs));\n } catch (cause) {\n return err(\n new SystemctlCommandError(`Failed to run systemctl ${args[0] ?? `command`}`, {\n args: scopedArgs,\n cause,\n command: `systemctl`,\n operation: args[0],\n reason: `executor-failed`,\n }),\n );\n }\n }\n\n private scopeArgs(): readonly string[] {\n return this.scope === `user` ? [`--user`] : [];\n }\n}\n\nfunction ok<TValue>(value: TValue): Result<TValue, never> {\n return { ok: true, value };\n}\n\nfunction err<TError>(error: TError): Result<never, TError> {\n return { ok: false, error };\n}\n\nfunction parseSystemctlShowOutput(output: string): Readonly<Record<string, string>> {\n return Object.freeze(\n Object.fromEntries(\n output\n .split(`\\n`)\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .map((line) => {\n const separatorIndex = line.indexOf(`=`);\n if (separatorIndex === -1) {\n return [line, ``] as const;\n }\n\n return [line.slice(0, separatorIndex), line.slice(separatorIndex + 1)] as const;\n }),\n ),\n );\n}\n\nfunction firstNonEmptyOutputLine(output: CommandOutput): string {\n const line = [output.stdout, output.stderr]\n .flatMap((value) => value.split(`\\n`))\n .map((value) => value.trim())\n .find((value) => value.length > 0);\n return line ?? ``;\n}\n","import { mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport {\n defaultCommandExecutor,\n defaultUnitDirForScope,\n extractCommandOutput,\n fileExists,\n parseStartStatus,\n type Result,\n} from \"./internal.ts\";\nimport {\n classifyMaterializationReason,\n NoUnitsProvidedError,\n ExecutableInferenceError,\n InvalidExecDirectiveError,\n UnitEnableError,\n UnitLogsReadError,\n UnitMaterializationError,\n UnitStartError,\n} from \"./errors.ts\";\nimport { SystemdService } from \"./systemd-service.ts\";\nimport { Systemctl } from \"./systemctl.ts\";\nimport { SystemdTimer } from \"./systemd-timer.ts\";\nimport type {\n CommandExecutor,\n MaterializedUnit,\n LogsOptions,\n StartStatus,\n SystemdOptions,\n SystemdUnit,\n ValidInstallUnits,\n} from \"./types.ts\";\n\nexport interface SystemdTsAttachOptions {\n readonly owner: string;\n readonly enable?: boolean;\n readonly start?: boolean;\n}\n\nexport interface SystemdTsDetachOptions {\n readonly deleteUnitFiles?: boolean;\n readonly disable?: boolean;\n readonly stop?: boolean;\n}\n\nexport interface SystemdTsReattachOptions extends SystemdTsAttachOptions {\n readonly disableRemoved?: boolean;\n readonly prune?: boolean;\n readonly restartUpdated?: boolean;\n readonly stopRemoved?: boolean;\n}\n\nexport interface SystemdTsAttachmentSelector {\n readonly owner: string;\n}\n\nexport interface SystemdTsAttachmentResult {\n readonly added: readonly string[];\n readonly directory: string;\n readonly enabled: readonly string[];\n readonly manifestPath: string;\n readonly owner: string;\n readonly removed: readonly string[];\n readonly restarted: readonly string[];\n readonly started: readonly string[];\n readonly unchanged: readonly string[];\n readonly updated: readonly string[];\n}\n\ninterface AttachmentManifest {\n readonly owner: string;\n readonly units: readonly {\n readonly filename: string;\n readonly path: string;\n }[];\n readonly version: 1;\n}\n\n/**\n * A successful systemd unit materialization.\n *\n * It records the target directory and the on-disk path associated with each\n * materialized unit.\n */\nexport class SystemdMaterialization<\n TUnits extends readonly SystemdUnit[] = readonly SystemdUnit[],\n> {\n /** The directory units were written into. */\n public readonly directory: string;\n /** The materialized units together with their resolved on-disk paths. */\n public readonly materialized: readonly MaterializedUnit<TUnits[number]>[];\n\n public constructor(directory: string, materialized: readonly MaterializedUnit<TUnits[number]>[]) {\n this.directory = directory;\n this.materialized = Object.freeze([...materialized]);\n Object.freeze(this);\n }\n}\n\n/**\n * A configured interface to a specific systemd environment.\n *\n * `Systemd` combines unit-file materialization with a command execution\n * strategy. It knows which scope it is targeting, where unit files should be\n * written, and how `systemctl` should be invoked.\n *\n * This abstraction is intentionally close to `systemctl` concepts while still\n * accepting full unit definitions instead of loose unit-name strings.\n */\nexport class Systemd {\n /** Command executor used for `systemctl` and related subprocess calls. */\n public readonly executor: CommandExecutor;\n /** Whether units should be linked into systemd before manager operations. */\n public readonly linkUnits: boolean;\n /** The target manager scope, either `system` or `user`. */\n public readonly scope: `system` | `user`;\n /** The low-level `systemctl` client for this configured target. */\n public readonly systemctl: Systemctl;\n /** Higher-level `systemd-ts` upkeep helpers for application-owned units. */\n public readonly ts: SystemdTs;\n /** The directory used when materializing unit files. */\n public readonly unitDir: string;\n\n /**\n * Creates a configured `Systemd` facade.\n *\n * By default, this targets the system scope and `/etc/systemd/system`. Use\n * `scope: \"user\"` or an explicit `unitDir` to target a different manager or\n * unit-file location.\n */\n public constructor(options: SystemdOptions = {}) {\n this.scope = options.scope ?? `system`;\n this.unitDir = options.unitDir ?? defaultUnitDirForScope(this.scope);\n this.linkUnits = options.linkUnits ?? false;\n this.executor = options.executor ?? defaultCommandExecutor;\n this.systemctl = new Systemctl({\n executor: this.executor,\n scope: this.scope,\n });\n this.ts = new SystemdTs(this);\n Object.freeze(this);\n }\n\n /**\n * Renders and writes one or more units into this instance's `unitDir`.\n *\n * This is intentionally a file-materialization step. It does not enable or\n * start the units on its own.\n */\n public async materialize<const TUnits extends readonly SystemdUnit[]>(\n ...units: TUnits & ValidInstallUnits<TUnits>\n ): Promise<\n Result<\n SystemdMaterialization<TUnits>,\n | ExecutableInferenceError\n | InvalidExecDirectiveError\n | NoUnitsProvidedError\n | UnitMaterializationError\n >\n > {\n return this.materializeUnits(units);\n }\n\n /**\n * Enables one or more units via `systemctl enable`.\n *\n * When `linkUnits` is enabled, this first links materialized unit files into the\n * target manager and reloads systemd so the units are visible before the\n * enable operation runs.\n */\n public async enable(\n ...units: readonly SystemdUnit[]\n ): Promise<Result<void, NoUnitsProvidedError | UnitEnableError>> {\n if (units.length === 0) {\n return err(new NoUnitsProvidedError(`Systemd.enable()`));\n }\n\n const scopeArgs = this.scopeArgs();\n try {\n await this.prepareUnits(scopeArgs, units, `enable`);\n } catch (cause) {\n if (cause instanceof UnitEnableError) {\n return err(cause);\n }\n\n return err(\n new UnitEnableError(`Failed to prepare units for enable`, {\n cause,\n stage: `prepare`,\n unitName: units[0]?.filename,\n }),\n );\n }\n\n for (const unit of units) {\n const args = [...scopeArgs, `enable`, unit.filename] as const;\n const enabled = await this.systemctl.enable(unit.filename);\n if (!enabled.ok) {\n const errorOptions = {\n args,\n cause: enabled.error,\n command: `systemctl`,\n stage: `enable`,\n unitName: unit.filename,\n ...(enabled.error.environmentReason === undefined\n ? {}\n : { environmentReason: enabled.error.environmentReason }),\n };\n return err(new UnitEnableError(`Failed to enable ${unit.filename}`, errorOptions));\n }\n }\n\n return ok(undefined);\n }\n\n /**\n * Starts a unit and returns a parsed `systemctl show` snapshot of its final\n * observed state.\n *\n * For oneshot services, a successful result commonly means `ActiveState` is\n * already back to `inactive` by the time the status snapshot is collected.\n */\n public async start(unit: SystemdUnit): Promise<Result<StartStatus, UnitStartError>> {\n const scopeArgs = this.scopeArgs();\n try {\n await this.prepareUnits(scopeArgs, [unit], `start`);\n } catch (cause) {\n if (cause instanceof UnitStartError) {\n return err(cause);\n }\n\n return err(\n new UnitStartError(`Failed to prepare ${unit.filename} for start`, {\n cause,\n diagnostics: await this.collectStartDiagnostics(scopeArgs, unit.filename),\n stage: `prepare`,\n unitName: unit.filename,\n }),\n );\n }\n\n const startArgs = [...scopeArgs, `start`, unit.filename] as const;\n const started = await this.systemctl.start(unit.filename);\n if (!started.ok) {\n const errorOptions = {\n args: startArgs,\n cause: started.error,\n command: `systemctl`,\n diagnostics: await this.collectStartDiagnostics(scopeArgs, unit.filename),\n stage: `start`,\n unitName: unit.filename,\n ...(started.error.environmentReason === undefined\n ? {}\n : { environmentReason: started.error.environmentReason }),\n };\n return err(new UnitStartError(`Failed to start ${unit.filename}`, errorOptions));\n }\n\n const status = await this.systemctl.showServiceStatus(unit.filename);\n if (!status.ok) {\n const errorOptions = {\n args: [\n ...scopeArgs,\n `show`,\n unit.filename,\n `--property=Id,ActiveState,SubState,Result,ExecMainStatus`,\n ] as const,\n cause: status.error,\n command: `systemctl`,\n diagnostics: await this.collectStartDiagnostics(scopeArgs, unit.filename),\n stage: `show-status`,\n unitName: unit.filename,\n ...(status.error.environmentReason === undefined\n ? {}\n : { environmentReason: status.error.environmentReason }),\n };\n return err(\n new UnitStartError(`Started ${unit.filename} but failed to query its status`, errorOptions),\n );\n }\n return ok(status.value);\n }\n\n /**\n * Reads recent output for a managed unit.\n *\n * If the unit is configured with file-backed `StandardOutput` or\n * `StandardError`, this reads directly from that file. Otherwise it falls back\n * to `systemctl status --lines ...`.\n */\n public async logs(\n unit: SystemdUnit,\n options?: LogsOptions,\n ): Promise<Result<string, UnitLogsReadError>> {\n const fileLogPath = resolveUnitLogPath(unit);\n if (fileLogPath !== undefined) {\n try {\n const output = await readFile(fileLogPath, `utf8`);\n return ok(tailLines(output, options?.lines ?? 50));\n } catch (cause) {\n return err(\n new UnitLogsReadError(`Failed to read logs for ${unit.filename} from ${fileLogPath}`, {\n cause,\n reason: isMissingPathError(cause) ? `missing-log-file` : `log-file-read-failed`,\n stage: `read-log-file`,\n unitName: unit.filename,\n unitPath: fileLogPath,\n }),\n );\n }\n }\n\n const scopeArgs = this.scopeArgs();\n const lines = options?.lines ?? 50;\n const logs = await this.systemctl.status(unit.filename, {\n lines,\n });\n if (logs.ok) {\n return ok(joinCommandOutput(logs.value));\n }\n\n const errorOutput = extractCommandOutput(logs.error);\n if (errorOutput !== undefined) {\n return ok(joinCommandOutput(errorOutput));\n }\n\n const args = [\n ...scopeArgs,\n `status`,\n unit.filename,\n `--no-pager`,\n `--lines`,\n String(lines),\n ] as const;\n return err(\n new UnitLogsReadError(`Failed to query logs for ${unit.filename} from systemctl status`, {\n args,\n cause: logs.error,\n command: `systemctl`,\n reason: `status-command-failed`,\n stage: `status`,\n unitName: unit.filename,\n }),\n );\n }\n\n /** Returns the on-disk unit-file path this instance uses for the given unit. */\n public pathFor(unit: SystemdUnit): string {\n return join(this.unitDir, unit.filename);\n }\n\n private async prepareUnits(\n scopeArgs: readonly string[],\n units: readonly SystemdUnit[],\n operation: `enable` | `start`,\n ): Promise<void> {\n if (this.linkUnits) {\n const linkPaths = await this.collectLinkPaths(units);\n for (const path of linkPaths) {\n const args = [...scopeArgs, `link`, path] as const;\n const linked = await this.systemctl.link(path);\n if (!linked.ok) {\n const linkedUnit = units.find((candidate) => this.pathFor(candidate) === path);\n const errorContext = {\n args,\n cause: linked.error,\n command: `systemctl`,\n stage: `link`,\n unitPath: path,\n ...(linked.error.environmentReason === undefined\n ? {}\n : { environmentReason: linked.error.environmentReason }),\n ...(linkedUnit === undefined ? {} : { unitName: linkedUnit.filename }),\n };\n throw operation === `enable`\n ? new UnitEnableError(`Failed to link ${path} before enable`, errorContext)\n : new UnitStartError(`Failed to link ${path} before start`, errorContext);\n }\n }\n }\n\n const args = [...scopeArgs, `daemon-reload`] as const;\n const reloaded = await this.systemctl.daemonReload();\n if (!reloaded.ok) {\n const errorContext = {\n args,\n cause: reloaded.error,\n command: `systemctl`,\n stage: `daemon-reload`,\n ...(reloaded.error.environmentReason === undefined\n ? {}\n : { environmentReason: reloaded.error.environmentReason }),\n ...(units[0]?.filename === undefined ? {} : { unitName: units[0].filename }),\n };\n throw operation === `enable`\n ? new UnitEnableError(`Failed to reload systemd before enable`, errorContext)\n : new UnitStartError(`Failed to reload systemd before start`, errorContext);\n }\n }\n\n private scopeArgs(): readonly string[] {\n return this.scope === `user` ? [`--user`] : [];\n }\n\n private async collectStartDiagnostics(\n scopeArgs: readonly string[],\n unitName: string,\n ): Promise<{\n readonly showOutput?: string;\n readonly showStatus?: StartStatus;\n readonly statusOutput?: string;\n }> {\n const diagnostics: {\n showOutput?: string;\n showStatus?: StartStatus;\n statusOutput?: string;\n } = {};\n\n const showArgs = [\n ...scopeArgs,\n `show`,\n unitName,\n `--property=Id,ActiveState,SubState,Result,ExecMainStatus`,\n ] as const;\n const show = await this.tryBestEffortCommand(`systemctl`, showArgs);\n if (show !== undefined) {\n const showOutput = joinCommandOutput(show);\n if (showOutput.length > 0) {\n diagnostics.showOutput = showOutput;\n }\n if (show.stdout.length > 0) {\n diagnostics.showStatus = parseStartStatus(unitName, show.stdout);\n }\n }\n\n const statusArgs = [...scopeArgs, `status`, unitName, `--no-pager`, `--lines`, `20`] as const;\n const status = await this.tryBestEffortCommand(`systemctl`, statusArgs);\n if (status !== undefined) {\n const statusOutput = joinCommandOutput(status);\n if (statusOutput.length > 0) {\n diagnostics.statusOutput = statusOutput;\n }\n }\n\n return diagnostics;\n }\n\n private async collectLinkPaths(units: readonly SystemdUnit[]): Promise<readonly string[]> {\n const paths = new Set<string>();\n\n for (const unit of units) {\n paths.add(this.pathFor(unit));\n\n if (unit instanceof SystemdTimer) {\n const targetPath = join(this.unitDir, unit.targetUnit);\n if (await fileExists(targetPath)) {\n paths.add(targetPath);\n }\n }\n }\n\n return [...paths];\n }\n\n private async materializeUnits<const TUnits extends readonly SystemdUnit[]>(\n units: TUnits & ValidInstallUnits<TUnits>,\n ): Promise<\n Result<\n SystemdMaterialization<TUnits>,\n | ExecutableInferenceError\n | InvalidExecDirectiveError\n | NoUnitsProvidedError\n | UnitMaterializationError\n >\n > {\n if (units.length === 0) {\n return err(new NoUnitsProvidedError(`Systemd.materialize()`));\n }\n\n try {\n await writeUnitDirectory(this.unitDir);\n } catch (cause) {\n const reason = classifyMaterializationReason(cause);\n return err(\n new UnitMaterializationError(`Failed to create unit directory ${this.unitDir}`, {\n cause,\n operation: `create-directory`,\n ...(reason === undefined ? {} : { reason }),\n unitPath: this.unitDir,\n }),\n );\n }\n\n const materialized: MaterializedUnit<TUnits[number]>[] = [];\n for (const unit of units) {\n const path = join(this.unitDir, unit.filename);\n const rendered = unit.render();\n if (!rendered.ok) {\n return err(rendered.error);\n }\n try {\n await writeFile(path, rendered.value, `utf8`);\n } catch (cause) {\n if (cause instanceof InvalidExecDirectiveError) {\n return err(cause);\n }\n\n const reason = classifyMaterializationReason(cause);\n return err(\n new UnitMaterializationError(`Failed to materialize ${unit.filename} into ${path}`, {\n cause,\n operation: `write-file`,\n ...(reason === undefined ? {} : { reason }),\n unitName: unit.filename,\n unitPath: path,\n }),\n );\n }\n materialized.push({ path, unit });\n }\n\n return ok(new SystemdMaterialization<TUnits>(this.unitDir, materialized));\n }\n\n private async tryBestEffortCommand(\n command: string,\n args: readonly string[],\n ): Promise<\n | {\n readonly stderr: string;\n readonly stdout: string;\n }\n | undefined\n > {\n try {\n return await this.executor(command, args);\n } catch (cause) {\n const output = extractCommandOutput(cause);\n if (output !== undefined) {\n return output;\n }\n return undefined;\n }\n }\n}\n\n/**\n * Opinionated `systemd-ts` upkeep helpers for application-owned units.\n *\n * This layer is intentionally analogous to a subset of `portablectl`'s\n * ownership workflow, but it operates on regular materialized units instead of\n * portable service images.\n */\nexport class SystemdTs {\n private readonly systemd: Systemd;\n\n public constructor(systemd: Systemd) {\n this.systemd = systemd;\n Object.freeze(this);\n }\n\n public async attach(\n units: readonly SystemdUnit[],\n options: SystemdTsAttachOptions,\n ): Promise<\n Result<\n SystemdTsAttachmentResult,\n | ExecutableInferenceError\n | InvalidExecDirectiveError\n | NoUnitsProvidedError\n | UnitEnableError\n | UnitMaterializationError\n | UnitStartError\n >\n > {\n if (units.length === 0) {\n return err(new NoUnitsProvidedError(`Systemd.ts.attach()`));\n }\n\n const described = await this.describeUnits(units);\n if (!described.ok) {\n return described;\n }\n\n const manifestPath = this.manifestPathFor(options.owner);\n const prior = await this.readManifest(options.owner);\n const diff = await this.diffManifest(prior, described.value);\n const materialized = await this.systemd.materialize(...(units as readonly SystemdUnit[]));\n if (!materialized.ok) {\n return materialized;\n }\n\n const enabled: string[] = [];\n if (options.enable ?? false) {\n const result = await this.systemd.enable(...units);\n if (!result.ok) {\n return result;\n }\n enabled.push(...units.map((unit) => unit.filename));\n }\n\n const started: string[] = [];\n if (options.start ?? false) {\n for (const unit of units) {\n const result = await this.systemd.start(unit);\n if (!result.ok) {\n return result;\n }\n started.push(unit.filename);\n }\n }\n\n await this.writeManifest(options.owner, described.value);\n\n return ok({\n added: diff.added,\n directory: this.systemd.unitDir,\n enabled,\n manifestPath,\n owner: options.owner,\n removed: diff.removed,\n restarted: [],\n started,\n unchanged: diff.unchanged,\n updated: diff.updated,\n });\n }\n\n public async detach(\n selector: SystemdTsAttachmentSelector,\n options: SystemdTsDetachOptions = {},\n ): Promise<\n Result<\n {\n readonly deleted: readonly string[];\n readonly detached: readonly string[];\n readonly disabled: readonly string[];\n readonly owner: string;\n readonly stopped: readonly string[];\n },\n Error\n >\n > {\n const manifest = await this.readManifest(selector.owner);\n if (manifest === undefined) {\n return ok({\n deleted: [],\n detached: [],\n disabled: [],\n owner: selector.owner,\n stopped: [],\n });\n }\n\n const filenames = manifest.units.map((unit) => unit.filename);\n const deleted: string[] = [];\n const disabled: string[] = [];\n const stopped: string[] = [];\n\n if (options.stop ?? true) {\n await this.runSystemctl(`stop`, filenames);\n stopped.push(...filenames);\n }\n if (options.disable ?? true) {\n await this.runSystemctl(`disable`, filenames);\n disabled.push(...filenames);\n }\n if (options.deleteUnitFiles ?? true) {\n for (const unit of manifest.units) {\n await this.removeManagedUnitPath(unit.path);\n await rm(unit.path, { force: true });\n deleted.push(unit.filename);\n }\n await this.runSystemctl(`daemon-reload`);\n }\n\n await rm(this.manifestPathFor(selector.owner), { force: true });\n\n return ok({\n deleted,\n detached: filenames,\n disabled,\n owner: selector.owner,\n stopped,\n });\n }\n\n public async reattach(\n units: readonly SystemdUnit[],\n options: SystemdTsReattachOptions,\n ): Promise<\n Result<\n SystemdTsAttachmentResult,\n | ExecutableInferenceError\n | InvalidExecDirectiveError\n | NoUnitsProvidedError\n | UnitEnableError\n | UnitMaterializationError\n | UnitStartError\n | Error\n >\n > {\n if (units.length === 0) {\n return err(new NoUnitsProvidedError(`Systemd.ts.reattach()`));\n }\n\n const described = await this.describeUnits(units);\n if (!described.ok) {\n return described;\n }\n\n const manifestPath = this.manifestPathFor(options.owner);\n const prior = await this.readManifest(options.owner);\n const diff = await this.diffManifest(prior, described.value);\n\n if ((options.stopRemoved ?? true) && diff.removed.length > 0) {\n await this.runSystemctl(`stop`, diff.removed);\n }\n if ((options.disableRemoved ?? true) && diff.removed.length > 0) {\n await this.runSystemctl(`disable`, diff.removed);\n }\n if ((options.prune ?? true) && prior !== undefined) {\n for (const unit of prior.units) {\n if (!diff.removed.includes(unit.filename)) {\n continue;\n }\n await this.removeManagedUnitPath(unit.path);\n await rm(unit.path, { force: true });\n }\n if (diff.removed.length > 0) {\n await this.runSystemctl(`daemon-reload`);\n }\n }\n\n const materialized = await this.systemd.materialize(...(units as readonly SystemdUnit[]));\n if (!materialized.ok) {\n return materialized;\n }\n\n const enabled: string[] = [];\n if (options.enable ?? false) {\n const result = await this.systemd.enable(...units);\n if (!result.ok) {\n return result;\n }\n enabled.push(...units.map((unit) => unit.filename));\n }\n\n const restarted: string[] = [];\n if (options.restartUpdated ?? false) {\n const restartable = units\n .filter((unit) => diff.updated.includes(unit.filename))\n .map((unit) => unit.filename);\n if (restartable.length > 0) {\n await this.runSystemctl(`restart`, restartable);\n restarted.push(...restartable);\n }\n }\n\n const started: string[] = [];\n if (options.start ?? false) {\n for (const unit of units) {\n if (restarted.includes(unit.filename)) {\n continue;\n }\n const result = await this.systemd.start(unit);\n if (!result.ok) {\n return result;\n }\n started.push(unit.filename);\n }\n }\n\n await this.writeManifest(options.owner, described.value);\n\n return ok({\n added: diff.added,\n directory: this.systemd.unitDir,\n enabled,\n manifestPath,\n owner: options.owner,\n removed: diff.removed,\n restarted,\n started,\n unchanged: diff.unchanged,\n updated: diff.updated,\n });\n }\n\n private async describeUnits(units: readonly SystemdUnit[]): Promise<\n Result<\n readonly {\n readonly filename: string;\n readonly path: string;\n readonly rendered: string;\n }[],\n ExecutableInferenceError | InvalidExecDirectiveError\n >\n > {\n const described = [];\n for (const unit of units) {\n const rendered = unit.render();\n if (!rendered.ok) {\n return rendered;\n }\n described.push({\n filename: unit.filename,\n path: this.systemd.pathFor(unit),\n rendered: rendered.value,\n });\n }\n\n return ok(described);\n }\n\n private async diffManifest(\n prior: AttachmentManifest | undefined,\n desired: readonly {\n readonly filename: string;\n readonly path: string;\n readonly rendered: string;\n }[],\n ): Promise<{\n readonly added: readonly string[];\n readonly removed: readonly string[];\n readonly unchanged: readonly string[];\n readonly updated: readonly string[];\n }> {\n const priorUnits = new Map(prior?.units.map((unit) => [unit.filename, unit.path]) ?? []);\n const desiredNames = new Set(desired.map((unit) => unit.filename));\n const added: string[] = [];\n const removed = [...priorUnits.keys()].filter((filename) => !desiredNames.has(filename));\n const unchanged: string[] = [];\n const updated: string[] = [];\n\n for (const unit of desired) {\n const priorPath = priorUnits.get(unit.filename);\n if (priorPath === undefined) {\n added.push(unit.filename);\n continue;\n }\n\n try {\n const current = await readFile(priorPath, `utf8`);\n if (current === unit.rendered) {\n unchanged.push(unit.filename);\n continue;\n }\n } catch {\n added.push(unit.filename);\n continue;\n }\n\n updated.push(unit.filename);\n }\n\n return {\n added,\n removed,\n unchanged,\n updated,\n };\n }\n\n private async manifestDir(): Promise<string> {\n const directory = join(this.systemd.unitDir, `.systemd-ts`);\n await mkdir(directory, { recursive: true });\n return directory;\n }\n\n private manifestPathFor(owner: string): string {\n return join(this.systemd.unitDir, `.systemd-ts`, `${encodeURIComponent(owner)}.json`);\n }\n\n private async readManifest(owner: string): Promise<AttachmentManifest | undefined> {\n try {\n const content = await readFile(this.manifestPathFor(owner), `utf8`);\n return JSON.parse(content) as AttachmentManifest;\n } catch {\n return undefined;\n }\n }\n\n private async runSystemctl(action: string, units: readonly string[] = []): Promise<void> {\n const args =\n action === `daemon-reload`\n ? [...this.scopeArgs(), action]\n : [...this.scopeArgs(), action, ...units];\n await this.systemd.executor(`systemctl`, args);\n }\n\n private async removeManagedUnitPath(path: string): Promise<void> {\n await this.systemd.executor(`rm`, [`-f`, path]);\n }\n\n private scopeArgs(): readonly string[] {\n return this.systemd.scope === `user` ? [`--user`] : [];\n }\n\n private async writeManifest(\n owner: string,\n units: readonly {\n readonly filename: string;\n readonly path: string;\n readonly rendered: string;\n }[],\n ): Promise<void> {\n await this.manifestDir();\n const manifest: AttachmentManifest = {\n owner,\n units: units.map((unit) => ({\n filename: unit.filename,\n path: unit.path,\n })),\n version: 1,\n };\n await writeFile(this.manifestPathFor(owner), JSON.stringify(manifest, null, 2), `utf8`);\n }\n}\n\nfunction ok<TValue>(value: TValue): Result<TValue, never> {\n return { ok: true, value };\n}\n\nfunction err<TError>(error: TError): Result<never, TError> {\n return { ok: false, error };\n}\n\nfunction joinCommandOutput(output: { readonly stderr: string; readonly stdout: string }): string {\n return [output.stdout, output.stderr].filter((value) => value.length > 0).join(`\\n`);\n}\n\nlet lazyDefaultSystemd: Systemd | undefined;\n\n/**\n * Returns the lazily created default `Systemd` instance.\n *\n * The default instance uses the library defaults for scope, unit directory, and\n * command execution.\n */\nexport function defaultSystemd(): Systemd {\n lazyDefaultSystemd ??= new Systemd();\n return lazyDefaultSystemd;\n}\n\nfunction resolveUnitLogPath(unit: SystemdUnit): string | undefined {\n if (!(unit instanceof SystemdService)) {\n return undefined;\n }\n\n for (const key of [`StandardOutput`, `StandardError`] as const) {\n const value = unit.service[key];\n if (typeof value !== `string`) {\n continue;\n }\n\n const path = parseFileLogPath(value);\n if (path !== undefined) {\n return path;\n }\n }\n\n return undefined;\n}\n\nfunction parseFileLogPath(value: string): string | undefined {\n for (const prefix of [`append:`, `file:`] as const) {\n if (value.startsWith(prefix)) {\n return value.slice(prefix.length);\n }\n }\n\n return undefined;\n}\n\nfunction tailLines(output: string, lines: number): string {\n return output.split(`\\n`).slice(-lines).join(`\\n`);\n}\n\nfunction isMissingPathError(cause: unknown): boolean {\n if (cause === null || typeof cause !== `object`) {\n return false;\n }\n\n return (cause as Record<string, unknown>)[`code`] === `ENOENT`;\n}\n\nasync function writeUnitDirectory(path: string): Promise<void> {\n await mkdir(path, { recursive: true });\n}\n","export {\n ExecutableInferenceError,\n InvalidExecDirectiveError,\n NoUnitsProvidedError,\n NotifySendError,\n SystemctlCommandError,\n SystemdTsError,\n UnitEnableError,\n UnitLogsReadError,\n UnitMaterializationError,\n UnitStartError,\n} from \"./errors.ts\";\nexport { Executable, defineExecutable } from \"./executable.ts\";\nexport { notify } from \"./notify.ts\";\nexport { SystemdService } from \"./systemd-service.ts\";\nexport { SystemdTimer } from \"./systemd-timer.ts\";\nexport { Systemctl } from \"./systemctl.ts\";\nexport { Systemd, SystemdMaterialization, SystemdTs, defaultSystemd } from \"./systemd.ts\";\nexport type {\n SystemdTsAttachmentSelector,\n SystemdTsAttachOptions,\n SystemdTsAttachmentResult,\n SystemdTsDetachOptions,\n SystemdTsReattachOptions,\n} from \"./systemd.ts\";\nexport type { Result } from \"./internal.ts\";\nexport type {\n AnySystemdService,\n AnySystemdTimer,\n CommandExecutionOptions,\n CommandExecutor,\n CommandOutput,\n ExecutableOptions,\n MaterializedUnit,\n LogsOptions,\n NotifyOptions,\n ServiceBaseName,\n ServiceFilename,\n StartStatus,\n SystemdOptions,\n SystemdServiceOptions,\n SystemctlActiveState,\n SystemctlEnablementState,\n SystemctlIsEnabledOptions,\n SystemctlIsSystemRunningOptions,\n SystemctlListTimersOptions,\n SystemctlOptions,\n SystemctlServiceStatus,\n SystemctlSystemRunningState,\n SystemctlStateQueryOptions,\n SystemctlShowOptions,\n SystemctlStatusOptions,\n SystemctlTimerListEntry,\n SystemdTimerOptions,\n SystemdUnit,\n TimerBaseName,\n TimerFilename,\n TimerTargetServiceName,\n TimerTargetUnit,\n UnitValue,\n ValidInstallUnits,\n} from \"./types.ts\";\nexport type {\n NotifySendErrorReason,\n SystemctlCommandErrorReason,\n SystemdCommandEnvironmentReason,\n UnitLogsReadErrorReason,\n UnitMaterializationErrorReason,\n} from \"./errors.ts\";\n\nimport * as I from \"./internal.ts\";\n/**\n * Internal helpers are exposed for advanced use, but they are not a stable public API.\n * Expect breaking changes here outside the package's normal compatibility guarantees.\n */\nexport const Internal: typeof I = I;\n"],"mappings":";;;;;;;;AA4EA,IAAa,iBAAb,cAAoC,MAAM;CACxC;CAEA,YACE,MACA,SACA,UAAiC,CAAC,GAClC;EACA,MAAM,SAAS,EAAE,OAAO,QAAQ,MAAM,CAAC;EACvC,KAAK,OAA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