penguins-eggs 25.11.21 → 25.12.7

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 (114) hide show
  1. package/.oclif.manifest.json +53 -41
  2. package/README.md +80 -36
  3. package/README.pdf +21575 -3241
  4. package/addons/eggs/theme/livecd/full.grub.main.cfg +39 -4
  5. package/addons/eggs/theme/livecd/full.isolinux.main.cfg +47 -4
  6. package/bin/run.js +11 -0
  7. package/conf/derivatives.yaml +4 -2
  8. package/conf/exclude.list.d/var.list +11 -6
  9. package/dist/appimage/dependency-manager.d.ts +31 -0
  10. package/dist/appimage/dependency-manager.js +292 -0
  11. package/dist/appimage/first-run-check.js +3 -3
  12. package/dist/bin/run.js +11 -0
  13. package/dist/classes/cli-autologin.js +78 -53
  14. package/dist/classes/compressors.d.ts +7 -10
  15. package/dist/classes/compressors.js +44 -31
  16. package/dist/classes/daddy.js +11 -11
  17. package/dist/classes/distro.js +2 -2
  18. package/dist/classes/diversions.js +2 -3
  19. package/dist/classes/incubation/fisherman-helper/initcpio.d.ts +4 -0
  20. package/dist/classes/incubation/fisherman-helper/initcpio.js +14 -4
  21. package/dist/classes/incubation/fisherman-helper/settings.js +1 -1
  22. package/dist/classes/incubation/fisherman.js +1 -3
  23. package/dist/classes/incubation/incubator.js +1 -1
  24. package/dist/classes/network.d.ts +1 -1
  25. package/dist/classes/ovary.d/create-xdg-autostart.js +1 -1
  26. package/dist/classes/ovary.d/edit-live-fs.d.ts +1 -12
  27. package/dist/classes/ovary.d/edit-live-fs.js +216 -186
  28. package/dist/classes/ovary.d/fertilization.js +1 -1
  29. package/dist/classes/ovary.d/make-dot-disk.js +1 -1
  30. package/dist/classes/ovary.d/produce.js +1 -1
  31. package/dist/classes/ovary.d/user-create-live.d.ts +4 -10
  32. package/dist/classes/ovary.d/user-create-live.js +82 -84
  33. package/dist/classes/ovary.d/users-remove.d.ts +5 -6
  34. package/dist/classes/ovary.d/users-remove.js +61 -31
  35. package/dist/classes/ovary.d/xorriso-command.js +1 -5
  36. package/dist/classes/ovary.d.ts +2 -2
  37. package/dist/classes/ovary.js +2 -2
  38. package/dist/classes/pacman.d/alpine.js +2 -2
  39. package/dist/classes/pacman.d/archlinux.js +2 -2
  40. package/dist/classes/pacman.d/debian.js +2 -3
  41. package/dist/classes/pacman.d/fedora.js +2 -3
  42. package/dist/classes/pacman.d/openmamba.js +2 -3
  43. package/dist/classes/pacman.d/opensuse.js +2 -3
  44. package/dist/classes/pacman.d.ts +21 -12
  45. package/dist/classes/pacman.js +55 -47
  46. package/dist/classes/pve-live.js +1 -1
  47. package/dist/classes/settings.js +1 -1
  48. package/dist/classes/sys-users.d.ts +76 -0
  49. package/dist/classes/sys-users.js +206 -0
  50. package/dist/classes/utils.d/kernel.js +3 -3
  51. package/dist/classes/utils.d.ts +16 -11
  52. package/dist/classes/utils.js +92 -56
  53. package/dist/classes/xdg.js +1 -1
  54. package/dist/classes/yolk.js +2 -4
  55. package/dist/commands/config.js +3 -14
  56. package/dist/commands/cuckoo.js +1 -1
  57. package/dist/commands/export/appimage.js +3 -3
  58. package/dist/commands/export/pkg.js +3 -3
  59. package/dist/commands/export/tarballs.js +3 -3
  60. package/dist/commands/krill.js +1 -1
  61. package/dist/commands/produce.js +9 -4
  62. package/dist/commands/{setup.d.ts → setup/install.d.ts} +1 -5
  63. package/dist/commands/setup/install.js +71 -0
  64. package/dist/commands/setup/purge.d.ts +17 -0
  65. package/dist/commands/setup/purge.js +71 -0
  66. package/dist/commands/tools/yolk.js +1 -1
  67. package/dist/commands/update.d.ts +15 -0
  68. package/dist/commands/update.js +74 -7
  69. package/dist/interfaces/i-exec.d.ts +1 -0
  70. package/dist/krill/classes/prepare.d/location.js +1 -1
  71. package/dist/krill/classes/prepare.d/partitions.js +1 -1
  72. package/dist/krill/classes/prepare.d/users.js +2 -2
  73. package/dist/krill/classes/prepare.js +5 -5
  74. package/dist/krill/classes/sequence.d/add_user.d.ts +3 -15
  75. package/dist/krill/classes/sequence.d/add_user.js +87 -57
  76. package/dist/krill/classes/sequence.d/change_password.d.ts +5 -7
  77. package/dist/krill/classes/sequence.d/change_password.js +25 -10
  78. package/dist/krill/classes/sequence.d/del_live_user.d.ts +5 -7
  79. package/dist/krill/classes/sequence.d/del_live_user.js +39 -25
  80. package/dist/krill/classes/sequence.d/fstab.js +1 -1
  81. package/dist/krill/classes/sequence.d/grubcfg.d.ts +3 -7
  82. package/dist/krill/classes/sequence.d/grubcfg.js +33 -13
  83. package/dist/krill/classes/sequence.d/mkfs.js +1 -2
  84. package/dist/krill/classes/sequence.d/unpackfs.d.ts +2 -4
  85. package/dist/krill/classes/sequence.d/unpackfs.js +8 -5
  86. package/dist/krill/classes/sequence.js +2 -3
  87. package/dist/krill/components/title.js +4 -4
  88. package/dist/krill/lib/select_installation_device.js +1 -1
  89. package/dist/krill/lib/select_replaced_partition.js +1 -1
  90. package/dist/lib/utils.d.ts +51 -19
  91. package/dist/lib/utils.js +225 -39
  92. package/manpages/doc/man/eggs.1.gz +0 -0
  93. package/manpages/doc/man/eggs.html +29 -17
  94. package/package.json +13 -14
  95. package/perrisbrewery/template/dependencies.yaml +1 -0
  96. package/scripts/_eggs +35 -7
  97. package/scripts/boot-encrypted-root.sh +220 -0
  98. package/scripts/eggs.bash +2 -1
  99. package/scripts/mount-encrypted-home.sh +324 -0
  100. package/dist/appimage/prerequisites.d.ts +0 -34
  101. package/dist/appimage/prerequisites.js +0 -350
  102. package/dist/commands/setup.js +0 -90
  103. package/dracut/create-symlink +0 -71
  104. package/dracut/dracut-log.txt +0 -3
  105. package/dracut/export +0 -4
  106. package/dracut/export-dracut-analysis +0 -51
  107. package/dracut/export-dracut-log +0 -2
  108. package/dracut/mkisofs +0 -10
  109. package/dracut/renew-initramfs +0 -17
  110. package/dracut/sbin2bin +0 -10
  111. package/dracut/update-dracut-conf-d +0 -2
  112. package/dracut/update-dracut-modules +0 -62
  113. package/scripts/appimage-build.sh +0 -152
  114. package/scripts/appimage-install.sh +0 -43
