pmcf 2.7.1 → 2.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,6 +1,12 @@
1
+ import { join } from "node:path";
2
+ import { FileContentProvider } from "npm-pkgbuild";
1
3
  import { addType } from "../types.mjs";
2
4
  import { ServiceTypeDefinition, serviceAddresses } from "../service.mjs";
3
- import { ExtraSourceService, ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
5
+ import {
6
+ ExtraSourceService,
7
+ ExtraSourceServiceTypeDefinition
8
+ } from "../extra-source-service.mjs";
9
+ import { writeLines } from "../utils.mjs";
4
10
 
5
11
  const NTPServiceTypeDefinition = {
6
12
  name: "ntp",
@@ -47,4 +53,45 @@ export class NTPService extends ExtraSourceService {
47
53
  }
48
54
  ];
49
55
  }
56
+
57
+ async *preparePackages(dir) {
58
+ const network = this.network;
59
+ const host = this.server;
60
+ const name = host.name;
61
+
62
+ console.log("chrony", host.name, network.name);
63
+
64
+ const packageData = {
65
+ dir,
66
+ sources: [new FileContentProvider(dir + "/")[Symbol.asyncIterator]()],
67
+ outputs: this.outputs,
68
+ properties: {
69
+ name: `chrony-${this.location.name}-${host.name}`,
70
+ description: `chrony definitions for ${this.fullName}@${name}`,
71
+ access: "private",
72
+ dependencies: ["chrony>=4.6.1"]
73
+ }
74
+ };
75
+
76
+ const lines = [
77
+ ...serviceAddresses(this, {
78
+ ...NTP_SERVICE_FILTER,
79
+ priority: ">=10"
80
+ }).map(address => `server ${address} iburst`),
81
+ `mailonchange ${this.administratorEmail} 0.5`,
82
+ "local stratum 10",
83
+ "leapsectz right/UTC",
84
+ "makestep 1.0 3",
85
+ "ratelimit interval 3 burst 8",
86
+ "cmdratelimit interval -4 burst 16",
87
+ "driftfile /var/lib/chrony/drift",
88
+ "ntsdumpdir /var/lib/chrony",
89
+ "dumpdir /var/lib/chrony",
90
+ "pidfile /run/chrony/chronyd.pid"
91
+ ];
92
+
93
+ await writeLines(join(dir, "etc"), "chrony.conf", lines);
94
+
95
+ yield packageData;
96
+ }
50
97
  }
@@ -264,5 +264,16 @@ export class NTPService extends ExtraSourceService {
264
264
  get systemdConfig(): (string | {
265
265
  NTP: string;
266
266
  })[];
267
+ preparePackages(dir: any): AsyncGenerator<{
268
+ dir: any;
269
+ sources: AsyncIterable<import("content-entry").ContentEntry>[];
270
+ outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
271
+ properties: {
272
+ name: string;
273
+ description: string;
274
+ access: string;
275
+ dependencies: string[];
276
+ };
277
+ }, void, unknown>;
267
278
  }
268
279
  import { ExtraSourceService } from "../extra-source-service.mjs";