penguins-eggs 25.12.7 → 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 (53) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/README.md +74 -45
  3. package/README.pdf +13450 -14838
  4. package/addons/eggs/theme/livecd/simple.grub.main.cfg +3 -3
  5. package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  6. package/conf/distros/focal/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  7. package/conf/distros/noble/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  8. package/conf/distros/noble/calamares/libexec/calamares-l10n-helper.sh +2 -1
  9. package/conf/distros/noble/calamares/settings.yml +1 -0
  10. package/conf/distros/trixie/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
  11. package/dist/classes/cli-autologin.d.ts +37 -4
  12. package/dist/classes/cli-autologin.js +125 -112
  13. package/dist/classes/daddy.js +4 -1
  14. package/dist/classes/incubation/fisherman-helper/initcpio.d.ts +3 -2
  15. package/dist/classes/incubation/fisherman-helper/initcpio.js +25 -20
  16. package/dist/classes/incubation/incubator.d/manjaro.js +1 -0
  17. package/dist/classes/ovary.d/edit-live-fs.d.ts +1 -1
  18. package/dist/classes/ovary.d/edit-live-fs.js +15 -122
  19. package/dist/classes/ovary.d/fertilization.js +1 -1
  20. package/dist/classes/ovary.d/luks-home.js +33 -19
  21. package/dist/classes/ovary.d/luks-root.d.ts +1 -2
  22. package/dist/classes/ovary.d/luks-root.js +46 -27
  23. package/dist/classes/ovary.d/luks-shrink.d.ts +14 -0
  24. package/dist/classes/ovary.d/luks-shrink.js +86 -0
  25. package/dist/classes/ovary.d/produce.js +63 -21
  26. package/dist/classes/ovary.d.ts +3 -1
  27. package/dist/classes/ovary.js +3 -1
  28. package/dist/classes/utils.js +1 -1
  29. package/dist/classes/yolk.js +1 -1
  30. package/dist/commands/produce.js +11 -7
  31. package/dist/interfaces/calamares/i-calamares-branding.d.ts +56 -38
  32. package/dist/interfaces/calamares/i-calamares-branding.js +10 -0
  33. package/dist/krill/classes/prepare.d/users.js +1 -1
  34. package/dist/krill/classes/sequence.d/fstab.js +1 -1
  35. package/dist/krill/classes/sequence.d/mkfs.js +1 -1
  36. package/dist/krill/classes/sequence.d/unpackfs.js +2 -2
  37. package/dist/krill/classes/sequence.d.ts +1 -5
  38. package/dist/krill/classes/sequence.js +26 -29
  39. package/dist/krill/components/finished.js +2 -2
  40. package/dist/krill/components/install.js +2 -2
  41. package/dist/krill/components/keyboard.js +2 -2
  42. package/dist/krill/components/location.js +2 -2
  43. package/dist/krill/components/network.js +2 -2
  44. package/dist/krill/components/partitions.js +2 -2
  45. package/dist/krill/components/summary.js +2 -2
  46. package/dist/krill/components/users.js +2 -2
  47. package/dist/krill/components/welcome.js +2 -2
  48. package/dist/lib/utils.d.ts +1 -0
  49. package/dist/lib/utils.js +46 -0
  50. package/manpages/doc/man/eggs.1.gz +0 -0
  51. package/manpages/doc/man/eggs.html +8 -8
  52. package/package.json +2 -2
  53. package/scripts/restore_homecrypt_krill.sh +93 -0
@@ -3,21 +3,21 @@ set theme=/boot/grub/theme.cfg
3
3
  menuentry "{{{fullname}}} Live/Installation" {
4
4
  set gfxpayload=keep
5
5
  {{{rmModules}}}
6
- linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
6
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash loglevel=2
7
7
  initrd {{{initrdImg}}}
8
8
  }
9
9
 
10
10
  menuentry "{{{fullname}}} Safe Mode" {
11
11
  set gfxpayload=keep
12
12
  {{{rmModules}}}
13
- linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
13
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash loglevel=2
14
14
  initrd {{{initrdImg}}}
15
15
  }