@@ -6,8 +6,7 @@
6
6
  * license: MIT
7
7
  */
8
8
  import chalk from 'chalk';
9
- import { execSync } from 'node:child_process';
10
- // 🔧 [Change 1] - Removed unused `{ link }` import to clean up unnecessary dependencies.
9
+ import { execSync } from '../lib/utils.js';
11
10
  import fs from 'node:fs';
12
11
  import path from 'node:path';
13
12
  // libraries
@@ -18,17 +17,16 @@ const startMessage = 'eggs-start-message';
18
17
  const stopMessage = 'eggs-stop-message';
19
18
  export default class CliAutologin {
20
19
  async add(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
21
- // 🔧 [Change 2] - Added parameter validation to prevent running with missing credentials.
22
- // This prevents undefined users or empty passwords from breaking the autologin setup.
20
+ // 🔧 [Change 1] - Added parameter validation to prevent running with missing credentials.
23
21
  if (!user || !userPasswd || !rootPasswd) {
24
22
  throw new Error('Missing user credentials for CLI autologin setup.');
25
23
  }
24
+ // --- SYSTEMD ---
26
25
  if (Utils.isSystemd()) {
27
26
  Utils.warning("systemd: creating CLI autologin");
28
27
  const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
29
28
  const dirOverride = path.dirname(fileOverride);
30
- // 🔧 [Change 3] - Replaced raw `rm -rf` shell command with the safer Node.js `fs.rmSync()`.
31
- // This avoids potential shell injection or accidental file deletion outside the target directory.
29
+ // 🔧 [Change 2] - Replaced raw `rm -rf` shell command with `fs.rmSync()`.
32
30
  if (fs.existsSync(dirOverride)) {
33
31
  try {
34
32
  fs.rmSync(dirOverride, { recursive: true, force: true });
@@ -39,14 +37,11 @@ export default class CliAutologin {
39
37
  }
40
38
  // Exclude OpenSUSE since it uses a different login mechanism.
41
39
  if (distro !== 'Opensuse') {
42
- // 🔧 [Change 4] - Used `fs.mkdirSync()` instead of shell command for better cross-platform reliability.
43
40
  fs.mkdirSync(dirOverride, { recursive: true });
44
41
  let content = '';
45
42
  content += '[Service]\n';
46
43
  content += 'ExecStart=\n';
47
44
  content += `ExecStart=-/sbin/agetty --noclear --autologin ${user} %I $TERM\n`;
48
- // 🔧 [Change 5] - Wrapped file operations in try/catch for safe I/O handling.
49
- // Prevents crash if permission denied or disk error occurs.
50
45
  try {
51
46
  fs.writeFileSync(fileOverride, content);
52
47
  fs.chmodSync(fileOverride, 0o755);
@@ -57,12 +52,12 @@ export default class CliAutologin {
57
52
  }
58
53
  await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
59
54
  await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
55
+ // --- OPENRC ---
60
56
  }
61
57
  else if (Utils.isOpenRc()) {
62
58
  Utils.warning("openrc: creating CLI autologin");
63
59
  const inittab = chroot + '/etc/inittab';
64
- // 🔧 [Change 6] - Automatically creates a backup of `/etc/inittab` before making modifications.
65
- // This allows easy rollback in case autologin configuration fails.
60
+ // 🔧 [Change 3] - Backup inittab before modification
66
61
  if (fs.existsSync(inittab)) {
67
62
  fs.copyFileSync(inittab, `${inittab}.bak`);
68
63
  }
@@ -84,23 +79,38 @@ export default class CliAutologin {
84
79
  execSync(`chmod +x ${autologin}`);
85
80
  await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
86
81
  await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
82
+ // --- SYSVINIT ---
87
83
  }
88
84
  else if (Utils.isSysvinit()) {
89
85
  Utils.warning("sysvinit: creating CLI autologin");
90
86
  const inittab = chroot + '/etc/inittab';
91
- // 🔧 [Change 7] - Added backup for SysVInit `inittab` as well.
92
- // Provides consistency and safety across all init systems.
87
+ // 🔧 [Change 4] - Backup for SysVInit
93
88
  if (fs.existsSync(inittab)) {
94
- fs.copyFileSync(inittab, `${inittab}.bak`);
89
+ try {
90
+ fs.copyFileSync(inittab, `${inittab}.bak`);
91
+ }
92
+ catch (e) {
93
+ Utils.warning(`Could not backup inittab: ${e}`);
94
+ }
95
95
  }
96
- const search = '1:2345:respawn:/sbin/getty';
97
- const replace = `1:2345:respawn:/sbin/getty --autologin ${user} 38400 tty1`;
98
- let content = '';
99
- const lines = fs.readFileSync(inittab, 'utf8').split('\n');
100
- for (let i = 0; i < lines.length; i++) {
101
- if (lines[i].includes(search))
102
- lines[i] = replace;
103
- content += lines[i] + '\n';
96
+ let content = fs.readFileSync(inittab, 'utf8');
97
+ // 🔧 [Change 5] - ROBUST REGEX REPLACEMENT
98
+ // Instead of exact string match, we use Regex to find the tty1 line.
99
+ // We force usage of /sbin/agetty (safer than getty) and add --noclear to prevent blinking/loops.
100
+ // ^(1:[0-9]*:respawn:) matches the ID and runlevels
101
+ // (.*getty\s+.*tty1.*)$ matches the command part
102
+ const regex = /^(1:[0-9]*:respawn:)(.*getty\s+.*tty1.*)$/gm;
103
+ if (regex.test(content)) {
104
+ regex.lastIndex = 0; // Reset index
105
+ content = content.replace(regex, (match, prefix, oldCmd) => {
106
+ // We comment out the original line for safety and append the new valid one
107
+ return `# ORIGINAL DISABLED BY EGGS: ${match}\n${prefix}/sbin/agetty --autologin ${user} --noclear 38400 tty1 linux`;
108
+ });
109
+ }
110
+ else {
111
+ // Fallback if regex fails: append config
112
+ Utils.warning("Standard tty1 line not found in inittab. Appending autologin configuration.");
113
+ content += `\n# Autologin added by penguins-eggs\n1:2345:respawn:/sbin/agetty --autologin ${user} --noclear 38400 tty1 linux\n`;
104
114
  }
105
115
  fs.writeFileSync(inittab, content, 'utf-8');
106
116
  await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
@@ -117,8 +127,6 @@ export default class CliAutologin {
117
127
  content += `This is a ${distro}/${version} system created by Penguins' eggs.\n`;
118
128
  content += `You can login with user: ${chalk.bold(user)} and password: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n`;
119
129
  content += stopMessage + '\n';
120
- // 🔧 [Change 8] - File writing is now protected by try/catch for reliability.
121
- // Prevents the script from crashing if write permission is missing.
122
130
  try {
123
131
  fs.writeFileSync(fileIssue, content);
124
132
  }
@@ -130,7 +138,7 @@ export default class CliAutologin {
130
138
  }
131
139
  async addMotd(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
132
140
  const fileMotd = `${chroot}/etc/motd`;
133
- let installer = 'sudo eggs install';
141
+ let installer = 'sudo eggs krill';
134
142
  if (Pacman.calamaresExists()) {
135
143
  if (Pacman.packageIsInstalled('plasma-desktop')) {
136
144
  installer = 'startplasma-wayland to run GUI and launch calamares';
@@ -147,12 +155,11 @@ export default class CliAutologin {
147
155
  eggsMotd += startMessage + '\n';
148
156
  eggsMotd += Utils.flag() + '\n';
149
157
  eggsMotd += `You are logged as: ${chalk.bold(user)} your password is: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n\n`;
150
- eggsMotd += `install system : ${chalk.bold(installer)}\n`;
151
- eggsMotd += ` --unattended : ${chalk.bold('sudo eggs krill --unattended')}\n`;
152
- eggsMotd += ` --chroot : ${chalk.bold('sudo eggs krill --chroot')}\n`;
153
- eggsMotd += ` --help : ${chalk.bold('sudo eggs krill --help')}\n\n`;
158
+ eggsMotd += `install system : ${chalk.bold(installer)}\n`;
159
+ eggsMotd += ` --unattended : ${chalk.bold('sudo eggs krill --unattended')}\n`;
160
+ eggsMotd += ` --chroot : ${chalk.bold('sudo eggs krill --chroot')}\n`;
161
+ eggsMotd += ` --help : ${chalk.bold('sudo eggs krill --help')}\n\n`;
154
162
  eggsMotd += stopMessage + '\n';
155
- // 🔧 [Change 9] - Same as above: safe write with error handling to improve reliability.
156
163
  try {
157
164
  fs.writeFileSync(fileMotd, eggsMotd);
158
165
  }
@@ -161,10 +168,10 @@ export default class CliAutologin {
161
168
  }
162
169
  }
163
170
  async remove(chroot = '/') {
171
+ // --- SYSTEMD REMOVE ---
164
172
  if (Utils.isSystemd()) {
165
173
  const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
166
174
  const dirOverride = path.dirname(fileOverride);
167
- // 🔧 [Change 10] - Replaced shell-based deletion with `fs.rmSync()` for safety and consistency.
168
175
  if (fs.existsSync(dirOverride)) {
169
176
  try {
170
177
  fs.rmSync(dirOverride, { recursive: true, force: true });
@@ -175,40 +182,60 @@ export default class CliAutologin {
175
182
  }
176
183
  this.msgRemove(`${chroot}/etc/motd`);
177
184
  this.msgRemove(`${chroot}/etc/issue`);
185
+ // --- OPENRC REMOVE ---
178
186
  }
179
187
  else if (Utils.isOpenRc()) {
180
188
  const inittab = chroot + '/etc/inittab';
181
- const search = 'autologin';
182
- const replace = `tty1::respawn:/sbin/getty 38400 tty1`;
183
- let content = '';
184
- const lines = fs.readFileSync(inittab, 'utf8').split('\n');
185
- for (let i = 0; i < lines.length; i++) {
186
- if (lines[i].includes(search))
187
- lines[i] = replace;
188
- content += lines[i] + '\n';
189
+ // 🔧 [Change 6] - Safe Restore: If backup exists, use it.
190
+ if (fs.existsSync(`${inittab}.bak`)) {
191
+ fs.copyFileSync(`${inittab}.bak`, inittab);
192
+ fs.rmSync(`${inittab}.bak`);
193
+ }
194
+ else {
195
+ // Fallback to manual string replacement (Legacy)
196
+ const search = 'autologin';
197
+ const replace = `tty1::respawn:/sbin/getty 38400 tty1`;
198
+ let content = '';
199
+ const lines = fs.readFileSync(inittab, 'utf8').split('\n');
200
+ for (let i = 0; i < lines.length; i++) {
201
+ if (lines[i].includes(search))
202
+ lines[i] = replace;
203
+ content += lines[i] + '\n';
204
+ }
205
+ fs.writeFileSync(inittab, content, 'utf-8');
189
206
  }
190
- fs.writeFileSync(inittab, content, 'utf-8');
191
207
  this.msgRemove(`${chroot}/etc/motd`);
192
208
  this.msgRemove(`${chroot}/etc/issue`);
193
209
  const autologin = `${chroot}/bin/autologin`;
194
- // 🔧 [Change 11] - Added safety check before deleting `/bin/autologin`.
195
- // Prevents accidental removal of unrelated files outside chroot.
196
210
  if (autologin.startsWith(chroot)) {
197
211
  execSync(`rm -f ${autologin}`);
198
212
  }
213
+ // --- SYSVINIT REMOVE ---
199
214
  }
200
215
  else if (Utils.isSysvinit()) {
201
216
  const inittab = chroot + '/etc/inittab';
202
- const search = '--autologin';
203
- const replace = '1:2345:respawn:/sbin/getty 38400 tty1 ';
204
- let content = '';
205
- const lines = fs.readFileSync(inittab, 'utf8').split('\n');
206
- for (let i = 0; i < lines.length; i++) {
207
- if (lines[i].includes(search))
208
- lines[i] = replace;
209
- content += lines[i] + '\n';
217
+ // 🔧 [Change 7] - Safe Restore for SysVinit
218
+ // Much safer to restore the backup than trying to undo regex replacements manually.
219
+ if (fs.existsSync(`${inittab}.bak`)) {
220
+ console.log(`Restoring ${inittab} from backup...`);
221
+ fs.copyFileSync(`${inittab}.bak`, inittab);
222
+ fs.rmSync(`${inittab}.bak`);
223
+ }
224
+ else {
225
+ // Fallback: Try to clean up the inserted lines
226
+ const search = '--autologin';
227
+ const replace = '1:2345:respawn:/sbin/getty 38400 tty1';
228
+ let content = '';
229
+ const lines = fs.readFileSync(inittab, 'utf8').split('\n');
230
+ for (let i = 0; i < lines.length; i++) {
231
+ // If we find our modified line, we try to revert to a standard one
232
+ // Note: This is less precise than backup restore, hence why backup is preferred.
233
+ if (lines[i].includes(search))
234
+ lines[i] = replace;
235
+ content += lines[i] + '\n';
236
+ }
237
+ fs.writeFileSync(inittab, content, 'utf-8');
210
238
  }
211
- fs.writeFileSync(inittab, content, 'utf-8');
212
239
  this.msgRemove(`${chroot}/etc/motd`);
213
240
  this.msgRemove(`${chroot}/etc/issue`);
214
241
  }
@@ -216,8 +243,6 @@ export default class CliAutologin {
216
243
  async msgRemove(path) {
217
244
  if (fs.existsSync(path)) {
218
245
  if (!fs.lstatSync(path).isSymbolicLink()) {
219
- // 🔧 [Change 12] - Rewrote cleanup logic using a regular expression to remove the block
220
- // between `eggs-start-message` and `eggs-stop-message`. More efficient and cleaner.
221
246
  let content = fs.readFileSync(path, 'utf8');
222
247
  content = content.replace(/eggs-start-message[\s\S]*?eggs-stop-message/g, '');
223
248
  fs.writeFileSync(path, content, 'utf-8');
@@ -1,12 +1,13 @@
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
8
  export default class Compressors {
9
9
  dest: string;
10
+ source: string;
10
11
  isEnabled: {
11
12
  error: boolean;
12
13
  gzip: boolean;
@@ -16,39 +17,35 @@ export default class Compressors {
16
17
  xz: boolean;
17
18
  zstd: boolean;
18
19
  };
19
- source: string;
20
20
  /**
21
21
  * fast compression
22
- * @returns
23
22
  */
24
23
  fast(): string;
25
24
  /**
26
25
  * max
27
- * @returns
28
26
  */
29
27
  max(): string;
30
28
  pendrive(level?: string): string;
31
29
  /**
32
30
  * populate
31
+ * Manteniamo async per compatibilità con chi lo chiama,
32
+ * ma internamente ora è tutto sincrono e veloce.
33
33
  */
34
34
  populate(): Promise<void>;
35
35
  /**
36
36
  * standard
37
- * @returns
38
37
  */
39
38
  standard(): string;
40
39
  /**
41
- * check mksquashfs exists
42
- * @param compressor
43
- * @returns
40
+ * check mksquashfs exists and supports compressor
44
41
  */
45
42
  private check;
46
43
  /**
47
- * prepareCheck
44
+ * prepareCheck: Usa FS nativo invece di shelljs
48
45
  */
49
46
  private prepareCheck;
50
47
  /**
51
- * removeCheck
48
+ * removeCheck: Usa FS nativo invece di shelljs
52
49
  */
53
50
  private removeCheck;
54
51
  }
@@ -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
  }
@@ -9,7 +9,6 @@ import inquirer from 'inquirer';
9
9
  import yaml from 'js-yaml';
10
10
  import fs from 'node:fs/promises';
11
11
  import path from 'node:path';
12
- import { exec } from '../lib/utils.js';
13
12
  import Pacman from '../classes/pacman.js';
14
13
  import Settings from '../classes/settings.js';
15
14
  import Utils from '../classes/utils.js';
@@ -147,17 +146,18 @@ export default class Daddy {
147
146
  * Apply reset or custom configuration
148
147
  */
149
148
  async applyResetOrCustomConfig(config, isCustom, fileCustom) {
150
- // Reset snapshot prefix if empty
151
149
  if (!config.snapshot_prefix) {
152
- let fstype = '';
153
- try {
154
- const { data } = await exec(`findmnt -n -o FSTYPE /`, { capture: true });
155
- fstype = data.trim() === 'ext4' ? '' : `${data.trim()}-`;
156
- }
157
- catch (err) {
158
- console.warn('Unable to detect FSTYPE:', err);
159
- }
160
- config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId) + fstype;
150
+ /**
151
+ * add fstype: btrfs, xfs, etc
152
+ */
153
+ // let fstype = '';
154
+ // try {
155
+ // const { data } = await exec(`findmnt -n -o FSTYPE /`, { capture: true });
156
+ // fstype = data.trim() === 'ext4' ? '' : `${data.trim()}-`;
157
+ // } catch (err) {
158
+ // console.warn('Unable to detect FSTYPE:', err);
159
+ // }
160
+ config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId);
161
161
  }
162
162
  // Apply custom YAML if needed
163
163
  if (isCustom && fileCustom) {
@@ -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 +1,5 @@
1
+ /**
2
+ *
3
+ * @returns
4
+ */
1
5
  export declare function initcpio(): Promise<string>;
@@ -1,10 +1,20 @@
1
- import { exec } from 'child_process';
2
- import { promisify } from 'util';
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
7
+ */
8
+ import { exec } from '../../../lib/utils.js';
3
9
  import { access } from 'fs/promises';
4
- const execAsync = promisify(exec);
10
+ /**
11
+ *
12
+ * @returns
13
+ */
5
14
  export async function initcpio() {
6
15
  try {
7
- const { stdout: kernelVersion } = await execAsync('uname -r');
16
+ const result = await exec('uname -r');
17
+ const kernelVersion = result.data;
8
18
  const version = kernelVersion.trim();
9
19
  // Manjaro
10
20
  if (version.includes('MANJARO')) {
@@ -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';
@@ -90,8 +90,6 @@ export default class Fisherman {
90
90
  * and end in:
91
91
  * /etc/calamares/modules/partition.conf
92
92
  *
93
- * And we solve the issue of Sebastien who need btrfs
94
- *
95
93
  */
96
94
  if (vendor !== 'eggs') {
97
95
  let customModuleSource = path.resolve(__dirname, `../../../addons/${vendor}/theme/calamares/modules/${name}.yml`);
@@ -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';
@@ -23,7 +23,7 @@ export default class Network {
23
23
  constructor();
24
24
  base(): string;
25
25
  bitmask(): void;
26
- broadcast(): string;
26
+ broadcast(): string | undefined;
27
27
  contains(): (address: string | Netmask | number) => boolean;
28
28
  first(): string;
29
29
  forEach(): (cb: (ip: string, long: number, index: number) => void) => void;
@@ -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.7.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
9
  export declare function editLiveFs(this: Ovary, clone?: boolean): Promise<void>;