pmcf 2.41.2 → 2.43.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.2",
3
+ "version": "2.43.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
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,
@@ -118,6 +119,8 @@ export class Host extends ServiceOwner {
118
119
  }
119
120
  });
120
121
  }
122
+
123
+ this.extra = data.extra;
121
124
  }
122
125
 
123
126
  _applyExtends(host) {
@@ -450,7 +453,7 @@ export class Host extends ServiceOwner {
450
453
  }
451
454
 
452
455
  async *preparePackages(dir) {
453
- const packageData = {
456
+ let packageData = {
454
457
  dir,
455
458
  sources: [
456
459
  new FileContentProvider(
@@ -461,8 +464,7 @@ export class Host extends ServiceOwner {
461
464
  { base: this.directory, pattern: "*_key" },
462
465
  { destination: "/etc/ssh/", mode: 0o600 }
463
466
  ),
464
- new FileContentProvider(dir + "/"),
465
- new FileContentProvider(join(this.directory, "extra") + "/")
467
+ new FileContentProvider(dir + "/")
466
468
  ],
467
469
  outputs: this.outputs,
468
470
  properties: {
@@ -493,11 +495,35 @@ export class Host extends ServiceOwner {
493
495
 
494
496
  for (const service of this.services) {
495
497
  if (service.systemdConfig) {
496
- const { name, content } = service.systemdConfig(this.name);
497
- await writeLines(dir, name, sectionLines(...content));
498
+ const { serviceName, configFileName, content } = service.systemdConfig(
499
+ this.name
500
+ );
501
+ await writeLines(dir, configFileName, sectionLines(...content));
502
+
503
+ addHook(
504
+ packageData.properties.hooks,
505
+ "post_install",
506
+ `systemctl enable ${serviceName}.service`
507
+ );
498
508
  }
499
509
  }
500
510
 
501
511
  yield packageData;
512
+
513
+ if (this.extra) {
514
+ packageData = {
515
+ dir,
516
+ sources: [new FileContentProvider(join(this.directory, "extra") + "/")],
517
+ outputs: this.outputs,
518
+ properties: {
519
+ name: `${this.typeName}-extra-${this.owner.name}-${this.name}`,
520
+ description: `additional files for ${this.fullName}`,
521
+ access: "private",
522
+ dependencies: [`${this.typeName}-${this.owner.name}-${this.name}`]
523
+ }
524
+ };
525
+
526
+ yield packageData;
527
+ }
502
528
  }
503
529
  }
@@ -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
@@ -185,6 +185,7 @@ export class Host extends ServiceOwner {
185
185
  _vendor: any;
186
186
  _architecture: any;
187
187
  _serial: any;
188
+ extra: any;
188
189
  _applyExtends(host: any): void;
189
190
  set serial(value: any);
190
191
  get serial(): any;
@@ -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
  })[];