pmcf 2.41.1 → 2.42.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.41.1",
3
+ "version": "2.42.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,7 +27,9 @@ export async function generateKnownHosts(hosts, dir) {
27
27
 
28
28
  keys.push(`${host.domainName} ${alg} ${key}`);
29
29
 
30
- for await (const addr of host.networkAddresses()) {
30
+ for await (const addr of host.networkAddresses(
31
+ na => na.networkInterface.kind !== "loopback"
32
+ )) {
31
33
  keys.push(`${addr.address} ${alg} ${key}`);
32
34
  }
33
35
  } catch {}
package/src/host.mjs CHANGED
@@ -3,6 +3,7 @@ import { join } from "node:path";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
4
  import { ServiceOwner, Base, addresses } from "pmcf";
5
5
  import { networkAddressProperties } from "./network-support.mjs";
6
+ import { addHook } from "./hooks.mjs";
6
7
  import {
7
8
  domainFromDominName,
8
9
  domainName,
@@ -461,7 +462,8 @@ export class Host extends ServiceOwner {
461
462
  { base: this.directory, pattern: "*_key" },
462
463
  { destination: "/etc/ssh/", mode: 0o600 }
463
464
  ),
464
- new FileContentProvider(dir + "/")
465
+ new FileContentProvider(dir + "/"),
466
+ new FileContentProvider(join(this.directory, "extra") + "/")
465
467
  ],
466
468
  outputs: this.outputs,
467
469
  properties: {
@@ -474,6 +476,7 @@ export class Host extends ServiceOwner {
474
476
  ],
475
477
  provides: [...this.provides],
476
478
  replaces: [`mf-${this.hostName}`, ...this.replaces],
479
+ requires: [],
477
480
  backup: "root/.ssh/known_hosts",
478
481
  hooks: await loadHooks(
479
482
  {},
@@ -490,9 +493,15 @@ export class Host extends ServiceOwner {
490
493
  await generateKnownHosts(this.owner.hosts(), join(dir, "root", ".ssh"));
491
494
 
492
495
  for (const service of this.services) {
493
- if (service.systemdConfig) {
494
- const { name, content } = service.systemdConfig(this.name);
495
- await writeLines(dir, name, sectionLines(...content));
496
+ if (service.systemdConfig) {
497
+ const { serviceName, configFileName, content } = service.systemdConfig(this.name);
498
+ await writeLines(dir, configFileName, sectionLines(...content));
499
+
500
+ addHook(
501
+ packageData.properties.hooks,
502
+ "post_install",
503
+ `systemctl enable ${serviceName}.service`
504
+ );
496
505
  }
497
506
  }
498
507
 
@@ -54,6 +54,8 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
54
54
  const d = join(packageData.dir, "var/lib/iwd/");
55
55
  await mkdir(d, { recursive: true });
56
56
 
57
+ packageData.properties.requires.push("iwd", "impala");
58
+
57
59
  /*
58
60
  writeFile(
59
61
  join(d, `${this.network.name}.psk`),
@@ -34,7 +34,8 @@ export class SystemdJournalService extends Service {
34
34
 
35
35
  systemdConfig(name) {
36
36
  return {
37
- name: `etc/systemd/journal.conf.d/${name}.conf`,
37
+ serviceName: "systemd-journald",
38
+ configFileName: `etc/systemd/journal.conf.d/${name}.conf`,
38
39
  content: [
39
40
  "Journal",
40
41
  {
@@ -48,7 +48,8 @@ export class SystemdResolvedService extends ExtraSourceService {
48
48
  };
49
49
 
50
50
  return {
51
- name: `etc/systemd/resolved.conf.d/${name}.conf`,
51
+ serviceName: "systemd-resolved",
52
+ configFileName: `etc/systemd/resolved.conf.d/${name}.conf`,
52
53
  content: [
53
54
  "Resolve",
54
55
  {
@@ -38,7 +38,8 @@ export class SystemdTimesyncdService extends ExtraSourceService {
38
38
 
39
39
  systemdConfig(name) {
40
40
  return {
41
- name: `etc/systemd/timesyncd.conf.d/${name}.conf`,
41
+ serviceName: "systemd-timesyncd",
42
+ configFileName: `etc/systemd/timesyncd.conf.d/${name}.conf`,
42
43
  content: [
43
44
  "Time",
44
45
  {
package/types/host.d.mts CHANGED
@@ -246,6 +246,7 @@ export class Host extends ServiceOwner {
246
246
  dependencies: any[];
247
247
  provides: any[];
248
248
  replaces: any[];
249
+ requires: any[];
249
250
  backup: string;
250
251
  hooks: any;
251
252
  };
@@ -246,7 +246,8 @@ export class SystemdJournalService extends Service {
246
246
  get type(): string;
247
247
  get systemdServices(): string;
248
248
  systemdConfig(name: any): {
249
- name: string;
249
+ serviceName: string;
250
+ configFileName: string;
250
251
  content: (string | {
251
252
  Compress: string;
252
253
  SystemMaxUse: string;
@@ -245,7 +245,8 @@ export class SystemdResolvedService extends ExtraSourceService {
245
245
  };
246
246
  get systemdServices(): string;
247
247
  systemdConfig(name: any): {
248
- name: string;
248
+ serviceName: string;
249
+ configFileName: string;
249
250
  content: (string | {
250
251
  DNS: any;
251
252
  FallbackDNS: any;
@@ -245,7 +245,8 @@ export class SystemdTimesyncdService extends ExtraSourceService {
245
245
  };
246
246
  get systemdServices(): string;
247
247
  systemdConfig(name: any): {
248
- name: string;
248
+ serviceName: string;
249
+ configFileName: string;
249
250
  content: (string | {
250
251
  NTP: any;
251
252
  })[];