systemd-ts 0.0.0 → 0.1.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/chunk-CfYAbeIz.mjs +13 -0
- package/dist/index.d.mts +755 -39
- package/dist/index.mjs +469 -189
- package/dist/test.d.mts +2 -2
- package/dist/test.mjs +3 -3
- package/package.json +15 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,19 +1,580 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/main/systemd-service.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* An immutable definition of a `.service` unit.
|
|
4
|
+
*
|
|
5
|
+
* `SystemdService` is a pure value object: it captures the intended unit name
|
|
6
|
+
* and section contents, but it does not write files or talk to `systemd`
|
|
7
|
+
* directly. Operational actions such as installation or startup belong on
|
|
8
|
+
* {@link Systemd}.
|
|
9
|
+
*
|
|
10
|
+
* Source:
|
|
11
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html
|
|
12
|
+
*/
|
|
13
|
+
declare class SystemdService<const TOptions extends SystemdServiceOptions = SystemdServiceOptions> {
|
|
14
|
+
/** Optional `[Install]` section for enable-time relationships. */
|
|
15
|
+
readonly install: TOptions[`install`] | undefined;
|
|
16
|
+
/** The normalized base unit name, without the `.service` suffix. */
|
|
17
|
+
readonly name: ServiceBaseName<TOptions[`name`]>;
|
|
18
|
+
/** The fully frozen original options used to construct this service. */
|
|
19
|
+
readonly options: Readonly<TOptions>;
|
|
20
|
+
/** The `[Service]` section payload. */
|
|
21
|
+
readonly service: TOptions[`service`];
|
|
22
|
+
/** Optional `[Unit]` section metadata and dependency configuration. */
|
|
23
|
+
readonly unit: TOptions[`unit`] | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an immutable service definition.
|
|
26
|
+
*
|
|
27
|
+
* The constructor preserves literal types where possible and rejects unknown
|
|
28
|
+
* directive names within the provided sections, while still allowing custom
|
|
29
|
+
* `X-...` extension directives.
|
|
30
|
+
*/
|
|
31
|
+
constructor(options: TOptions & ExactSystemdServiceOptions<TOptions>);
|
|
32
|
+
/** The canonical unit filename, including the `.service` suffix. */
|
|
33
|
+
get filename(): ServiceFilename<TOptions[`name`]>;
|
|
34
|
+
/**
|
|
35
|
+
* Renders the service as a complete unit file.
|
|
36
|
+
*
|
|
37
|
+
* Rendering also validates executable-valued directives such as `ExecStart`
|
|
38
|
+
* and `ExecStop`, ensuring they use absolute runtime entrypoints as required
|
|
39
|
+
* by systemd.
|
|
40
|
+
*/
|
|
41
|
+
render(): string;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/main/systemd-timer.d.ts
|
|
45
|
+
/**
|
|
46
|
+
* An immutable definition of a `.timer` unit.
|
|
47
|
+
*
|
|
48
|
+
* Like {@link SystemdService}, this is a pure value object. It models the timer
|
|
49
|
+
* configuration and its attachment target, but does not write files or interact
|
|
50
|
+
* with the service manager directly.
|
|
51
|
+
*
|
|
52
|
+
* Source:
|
|
53
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html
|
|
54
|
+
*/
|
|
55
|
+
declare class SystemdTimer<const TOptions extends SystemdTimerOptions = SystemdTimerOptions> {
|
|
56
|
+
/** Optional `[Install]` section for enable-time relationships. */
|
|
57
|
+
readonly install: TOptions[`install`] | undefined;
|
|
58
|
+
/** The normalized base unit name, without the `.timer` suffix. */
|
|
59
|
+
readonly name: TimerBaseName<TOptions[`name`]>;
|
|
60
|
+
/** The fully frozen original options used to construct this timer. */
|
|
61
|
+
readonly options: Readonly<TOptions>;
|
|
62
|
+
/** The attached service basename inferred from `targetUnit`. */
|
|
63
|
+
readonly targetServiceName: TimerTargetServiceName<TOptions>;
|
|
64
|
+
/** The unit name this timer activates, explicit or implicit. */
|
|
65
|
+
readonly targetUnit: TimerTargetUnit<TOptions>;
|
|
66
|
+
/** The `[Timer]` section payload. */
|
|
67
|
+
readonly timer: TOptions[`timer`];
|
|
68
|
+
/** Optional `[Unit]` section metadata and dependency configuration. */
|
|
69
|
+
readonly unit: TOptions[`unit`] | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Creates an immutable timer definition.
|
|
72
|
+
*
|
|
73
|
+
* If no explicit `timer.Unit` is provided, the target defaults to the service
|
|
74
|
+
* with the same basename, matching systemd's native timer behavior.
|
|
75
|
+
*/
|
|
76
|
+
constructor(options: TOptions & ExactSystemdTimerOptions<TOptions>);
|
|
77
|
+
/** The canonical unit filename, including the `.timer` suffix. */
|
|
78
|
+
get filename(): TimerFilename<TOptions[`name`]>;
|
|
79
|
+
/** Renders the timer as a complete unit file. */
|
|
80
|
+
render(): string;
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/main/types.d.ts
|
|
84
|
+
type ScalarDirectiveValue = string | number | boolean;
|
|
85
|
+
type ScalarDirectiveValues = ScalarDirectiveValue | readonly ScalarDirectiveValue[];
|
|
86
|
+
type ExecutableDirectiveValue = string | Executable;
|
|
87
|
+
type ExecutableDirectiveValues = ExecutableDirectiveValue | readonly ExecutableDirectiveValue[];
|
|
88
|
+
type UnitValue = ScalarDirectiveValue | Executable;
|
|
89
|
+
type UnitValueList = readonly UnitValue[];
|
|
90
|
+
type UnitSectionValue = UnitValue | UnitValueList | undefined;
|
|
91
|
+
interface CustomDirectiveSection {
|
|
92
|
+
readonly [key: `X-${string}`]: UnitSectionValue;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Generic unit-level directives shared by service and timer units.
|
|
96
|
+
*
|
|
97
|
+
* Sources:
|
|
98
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html
|
|
99
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.directives.html
|
|
100
|
+
*/
|
|
101
|
+
interface SystemdUnitSection extends CustomDirectiveSection {
|
|
102
|
+
readonly After?: ScalarDirectiveValues;
|
|
103
|
+
readonly AllowIsolate?: ScalarDirectiveValues;
|
|
104
|
+
readonly AssertACPower?: ScalarDirectiveValues;
|
|
105
|
+
readonly AssertArchitecture?: ScalarDirectiveValues;
|
|
106
|
+
readonly AssertCPUFeature?: ScalarDirectiveValues;
|
|
107
|
+
readonly AssertCPUPressure?: ScalarDirectiveValues;
|
|
108
|
+
readonly AssertCPUs?: ScalarDirectiveValues;
|
|
109
|
+
readonly AssertCapability?: ScalarDirectiveValues;
|
|
110
|
+
readonly AssertControlGroupController?: ScalarDirectiveValues;
|
|
111
|
+
readonly AssertCredential?: ScalarDirectiveValues;
|
|
112
|
+
readonly AssertDirectoryNotEmpty?: ScalarDirectiveValues;
|
|
113
|
+
readonly AssertEnvironment?: ScalarDirectiveValues;
|
|
114
|
+
readonly AssertFileIsExecutable?: ScalarDirectiveValues;
|
|
115
|
+
readonly AssertFileNotEmpty?: ScalarDirectiveValues;
|
|
116
|
+
readonly AssertFirstBoot?: ScalarDirectiveValues;
|
|
117
|
+
readonly AssertGroup?: ScalarDirectiveValues;
|
|
118
|
+
readonly AssertHost?: ScalarDirectiveValues;
|
|
119
|
+
readonly AssertIOPressure?: ScalarDirectiveValues;
|
|
120
|
+
readonly AssertKernelCommandLine?: ScalarDirectiveValues;
|
|
121
|
+
readonly AssertKernelModuleLoaded?: ScalarDirectiveValues;
|
|
122
|
+
readonly AssertKernelVersion?: ScalarDirectiveValues;
|
|
123
|
+
readonly AssertMemory?: ScalarDirectiveValues;
|
|
124
|
+
readonly AssertMemoryPressure?: ScalarDirectiveValues;
|
|
125
|
+
readonly AssertNeedsUpdate?: ScalarDirectiveValues;
|
|
126
|
+
readonly AssertOSRelease?: ScalarDirectiveValues;
|
|
127
|
+
readonly AssertPathExists?: ScalarDirectiveValues;
|
|
128
|
+
readonly AssertPathExistsGlob?: ScalarDirectiveValues;
|
|
129
|
+
readonly AssertPathIsDirectory?: ScalarDirectiveValues;
|
|
130
|
+
readonly AssertPathIsEncrypted?: ScalarDirectiveValues;
|
|
131
|
+
readonly AssertPathIsMountPoint?: ScalarDirectiveValues;
|
|
132
|
+
readonly AssertPathIsReadWrite?: ScalarDirectiveValues;
|
|
133
|
+
readonly AssertPathIsSocket?: ScalarDirectiveValues;
|
|
134
|
+
readonly AssertPathIsSymbolicLink?: ScalarDirectiveValues;
|
|
135
|
+
readonly AssertSecurity?: ScalarDirectiveValues;
|
|
136
|
+
readonly AssertUser?: ScalarDirectiveValues;
|
|
137
|
+
readonly AssertVersion?: ScalarDirectiveValues;
|
|
138
|
+
readonly AssertVirtualization?: ScalarDirectiveValues;
|
|
139
|
+
readonly Before?: ScalarDirectiveValues;
|
|
140
|
+
readonly BindsTo?: ScalarDirectiveValues;
|
|
141
|
+
readonly CollectMode?: ScalarDirectiveValues;
|
|
142
|
+
readonly ConditionACPower?: ScalarDirectiveValues;
|
|
143
|
+
readonly ConditionArchitecture?: ScalarDirectiveValues;
|
|
144
|
+
readonly ConditionCPUFeature?: ScalarDirectiveValues;
|
|
145
|
+
readonly ConditionCPUPressure?: ScalarDirectiveValues;
|
|
146
|
+
readonly ConditionCPUs?: ScalarDirectiveValues;
|
|
147
|
+
readonly ConditionCapability?: ScalarDirectiveValues;
|
|
148
|
+
readonly ConditionControlGroupController?: ScalarDirectiveValues;
|
|
149
|
+
readonly ConditionCredential?: ScalarDirectiveValues;
|
|
150
|
+
readonly ConditionDirectoryNotEmpty?: ScalarDirectiveValues;
|
|
151
|
+
readonly ConditionEnvironment?: ScalarDirectiveValues;
|
|
152
|
+
readonly ConditionFileIsExecutable?: ScalarDirectiveValues;
|
|
153
|
+
readonly ConditionFileNotEmpty?: ScalarDirectiveValues;
|
|
154
|
+
readonly ConditionFirmware?: ScalarDirectiveValues;
|
|
155
|
+
readonly ConditionFirstBoot?: ScalarDirectiveValues;
|
|
156
|
+
readonly ConditionGroup?: ScalarDirectiveValues;
|
|
157
|
+
readonly ConditionHost?: ScalarDirectiveValues;
|
|
158
|
+
readonly ConditionIOPressure?: ScalarDirectiveValues;
|
|
159
|
+
readonly ConditionKernelCommandLine?: ScalarDirectiveValues;
|
|
160
|
+
readonly ConditionKernelModuleLoaded?: ScalarDirectiveValues;
|
|
161
|
+
readonly ConditionKernelVersion?: ScalarDirectiveValues;
|
|
162
|
+
readonly ConditionMemory?: ScalarDirectiveValues;
|
|
163
|
+
readonly ConditionMemoryPressure?: ScalarDirectiveValues;
|
|
164
|
+
readonly ConditionNeedsUpdate?: ScalarDirectiveValues;
|
|
165
|
+
readonly ConditionOSRelease?: ScalarDirectiveValues;
|
|
166
|
+
readonly ConditionPathExists?: ScalarDirectiveValues;
|
|
167
|
+
readonly ConditionPathExistsGlob?: ScalarDirectiveValues;
|
|
168
|
+
readonly ConditionPathIsDirectory?: ScalarDirectiveValues;
|
|
169
|
+
readonly ConditionPathIsEncrypted?: ScalarDirectiveValues;
|
|
170
|
+
readonly ConditionPathIsMountPoint?: ScalarDirectiveValues;
|
|
171
|
+
readonly ConditionPathIsReadWrite?: ScalarDirectiveValues;
|
|
172
|
+
readonly ConditionPathIsSocket?: ScalarDirectiveValues;
|
|
173
|
+
readonly ConditionPathIsSymbolicLink?: ScalarDirectiveValues;
|
|
174
|
+
readonly ConditionSecurity?: ScalarDirectiveValues;
|
|
175
|
+
readonly ConditionUser?: ScalarDirectiveValues;
|
|
176
|
+
readonly ConditionVersion?: ScalarDirectiveValues;
|
|
177
|
+
readonly ConditionVirtualization?: ScalarDirectiveValues;
|
|
178
|
+
readonly Conflicts?: ScalarDirectiveValues;
|
|
179
|
+
readonly DefaultDependencies?: ScalarDirectiveValues;
|
|
180
|
+
readonly Description?: ScalarDirectiveValues;
|
|
181
|
+
readonly Documentation?: ScalarDirectiveValues;
|
|
182
|
+
readonly FailureAction?: ScalarDirectiveValues;
|
|
183
|
+
readonly FailureActionExitStatus?: ScalarDirectiveValues;
|
|
184
|
+
readonly IgnoreOnIsolate?: ScalarDirectiveValues;
|
|
185
|
+
readonly JobRunningTimeoutSec?: ScalarDirectiveValues;
|
|
186
|
+
readonly JobTimeoutAction?: ScalarDirectiveValues;
|
|
187
|
+
readonly JobTimeoutRebootArgument?: ScalarDirectiveValues;
|
|
188
|
+
readonly JobTimeoutSec?: ScalarDirectiveValues;
|
|
189
|
+
readonly JoinsNamespaceOf?: ScalarDirectiveValues;
|
|
190
|
+
readonly OnFailure?: ScalarDirectiveValues;
|
|
191
|
+
readonly OnFailureJobMode?: ScalarDirectiveValues;
|
|
192
|
+
readonly OnSuccess?: ScalarDirectiveValues;
|
|
193
|
+
readonly OnSuccessJobMode?: ScalarDirectiveValues;
|
|
194
|
+
readonly PartOf?: ScalarDirectiveValues;
|
|
195
|
+
readonly PropagatesReloadTo?: ScalarDirectiveValues;
|
|
196
|
+
readonly PropagatesStopTo?: ScalarDirectiveValues;
|
|
197
|
+
readonly RebootArgument?: ScalarDirectiveValues;
|
|
198
|
+
readonly RefuseManualStart?: ScalarDirectiveValues;
|
|
199
|
+
readonly RefuseManualStop?: ScalarDirectiveValues;
|
|
200
|
+
readonly ReloadPropagatedFrom?: ScalarDirectiveValues;
|
|
201
|
+
readonly Requires?: ScalarDirectiveValues;
|
|
202
|
+
readonly RequiresMountsFor?: ScalarDirectiveValues;
|
|
203
|
+
readonly Requisite?: ScalarDirectiveValues;
|
|
204
|
+
readonly SourcePath?: ScalarDirectiveValues;
|
|
205
|
+
readonly StartLimitAction?: ScalarDirectiveValues;
|
|
206
|
+
readonly StartLimitBurst?: ScalarDirectiveValues;
|
|
207
|
+
readonly StartLimitIntervalSec?: ScalarDirectiveValues;
|
|
208
|
+
readonly StopPropagatedFrom?: ScalarDirectiveValues;
|
|
209
|
+
readonly StopWhenUnneeded?: ScalarDirectiveValues;
|
|
210
|
+
readonly SuccessAction?: ScalarDirectiveValues;
|
|
211
|
+
readonly SuccessActionExitStatus?: ScalarDirectiveValues;
|
|
212
|
+
readonly SurviveFinalKillSignal?: ScalarDirectiveValues;
|
|
213
|
+
readonly Upholds?: ScalarDirectiveValues;
|
|
214
|
+
readonly Wants?: ScalarDirectiveValues;
|
|
215
|
+
readonly WantsMountsFor?: ScalarDirectiveValues;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Install-time directives interpreted by `systemctl enable` rather than the
|
|
219
|
+
* service manager during normal unit execution.
|
|
220
|
+
*
|
|
221
|
+
* Sources:
|
|
222
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html
|
|
223
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.directives.html
|
|
224
|
+
*/
|
|
225
|
+
interface SystemdInstallSection extends CustomDirectiveSection {
|
|
226
|
+
readonly Alias?: ScalarDirectiveValues;
|
|
227
|
+
readonly Also?: ScalarDirectiveValues;
|
|
228
|
+
readonly DefaultInstance?: ScalarDirectiveValues;
|
|
229
|
+
readonly RequiredBy?: ScalarDirectiveValues;
|
|
230
|
+
readonly UpheldBy?: ScalarDirectiveValues;
|
|
231
|
+
readonly WantedBy?: ScalarDirectiveValues;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Timer-specific directives for `[Timer]` sections.
|
|
235
|
+
*
|
|
236
|
+
* Sources:
|
|
237
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html
|
|
238
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.directives.html
|
|
239
|
+
*/
|
|
240
|
+
interface SystemdTimerSection extends CustomDirectiveSection {
|
|
241
|
+
readonly AccuracySec?: ScalarDirectiveValues;
|
|
242
|
+
readonly DeferReactivation?: ScalarDirectiveValues;
|
|
243
|
+
readonly FixedRandomDelay?: ScalarDirectiveValues;
|
|
244
|
+
readonly OnActiveSec?: ScalarDirectiveValues;
|
|
245
|
+
readonly OnBootSec?: ScalarDirectiveValues;
|
|
246
|
+
readonly OnCalendar?: ScalarDirectiveValues;
|
|
247
|
+
readonly OnClockChange?: ScalarDirectiveValues;
|
|
248
|
+
readonly OnStartupSec?: ScalarDirectiveValues;
|
|
249
|
+
readonly OnTimezoneChange?: ScalarDirectiveValues;
|
|
250
|
+
readonly OnUnitActiveSec?: ScalarDirectiveValues;
|
|
251
|
+
readonly OnUnitInactiveSec?: ScalarDirectiveValues;
|
|
252
|
+
readonly Persistent?: ScalarDirectiveValues;
|
|
253
|
+
readonly RandomizedDelaySec?: ScalarDirectiveValues;
|
|
254
|
+
readonly RandomizedOffsetSec?: ScalarDirectiveValues;
|
|
255
|
+
readonly RemainAfterElapse?: ScalarDirectiveValues;
|
|
256
|
+
readonly Unit?: ScalarDirectiveValues;
|
|
257
|
+
readonly WakeSystem?: ScalarDirectiveValues;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Service-specific and shared execution directives for `[Service]` sections.
|
|
261
|
+
*
|
|
262
|
+
* This interface includes:
|
|
263
|
+
* - directives from `systemd.service(5)`
|
|
264
|
+
* - execution-environment directives from `systemd.exec(5)`
|
|
265
|
+
* - kill-behaviour directives from `systemd.kill(5)`
|
|
266
|
+
* - resource-control directives from `systemd.resource-control(5)`
|
|
267
|
+
*
|
|
268
|
+
* Sources:
|
|
269
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html
|
|
270
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html
|
|
271
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.kill.html
|
|
272
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html
|
|
273
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd.directives.html
|
|
274
|
+
*/
|
|
275
|
+
interface SystemdServiceSection extends CustomDirectiveSection {
|
|
276
|
+
readonly AllowedCPUs?: ScalarDirectiveValues;
|
|
277
|
+
readonly AllowedMemoryNodes?: ScalarDirectiveValues;
|
|
278
|
+
readonly AmbientCapabilities?: ScalarDirectiveValues;
|
|
279
|
+
readonly AppArmorProfile?: ScalarDirectiveValues;
|
|
280
|
+
readonly BPFDelegateAttachments?: ScalarDirectiveValues;
|
|
281
|
+
readonly BPFDelegateCommands?: ScalarDirectiveValues;
|
|
282
|
+
readonly BPFDelegateMaps?: ScalarDirectiveValues;
|
|
283
|
+
readonly BPFDelegatePrograms?: ScalarDirectiveValues;
|
|
284
|
+
readonly BPFProgram?: ScalarDirectiveValues;
|
|
285
|
+
readonly BindLogSockets?: ScalarDirectiveValues;
|
|
286
|
+
readonly BindNetworkInterface?: ScalarDirectiveValues;
|
|
287
|
+
readonly BindPaths?: ScalarDirectiveValues;
|
|
288
|
+
readonly BindReadOnlyPaths?: ScalarDirectiveValues;
|
|
289
|
+
readonly BusName?: ScalarDirectiveValues;
|
|
290
|
+
readonly CPUAffinity?: ScalarDirectiveValues;
|
|
291
|
+
readonly CPUQuota?: ScalarDirectiveValues;
|
|
292
|
+
readonly CPUQuotaPeriodSec?: ScalarDirectiveValues;
|
|
293
|
+
readonly CPUSchedulingPolicy?: ScalarDirectiveValues;
|
|
294
|
+
readonly CPUSchedulingPriority?: ScalarDirectiveValues;
|
|
295
|
+
readonly CPUSchedulingResetOnFork?: ScalarDirectiveValues;
|
|
296
|
+
readonly CPUWeight?: ScalarDirectiveValues;
|
|
297
|
+
readonly CacheDirectory?: ScalarDirectiveValues;
|
|
298
|
+
readonly CacheDirectoryAccounting?: ScalarDirectiveValues;
|
|
299
|
+
readonly CacheDirectoryMode?: ScalarDirectiveValues;
|
|
300
|
+
readonly CacheDirectoryQuota?: ScalarDirectiveValues;
|
|
301
|
+
readonly CapabilityBoundingSet?: ScalarDirectiveValues;
|
|
302
|
+
readonly ConfigurationDirectory?: ScalarDirectiveValues;
|
|
303
|
+
readonly ConfigurationDirectoryMode?: ScalarDirectiveValues;
|
|
304
|
+
readonly CoredumpFilter?: ScalarDirectiveValues;
|
|
305
|
+
readonly CoredumpReceive?: ScalarDirectiveValues;
|
|
306
|
+
readonly Delegate?: ScalarDirectiveValues;
|
|
307
|
+
readonly DelegateNamespaces?: ScalarDirectiveValues;
|
|
308
|
+
readonly DelegateSubgroup?: ScalarDirectiveValues;
|
|
309
|
+
readonly DeviceAllow?: ScalarDirectiveValues;
|
|
310
|
+
readonly DevicePolicy?: ScalarDirectiveValues;
|
|
311
|
+
readonly DisableControllers?: ScalarDirectiveValues;
|
|
312
|
+
readonly DynamicUser?: ScalarDirectiveValues;
|
|
313
|
+
readonly Environment?: ScalarDirectiveValues;
|
|
314
|
+
readonly EnvironmentFile?: ScalarDirectiveValues;
|
|
315
|
+
readonly ExecCondition?: ExecutableDirectiveValues;
|
|
316
|
+
readonly ExecPaths?: ScalarDirectiveValues;
|
|
317
|
+
readonly ExecReload?: ExecutableDirectiveValues;
|
|
318
|
+
readonly ExecReloadPost?: ExecutableDirectiveValues;
|
|
319
|
+
readonly ExecSearchPath?: ScalarDirectiveValues;
|
|
320
|
+
readonly ExecStart?: ExecutableDirectiveValues;
|
|
321
|
+
readonly ExecStartPost?: ExecutableDirectiveValues;
|
|
322
|
+
readonly ExecStartPre?: ExecutableDirectiveValues;
|
|
323
|
+
readonly ExecStop?: ExecutableDirectiveValues;
|
|
324
|
+
readonly ExecStopPost?: ExecutableDirectiveValues;
|
|
325
|
+
readonly ExitType?: ScalarDirectiveValues;
|
|
326
|
+
readonly ExtensionDirectories?: ScalarDirectiveValues;
|
|
327
|
+
readonly ExtensionImagePolicy?: ScalarDirectiveValues;
|
|
328
|
+
readonly ExtensionImages?: ScalarDirectiveValues;
|
|
329
|
+
readonly FileDescriptorStoreMax?: ScalarDirectiveValues;
|
|
330
|
+
readonly FileDescriptorStorePreserve?: ScalarDirectiveValues;
|
|
331
|
+
readonly FinalKillSignal?: ScalarDirectiveValues;
|
|
332
|
+
readonly Group?: ScalarDirectiveValues;
|
|
333
|
+
readonly GuessMainPID?: ScalarDirectiveValues;
|
|
334
|
+
readonly IOAccounting?: ScalarDirectiveValues;
|
|
335
|
+
readonly IODeviceLatencyTargetSec?: ScalarDirectiveValues;
|
|
336
|
+
readonly IODeviceWeight?: ScalarDirectiveValues;
|
|
337
|
+
readonly IOReadBandwidthMax?: ScalarDirectiveValues;
|
|
338
|
+
readonly IOReadIOPSMax?: ScalarDirectiveValues;
|
|
339
|
+
readonly IOSchedulingClass?: ScalarDirectiveValues;
|
|
340
|
+
readonly IOSchedulingPriority?: ScalarDirectiveValues;
|
|
341
|
+
readonly IOWeight?: ScalarDirectiveValues;
|
|
342
|
+
readonly IOWriteBandwidthMax?: ScalarDirectiveValues;
|
|
343
|
+
readonly IOWriteIOPSMax?: ScalarDirectiveValues;
|
|
344
|
+
readonly IPAccounting?: ScalarDirectiveValues;
|
|
345
|
+
readonly IPAddressAllow?: ScalarDirectiveValues;
|
|
346
|
+
readonly IPAddressDeny?: ScalarDirectiveValues;
|
|
347
|
+
readonly IPEgressFilterPath?: ScalarDirectiveValues;
|
|
348
|
+
readonly IPIngressFilterPath?: ScalarDirectiveValues;
|
|
349
|
+
readonly IPCNamespacePath?: ScalarDirectiveValues;
|
|
350
|
+
readonly IgnoreSIGPIPE?: ScalarDirectiveValues;
|
|
351
|
+
readonly ImportCredential?: ScalarDirectiveValues;
|
|
352
|
+
readonly InaccessiblePaths?: ScalarDirectiveValues;
|
|
353
|
+
readonly KeyringMode?: ScalarDirectiveValues;
|
|
354
|
+
readonly KillMode?: ScalarDirectiveValues;
|
|
355
|
+
readonly KillSignal?: ScalarDirectiveValues;
|
|
356
|
+
readonly LimitAS?: ScalarDirectiveValues;
|
|
357
|
+
readonly LimitCORE?: ScalarDirectiveValues;
|
|
358
|
+
readonly LimitCPU?: ScalarDirectiveValues;
|
|
359
|
+
readonly LimitDATA?: ScalarDirectiveValues;
|
|
360
|
+
readonly LimitFSIZE?: ScalarDirectiveValues;
|
|
361
|
+
readonly LimitLOCKS?: ScalarDirectiveValues;
|
|
362
|
+
readonly LimitMEMLOCK?: ScalarDirectiveValues;
|
|
363
|
+
readonly LimitMSGQUEUE?: ScalarDirectiveValues;
|
|
364
|
+
readonly LimitNICE?: ScalarDirectiveValues;
|
|
365
|
+
readonly LimitNOFILE?: ScalarDirectiveValues;
|
|
366
|
+
readonly LimitNPROC?: ScalarDirectiveValues;
|
|
367
|
+
readonly LimitRSS?: ScalarDirectiveValues;
|
|
368
|
+
readonly LimitRTPRIO?: ScalarDirectiveValues;
|
|
369
|
+
readonly LimitRTTIME?: ScalarDirectiveValues;
|
|
370
|
+
readonly LimitSIGPENDING?: ScalarDirectiveValues;
|
|
371
|
+
readonly LimitSTACK?: ScalarDirectiveValues;
|
|
372
|
+
readonly LoadCredential?: ScalarDirectiveValues;
|
|
373
|
+
readonly LoadCredentialEncrypted?: ScalarDirectiveValues;
|
|
374
|
+
readonly LockPersonality?: ScalarDirectiveValues;
|
|
375
|
+
readonly LogExtraFields?: ScalarDirectiveValues;
|
|
376
|
+
readonly LogFilterPatterns?: ScalarDirectiveValues;
|
|
377
|
+
readonly LogLevelMax?: ScalarDirectiveValues;
|
|
378
|
+
readonly LogNamespace?: ScalarDirectiveValues;
|
|
379
|
+
readonly LogRateLimitBurst?: ScalarDirectiveValues;
|
|
380
|
+
readonly LogRateLimitIntervalSec?: ScalarDirectiveValues;
|
|
381
|
+
readonly LogsDirectory?: ScalarDirectiveValues;
|
|
382
|
+
readonly LogsDirectoryAccounting?: ScalarDirectiveValues;
|
|
383
|
+
readonly LogsDirectoryMode?: ScalarDirectiveValues;
|
|
384
|
+
readonly LogsDirectoryQuota?: ScalarDirectiveValues;
|
|
385
|
+
readonly ManagedOOMMemoryPressure?: ScalarDirectiveValues;
|
|
386
|
+
readonly ManagedOOMMemoryPressureDurationSec?: ScalarDirectiveValues;
|
|
387
|
+
readonly ManagedOOMMemoryPressureLimit?: ScalarDirectiveValues;
|
|
388
|
+
readonly ManagedOOMPreference?: ScalarDirectiveValues;
|
|
389
|
+
readonly ManagedOOMSwap?: ScalarDirectiveValues;
|
|
390
|
+
readonly MemoryAccounting?: ScalarDirectiveValues;
|
|
391
|
+
readonly MemoryDenyWriteExecute?: ScalarDirectiveValues;
|
|
392
|
+
readonly MemoryHigh?: ScalarDirectiveValues;
|
|
393
|
+
readonly MemoryKSM?: ScalarDirectiveValues;
|
|
394
|
+
readonly MemoryLow?: ScalarDirectiveValues;
|
|
395
|
+
readonly MemoryMax?: ScalarDirectiveValues;
|
|
396
|
+
readonly MemoryMin?: ScalarDirectiveValues;
|
|
397
|
+
readonly MemoryPressureThresholdSec?: ScalarDirectiveValues;
|
|
398
|
+
readonly MemoryPressureWatch?: ScalarDirectiveValues;
|
|
399
|
+
readonly MemorySwapMax?: ScalarDirectiveValues;
|
|
400
|
+
readonly MemoryTHP?: ScalarDirectiveValues;
|
|
401
|
+
readonly MemoryZSwapMax?: ScalarDirectiveValues;
|
|
402
|
+
readonly MemoryZSwapWriteback?: ScalarDirectiveValues;
|
|
403
|
+
readonly MountAPIVFS?: ScalarDirectiveValues;
|
|
404
|
+
readonly MountFlags?: ScalarDirectiveValues;
|
|
405
|
+
readonly MountImagePolicy?: ScalarDirectiveValues;
|
|
406
|
+
readonly MountImages?: ScalarDirectiveValues;
|
|
407
|
+
readonly NFTSet?: ScalarDirectiveValues;
|
|
408
|
+
readonly NUMAMask?: ScalarDirectiveValues;
|
|
409
|
+
readonly NUMAPolicy?: ScalarDirectiveValues;
|
|
410
|
+
readonly NetworkNamespacePath?: ScalarDirectiveValues;
|
|
411
|
+
readonly Nice?: ScalarDirectiveValues;
|
|
412
|
+
readonly NoExecPaths?: ScalarDirectiveValues;
|
|
413
|
+
readonly NoNewPrivileges?: ScalarDirectiveValues;
|
|
414
|
+
readonly NonBlocking?: ScalarDirectiveValues;
|
|
415
|
+
readonly NotifyAccess?: ScalarDirectiveValues;
|
|
416
|
+
readonly OOMPolicy?: ScalarDirectiveValues;
|
|
417
|
+
readonly OOMScoreAdjust?: ScalarDirectiveValues;
|
|
418
|
+
readonly OpenFile?: ScalarDirectiveValues;
|
|
419
|
+
readonly PAMName?: ScalarDirectiveValues;
|
|
420
|
+
readonly PIDFile?: ScalarDirectiveValues;
|
|
421
|
+
readonly PassEnvironment?: ScalarDirectiveValues;
|
|
422
|
+
readonly Personality?: ScalarDirectiveValues;
|
|
423
|
+
readonly PrivateBPF?: ScalarDirectiveValues;
|
|
424
|
+
readonly PrivateDevices?: ScalarDirectiveValues;
|
|
425
|
+
readonly PrivateIPC?: ScalarDirectiveValues;
|
|
426
|
+
readonly PrivateMounts?: ScalarDirectiveValues;
|
|
427
|
+
readonly PrivateNetwork?: ScalarDirectiveValues;
|
|
428
|
+
readonly PrivatePIDs?: ScalarDirectiveValues;
|
|
429
|
+
readonly PrivateTmp?: ScalarDirectiveValues;
|
|
430
|
+
readonly PrivateUsers?: ScalarDirectiveValues;
|
|
431
|
+
readonly ProcSubset?: ScalarDirectiveValues;
|
|
432
|
+
readonly ProtectClock?: ScalarDirectiveValues;
|
|
433
|
+
readonly ProtectControlGroups?: ScalarDirectiveValues;
|
|
434
|
+
readonly ProtectHome?: ScalarDirectiveValues;
|
|
435
|
+
readonly ProtectHostname?: ScalarDirectiveValues;
|
|
436
|
+
readonly ProtectKernelLogs?: ScalarDirectiveValues;
|
|
437
|
+
readonly ProtectKernelModules?: ScalarDirectiveValues;
|
|
438
|
+
readonly ProtectKernelTunables?: ScalarDirectiveValues;
|
|
439
|
+
readonly ProtectProc?: ScalarDirectiveValues;
|
|
440
|
+
readonly ProtectSystem?: ScalarDirectiveValues;
|
|
441
|
+
readonly ReadOnlyPaths?: ScalarDirectiveValues;
|
|
442
|
+
readonly ReadWritePaths?: ScalarDirectiveValues;
|
|
443
|
+
readonly RefreshOnReload?: ScalarDirectiveValues;
|
|
444
|
+
readonly ReloadSignal?: ScalarDirectiveValues;
|
|
445
|
+
readonly RemainAfterExit?: ScalarDirectiveValues;
|
|
446
|
+
readonly RemoveIPC?: ScalarDirectiveValues;
|
|
447
|
+
readonly Restart?: ScalarDirectiveValues;
|
|
448
|
+
readonly RestartForceExitStatus?: ScalarDirectiveValues;
|
|
449
|
+
readonly RestartKillSignal?: ScalarDirectiveValues;
|
|
450
|
+
readonly RestartMaxDelaySec?: ScalarDirectiveValues;
|
|
451
|
+
readonly RestartMode?: ScalarDirectiveValues;
|
|
452
|
+
readonly RestartPreventExitStatus?: ScalarDirectiveValues;
|
|
453
|
+
readonly RestartSec?: ScalarDirectiveValues;
|
|
454
|
+
readonly RestartSteps?: ScalarDirectiveValues;
|
|
455
|
+
readonly RestrictAddressFamilies?: ScalarDirectiveValues;
|
|
456
|
+
readonly RestrictFileSystems?: ScalarDirectiveValues;
|
|
457
|
+
readonly RestrictNamespaces?: ScalarDirectiveValues;
|
|
458
|
+
readonly RestrictNetworkInterfaces?: ScalarDirectiveValues;
|
|
459
|
+
readonly RestrictRealtime?: ScalarDirectiveValues;
|
|
460
|
+
readonly RestrictSUIDSGID?: ScalarDirectiveValues;
|
|
461
|
+
readonly RootDirectory?: ScalarDirectiveValues;
|
|
462
|
+
readonly RootDirectoryStartOnly?: ScalarDirectiveValues;
|
|
463
|
+
readonly RootEphemeral?: ScalarDirectiveValues;
|
|
464
|
+
readonly RootHash?: ScalarDirectiveValues;
|
|
465
|
+
readonly RootHashSignature?: ScalarDirectiveValues;
|
|
466
|
+
readonly RootImage?: ScalarDirectiveValues;
|
|
467
|
+
readonly RootImageOptions?: ScalarDirectiveValues;
|
|
468
|
+
readonly RootImagePolicy?: ScalarDirectiveValues;
|
|
469
|
+
readonly RootMStack?: ScalarDirectiveValues;
|
|
470
|
+
readonly RootVerity?: ScalarDirectiveValues;
|
|
471
|
+
readonly RuntimeDirectory?: ScalarDirectiveValues;
|
|
472
|
+
readonly RuntimeDirectoryMode?: ScalarDirectiveValues;
|
|
473
|
+
readonly RuntimeDirectoryPreserve?: ScalarDirectiveValues;
|
|
474
|
+
readonly RuntimeMaxSec?: ScalarDirectiveValues;
|
|
475
|
+
readonly RuntimeRandomizedExtraSec?: ScalarDirectiveValues;
|
|
476
|
+
readonly SELinuxContext?: ScalarDirectiveValues;
|
|
477
|
+
readonly SecureBits?: ScalarDirectiveValues;
|
|
478
|
+
readonly SendSIGHUP?: ScalarDirectiveValues;
|
|
479
|
+
readonly SendSIGKILL?: ScalarDirectiveValues;
|
|
480
|
+
readonly SetCredential?: ScalarDirectiveValues;
|
|
481
|
+
readonly SetCredentialEncrypted?: ScalarDirectiveValues;
|
|
482
|
+
readonly SetLoginEnvironment?: ScalarDirectiveValues;
|
|
483
|
+
readonly Slice?: ScalarDirectiveValues;
|
|
484
|
+
readonly SmackProcessLabel?: ScalarDirectiveValues;
|
|
485
|
+
readonly SocketBindAllow?: ScalarDirectiveValues;
|
|
486
|
+
readonly SocketBindDeny?: ScalarDirectiveValues;
|
|
487
|
+
readonly Sockets?: ScalarDirectiveValues;
|
|
488
|
+
readonly StandardError?: ScalarDirectiveValues;
|
|
489
|
+
readonly StandardInput?: ScalarDirectiveValues;
|
|
490
|
+
readonly StandardInputData?: ScalarDirectiveValues;
|
|
491
|
+
readonly StandardInputText?: ScalarDirectiveValues;
|
|
492
|
+
readonly StandardOutput?: ScalarDirectiveValues;
|
|
493
|
+
readonly StartupAllowedCPUs?: ScalarDirectiveValues;
|
|
494
|
+
readonly StartupAllowedMemoryNodes?: ScalarDirectiveValues;
|
|
495
|
+
readonly StartupCPUWeight?: ScalarDirectiveValues;
|
|
496
|
+
readonly StartupIOWeight?: ScalarDirectiveValues;
|
|
497
|
+
readonly StartupMemoryHigh?: ScalarDirectiveValues;
|
|
498
|
+
readonly StartupMemoryLow?: ScalarDirectiveValues;
|
|
499
|
+
readonly StartupMemoryMax?: ScalarDirectiveValues;
|
|
500
|
+
readonly StartupMemorySwapMax?: ScalarDirectiveValues;
|
|
501
|
+
readonly StartupMemoryZSwapMax?: ScalarDirectiveValues;
|
|
502
|
+
readonly StateDirectory?: ScalarDirectiveValues;
|
|
503
|
+
readonly StateDirectoryAccounting?: ScalarDirectiveValues;
|
|
504
|
+
readonly StateDirectoryMode?: ScalarDirectiveValues;
|
|
505
|
+
readonly StateDirectoryQuota?: ScalarDirectiveValues;
|
|
506
|
+
readonly SuccessExitStatus?: ScalarDirectiveValues;
|
|
507
|
+
readonly SupplementaryGroups?: ScalarDirectiveValues;
|
|
508
|
+
readonly SyslogFacility?: ScalarDirectiveValues;
|
|
509
|
+
readonly SyslogIdentifier?: ScalarDirectiveValues;
|
|
510
|
+
readonly SyslogLevel?: ScalarDirectiveValues;
|
|
511
|
+
readonly SyslogLevelPrefix?: ScalarDirectiveValues;
|
|
512
|
+
readonly SystemCallArchitectures?: ScalarDirectiveValues;
|
|
513
|
+
readonly SystemCallErrorNumber?: ScalarDirectiveValues;
|
|
514
|
+
readonly SystemCallFilter?: ScalarDirectiveValues;
|
|
515
|
+
readonly SystemCallLog?: ScalarDirectiveValues;
|
|
516
|
+
readonly TTYColumns?: ScalarDirectiveValues;
|
|
517
|
+
readonly TTYPath?: ScalarDirectiveValues;
|
|
518
|
+
readonly TTYReset?: ScalarDirectiveValues;
|
|
519
|
+
readonly TTYRows?: ScalarDirectiveValues;
|
|
520
|
+
readonly TTYVHangup?: ScalarDirectiveValues;
|
|
521
|
+
readonly TTYVTDisallocate?: ScalarDirectiveValues;
|
|
522
|
+
readonly TasksAccounting?: ScalarDirectiveValues;
|
|
523
|
+
readonly TasksMax?: ScalarDirectiveValues;
|
|
524
|
+
readonly TemporaryFileSystem?: ScalarDirectiveValues;
|
|
525
|
+
readonly TimeoutAbortSec?: ScalarDirectiveValues;
|
|
526
|
+
readonly TimeoutSec?: ScalarDirectiveValues;
|
|
527
|
+
readonly TimeoutCleanSec?: ScalarDirectiveValues;
|
|
528
|
+
readonly TimeoutStartFailureMode?: ScalarDirectiveValues;
|
|
529
|
+
readonly TimeoutStartSec?: ScalarDirectiveValues;
|
|
530
|
+
readonly TimeoutStopFailureMode?: ScalarDirectiveValues;
|
|
531
|
+
readonly TimeoutStopSec?: ScalarDirectiveValues;
|
|
532
|
+
readonly TimerSlackNSec?: ScalarDirectiveValues;
|
|
533
|
+
readonly UMask?: ScalarDirectiveValues;
|
|
534
|
+
readonly USBFunctionDescriptors?: ScalarDirectiveValues;
|
|
535
|
+
readonly USBFunctionStrings?: ScalarDirectiveValues;
|
|
536
|
+
readonly UnsetEnvironment?: ScalarDirectiveValues;
|
|
537
|
+
readonly User?: ScalarDirectiveValues;
|
|
538
|
+
readonly UserNamespacePath?: ScalarDirectiveValues;
|
|
539
|
+
readonly UtmpIdentifier?: ScalarDirectiveValues;
|
|
540
|
+
readonly UtmpMode?: ScalarDirectiveValues;
|
|
541
|
+
readonly Type?: ScalarDirectiveValues;
|
|
542
|
+
readonly WatchdogSec?: ScalarDirectiveValues;
|
|
543
|
+
readonly WatchdogSignal?: ScalarDirectiveValues;
|
|
544
|
+
readonly WorkingDirectory?: ScalarDirectiveValues;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* @deprecated Use one of the specific section interfaces instead:
|
|
548
|
+
* `SystemdUnitSection`, `SystemdInstallSection`, `SystemdServiceSection`, or
|
|
549
|
+
* `SystemdTimerSection`.
|
|
550
|
+
*/
|
|
2
551
|
interface UnitSection {
|
|
3
|
-
readonly [key: string]:
|
|
552
|
+
readonly [key: string]: UnitSectionValue;
|
|
4
553
|
}
|
|
5
554
|
interface SystemdServiceOptions {
|
|
6
|
-
readonly install?:
|
|
555
|
+
readonly install?: SystemdInstallSection;
|
|
7
556
|
readonly name: string;
|
|
8
|
-
readonly service:
|
|
9
|
-
readonly unit?:
|
|
557
|
+
readonly service: SystemdServiceSection;
|
|
558
|
+
readonly unit?: SystemdUnitSection;
|
|
10
559
|
}
|
|
11
560
|
interface SystemdTimerOptions {
|
|
12
|
-
readonly install?:
|
|
561
|
+
readonly install?: SystemdInstallSection;
|
|
13
562
|
readonly name: string;
|
|
14
|
-
readonly timer:
|
|
15
|
-
readonly unit?:
|
|
563
|
+
readonly timer: SystemdTimerSection;
|
|
564
|
+
readonly unit?: SystemdUnitSection;
|
|
16
565
|
}
|
|
566
|
+
type NoExtraKeys<TActual, TShape> = TActual & { readonly [K in Exclude<keyof TActual, keyof TShape>]: never };
|
|
567
|
+
type ExactOptionalSection<TSection, TShape> = TSection extends undefined ? undefined : NoExtraKeys<TSection, TShape>;
|
|
568
|
+
type ExactSystemdServiceOptions<TOptions extends SystemdServiceOptions> = NoExtraKeys<Omit<TOptions, "install" | "service" | "unit"> & {
|
|
569
|
+
readonly install?: ExactOptionalSection<TOptions[`install`], SystemdInstallSection>;
|
|
570
|
+
readonly service: NoExtraKeys<TOptions[`service`], SystemdServiceSection>;
|
|
571
|
+
readonly unit?: ExactOptionalSection<TOptions[`unit`], SystemdUnitSection>;
|
|
572
|
+
}, SystemdServiceOptions>;
|
|
573
|
+
type ExactSystemdTimerOptions<TOptions extends SystemdTimerOptions> = NoExtraKeys<Omit<TOptions, "install" | "timer" | "unit"> & {
|
|
574
|
+
readonly install?: ExactOptionalSection<TOptions[`install`], SystemdInstallSection>;
|
|
575
|
+
readonly timer: NoExtraKeys<TOptions[`timer`], SystemdTimerSection>;
|
|
576
|
+
readonly unit?: ExactOptionalSection<TOptions[`unit`], SystemdUnitSection>;
|
|
577
|
+
}, SystemdTimerOptions>;
|
|
17
578
|
interface SystemdOptions {
|
|
18
579
|
readonly executor?: CommandExecutor;
|
|
19
580
|
readonly linkUnits?: boolean;
|
|
@@ -69,64 +630,219 @@ type MismatchedTimers<TUnits extends readonly SystemdUnit[]> = TUnits[number] ex
|
|
|
69
630
|
type HasServices<TUnits extends readonly SystemdUnit[]> = [ServiceNamesIn<TUnits>] extends [never] ? false : true;
|
|
70
631
|
type HasMismatchedServiceTimerPairs<TUnits extends readonly SystemdUnit[]> = HasServices<TUnits> extends true ? [MismatchedTimers<TUnits>] extends [never] ? false : true : false;
|
|
71
632
|
type ValidInstallUnits<TUnits extends readonly SystemdUnit[]> = HasMismatchedServiceTimerPairs<TUnits> extends true ? never : TUnits;
|
|
72
|
-
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/main/executable.d.ts
|
|
635
|
+
/**
|
|
636
|
+
* An immutable description of a runnable module entrypoint that can be used in
|
|
637
|
+
* executable-valued systemd unit directives.
|
|
638
|
+
*
|
|
639
|
+
* `Executable` captures three pieces of information:
|
|
640
|
+
* - the absolute runtime binary that should launch the module
|
|
641
|
+
* - the absolute path to the module itself
|
|
642
|
+
* - any additional arguments that should be passed after the module path
|
|
643
|
+
*
|
|
644
|
+
* Most consumers will create one via {@link defineExecutable} and then pass it
|
|
645
|
+
* into a {@link SystemdService} directive such as `ExecStart`, `ExecStop`, or
|
|
646
|
+
* `ExecReload`.
|
|
647
|
+
*/
|
|
73
648
|
declare class Executable {
|
|
649
|
+
/** Additional arguments passed after the module path. */
|
|
74
650
|
readonly args: readonly string[];
|
|
651
|
+
/** Absolute path to the module that should be executed. */
|
|
75
652
|
readonly modulePath: string;
|
|
653
|
+
/** Absolute path to the runtime binary that should launch the module. */
|
|
76
654
|
readonly runtimeEntrypoint: string;
|
|
655
|
+
/**
|
|
656
|
+
* Creates an executable description.
|
|
657
|
+
*
|
|
658
|
+
* When `modulePath` is omitted, the calling module is inferred from the
|
|
659
|
+
* current stack so `defineExecutable()` can be used inline from the module
|
|
660
|
+
* that should become runnable.
|
|
661
|
+
*
|
|
662
|
+
* When `runtimeEntrypoint` is omitted, the current process executable is
|
|
663
|
+
* used. This works well for the common case where the same runtime that is
|
|
664
|
+
* evaluating your module should also be used by systemd.
|
|
665
|
+
*/
|
|
77
666
|
constructor(options?: ExecutableOptions);
|
|
667
|
+
/**
|
|
668
|
+
* Returns the executable as raw command parts.
|
|
669
|
+
*
|
|
670
|
+
* The first element is always the runtime entrypoint, followed by the module
|
|
671
|
+
* path and any configured arguments.
|
|
672
|
+
*/
|
|
78
673
|
toCommandParts(): readonly [string, ...string[]];
|
|
674
|
+
/**
|
|
675
|
+
* Renders the executable as a shell-quoted command string suitable for
|
|
676
|
+
* executable-valued systemd directives such as `ExecStart=`.
|
|
677
|
+
*/
|
|
79
678
|
toExecStart(): string;
|
|
80
679
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
680
|
+
/**
|
|
681
|
+
* Defines a module as a runnable executable and returns its immutable
|
|
682
|
+
* `Executable` description.
|
|
683
|
+
*
|
|
684
|
+
* This helper is designed for the pattern:
|
|
685
|
+
*
|
|
686
|
+
* ```ts
|
|
687
|
+
* export default defineExecutable(async () => {
|
|
688
|
+
* // do work here
|
|
689
|
+
* });
|
|
690
|
+
* ```
|
|
691
|
+
*
|
|
692
|
+
* When the defining module is executed as the main entrypoint, `fn` is invoked.
|
|
693
|
+
* When the module is merely imported, `fn` is not run and only the executable
|
|
694
|
+
* description is returned.
|
|
695
|
+
*
|
|
696
|
+
* Pass `options.runtimeEntrypoint` to override the default runtime binary when
|
|
697
|
+
* the current process is not the exact runtime you want systemd to use.
|
|
698
|
+
*/
|
|
699
|
+
declare function defineExecutable(fn: () => void | Promise<void>, options?: ExecutableOptions): Executable;
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region src/main/notify.d.ts
|
|
702
|
+
/**
|
|
703
|
+
* Helpers for sending `sd_notify` state updates to systemd.
|
|
704
|
+
*
|
|
705
|
+
* These helpers send notification payloads to the socket identified by
|
|
706
|
+
* `NOTIFY_SOCKET`, or to `options.socketPath` when one is provided explicitly.
|
|
707
|
+
* They are useful both in real services and in tests that want to observe
|
|
708
|
+
* readiness or watchdog traffic directly.
|
|
709
|
+
*
|
|
710
|
+
* Source:
|
|
711
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html
|
|
712
|
+
* - https://www.freedesktop.org/software/systemd/man/latest/systemd-notify.html
|
|
713
|
+
*/
|
|
714
|
+
declare const notify: {
|
|
715
|
+
/**
|
|
716
|
+
* Sends `READY=1` to systemd.
|
|
717
|
+
*
|
|
718
|
+
* Use this when a `Type=notify` service has completed its startup work and is
|
|
719
|
+
* ready to be considered fully started. If `options.status` is provided, it is
|
|
720
|
+
* sent as an additional `STATUS=...` field.
|
|
721
|
+
*/
|
|
722
|
+
ready(options?: NotifyOptions): Promise<void>;
|
|
723
|
+
/**
|
|
724
|
+
* Sends `WATCHDOG=1` to systemd.
|
|
725
|
+
*
|
|
726
|
+
* Use this when a service configured with `WatchdogSec=` needs to emit a
|
|
727
|
+
* watchdog heartbeat. If `options.pid` is provided, it is sent as
|
|
728
|
+
* `MAINPID=...`, and `options.status` is forwarded as `STATUS=...`.
|
|
729
|
+
*/
|
|
730
|
+
watchdog(options?: NotifyOptions): Promise<void>;
|
|
731
|
+
};
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region src/main/systemd.d.ts
|
|
734
|
+
/**
|
|
735
|
+
* The result of installing one or more units with {@link Systemd.install}.
|
|
736
|
+
*
|
|
737
|
+
* It records the installation directory and the on-disk path associated with
|
|
738
|
+
* each installed unit.
|
|
739
|
+
*/
|
|
103
740
|
declare class SystemdInstallResult<TUnits extends readonly SystemdUnit[] = readonly SystemdUnit[]> {
|
|
741
|
+
/** The directory units were written into. */
|
|
104
742
|
readonly directory: string;
|
|
743
|
+
/** The installed units together with their resolved on-disk paths. */
|
|
105
744
|
readonly installed: readonly InstalledUnit<TUnits[number]>[];
|
|
106
745
|
private readonly pathByFilename;
|
|
107
746
|
constructor(directory: string, installed: readonly InstalledUnit<TUnits[number]>[]);
|
|
747
|
+
/** Returns the installed on-disk path for a previously installed unit. */
|
|
108
748
|
pathFor(unit: TUnits[number]): string;
|
|
109
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* A configured interface to a specific systemd environment.
|
|
752
|
+
*
|
|
753
|
+
* `Systemd` combines unit-file materialization with a command execution
|
|
754
|
+
* strategy. It knows which scope it is targeting, where unit files should be
|
|
755
|
+
* written, and how `systemctl` should be invoked.
|
|
756
|
+
*
|
|
757
|
+
* This abstraction is intentionally close to `systemctl` concepts while still
|
|
758
|
+
* accepting full unit definitions instead of loose unit-name strings.
|
|
759
|
+
*/
|
|
110
760
|
declare class Systemd {
|
|
761
|
+
/** Command executor used for `systemctl` and related subprocess calls. */
|
|
111
762
|
readonly executor: CommandExecutor;
|
|
763
|
+
/** Whether units should be linked into systemd before manager operations. */
|
|
112
764
|
readonly linkUnits: boolean;
|
|
765
|
+
/** The target manager scope, either `system` or `user`. */
|
|
113
766
|
readonly scope: `system` | `user`;
|
|
767
|
+
/** The directory used when materializing unit files. */
|
|
114
768
|
readonly unitDir: string;
|
|
769
|
+
/**
|
|
770
|
+
* Creates a configured `Systemd` facade.
|
|
771
|
+
*
|
|
772
|
+
* By default, this targets the system scope and `/etc/systemd/system`. Use
|
|
773
|
+
* `scope: "user"` or an explicit `unitDir` to target a different manager or
|
|
774
|
+
* unit-file location.
|
|
775
|
+
*/
|
|
115
776
|
constructor(options?: SystemdOptions);
|
|
116
|
-
|
|
777
|
+
/**
|
|
778
|
+
* Renders and writes one or more units into this instance's `unitDir`.
|
|
779
|
+
*
|
|
780
|
+
* This is intentionally a file-materialization step. It does not enable or
|
|
781
|
+
* start the units on its own. When both timers and services are installed
|
|
782
|
+
* together, compile-time and runtime attachment checks ensure the timer points
|
|
783
|
+
* at one of the accompanying services.
|
|
784
|
+
*/
|
|
785
|
+
install<const TUnits extends readonly SystemdUnit[]>(...units: TUnits & ValidInstallUnits<TUnits>): Promise<SystemdInstallResult<TUnits>>;
|
|
786
|
+
/**
|
|
787
|
+
* Enables one or more units via `systemctl enable`.
|
|
788
|
+
*
|
|
789
|
+
* When `linkUnits` is enabled, this first links installed unit files into the
|
|
790
|
+
* target manager and reloads systemd so the units are visible before the
|
|
791
|
+
* enable operation runs.
|
|
792
|
+
*/
|
|
117
793
|
enable(...units: readonly SystemdUnit[]): Promise<void>;
|
|
794
|
+
/**
|
|
795
|
+
* Starts a unit and returns a parsed `systemctl show` snapshot of its final
|
|
796
|
+
* observed state.
|
|
797
|
+
*
|
|
798
|
+
* For oneshot services, a successful result commonly means `ActiveState` is
|
|
799
|
+
* already back to `inactive` by the time the status snapshot is collected.
|
|
800
|
+
*/
|
|
118
801
|
start(unit: SystemdUnit): Promise<StartResult>;
|
|
119
|
-
|
|
802
|
+
/**
|
|
803
|
+
* Reads recent output for a managed unit.
|
|
804
|
+
*
|
|
805
|
+
* If the unit is configured with file-backed `StandardOutput` or
|
|
806
|
+
* `StandardError`, this reads directly from that file. Otherwise it falls back
|
|
807
|
+
* to `systemctl status --lines ...`.
|
|
808
|
+
*/
|
|
809
|
+
logs(unit: SystemdUnit, options?: LogsOptions): Promise<string>;
|
|
810
|
+
/** Returns the on-disk unit-file path this instance uses for the given unit. */
|
|
120
811
|
pathFor(unit: SystemdUnit): string;
|
|
121
812
|
private prepareUnits;
|
|
122
813
|
private scopeArgs;
|
|
123
814
|
private collectLinkPaths;
|
|
124
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Returns the lazily created default `Systemd` instance.
|
|
818
|
+
*
|
|
819
|
+
* The default instance uses the library defaults for scope, unit directory, and
|
|
820
|
+
* command execution.
|
|
821
|
+
*/
|
|
125
822
|
declare function defaultSystemd(): Systemd;
|
|
126
|
-
declare
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
declare function
|
|
823
|
+
declare namespace internal_d_exports {
|
|
824
|
+
export { assertInstallableTogether, cloneUnitSection, defaultCommandExecutor, defaultUnitDirForScope, fileExists, freezeUnitOptions, normalizeUnitName, parseStartResult, renderUnitFile, resolveTimerTargetUnit, sendNotify, shellQuote, validateServiceSection };
|
|
825
|
+
}
|
|
826
|
+
type SectionLike = object;
|
|
827
|
+
declare function normalizeUnitName(name: string, suffix: `.service` | `.timer`): string;
|
|
828
|
+
declare function resolveTimerTargetUnit(options: SystemdTimerOptions): string;
|
|
829
|
+
declare function defaultUnitDirForScope(scope: `system` | `user`): string;
|
|
830
|
+
declare function freezeUnitOptions<TOptions extends SystemdServiceOptions | SystemdTimerOptions>(options: TOptions): Readonly<TOptions>;
|
|
831
|
+
declare function cloneUnitSection<TSection extends SectionLike | undefined>(section: TSection): TSection;
|
|
832
|
+
declare function validateServiceSection(service: SystemdServiceSection): void;
|
|
833
|
+
declare function assertInstallableTogether(units: readonly SystemdUnit[]): void;
|
|
834
|
+
declare function parseStartResult(unit: string, output: string): StartResult;
|
|
835
|
+
declare function renderUnitFile(sections: ReadonlyArray<readonly [string, SectionLike | undefined]>): string;
|
|
836
|
+
declare function shellQuote(value: string): string;
|
|
837
|
+
declare function defaultCommandExecutor(command: string, args: readonly string[]): Promise<CommandResult>;
|
|
838
|
+
declare function fileExists(path: string): Promise<boolean>;
|
|
839
|
+
declare function sendNotify(state: `READY=1` | `WATCHDOG=1`, options: NotifyOptions): Promise<void>;
|
|
840
|
+
//#endregion
|
|
841
|
+
//#region src/main/index.d.ts
|
|
842
|
+
/**
|
|
843
|
+
* Internal helpers are exposed for advanced use, but they are not a stable public API.
|
|
844
|
+
* Expect breaking changes here outside the package's normal compatibility guarantees.
|
|
845
|
+
*/
|
|
846
|
+
declare const Internal: typeof internal_d_exports;
|
|
131
847
|
//#endregion
|
|
132
|
-
export { AnySystemdService, AnySystemdTimer, CommandExecutor, CommandResult, Executable, ExecutableOptions, InstalledUnit, LogsOptions, NotifyOptions, StartResult, Systemd, SystemdInstallResult, SystemdOptions, SystemdService, SystemdServiceOptions, SystemdTimer, SystemdTimerOptions, SystemdUnit, UnitSection, UnitValue, defaultSystemd, defineExecutable, notify };
|
|
848
|
+
export { type AnySystemdService, type AnySystemdTimer, type CommandExecutor, type CommandResult, Executable, type ExecutableOptions, type InstalledUnit, Internal, type LogsOptions, type NotifyOptions, type ServiceBaseName, type ServiceFilename, type StartResult, Systemd, SystemdInstallResult, type SystemdOptions, SystemdService, type SystemdServiceOptions, SystemdTimer, type SystemdTimerOptions, type SystemdUnit, type TimerBaseName, type TimerFilename, type TimerTargetServiceName, type TimerTargetUnit, type UnitSection, type UnitValue, type ValidInstallUnits, defaultSystemd, defineExecutable, notify };
|