penguins-eggs 25.11.29 → 25.12.15

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.
Files changed (121) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/README.md +118 -127
  3. package/README.pdf +10950 -11893
  4. package/addons/eggs/theme/livecd/simple.grub.main.cfg +3 -3
  5. package/conf/derivatives.yaml +2 -1
  6. package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  7. package/conf/distros/focal/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  8. package/conf/distros/noble/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  9. package/conf/distros/noble/calamares/libexec/calamares-l10n-helper.sh +2 -1
  10. package/conf/distros/noble/calamares/settings.yml +1 -0
  11. package/conf/distros/trixie/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  12. package/conf/exclude.list.d/var.list +11 -6
  13. package/dist/appimage/dependency-manager.js +1 -1
  14. package/dist/classes/cli-autologin.d.ts +37 -4
  15. package/dist/classes/cli-autologin.js +153 -115
  16. package/dist/classes/compressors.d.ts +7 -10
  17. package/dist/classes/compressors.js +44 -31
  18. package/dist/classes/daddy.js +4 -1
  19. package/dist/classes/distro.js +2 -2
  20. package/dist/classes/diversions.js +2 -3
  21. package/dist/classes/incubation/fisherman-helper/initcpio.d.ts +3 -5
  22. package/dist/classes/incubation/fisherman-helper/initcpio.js +28 -20
  23. package/dist/classes/incubation/fisherman-helper/settings.js +1 -1
  24. package/dist/classes/incubation/fisherman.js +1 -1
  25. package/dist/classes/incubation/incubator.d/manjaro.js +1 -0
  26. package/dist/classes/incubation/incubator.js +1 -1
  27. package/dist/classes/ovary.d/create-xdg-autostart.js +1 -1
  28. package/dist/classes/ovary.d/edit-live-fs.d.ts +2 -13
  29. package/dist/classes/ovary.d/edit-live-fs.js +33 -146
  30. package/dist/classes/ovary.d/fertilization.js +1 -1
  31. package/dist/classes/ovary.d/luks-home.js +33 -19
  32. package/dist/classes/ovary.d/luks-root.d.ts +1 -2
  33. package/dist/classes/ovary.d/luks-root.js +46 -27
  34. package/dist/classes/ovary.d/luks-shrink.d.ts +14 -0
  35. package/dist/classes/ovary.d/luks-shrink.js +86 -0
  36. package/dist/classes/ovary.d/make-dot-disk.js +1 -1
  37. package/dist/classes/ovary.d/produce.js +64 -22
  38. package/dist/classes/ovary.d/user-create-live.d.ts +4 -10
  39. package/dist/classes/ovary.d/user-create-live.js +82 -84
  40. package/dist/classes/ovary.d/users-remove.d.ts +5 -6
  41. package/dist/classes/ovary.d/users-remove.js +61 -31
  42. package/dist/classes/ovary.d.ts +5 -3
  43. package/dist/classes/ovary.js +5 -3
  44. package/dist/classes/pacman.d/alpine.js +2 -2
  45. package/dist/classes/pacman.d/archlinux.js +2 -2
  46. package/dist/classes/pacman.d/debian.js +2 -3
  47. package/dist/classes/pacman.d/fedora.js +2 -3
  48. package/dist/classes/pacman.d/openmamba.js +2 -3
  49. package/dist/classes/pacman.d/opensuse.js +2 -3
  50. package/dist/classes/pacman.d.ts +0 -5
  51. package/dist/classes/pacman.js +3 -16
  52. package/dist/classes/pve-live.js +1 -1
  53. package/dist/classes/settings.js +1 -1
  54. package/dist/classes/sys-users.d.ts +76 -0
  55. package/dist/classes/sys-users.js +206 -0
  56. package/dist/classes/utils.d/kernel.js +3 -3
  57. package/dist/classes/utils.d.ts +15 -6
  58. package/dist/classes/utils.js +80 -47
  59. package/dist/classes/xdg.js +1 -1
  60. package/dist/classes/yolk.js +3 -5
  61. package/dist/commands/export/appimage.js +3 -3
  62. package/dist/commands/export/pkg.js +3 -3
  63. package/dist/commands/export/tarballs.js +3 -3
  64. package/dist/commands/krill.js +1 -1
  65. package/dist/commands/produce.js +14 -5
  66. package/dist/commands/setup/install.js +1 -1
  67. package/dist/commands/setup/purge.js +1 -1
  68. package/dist/commands/tools/yolk.js +1 -1
  69. package/dist/commands/update.js +1 -2
  70. package/dist/interfaces/calamares/i-calamares-branding.d.ts +56 -38
  71. package/dist/interfaces/calamares/i-calamares-branding.js +10 -0
  72. package/dist/interfaces/i-exec.d.ts +1 -0
  73. package/dist/krill/classes/prepare.d/location.js +1 -1
  74. package/dist/krill/classes/prepare.d/partitions.js +1 -1
  75. package/dist/krill/classes/prepare.d/users.js +2 -2
  76. package/dist/krill/classes/prepare.js +5 -5
  77. package/dist/krill/classes/sequence.d/add_user.d.ts +3 -15
  78. package/dist/krill/classes/sequence.d/add_user.js +87 -57
  79. package/dist/krill/classes/sequence.d/change_password.d.ts +5 -7
  80. package/dist/krill/classes/sequence.d/change_password.js +25 -10
  81. package/dist/krill/classes/sequence.d/del_live_user.d.ts +5 -7
  82. package/dist/krill/classes/sequence.d/del_live_user.js +39 -25
  83. package/dist/krill/classes/sequence.d/fstab.js +2 -2
  84. package/dist/krill/classes/sequence.d/grubcfg.d.ts +3 -7
  85. package/dist/krill/classes/sequence.d/grubcfg.js +33 -13
  86. package/dist/krill/classes/sequence.d/mkfs.js +2 -3
  87. package/dist/krill/classes/sequence.d/unpackfs.d.ts +2 -4
  88. package/dist/krill/classes/sequence.d/unpackfs.js +8 -5
  89. package/dist/krill/classes/sequence.d.ts +1 -5
  90. package/dist/krill/classes/sequence.js +28 -32
  91. package/dist/krill/components/finished.js +2 -2
  92. package/dist/krill/components/install.js +2 -2
  93. package/dist/krill/components/keyboard.js +2 -2
  94. package/dist/krill/components/location.js +2 -2
  95. package/dist/krill/components/network.js +2 -2
  96. package/dist/krill/components/partitions.js +2 -2
  97. package/dist/krill/components/summary.js +2 -2
  98. package/dist/krill/components/title.js +2 -2
  99. package/dist/krill/components/users.js +2 -2
  100. package/dist/krill/components/welcome.js +2 -2
  101. package/dist/krill/lib/select_installation_device.js +1 -1
  102. package/dist/krill/lib/select_replaced_partition.js +1 -1
  103. package/dist/lib/utils.d.ts +52 -19
  104. package/dist/lib/utils.js +271 -20
  105. package/manpages/doc/man/eggs.1.gz +0 -0
  106. package/manpages/doc/man/eggs.html +8 -8
  107. package/package.json +9 -9
  108. package/perrisbrewery/template/dependencies.yaml +1 -0
  109. package/scripts/boot-encrypted-root.sh +220 -0
  110. package/scripts/mount-encrypted-home.sh +324 -0
  111. package/scripts/restore_homecrypt_krill.sh +93 -0
  112. package/dracut/create-symlink +0 -71
  113. package/dracut/dracut-log.txt +0 -3
  114. package/dracut/export +0 -4
  115. package/dracut/export-dracut-analysis +0 -51
  116. package/dracut/export-dracut-log +0 -2
  117. package/dracut/mkisofs +0 -10
  118. package/dracut/renew-initramfs +0 -17
  119. package/dracut/sbin2bin +0 -10
  120. package/dracut/update-dracut-conf-d +0 -2
  121. package/dracut/update-dracut-modules +0 -62
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * ./src/classes/compressors.ts
3
- * penguins-eggs v.25.7.x / ecmascript 2020
3
+ * penguins-eggs v.25.11.x / ecmascript 2020
4
4
  * author: Piero Proietti
