pmcf 2.10.4 → 2.11.1
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/bin/pmcf-package +1 -1
- package/package.json +2 -2
- package/src/host-utils.mjs +9 -19
- package/src/host.mjs +14 -6
- package/src/location.mjs +7 -11
- package/src/services/dhcp.mjs +1 -1
- package/src/services/dns.mjs +20 -5
- package/src/services/ntp.mjs +1 -1
- package/types/host-utils.d.mts +0 -1
- package/types/host.d.mts +2 -1
- package/types/location.d.mts +2 -1
- package/types/services/dhcp.d.mts +2 -1
- package/types/services/dns.d.mts +2 -1
- package/types/services/ntp.d.mts +2 -1
package/bin/pmcf-package
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"npm-pkgbuild": "^18.0.
|
|
41
|
+
"npm-pkgbuild": "^18.0.1",
|
|
42
42
|
"pacc": "^3.3.0",
|
|
43
43
|
"pkg-dir": "^8.0.0"
|
|
44
44
|
},
|
package/src/host-utils.mjs
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
writeFile,
|
|
3
|
+
mkdir,
|
|
4
|
+
copyFile,
|
|
5
|
+
glob,
|
|
6
|
+
chmod,
|
|
7
|
+
stat
|
|
8
|
+
} from "node:fs/promises";
|
|
2
9
|
import { join } from "node:path";
|
|
10
|
+
import { FileContentProvider } from "npm-pkgbuild";
|
|
3
11
|
import { writeLines, sectionLines } from "../src/utils.mjs";
|
|
4
12
|
import { addHook } from "./hooks.mjs";
|
|
5
13
|
|
|
@@ -132,24 +140,6 @@ network={
|
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
|
|
135
|
-
export async function copySshKeys(host, packageData) {
|
|
136
|
-
const sshDir = join(packageData.dir, "etc", "ssh");
|
|
137
|
-
|
|
138
|
-
await mkdir(sshDir, { recursive: true });
|
|
139
|
-
|
|
140
|
-
for await (const file of glob("ssh_host_*", { cwd: host.directory })) {
|
|
141
|
-
const destinationFileName = join(sshDir, file);
|
|
142
|
-
await copyFile(join(host.directory, file), destinationFileName);
|
|
143
|
-
await chmod(
|
|
144
|
-
destinationFileName,
|
|
145
|
-
destinationFileName.endsWith(".pub") ? 0o644 : 0o600
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
const s = await stat(destinationFileName);
|
|
149
|
-
console.log(destinationFileName,s.mode)
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
143
|
export async function generateKnownHosts(hosts, dir) {
|
|
154
144
|
const keys = [];
|
|
155
145
|
for await (const host of hosts) {
|
package/src/host.mjs
CHANGED
|
@@ -22,7 +22,6 @@ import { loadHooks } from "./hooks.mjs";
|
|
|
22
22
|
import {
|
|
23
23
|
generateNetworkDefs,
|
|
24
24
|
generateMachineInfo,
|
|
25
|
-
copySshKeys,
|
|
26
25
|
generateKnownHosts
|
|
27
26
|
} from "./host-utils.mjs";
|
|
28
27
|
|
|
@@ -450,7 +449,17 @@ export class Host extends Base {
|
|
|
450
449
|
async *preparePackages(dir) {
|
|
451
450
|
const packageData = {
|
|
452
451
|
dir,
|
|
453
|
-
sources: [
|
|
452
|
+
sources: [
|
|
453
|
+
new FileContentProvider(
|
|
454
|
+
{ base: this.directory, pattern: "*.pub" },
|
|
455
|
+
{ destination: "/etc/ssh/", mode: 0o644 }
|
|
456
|
+
),
|
|
457
|
+
new FileContentProvider(
|
|
458
|
+
{ base: this.directory, pattern: "*_key" },
|
|
459
|
+
{ destination: "/etc/ssh/", mode: 0o600 }
|
|
460
|
+
),
|
|
461
|
+
new FileContentProvider(dir + "/")
|
|
462
|
+
],
|
|
454
463
|
outputs: this.outputs,
|
|
455
464
|
properties: {
|
|
456
465
|
name: `${this.typeName}-${this.owner.name}-${this.name}`,
|
|
@@ -472,7 +481,6 @@ export class Host extends Base {
|
|
|
472
481
|
|
|
473
482
|
await generateNetworkDefs(this, packageData);
|
|
474
483
|
await generateMachineInfo(this, packageData);
|
|
475
|
-
await copySshKeys(this, packageData);
|
|
476
484
|
await generateKnownHosts(this.owner.hosts(), join(dir, "root", ".ssh"));
|
|
477
485
|
|
|
478
486
|
yield packageData;
|
|
@@ -565,11 +573,11 @@ export class NetworkInterface extends Base {
|
|
|
565
573
|
}
|
|
566
574
|
|
|
567
575
|
get rawIPv4Address() {
|
|
568
|
-
return this.rawAddresses.filter(a=>isIPv4Address(a))[0];
|
|
576
|
+
return this.rawAddresses.filter(a => isIPv4Address(a))[0];
|
|
569
577
|
}
|
|
570
|
-
|
|
578
|
+
|
|
571
579
|
get rawIPv6Address() {
|
|
572
|
-
return this.rawAddresses.filter(a=>isIPv6Address(a))[0];
|
|
580
|
+
return this.rawAddresses.filter(a => isIPv6Address(a))[0];
|
|
573
581
|
}
|
|
574
582
|
|
|
575
583
|
get rawAddresses() {
|
package/src/location.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { mkdir, copyFile } from "node:fs/promises";
|
|
2
1
|
import { join } from "node:path";
|
|
3
2
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
3
|
import { Owner } from "./owner.mjs";
|
|
@@ -49,7 +48,13 @@ export class Location extends Owner {
|
|
|
49
48
|
async *preparePackages(dir) {
|
|
50
49
|
const packageData = {
|
|
51
50
|
dir,
|
|
52
|
-
sources: [
|
|
51
|
+
sources: [
|
|
52
|
+
new FileContentProvider(dir + "/"),
|
|
53
|
+
new FileContentProvider(
|
|
54
|
+
{ base: this.directory, pattern: "location.json" },
|
|
55
|
+
{ destination: "/etc/location/location.json" }
|
|
56
|
+
)
|
|
57
|
+
],
|
|
53
58
|
outputs: this.outputs,
|
|
54
59
|
properties: {
|
|
55
60
|
name: `${this.typeName}-${this.name}`,
|
|
@@ -87,15 +92,6 @@ export class Location extends Owner {
|
|
|
87
92
|
sectionLines(...this.findService({ type: "ntp" }).systemdConfig)
|
|
88
93
|
);
|
|
89
94
|
|
|
90
|
-
const locationDir = join(dir, "etc", "location");
|
|
91
|
-
|
|
92
|
-
await mkdir(locationDir, { recursive: true });
|
|
93
|
-
|
|
94
|
-
await copyFile(
|
|
95
|
-
join(this.directory, "location.json"),
|
|
96
|
-
join(locationDir, "location.json")
|
|
97
|
-
);
|
|
98
|
-
|
|
99
95
|
yield packageData;
|
|
100
96
|
}
|
|
101
97
|
}
|
package/src/services/dhcp.mjs
CHANGED
|
@@ -49,7 +49,7 @@ export class DHCPService extends Service {
|
|
|
49
49
|
|
|
50
50
|
const packageData = {
|
|
51
51
|
dir,
|
|
52
|
-
sources: [new FileContentProvider(dir + "/")
|
|
52
|
+
sources: [new FileContentProvider(dir + "/")],
|
|
53
53
|
outputs: this.outputs,
|
|
54
54
|
properties: {
|
|
55
55
|
name: `kea-${this.location.name}-${host.name}`,
|
package/src/services/dns.mjs
CHANGED
|
@@ -27,8 +27,18 @@ const DNSServiceTypeDefinition = {
|
|
|
27
27
|
trusted: { type: "network", collection: true, writeable: true },
|
|
28
28
|
protected: { type: "network", collection: true, writeable: true },
|
|
29
29
|
open: { type: "network", collection: true, writeable: true },
|
|
30
|
-
hasSVRRecords: {
|
|
31
|
-
|
|
30
|
+
hasSVRRecords: {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
collection: false,
|
|
33
|
+
writeable: true,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
hasCatalog: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
collection: false,
|
|
39
|
+
writeable: true,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
32
42
|
hasLinkLocalAdresses: {
|
|
33
43
|
type: "boolean",
|
|
34
44
|
collection: false,
|
|
@@ -36,7 +46,12 @@ const DNSServiceTypeDefinition = {
|
|
|
36
46
|
default: false
|
|
37
47
|
},
|
|
38
48
|
exclude: { type: "network", collection: true, writeable: true },
|
|
39
|
-
notify: {
|
|
49
|
+
notify: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
collection: false,
|
|
52
|
+
writeable: true,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
40
55
|
recordTTL: { type: "string", collection: false, writeable: true },
|
|
41
56
|
serial: { type: "number", collection: false, writeable: true },
|
|
42
57
|
refresh: { type: "string", collection: false, writeable: true },
|
|
@@ -162,7 +177,7 @@ export class DNSService extends ExtraSourceService {
|
|
|
162
177
|
const p1 = join(dir, "p1");
|
|
163
178
|
const packageData = {
|
|
164
179
|
dir: p1,
|
|
165
|
-
sources: [new FileContentProvider(p1 + "/")
|
|
180
|
+
sources: [new FileContentProvider(p1 + "/")],
|
|
166
181
|
outputs: this.outputs,
|
|
167
182
|
properties: {
|
|
168
183
|
name: `named-${name}`,
|
|
@@ -220,7 +235,7 @@ export class DNSService extends ExtraSourceService {
|
|
|
220
235
|
owner: "named",
|
|
221
236
|
group: "named"
|
|
222
237
|
}
|
|
223
|
-
)
|
|
238
|
+
)
|
|
224
239
|
];
|
|
225
240
|
|
|
226
241
|
await generateZoneDefs(this, location, packageData);
|
package/src/services/ntp.mjs
CHANGED
|
@@ -63,7 +63,7 @@ export class NTPService extends ExtraSourceService {
|
|
|
63
63
|
|
|
64
64
|
const packageData = {
|
|
65
65
|
dir,
|
|
66
|
-
sources: [new FileContentProvider(dir + "/")
|
|
66
|
+
sources: [new FileContentProvider(dir + "/")],
|
|
67
67
|
outputs: this.outputs,
|
|
68
68
|
properties: {
|
|
69
69
|
name: `chrony-${this.location.name}-${host.name}`,
|
package/types/host-utils.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export function generateMachineInfo(host: any, packageData: any): Promise<void>;
|
|
2
2
|
export function generateNetworkDefs(host: any, packageData: any): Promise<void>;
|
|
3
|
-
export function copySshKeys(host: any, packageData: any): Promise<void>;
|
|
4
3
|
export function generateKnownHosts(hosts: any, dir: any): Promise<void>;
|
package/types/host.d.mts
CHANGED
|
@@ -243,7 +243,7 @@ export class Host extends Base {
|
|
|
243
243
|
publicKey(type?: string): Promise<string>;
|
|
244
244
|
preparePackages(dir: any): AsyncGenerator<{
|
|
245
245
|
dir: any;
|
|
246
|
-
sources:
|
|
246
|
+
sources: FileContentProvider[];
|
|
247
247
|
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
248
248
|
properties: {
|
|
249
249
|
name: string;
|
|
@@ -464,3 +464,4 @@ export class NetworkInterface extends Base {
|
|
|
464
464
|
get kind(): any;
|
|
465
465
|
}
|
|
466
466
|
import { Base } from "./base.mjs";
|
|
467
|
+
import { FileContentProvider } from "npm-pkgbuild";
|
package/types/location.d.mts
CHANGED
|
@@ -277,7 +277,7 @@ export class Location extends Owner {
|
|
|
277
277
|
get location(): this;
|
|
278
278
|
preparePackages(dir: any): AsyncGenerator<{
|
|
279
279
|
dir: any;
|
|
280
|
-
sources:
|
|
280
|
+
sources: FileContentProvider[];
|
|
281
281
|
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
282
282
|
properties: {
|
|
283
283
|
name: string;
|
|
@@ -293,3 +293,4 @@ export class Location extends Owner {
|
|
|
293
293
|
}, void, unknown>;
|
|
294
294
|
}
|
|
295
295
|
import { Owner } from "./owner.mjs";
|
|
296
|
+
import { FileContentProvider } from "npm-pkgbuild";
|
|
@@ -256,7 +256,7 @@ export class DHCPService extends Service {
|
|
|
256
256
|
get type(): string;
|
|
257
257
|
preparePackages(dir: any): AsyncGenerator<{
|
|
258
258
|
dir: any;
|
|
259
|
-
sources:
|
|
259
|
+
sources: FileContentProvider[];
|
|
260
260
|
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
261
261
|
properties: {
|
|
262
262
|
name: string;
|
|
@@ -267,3 +267,4 @@ export class DHCPService extends Service {
|
|
|
267
267
|
}, void, unknown>;
|
|
268
268
|
}
|
|
269
269
|
import { Service } from "../service.mjs";
|
|
270
|
+
import { FileContentProvider } from "npm-pkgbuild";
|
package/types/services/dns.d.mts
CHANGED
|
@@ -379,7 +379,7 @@ export class DNSService extends ExtraSourceService {
|
|
|
379
379
|
})[];
|
|
380
380
|
preparePackages(dir: any): AsyncGenerator<{
|
|
381
381
|
dir: string;
|
|
382
|
-
sources:
|
|
382
|
+
sources: FileContentProvider[];
|
|
383
383
|
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
384
384
|
properties: {
|
|
385
385
|
name: string;
|
|
@@ -389,3 +389,4 @@ export class DNSService extends ExtraSourceService {
|
|
|
389
389
|
}, void, unknown>;
|
|
390
390
|
}
|
|
391
391
|
import { ExtraSourceService } from "../extra-source-service.mjs";
|
|
392
|
+
import { FileContentProvider } from "npm-pkgbuild";
|
package/types/services/ntp.d.mts
CHANGED
|
@@ -270,7 +270,7 @@ export class NTPService extends ExtraSourceService {
|
|
|
270
270
|
})[];
|
|
271
271
|
preparePackages(dir: any): AsyncGenerator<{
|
|
272
272
|
dir: any;
|
|
273
|
-
sources:
|
|
273
|
+
sources: FileContentProvider[];
|
|
274
274
|
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
275
275
|
properties: {
|
|
276
276
|
name: string;
|
|
@@ -281,3 +281,4 @@ export class NTPService extends ExtraSourceService {
|
|
|
281
281
|
}, void, unknown>;
|
|
282
282
|
}
|
|
283
283
|
import { ExtraSourceService } from "../extra-source-service.mjs";
|
|
284
|
+
import { FileContentProvider } from "npm-pkgbuild";
|