16
16
 
17
17
  menuentry "{{{fullname}}} Text Mode" {
18
18
  set gfxpayload=keep
19
19
  {{{rmModules}}}
20
- linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
20
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash loglevel=2
21
21
  initrd {{{initrdImg}}}
22
22
  }
23
23
 
@@ -13,7 +13,7 @@ fi
13
13
  rm -f $CHROOT/usr/share/applications/install-system.desktop
14
14
 
15
15
  # remove CLI autologin if exists
16
- rm -f $CHROOT/etc/systemd/system/getty@.service.d/override.conf
16
+ rm -f $CHROOT/etc/systemd/system/getty@tty1.service.d/override.conf
17
17
 
18
18
  # remove 10-installer if exists
19
19
  rm -f $CHROOT/etc/sudoers.d/10-installer
@@ -13,7 +13,7 @@ fi
13
13
  rm -f $CHROOT/usr/share/applications/install-system.desktop
14
14
 
15
15
  # remove CLI autologin if exists
16
- rm -f $CHROOT/etc/systemd/system/getty@.service.d/override.conf
16
+ rm -f $CHROOT/etc/systemd/system/getty@tty1.service.d/override.conf
17
17
 
18
18
  # remove 10-installer if exists
19
19
  rm -f $CHROOT/etc/sudoers.d/10-installer
@@ -13,7 +13,7 @@ fi
13
13
  rm -f $CHROOT/usr/share/applications/install-system.desktop
14
14
 
15
15
  # remove CLI autologin if exists
16
- rm -f $CHROOT/etc/systemd/system/getty@.service.d/override.conf
16
+ rm -f $CHROOT/etc/systemd/system/getty@tty1.service.d/override.conf
17
17
 
18
18
  # remove 10-installer if exists
19
19
  rm -f $CHROOT/etc/sudoers.d/10-installer
@@ -33,6 +33,7 @@ without_ext=$(echo $LANG | cut -d. -f1)
33
33
  /usr/sbin/locale-gen --keep-existing "$LC_TIME"
34
34
 
35
35
  apt-get update || true
36
- # apt-get install language-selector-common || true
36
+ # we need language-selector-common
37
+ apt-get install language-selector-common || true
37
38
  missing=$(check-language-support --language="$without_ext")
38
39
  apt-get install -y $missing || true
@@ -80,6 +80,7 @@ sequence:
80
80
  - shellprocess@aptsources
81
81
  - shellprocess@install_translations
82
82
  - packages
83
+ - removeuser
83
84
  - cleanup
84
85
  - shellprocess@logs
85
86
  - umount
@@ -13,7 +13,7 @@ fi
13
13
  rm -f $CHROOT/usr/share/applications/install-system.desktop
14
14
 
15
15
  # remove CLI autologin if exists
16
- rm -f $CHROOT/etc/systemd/system/getty@.service.d/override.conf
16
+ rm -f $CHROOT/etc/systemd/system/getty@tty1.service.d/override.conf
17
17
 
18
18
  # remove 10-installer if exists
19
19
  rm -f $CHROOT/etc/sudoers.d/10-installer
@@ -1,14 +1,47 @@
1
1
  /**
2
- * ./src/lib/cli-autologin.ts
3
- * penguins-eggs v.25.7.x / ecmascript 2020
2
+ * ./src/classes/cli-autologin.ts
3
+ * penguins-eggs v.25.12.8 / ecmascript 2020
4
4
  * author: Piero Proietti
5
5
  * modified by: Hossein Seilani
6
6
  * license: MIT
7
7
  */