5
5
  * email: piero.proietti@gmail.com
6
6
  * license: MIT
7
7
  */
8
- import shx from 'shelljs';
8
+ import fs from 'fs';
9
+ import { execSync } from '../lib/utils.js'; // Assicurati che il path sia corretto
9
10
  export default class Compressors {
10
11
  dest = '/tmp/eggs-mksquash-dest';
12
+ source = '/tmp/eggs-mksquash-test';
11
13
  isEnabled = {
12
14
  error: false,
13
15
  gzip: true,
@@ -17,10 +19,8 @@ export default class Compressors {
17
19
  xz: false,
18
20
  zstd: false
19
21
  };
20
- source = '/tmp/eggs-mksquash-test';
21
22
  /**
22
23
  * fast compression
23
- * @returns
24
24
  */
25
25
  fast() {
26
26
  let comp = 'gzip';
@@ -34,7 +34,6 @@ export default class Compressors {
34
34
  }
35
35
  /**
36
36
  * max
37
- * @returns
38
37
  */
39
38
  max() {
40
39
  let filter = 'x86';
@@ -42,9 +41,7 @@ export default class Compressors {
42
41
  filter = 'arm';
43
42
  }
44
43
  const options = '-b 1M -no-duplicates -no-recovery -always-use-fragments';
45
- if (process.arch === 'ia32') {
46
- // options = '-b 1M'
47
- }
44
+ // if (process.arch === 'ia32') { options = '-b 1M' }
48
45
  const comp = `xz -Xbcj ${filter} ${options}`;
49
46
  return comp;
50
47
  }
@@ -60,50 +57,66 @@ export default class Compressors {
60
57
  }
61
58
  /**
62
59
  * populate
60
+ * Manteniamo async per compatibilità con chi lo chiama,
61
+ * ma internamente ora è tutto sincrono e veloce.
63
62
  */
64
63
  async populate() {
65
- await this.prepareCheck();
66
- this.isEnabled.error = await this.check('error');
67
- this.isEnabled.lzma = await this.check('lzma');
68
- this.isEnabled.lzo = await this.check('lzo');
69
- this.isEnabled.lz4 = await this.check('lz4');
70
- this.isEnabled.xz = await this.check('xz');
71
- this.isEnabled.zstd = await this.check('zstd');
72
- await this.removeCheck();
64
+ this.prepareCheck();
65
+ // Non serve await perché check ora è sincrono
66
+ this.isEnabled.error = this.check('error');
67
+ this.isEnabled.lzma = this.check('lzma');
68
+ this.isEnabled.lzo = this.check('lzo');
69
+ this.isEnabled.lz4 = this.check('lz4');
70
+ this.isEnabled.xz = this.check('xz');
71
+ this.isEnabled.zstd = this.check('zstd');
72
+ this.removeCheck();
73
73
  }
74
74
  /**
75
75
  * standard
76
- * @returns
77
76
  */
78
77
  standard() {
79
78
  const comp = 'xz -b 1M';
80
79
  return comp;
81
80
  }
82
81
  /**
83
- * check mksquashfs exists
84
- * @param compressor
85
- * @returns
82
+ * check mksquashfs exists and supports compressor
86
83
  */
87
- async check(compressor) {
84
+ check(compressor) {
88
85
  let result = false;
89
- const { stderr } = shx.exec('mksquashfs ' + this.source + ' ' + this.dest + ' -comp ' + compressor + ' -no-xattrs -ef ' + this.dest, { silent: true });
90
- if (stderr === '') {
86
+ try {
87
+ // ignore: true silenzia output (stdio='ignore')
88
+ // Se mksquashfs fallisce (exit code != 0), execSync lancia un errore
89
+ execSync(`mksquashfs ${this.source} ${this.dest} -comp ${compressor} -no-xattrs -ef ${this.dest}`, { ignore: true });
91
90
  result = true;
92
91
  }
92
+ catch (error) {
93
+ // Fallito (comando non trovato o compressore non supportato)
94
+ result = false;
95
+ }
93
96
  return result;
94
97
  }
95
98
  /**
96
- * prepareCheck
99
+ * prepareCheck: Usa FS nativo invece di shelljs
97
100
  */
98
- async prepareCheck() {
99
- shx.exec('rm -rf ' + this.source, { silent: true });
100
- shx.exec('mkdir ' + this.source, { silent: true });
101
+ prepareCheck() {
102
+ // rm -rf
103
+ if (fs.existsSync(this.source)) {
104
+ fs.rmSync(this.source, { recursive: true, force: true });
105
+ }
106
+ // mkdir -p
107
+ fs.mkdirSync(this.source, { recursive: true });
101
108
  }
102
109
  /**
103
- * removeCheck
110
+ * removeCheck: Usa FS nativo invece di shelljs
104
111
  */
105
- async removeCheck() {
106
- shx.exec('rm -rf ' + this.source, { silent: true });
107
- shx.exec('rm -f ' + this.dest, { silent: true });
112
+ removeCheck() {
113
+ // rm -rf source
114
+ if (fs.existsSync(this.source)) {
115
+ fs.rmSync(this.source, { recursive: true, force: true });
116
+ }
117
+ // rm -f dest
118
+ if (fs.existsSync(this.dest)) {
119
+ fs.rmSync(this.dest, { recursive: true, force: true });
120
+ }
108
121
  }
109
122
  }
@@ -82,10 +82,13 @@ export default class Daddy {
82
82
  default: compressionOpt,
83
83
  },
84
84
  ];
85
+ // occorre aggiungere ad answer
86
+ // i campi mancanti
85
87
  try {
86
88
  // Prompt the user and return the typed config object
87
89
  const answers = await inquirer.prompt(questions);
88
- return answers;
90
+ return { ...config, ...answers };
91
+ //return answers;
89
92
  }
90
93
  catch (err) {
91
94
  console.error(chalk.red('Error editing configuration:'), err);
@@ -8,7 +8,7 @@
8
8
  import yaml from 'js-yaml';
9
9
  import fs from 'node:fs';
10
10
  import path from 'node:path';
11
- import shell from 'shelljs';
11
+ import { shx } from '../lib/utils.js';
12
12
  import Utils from './utils.js';
13
13
  import Diversions from './diversions.js';
14
14
  // _dirname
@@ -316,7 +316,7 @@ class Distro {
316
316
  if (Diversions.isManjaroBased(this.distroId)) {
317
317
  this.liveMediumPath = '/run/miso/bootmnt/';
318
318
  this.squashfs = 'manjaro/x86_64/livefs.sfs';
319
- this.codenameId = shell.exec(`lsb_release -cs`, { silent: true }).stdout.toString().trim();
319
+ this.codenameId = shx.exec(`lsb_release -cs`, { silent: true }).stdout.toString().trim();
320
320
  this.distroUniqueId = 'manjaro';
321
321
  }
322
322
  /**
@@ -68,7 +68,7 @@ export default class Diversions {
68
68
  break;
69
69
  case 'fedora':
70
70
  case 'openmamba':
71
- kp += `root=live:CDLABEL=${volid} rd.live.image rd.live.dir=/live rd.live.squashimg=filesystem.squashfs selinux=0`;
71
+ kp += `root=live:CDLABEL=${volid} rd.live.image rd.live.dir=/live rd.live.squashimg=filesystem.squashfs enforcing=0`;
72
72
  break;
73
73
  case 'opensuse':
74
74
  kp += `root=live:CDLABEL=${volid} rd.live.image rd.live.dir=/live rd.live.squashimg=filesystem.squashfs apparmor=0`;
@@ -104,8 +104,7 @@ export default class Diversions {
104
104
  let pathBootloaders = '/usr/lib/';
105
105
  if (familyId !== "debian") {
106
106
  if (Utils.isAppImage()) {
107
- const appImagePath = path.join(__dirname, '..', '..', 'bootloaders');
108
- pathBootloaders = appImagePath;
107
+ pathBootloaders = path.join(__dirname, '..', '..', 'bootloaders/');
109
108
  }
110
109
  else {
111
110
  pathBootloaders = '/usr/lib/penguins-eggs/bootloaders/';
@@ -1,8 +1,6 @@
1
1
  /**
2
- * ./src/classes/incubation/fisherman-helper/initcpio.ts
3
- * penguins-eggs v.25.7.x / ecmascript 2020
4
- * author: Piero Proietti
5
- * email: piero.proietti@gmail.com
6
- * license: MIT
2
+ * Cerca il file .preset per mkinitcpio appropriato per il kernel corrente.
3
+ * @returns Il percorso del file .preset trovato.
4
+ * @throws {Error} Se non è possibile trovare un file .preset valido.
7
5
  */
8
6
  export declare function initcpio(): Promise<string>;
@@ -5,31 +5,43 @@
5
5
  * email: piero.proietti@gmail.com
6
6
  * license: MIT
7
7
  */
8
- import { exec } from 'child_process';
9
- import { promisify } from 'util';
8
+ import { exec } from '../../../lib/utils.js';
10
9
  import { access } from 'fs/promises';
11
- const execAsync = promisify(exec);
10
+ /**
11
+ * Cerca il file .preset per mkinitcpio appropriato per il kernel corrente.
12
+ * @returns Il percorso del file .preset trovato.
13
+ * @throws {Error} Se non è possibile trovare un file .preset valido.
14
+ */
12
15
  export async function initcpio() {
13
16
  try {
14
- const { stdout: kernelVersion } = await execAsync('uname -r');
17
+ const kernelVersion = (await exec('uname -r', { capture: true })).data;
15
18
  const version = kernelVersion.trim();
16
- // Manjaro
19
+ // Logica Manjaro
17
20
  if (version.includes('MANJARO')) {
18
21
  try {
19
- // Estrai major e minor version. Es: da "6.12.48-1-MANJARO" -> ["6", "12", "48-1-MANJARO"]
20
22
  const parts = version.split('.');
21
- // Costruisci il nome del preset come "linux" + "6" + "12" -> "linux612"
22
23
  const kernelName = `linux${parts[0]}${parts[1]}`;
24
+ // Tentativo 1: Major/Minor (es. /etc/mkinitcpio.d/linux61.preset)
23
25
  const manjaroPreset = `/etc/mkinitcpio.d/${kernelName}.preset`;
24
- await access(manjaroPreset); // Verifica se esiste /etc/mkinitcpio.d/linux612.preset
25
- return manjaroPreset; // Se esiste, lo restituisce e la funzione termina
26
+ await access(manjaroPreset);
27
+ return manjaroPreset;
26
28
  }
27
- catch {
28
- // Se anche questa logica fallisce, lascia che proceda al fallback per Arch
29
- // console.warn('Logica Manjaro fallita, si tenta il fallback per Arch...');
29
+ catch (e) {
30
+ try {
31
+ const parts = version.split('.');
32
+ const kernelName = `linux${parts[0]}${parts[1]}`;
33
+ // Tentativo 2: Major/Minor con Architettura (es. /etc/mkinitcpio.d/linux61-x86_64.preset)
34
+ const manjaroPresetArch = `/etc/mkinitcpio.d/${kernelName}-x86_64.preset`;
35
+ await access(manjaroPresetArch);
36
+ return manjaroPresetArch;
37
+ }
38
+ catch (e) {
39
+ // Fallito, si procede al FALLBACK ARCH
40
+ }
30
41
  }
31
42
  }
32
43
  else if (version.includes('cachyos')) {
44
+ // Logica CachyOS
33
45
  try {
34
46
  let kernelType = 'linux-cachyos'; // default
35
47
  if (version.includes('lts')) {
@@ -46,14 +58,10 @@ export async function initcpio() {
46
58
  return cachyPreset;
47
59
  }
48
60
  catch {
49
- // Se anche questa logica fallisce, lascia che proceda al fallback per Arch
50
- // console.warn('Logica Manjaro fallita, si tenta il fallback per Arch...');
61
+ // Fallito, si procede al fallback Arch
51
62
  }
52
63
  }
53
- /**
54
- * FALLBACK ARCH
55
- */
56
- // Determina il tipo di kernel
64
+ // FALLBACK ARCH
57
65
  let kernelType = 'linux'; // default
58
66
  if (version.includes('lts')) {
59
67
  kernelType = 'linux-lts';
@@ -70,7 +78,7 @@ export async function initcpio() {
70
78
  return archPreset;
71
79
  }
72
80
  catch (error) {
73
- // Rimuoviamo l'errore originale dalla stringa per un messaggio più pulito
74
- throw new Error(`Impossibile trovare un file .preset valido in /etc/mkinitcpio.d/`);
81
+ // Lancia un errore se tutti i tentativi falliscono.
82
+ throw new Error(`Impossibile trovare un file .preset valido in /etc/mkinitcpio.d/.`);
75
83
  }
76
84
  }
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import yaml from 'js-yaml';
14
14
  import fs from 'node:fs';
15
- import shx from 'shelljs';
15
+ import { shx } from '../../../lib/utils.js';
16
16
  import Utils from '../../utils.js';
17
17
  import { installer } from '../installer.js';
18
18
  /**
@@ -9,7 +9,7 @@ import chalk from 'chalk';
9
9
  import mustache from 'mustache';
10
10
  import fs from 'node:fs';
11
11
  import path from 'node:path';
12
- import shx from 'shelljs';
12
+ import { shx } from '../../lib/utils.js';
13
13
  import yaml from 'js-yaml';
14
14
  import { exec } from '../../lib/utils.js';
15
15
  import { settings } from './fisherman-helper/settings.js';
@@ -78,5 +78,6 @@ export class Manjaro {
78
78
  }
79
79
  await fisherman.buildModule('umount');
80
80
  await fisherman.buildModuleFinished();
81
+ console.log('manjaro created');
81
82
  }
82
83
  }
@@ -13,7 +13,7 @@ const pjson = require('../../../package.json');
13
13
  import yaml from 'js-yaml';
14
14
  import fs from 'node:fs';
15
15
  import path from 'node:path';
16
- import shx from 'shelljs';
16
+ import { shx } from '../../lib/utils.js';
17
17
  import Pacman from '../pacman.js';
18
18
  import Utils from '../utils.js';
19
19
  import { installer } from './installer.js';
@@ -8,7 +8,7 @@
8
8
  // packages
9
9
  import fs from 'node:fs';
10
10
  import path from 'node:path';
11
- import shx from 'shelljs';
11
+ import { shx } from '../../lib/utils.js';
12
12
  import Pacman from '../pacman.js';
13
13
  import Utils from '../utils.js';
14
14
  import Xdg from '../xdg.js';
@@ -1,20 +1,9 @@
1
1
  /**
2
2
  * ./src/classes/ovary.d/edit-live-fs.ts
3
- * penguins-eggs v.25.11.x / ecmascript 2020
3
+ * penguins-eggs v.25.12.5 / ecmascript 2020
4
4
  * author: Piero Proietti
5
5
  * email: piero.proietti@gmail.com
6
6
  * license: MIT
7
7
  */
8
8
  import Ovary from '../ovary.js';
9
- /**
10
- * editLiveFs
11
- * - Mark if is_clone or is_clone_crypted
12
- * - Truncate logs, remove archived log
13
- * - Allow all fixed drives to be mounted with pmount
14
- * - Enable or disable password login trhough ssh for users (not root)
15
- * - Create an empty /etc/fstab
16
- * - Blanck /etc/machine-id
17
- * - Add some basic files to /dev
18
- * - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
19
- */
20
- export declare function editLiveFs(this: Ovary, clone?: boolean): Promise<void>;
9
+ export declare function editLiveFs(this: Ovary): Promise<void>;
@@ -1,84 +1,43 @@
1
1
  /**
2
2
  * ./src/classes/ovary.d/edit-live-fs.ts
3
- * penguins-eggs v.25.11.x / ecmascript 2020
3
+ * penguins-eggs v.25.12.5 / ecmascript 2020
4
4
  * author: Piero Proietti
5
5
  * email: piero.proietti@gmail.com
6
6
  * license: MIT
7
7
  */
8
- // packages
9
8
  import fs from 'fs';
10
9
  import os from 'os';
11
10
  import path from 'node:path';
12
- import shx from 'shelljs';
11
+ import { shx } from '../../lib/utils.js';
13
12
  import Utils from '../utils.js';
14
13
  import Pacman from '../pacman.js';
15
14
  import Systemctl from '../systemctl.js';
16
15
  import { exec } from '../../lib/utils.js';
17
16
  // _dirname
18
17
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
19
- /**
20
- * editLiveFs
21
- * - Mark if is_clone or is_clone_crypted
22
- * - Truncate logs, remove archived log
23
- * - Allow all fixed drives to be mounted with pmount
24
- * - Enable or disable password login trhough ssh for users (not root)
25
- * - Create an empty /etc/fstab
26
- * - Blanck /etc/machine-id
27
- * - Add some basic files to /dev
28
- * - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
29
- */
30
- export async function editLiveFs(clone = false) {
31
- if (this.verbose) {
18
+ export async function editLiveFs() {
19
+ if (this.verbose)
32
20
  console.log('Ovary: editLiveFs');
33
- }
34
21
  const workDir = this.settings.work_dir.merged;
35
- /**
36
- * /etc/penguins-eggs.d/is_clone file created on live
37
- */
38
- if (clone) {
22
+ if (this.clone || this.homecrypt || this.fullcrypt) {
39
23
  await exec(`touch ${workDir}/etc/penguins-eggs.d/is_clone`, this.echo);
40
24
  }
41
- /**
42
- * /etc/default/epoptes-client created on live
43
- */
44
25
  if (Pacman.packageIsInstalled('epoptes')) {
45
26
  const file = `${workDir}/etc/default/epoptes-client`;
46
27
  const text = `SERVER=${os.hostname}.local\n`;
47
28
  fs.writeFileSync(file, text);
48
29
  }
49
30
  if (this.familyId === 'debian') {
50
- // Aggiungo UMASK=0077 in /etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf
51
31
  const text = 'UMASK=0077\n';
52
32
  const file = '/etc/initramfs-tools/conf.d/eggs-safe-initramfs.conf';
53
33
  Utils.write(file, text);
54
34
  }
55
- // Truncate logs, remove archived logs.
35
+ // Truncate logs
56
36
  let cmd = `find ${workDir}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
57
37
  await exec(cmd, this.echo);
58
38
  cmd = `find ${workDir}/var/log/ -type f -exec truncate -s 0 {} \\;`;
59
39
  await exec(cmd, this.echo);
60
- // =========================================================================
61
- // FIX STRUTTURALE PER DEVUAN/DEBIAN (/var folders)
62
- // =========================================================================
63
- // Ricrea le directory essenziali che potrebbero essere state rimosse
64
- // o che devono esistere vuote per il corretto avvio dei servizi.
65
- const dirsToCreate = [
66
- `${workDir}/var/lib/dbus`, // Fondamentale per dbus
67
- `${workDir}/var/spool/rsyslog`, // Fondamentale per rsyslog
68
- `${workDir}/var/spool/cron/crontabs` // Fondamentale per cron
69
- ];
70
- for (const dir of dirsToCreate) {
71
- if (!fs.existsSync(dir)) {
72
- await exec(`mkdir -p ${dir}`, this.echo);
73
- // Assicuriamo permessi corretti (dbus vuole 755 root:root di base)
74
- await exec(`chmod 755 ${dir}`, this.echo);
75
- }
76
- }
77
- // =========================================================================
78
- // FIX CRITICO PER /var/run e /var/lock
79
- // =========================================================================
80
- // Su Debian/Devuan moderni, /var/run DEVE essere un symlink a /run.
81
- // Se rsync lo ha copiato come directory, D-Bus e altri servizi falliscono.
40
+ // Fix Symlinks /var/run e /var/lock
82
41
  const varRun = `${workDir}/var/run`;
83
42
  if (fs.existsSync(varRun) && !fs.lstatSync(varRun).isSymbolicLink()) {
84
43
  if (this.verbose)
@@ -93,20 +52,14 @@ export async function editLiveFs(clone = false) {
93
52
  await exec(`rm -rf ${varLock}`, this.echo);
94
53
  await exec(`ln -s /run/lock ${varLock}`, this.echo);
95
54
  }
96
- // =========================================================================
97
- // Allow all fixed drives to be mounted with pmount
55
+ // Altri fix standard
98
56
  if (this.settings.config.pmount_fixed && fs.existsSync(`${workDir}/etc/pmount.allow`)) {
99
- // MX aggiunto /etc
100
57
  await exec(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${workDir}/etc/pmount.allow`, this.echo);
101
58
  }
102
- // Remove obsolete live-config file
103
59
  if (fs.existsSync(`${workDir}lib/live/config/1161-openssh-server`)) {
104
60
  await exec(`rm -f ${workDir}/lib/live/config/1161-openssh-server`, this.echo);
105
61
  }
106
62
  if (fs.existsSync(`${workDir}/etc/ssh/sshd_config`)) {
107
- /**
108
- * enable/disable SSH root/users password login
109
- */
110
63
  await exec(`sed -i '/PermitRootLogin/d' ${workDir}/etc/ssh/sshd_config`);
111
64
  await exec(`sed -i '/PasswordAuthentication/d' ${workDir}/etc/ssh/sshd_config`);
112
65
  if (this.settings.config.ssh_pass) {
@@ -117,111 +70,57 @@ export async function editLiveFs(clone = false) {
117
70
  await exec(`echo 'PasswordAuthentication no' | tee -a ${workDir}/etc/ssh/sshd_config`, this.echo);
118
71
  }
119
72
  }
120
- /**
121
- * /etc/fstab should exist, even if it's empty,
122
- * to prevent error messages at boot
123
- */
124
73
  await exec(`rm ${workDir}/etc/fstab`, this.echo);
125
74
  await exec(`touch ${workDir}/etc/fstab`, this.echo);
126
- /**
127
- * Remove crypttab if exists
128
- * this is crucial for tpm systems.
129
- */
130
75
  if (fs.existsSync(`${workDir}/etc/crypttab`)) {
131
76
  await exec(`rm ${workDir}/etc/crypttab`, this.echo);
132
77
  }
133
- // =========================================================================
134
- // FIX MACHINE-ID (Il colpevole del blocco SysVinit)
135
- // =========================================================================
136
78
  /**
137
- * Blank out systemd machine id.
138
- * SU SYSTEMD: File vuoto = rigenerazione.
139
- * SU SYSVINIT (Devuan): File NON deve esistere o deve essere 0 bytes.
79
+ * machine-id
140
80
  */
141
- // 1. Pulisci /etc/machine-id
142
- if (fs.existsSync(`${workDir}/etc/machine-id`)) {
143
- await exec(`rm ${workDir}/etc/machine-id`, this.echo);
144
- // Per Systemd serve il file vuoto per fare il bind mount
145
- // Per Devuan va bene vuoto (lo riempie dbus-uuidgen)
146
- await exec(`touch ${workDir}/etc/machine-id`, this.echo);
147
- }
148
- // 2. Rimuovi /var/lib/dbus/machine-id
149
- // Questo è il file "vero" per dbus su sistemi non-systemd.
150
- // Deve sparire per essere rigenerato al boot.
151
- if (fs.existsSync(`${workDir}/var/lib/dbus/machine-id`)) {
152
- await exec(`rm ${workDir}/var/lib/dbus/machine-id`, this.echo);
81
+ await exec(`rm -f ${workDir}/etc/machine-id`);
82
+ await exec(`rm -f ${workDir}/var/lib/dbus/machine-id`);
83
+ if (Utils.isSysvinit()) {
84
+ await exec(`chroot ${workDir} dbus-uuidgen --ensure=/etc/machine-id`);
85
+ await exec(`ln -sf /etc/machine-id ${workDir}/var/lib/dbus/machine-id`);
86
+ // const machineId = crypto.randomBytes(16).toString('hex')
87
+ // fs.writeFileSync(`${workDir}/etc/machine-id`, machineId + '\n')
88
+ // fs.writeFileSync(`${workDir}/var/lib/dbus/machine-id`, machineId + '\n')
89
+ }
90
+ else if (Utils.isSystemd()) {
91
+ await exec(`touch ${workDir}/etc/machine-id`);
153
92
  }
154
- // =========================================================================
155
- /**
156
- * LMDE4: utilizza UbuntuMono16.pf2
157
- * aggiungo un link a /boot/grub/fonts/UbuntuMono16.pf2
158
- */
159
93
  if (fs.existsSync(`${workDir}/boot/grub/fonts/unicode.pf2`)) {
160
94
  shx.cp(`${workDir}/boot/grub/fonts/unicode.pf2`, `${workDir}/boot/grub/fonts/UbuntuMono16.pf2`);
161
95
  }
162
- /**
163
- * cleaning /etc/resolv.conf
164
- */
165
- const resolvFile = `${workDir}/etc/resolv.conf`;
166
- shx.rm(resolvFile);
167
- /**
168
- * Per tutte le distro systemd
169
- */
96
+ shx.rm(`${workDir}/etc/resolv.conf`);
97
+ // Systemd cleanup
170
98
  if (Utils.isSystemd()) {
171
99
  const systemdctl = new Systemctl(this.verbose);
172
- /*
173
- * Arch: /ci/minimal/arch-minimal.sh:
174
- * systemctl set-default multi-user.target
175
- * systemctl enable getty@tty1.service
176
- * systemctl enable systemd-networkd.service
177
- * systemctl enable 'systemd-resolved.service
178
- */
179
- if (await systemdctl.isEnabled('remote-cryptsetup.target')) {
100
+ if (await systemdctl.isEnabled('remote-cryptsetup.target'))
180
101
  await systemdctl.disable('remote-cryptsetup.target', workDir, true);
181
- }
182
- if (await systemdctl.isEnabled('speech-dispatcherd.service')) {
102
+ if (await systemdctl.isEnabled('speech-dispatcherd.service'))
183
103
  await systemdctl.disable('speech-dispatcherd.service', workDir, true);
184
- }
185
- if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service')) {
104
+ if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service'))
186
105
  await systemdctl.disable('wpa_supplicant-nl80211@.service', workDir, true);
187
- }
188
- if (await systemdctl.isEnabled('wpa_supplicant@.service')) {
106
+ if (await systemdctl.isEnabled('wpa_supplicant@.service'))
189
107
  await systemdctl.disable('wpa_supplicant@.service', workDir, true);
190
- }
191
- if (await systemdctl.isEnabled('wpa_supplicant-wired@.service')) {
108
+ if (await systemdctl.isEnabled('wpa_supplicant-wired@.service'))
192
109
  await systemdctl.disable('wpa_supplicant-wired@.service', workDir, true);
193
- }
194
- /**
195
- * All systemd distros
196
- */
197
110
  await exec(`rm -f ${workDir}/var/lib/wicd/configurations/*`, this.echo);
198
111
  await exec(`rm -f ${workDir}/etc/wicd/wireless-settings.conf`, this.echo);
199
112
  await exec(`rm -f ${workDir}/etc/NetworkManager/system-connections/*`, this.echo);
200
113
  await exec(`rm -f ${workDir}/etc/network/wifi/*`, this.echo);
201
- /**
202
- * removing from /etc/network/:
203
- * if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
204
- */
205
114
  const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
206
- let cleanDir = '';
207
- for (cleanDir of cleanDirs) {
115
+ for (const cleanDir of cleanDirs) {
208
116
  await exec(`rm -f ${workDir}/etc/network/${cleanDir}/wpasupplicant`, this.echo);
209
117
  }
210
118
  }
211
- /**
212
- * Clear configs from /etc/network/interfaces, wicd and NetworkManager
213
- * and netman, so they aren't stealthily included in the snapshot.
214
- */
215
119
  if (this.familyId === 'debian') {
216
120
  if (fs.existsSync(`${workDir}/etc/network/interfaces`)) {
217
121
  await exec(`rm -f ${workDir}/etc/network/interfaces`, this.echo);
218
122
  Utils.write(`${workDir}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
219
123
  }
220
- /**
221
- * add some basic files to /dev
222
- */
223
- // Ho condensato i controlli ripetitivi su mknod per leggibilità
224
- // Nota: Questo è safe da eseguire, anche se devtmpfs solitamente gestisce tutto.
225
124
  const devNodes = [
226
125
  { path: 'console', m: '622', type: 'c', major: 5, minor: 1 },
227
126
  { path: 'null', m: '666', type: 'c', major: 1, minor: 3 },
@@ -236,10 +135,9 @@ export async function editLiveFs(clone = false) {
236
135
  await exec(`mknod -m ${node.m} ${workDir}/dev/${node.path} ${node.type} ${node.major} ${node.minor}`, this.echo);
237
136
  }
238
137
  }
239
- if (!fs.existsSync(`${workDir}/dev/{console,ptmx,tty}`)) {
138
+ if (!fs.existsSync(`${workDir}/dev/console`)) {
240
139
  await exec(`chown -v root:tty ${workDir}/dev/{console,ptmx,tty}`, this.echo);
241
140
  }
242
- // Link simbolici standard
243
141
  const links = [
244
142
  { src: '/proc/self/fd', dest: 'fd' },
245
143
  { src: '/proc/self/fd/0', dest: 'stdin' },
@@ -252,24 +150,13 @@ export async function editLiveFs(clone = false) {
252
150
  await exec(`ln -sv ${link.src} ${workDir}/dev/${link.dest}`, this.echo);
253
151
  }
254
152
  }
255
- if (!fs.existsSync(`${workDir}/dev/shm`)) {
153
+ if (!fs.existsSync(`${workDir}/dev/shm`))
256
154
  await exec(`mkdir -v ${workDir}/dev/shm`, this.echo);
257
- }
258
- if (!fs.existsSync(`${workDir}/dev/pts`)) {
155
+ if (!fs.existsSync(`${workDir}/dev/pts`))
259
156
  await exec(`mkdir -v ${workDir}/dev/pts`, this.echo);
260
- }
261
- if (!fs.existsSync(`${workDir}/dev/shm`)) {
262
- await exec(`chmod 1777 ${workDir}/dev/shm`, this.echo);
263
- }
264
- /**
265
- * creo /tmp
266
- */
267
- if (!fs.existsSync(`${workDir}/tmp`)) {
157
+ await exec(`chmod 1777 ${workDir}/dev/shm`, this.echo);
158
+ if (!fs.existsSync(`${workDir}/tmp`))
268
159
  await exec(`mkdir ${workDir}/tmp`, this.echo);
269
- }
270
- /**
271
- * Assegno 1777 a /tmp creava problemi con MXLINUX
272
- */
273
160
  await exec(`chmod 1777 ${workDir}/tmp`, this.echo);
274
161
  }
275
162
  }
@@ -21,7 +21,7 @@ export async function fertilization(snapshot_prefix = '', snapshot_basename = ''
21
21
  this.familyId = distro.familyId;
22
22
  this.distroId = distro.distroId;
23
23
  this.distroLike = distro.distroLike;
24
- this.distroLliveMediumPath = distro.liveMediumPath;
24
+ this.distroLiveMediumPath = distro.liveMediumPath;
25
25
  this.settings = new Settings();
26
26
  if (await this.settings.load()) {
27
27
  await this.settings.loadRemix(this.theme);