pmcf 4.14.10 → 4.15.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 +2 -2
- package/src/host-utils.mjs +4 -21
- package/src/host.mjs +1 -2
- package/src/utils.mjs +1 -1
- package/types/host-utils.d.mts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"ava": "^6.4.1",
|
|
65
65
|
"c8": "^10.1.3",
|
|
66
66
|
"documentation": "^14.0.3",
|
|
67
|
-
"semantic-release": "^25.0.
|
|
67
|
+
"semantic-release": "^25.0.3",
|
|
68
68
|
"typescript": "^5.9.3"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
package/src/host-utils.mjs
CHANGED
|
@@ -1,32 +1,15 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
1
|
import { writeLines } from "../src/utils.mjs";
|
|
3
2
|
|
|
4
|
-
export async function generateMachineInfo(host, packageData) {
|
|
5
|
-
const etcDir = join(packageData.dir, "etc");
|
|
6
|
-
await writeLines(
|
|
7
|
-
etcDir,
|
|
8
|
-
"machine-info",
|
|
9
|
-
Object.entries({
|
|
10
|
-
CHASSIS: host.chassis,
|
|
11
|
-
DEPLOYMENT: host.deployment,
|
|
12
|
-
LOCATION: host.location.name,
|
|
13
|
-
HARDWARE_VENDOR: host.vendor,
|
|
14
|
-
HARDWARE_MODEL: host.modelName
|
|
15
|
-
}).map(([k, v]) => `${k}=${v}`)
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
await writeLines(etcDir, "machine-id", host["machine-id"]);
|
|
19
|
-
await writeLines(etcDir, "hostname", host.hostName);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
3
|
export async function generateKnownHosts(hosts, dir) {
|
|
23
4
|
const keys = [];
|
|
24
5
|
for (const host of hosts) {
|
|
25
6
|
try {
|
|
26
7
|
const [alg, key, desc] = (await host.publicKey("ed25519")).split(/\s+/);
|
|
27
8
|
|
|
28
|
-
for(const domainName of host.domainNames) {
|
|
29
|
-
|
|
9
|
+
for (const domainName of host.domainNames) {
|
|
10
|
+
if (domainName !== "localhost") {
|
|
11
|
+
keys.push(`${domainName} ${alg} ${key}`);
|
|
12
|
+
}
|
|
30
13
|
}
|
|
31
14
|
|
|
32
15
|
for (const addr of host.networkAddresses(
|
package/src/host.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
asArray
|
|
21
21
|
} from "./utils.mjs";
|
|
22
22
|
import { loadHooks } from "./hooks.mjs";
|
|
23
|
-
import {
|
|
23
|
+
import { generateKnownHosts } from "./host-utils.mjs";
|
|
24
24
|
import { NetworkInterfaceTypeDefinition } from "./network-interfaces/network-interface.mjs";
|
|
25
25
|
|
|
26
26
|
const HostTypeDefinition = {
|
|
@@ -468,7 +468,6 @@ export class Host extends ServiceOwner {
|
|
|
468
468
|
await writeLines(dir, "etc/vconsole.conf", `KEYMAP=${this.keymap}`);
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
-
await generateMachineInfo(this, packageData);
|
|
472
471
|
await generateKnownHosts(this.owner.hosts(), join(dir, "root", ".ssh"));
|
|
473
472
|
|
|
474
473
|
for (const service of this.services) {
|
package/src/utils.mjs
CHANGED
|
@@ -13,7 +13,7 @@ export function yesno(flag) {
|
|
|
13
13
|
*/
|
|
14
14
|
export function domainName(name, defaultDomain) {
|
|
15
15
|
const dcs = name.split(".");
|
|
16
|
-
return defaultDomain === undefined || dcs.length > 1
|
|
16
|
+
return defaultDomain === undefined || dcs.length > 1 || name === "localhost"
|
|
17
17
|
? name
|
|
18
18
|
: [name, defaultDomain].join(".");
|
|
19
19
|
}
|
package/types/host-utils.d.mts
CHANGED