8
8
  export default class CliAutologin {
9
+ /**
10
+ *
11
+ * @param distro
12
+ * @param version
13
+ * @param user
14
+ * @param userPasswd
15
+ * @param rootPasswd
16
+ * @param chroot
17
+ */
9
18
  add(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
10
- addIssue(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
11
- addMotd(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
19
+ /**
20
+ * remove()
21
+ * Rimuove qualsiasi configurazione di autologin (Systemd, OpenRC, SysVinit).
22
+ * Pulisce sia i target specifici (tty1) che quelli globali per evitare conflitti.
23
+ * * @param chroot - Il percorso della root del sistema (default: '/')
24
+ */
12
25
  remove(chroot?: string): Promise<void>;
13
26
  private msgRemove;
27
+ /**
28
+ *
29
+ * @param distro
30
+ * @param version
31
+ * @param user
32
+ * @param userPasswd
33
+ * @param rootPasswd
34
+ * @param chroot
35
+ */
36
+ addIssue(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
37
+ /**
38
+ *
39
+ * @param distro
40
+ * @param version
41
+ * @param user
42
+ * @param userPasswd
43
+ * @param rootPasswd
44
+ * @param chroot
45
+ */
46
+ addMotd(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
14
47
  }
@@ -1,65 +1,65 @@
1
1
  /**
2
- * ./src/lib/cli-autologin.ts
3
- * penguins-eggs v.25.7.x / ecmascript 2020
2
+ * ./src/classes/cli-autologin.ts
3
+ * penguins-eggs v.25.12.8 / ecmascript 2020
4
4
  * author: Piero Proietti
5
5
  * modified by: Hossein Seilani
6
6
  * license: MIT
7
7
  */
8
8
  import chalk from 'chalk';
9
- import { execSync } from '../lib/utils.js';
10
9
  import fs from 'node:fs';
11
10
  import path from 'node:path';
12
11
  // libraries
13
- import { exec } from '../lib/utils.js';
12
+ import { shx } from '../lib/utils.js';
14
13
  import Pacman from './pacman.js';
15
14
  import Utils from './utils.js';
16
15
  const startMessage = 'eggs-start-message';
17
16
  const stopMessage = 'eggs-stop-message';
18
17
  export default class CliAutologin {
18
+ /**
19
+ *
20
+ * @param distro
21
+ * @param version
22
+ * @param user
23
+ * @param userPasswd
24
+ * @param rootPasswd
25
+ * @param chroot
26
+ */
19
27
  async add(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
20
- // 🔧 [Change 1] - Added parameter validation to prevent running with missing credentials.
21
28
  if (!user || !userPasswd || !rootPasswd) {
22
29
  throw new Error('Missing user credentials for CLI autologin setup.');
23
30
  }
24
31
  // --- SYSTEMD ---
25
32
  if (Utils.isSystemd()) {
26
33
  Utils.warning("systemd: creating CLI autologin");
27
- const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
34
+ const fileOverride = `${chroot}/etc/systemd/system/getty@tty1.service.d/override.conf`;
28
35
  const dirOverride = path.dirname(fileOverride);
29
- // 🔧 [Change 2] - Replaced raw `rm -rf` shell command with `fs.rmSync()`.
36
+ // Clean existing override directory using shx
30
37
  if (fs.existsSync(dirOverride)) {
31
- try {
32
- fs.rmSync(dirOverride, { recursive: true, force: true });
33
- }
34
- catch (err) {
35
- Utils.error(`Failed to remove ${dirOverride}: ${err}`);
36
- }
38
+ shx.rm('-rf', dirOverride);
37
39
  }
38
40
  // Exclude OpenSUSE since it uses a different login mechanism.
39
41
  if (distro !== 'Opensuse') {
40
- fs.mkdirSync(dirOverride, { recursive: true });
42
+ shx.mkdir('-r', dirOverride);
41
43
  let content = '';
42
44
  content += '[Service]\n';
43
45
  content += 'ExecStart=\n';
44
- content += `ExecStart=-/sbin/agetty --noclear --autologin ${user} %I $TERM\n`;
46
+ content += `ExecStart=-/usr/sbin/agetty --noclear --autologin ${user} %I $TERM\n`;
45
47
  try {
46
48
  fs.writeFileSync(fileOverride, content);
47
- fs.chmodSync(fileOverride, 0o755);
49
+ shx.chmod(0o755, fileOverride);
48
50
  }
49
51
  catch (err) {
50
52
  Utils.error(`Failed to write ${fileOverride}: ${err}`);
51
53
  }
52
54
  }
53
- await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
54
- await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
55
55
  // --- OPENRC ---
56
56
  }
57
57
  else if (Utils.isOpenRc()) {
58
58
  Utils.warning("openrc: creating CLI autologin");
59
59
  const inittab = chroot + '/etc/inittab';
60
- // 🔧 [Change 3] - Backup inittab before modification
60
+ // Backup inittab
61
61
  if (fs.existsSync(inittab)) {
62
- fs.copyFileSync(inittab, `${inittab}.bak`);
62
+ shx.cp(inittab, `${inittab}.bak`);
63
63
  }
64
64
  let content = '';
65
65
  const search = `tty1::respawn:/sbin/getty 38400 tty1`;
@@ -76,123 +76,70 @@ export default class CliAutologin {
76
76
  content = '#!/bin/sh\n';
77
77
  content += `/bin/login -f ${user}\n`;
78
78
  fs.writeFileSync(autologin, content, 'utf-8');
79
- execSync(`chmod +x ${autologin}`);
80
- await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
81
- await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
79
+ shx.chmod('+x', autologin);
82
80
  // --- SYSVINIT ---
83
81
  }
84
82
  else if (Utils.isSysvinit()) {
85
83
  Utils.warning("sysvinit: creating CLI autologin");
86
84
  const inittab = chroot + '/etc/inittab';
87
- // 🔧 [Change 4] - Backup for SysVInit
85
+ // Backup for SysVInit
88
86
  if (fs.existsSync(inittab)) {
89
- try {
90
- fs.copyFileSync(inittab, `${inittab}.bak`);
91
- }
92
- catch (e) {
93
- Utils.warning(`Could not backup inittab: ${e}`);
94
- }
87
+ shx.cp(inittab, `${inittab}.bak`);
95
88
  }
96
89
  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
90
+ // Robust Regex Replacement for tty1 line
91
+ // Forces /sbin/agetty and adds --noclear
102
92
  const regex = /^(1:[0-9]*:respawn:)(.*getty\s+.*tty1.*)$/gm;
103
93
  if (regex.test(content)) {
104
94
  regex.lastIndex = 0; // Reset index
105
95
  content = content.replace(regex, (match, prefix, oldCmd) => {
106
- // We comment out the original line for safety and append the new valid one
107
96
  return `# ORIGINAL DISABLED BY EGGS: ${match}\n${prefix}/sbin/agetty --autologin ${user} --noclear 38400 tty1 linux`;
108
97
  });
109
98
  }
110
99
  else {
111
- // Fallback if regex fails: append config
100
+ // Fallback: append config
112
101
  Utils.warning("Standard tty1 line not found in inittab. Appending autologin configuration.");
113
102
  content += `\n# Autologin added by penguins-eggs\n1:2345:respawn:/sbin/agetty --autologin ${user} --noclear 38400 tty1 linux\n`;
114
103
  }
115
104
  fs.writeFileSync(inittab, content, 'utf-8');
116
- await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
117
- await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
118
- }
119
- }
120
- async addIssue(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
121
- const fileIssue = `${chroot}/etc/issue`;
122
- if (fs.existsSync(fileIssue)) {
123
- if (!fs.lstatSync(fileIssue).isSymbolicLink()) {
124
- this.msgRemove(fileIssue);
125
- let content = fs.readFileSync(fileIssue, 'utf8');
126
- content += startMessage + '\n';
127
- content += `This is a ${distro}/${version} system created by Penguins' eggs.\n`;
128
- content += `You can login with user: ${chalk.bold(user)} and password: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n`;
129
- content += stopMessage + '\n';
130
- try {
131
- fs.writeFileSync(fileIssue, content);
132
- }
133
- catch (err) {
134
- Utils.error(`Failed to write ${fileIssue}: ${err}`);
135
- }
136
- }
137
- }
138
- }
139
- async addMotd(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
140
- const fileMotd = `${chroot}/etc/motd`;
141
- let installer = 'sudo eggs krill';
142
- if (Pacman.calamaresExists()) {
143
- if (Pacman.packageIsInstalled('plasma-desktop')) {
144
- installer = 'startplasma-wayland to run GUI and launch calamares';
145
- }
146
- else if (Pacman.packageIsInstalled('xfce4')) {
147
- installer = 'startxfce4 to run GUI and launch calamares installer';
148
- }
149
- }
150
- if (!fs.existsSync(fileMotd)) {
151
- await exec(`touch ${fileMotd}`);
152
- }
153
- this.msgRemove(fileMotd);
154
- let eggsMotd = fs.readFileSync(fileMotd, 'utf8');
155
- eggsMotd += startMessage + '\n';
156
- eggsMotd += Utils.flag() + '\n';
157
- eggsMotd += `You are logged as: ${chalk.bold(user)} your password is: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\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`;
162
- eggsMotd += stopMessage + '\n';
163
- try {
164
- fs.writeFileSync(fileMotd, eggsMotd);
165
- }
166
- catch (err) {
167
- Utils.error(`Failed to write ${fileMotd}: ${err}`);
168
105
  }
106
+ await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
107
+ await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
169
108
  }
109
+ /**
110
+ * remove()
111
+ * Rimuove qualsiasi configurazione di autologin (Systemd, OpenRC, SysVinit).
112
+ * Pulisce sia i target specifici (tty1) che quelli globali per evitare conflitti.
113
+ * * @param chroot - Il percorso della root del sistema (default: '/')
114
+ */
170
115
  async remove(chroot = '/') {
171
116
  // --- SYSTEMD REMOVE ---
172
117
  if (Utils.isSystemd()) {
173
- const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
174
- const dirOverride = path.dirname(fileOverride);
175
- if (fs.existsSync(dirOverride)) {
176
- try {
177
- fs.rmSync(dirOverride, { recursive: true, force: true });
178
- }
179
- catch (err) {
180
- Utils.error(`Failed to remove ${dirOverride}: ${err}`);
181
- }
118
+ // 1. Rimuove il target specifico TTY1 (quello corretto che usiamo ora)
119
+ const specificDir = `${chroot}/etc/systemd/system/getty@tty1.service.d`;
120
+ if (fs.existsSync(specificDir)) {
121
+ shx.rm('-rf', specificDir);
122
+ }
123
+ // 2. Rimuove il target generico (residui vecchi o configurazioni ereditate dall'host)
124
+ // Questo è fondamentale per risolvere il problema del "loop" su tty2/tty3
125
+ const globalDir = `${chroot}/etc/systemd/system/getty@.service.d`;
126
+ if (fs.existsSync(globalDir)) {
127
+ shx.rm('-rf', globalDir);
182
128
  }
129
+ // Pulizia messaggi di benvenuto
183
130
  this.msgRemove(`${chroot}/etc/motd`);
184
131
  this.msgRemove(`${chroot}/etc/issue`);
185
132
  // --- OPENRC REMOVE ---
186
133
  }
187
134
  else if (Utils.isOpenRc()) {
188
135
  const inittab = chroot + '/etc/inittab';
189
- // 🔧 [Change 6] - Safe Restore: If backup exists, use it.
136
+ // Safe Restore: Se esiste il backup, usalo.
190
137
  if (fs.existsSync(`${inittab}.bak`)) {
191
- fs.copyFileSync(`${inittab}.bak`, inittab);
192
- fs.rmSync(`${inittab}.bak`);
138
+ shx.cp(`${inittab}.bak`, inittab);
139
+ shx.rm(`${inittab}.bak`);
193
140
  }
194
141
  else {
195
- // Fallback to manual string replacement (Legacy)
142
+ // Fallback: ripristino manuale delle stringhe (Legacy)
196
143
  const search = 'autologin';
197
144
  const replace = `tty1::respawn:/sbin/getty 38400 tty1`;
198
145
  let content = '';
@@ -206,30 +153,28 @@ export default class CliAutologin {
206
153
  }
207
154
  this.msgRemove(`${chroot}/etc/motd`);
208
155
  this.msgRemove(`${chroot}/etc/issue`);
156
+ // Rimuove lo script binario di supporto per OpenRC
209
157
  const autologin = `${chroot}/bin/autologin`;
210
- if (autologin.startsWith(chroot)) {
211
- execSync(`rm -f ${autologin}`);
158
+ if (fs.existsSync(autologin)) {
159
+ shx.rm(autologin);
212
160
  }
213
161
  // --- SYSVINIT REMOVE ---
214
162
  }
215
163
  else if (Utils.isSysvinit()) {
216
164
  const inittab = chroot + '/etc/inittab';
217
- // 🔧 [Change 7] - Safe Restore for SysVinit
218
- // Much safer to restore the backup than trying to undo regex replacements manually.
165
+ // Safe Restore per SysVinit
219
166
  if (fs.existsSync(`${inittab}.bak`)) {
220
- console.log(`Restoring ${inittab} from backup...`);
221
- fs.copyFileSync(`${inittab}.bak`, inittab);
222
- fs.rmSync(`${inittab}.bak`);
167
+ // console.log(`Restoring ${inittab} from backup...`);
168
+ shx.cp(`${inittab}.bak`, inittab);
169
+ shx.rm(`${inittab}.bak`);
223
170
  }
224
171
  else {
225
- // Fallback: Try to clean up the inserted lines
172
+ // Fallback: Pulisce le righe inserite
226
173
  const search = '--autologin';
227
174
  const replace = '1:2345:respawn:/sbin/getty 38400 tty1';
228
175
  let content = '';
229
176
  const lines = fs.readFileSync(inittab, 'utf8').split('\n');
230
177
  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
178
  if (lines[i].includes(search))
234
179
  lines[i] = replace;
235
180
  content += lines[i] + '\n';
@@ -249,4 +194,72 @@ export default class CliAutologin {
249
194
  }
250
195
  }
251
196
  }
197
+ /**
198
+ *
199
+ * @param distro
200
+ * @param version
201
+ * @param user
202
+ * @param userPasswd
203
+ * @param rootPasswd
204
+ * @param chroot
205
+ */
206
+ async addIssue(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
207
+ const fileIssue = `${chroot}/etc/issue`;
208
+ if (fs.existsSync(fileIssue)) {
209
+ if (!fs.lstatSync(fileIssue).isSymbolicLink()) {
210
+ this.msgRemove(fileIssue);
211
+ let content = fs.readFileSync(fileIssue, 'utf8');
212
+ content += startMessage + '\n';
213
+ content += `This is a ${distro}/${version} system created by Penguins' eggs.\n`;
214
+ content += `You can login with user: ${chalk.bold(user)} and password: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n`;
215
+ content += stopMessage + '\n';
216
+ try {
217
+ fs.writeFileSync(fileIssue, content);
218
+ }
219
+ catch (err) {
220
+ Utils.error(`Failed to write ${fileIssue}: ${err}`);
221
+ }
222
+ }
223
+ }
224
+ }
225
+ /**
226
+ *
227
+ * @param distro
228
+ * @param version
229
+ * @param user
230
+ * @param userPasswd
231
+ * @param rootPasswd
232
+ * @param chroot
233
+ */
234
+ async addMotd(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
235
+ const fileMotd = `${chroot}/etc/motd`;
236
+ let installer = 'sudo eggs krill';
237
+ if (Pacman.calamaresExists()) {
238
+ if (Pacman.packageIsInstalled('plasma-desktop')) {
239
+ installer = 'startplasma-wayland to run GUI and launch calamares';
240
+ }
241
+ else if (Pacman.packageIsInstalled('xfce4')) {
242
+ installer = 'startxfce4 to run GUI and launch calamares installer';
243
+ }
244
+ }
245
+ if (!fs.existsSync(fileMotd)) {
246
+ shx.touch(fileMotd);
247
+ }
248
+ this.msgRemove(fileMotd);
249
+ let eggsMotd = fs.readFileSync(fileMotd, 'utf8');
250
+ eggsMotd += startMessage + '\n';
251
+ eggsMotd += Utils.flag() + '\n';
252
+ eggsMotd += `You are logged as: ${chalk.bold(user)} your password is: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n\n`;
253
+ eggsMotd += `install system : ${chalk.bold(installer)}\n`;
254
+ eggsMotd += ` --unattended : ${chalk.bold('sudo eggs krill --unattended')}\n`;
255
+ eggsMotd += ` --chroot : ${chalk.bold('sudo eggs krill --chroot')}\n`;
256
+ eggsMotd += ` --help : ${chalk.bold('sudo eggs krill --help')}\n\n`;
257
+ eggsMotd += stopMessage + '\n';
258
+ try {
259
+ fs.writeFileSync(fileMotd, eggsMotd);
260
+ }
261
+ catch (err) {
262
+ Utils.error(`Failed to write ${fileMotd}: ${err}`);
263
+ }
264
+ }
252
265
  }
@@ -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);
@@ -1,5 +1,6 @@
1
1
  /**
2
- *
3
- * @returns
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.
4
5
  */
5
6
  export declare function initcpio(): Promise<string>;
@@ -8,31 +8,40 @@
8
8
  import { exec } from '../../../lib/utils.js';
9
9
  import { access } from 'fs/promises';
10
10
  /**
11
- *
12
- * @returns
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.
13
14
  */
14
15
  export async function initcpio() {
15
16
  try {
16
- const result = await exec('uname -r');
17
- const kernelVersion = result.data;
17
+ const kernelVersion = (await exec('uname -r', { capture: true })).data;
18
18
  const version = kernelVersion.trim();
19
- // Manjaro
19
+ // Logica Manjaro
20
20
  if (version.includes('MANJARO')) {
21
21
  try {
22
- // Estrai major e minor version. Es: da "6.12.48-1-MANJARO" -> ["6", "12", "48-1-MANJARO"]
23
22
  const parts = version.split('.');
24
- // Costruisci il nome del preset come "linux" + "6" + "12" -> "linux612"
25
23
  const kernelName = `linux${parts[0]}${parts[1]}`;
24
+ // Tentativo 1: Major/Minor (es. /etc/mkinitcpio.d/linux61.preset)
26
25
  const manjaroPreset = `/etc/mkinitcpio.d/${kernelName}.preset`;
27
- await access(manjaroPreset); // Verifica se esiste /etc/mkinitcpio.d/linux612.preset
28
- return manjaroPreset; // Se esiste, lo restituisce e la funzione termina
26
+ await access(manjaroPreset);
27
+ return manjaroPreset;
29
28
  }
30
- catch {
31
- // Se anche questa logica fallisce, lascia che proceda al fallback per Arch
32
- // 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
+ }
33
41
  }
34
42
  }
35
43
  else if (version.includes('cachyos')) {
44
+ // Logica CachyOS
36
45
  try {
37
46
  let kernelType = 'linux-cachyos'; // default
38
47
  if (version.includes('lts')) {
@@ -49,14 +58,10 @@ export async function initcpio() {
49
58
  return cachyPreset;
50
59
  }
51
60
  catch {
52
- // Se anche questa logica fallisce, lascia che proceda al fallback per Arch
53
- // console.warn('Logica Manjaro fallita, si tenta il fallback per Arch...');
61
+ // Fallito, si procede al fallback Arch
54
62
  }
55
63
  }
56
- /**
57
- * FALLBACK ARCH
58
- */
59
- // Determina il tipo di kernel
64
+ // FALLBACK ARCH
60
65
  let kernelType = 'linux'; // default
61
66
  if (version.includes('lts')) {
62
67
  kernelType = 'linux-lts';
@@ -73,7 +78,7 @@ export async function initcpio() {
73
78
  return archPreset;
74
79
  }
75
80
  catch (error) {
76
- // Rimuoviamo l'errore originale dalla stringa per un messaggio più pulito
77
- 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/.`);
78
83
  }
79
84
  }
@@ -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
  }
@@ -6,4 +6,4 @@
6
6
  * license: MIT
7
7
  */
8
8
  import Ovary from '../ovary.js';
9
- export declare function editLiveFs(this: Ovary, clone?: boolean): Promise<void>;
9
+ export declare function editLiveFs(this: Ovary): Promise<void>;