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
@@ -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
 
@@ -36,9 +36,10 @@
36
36
  distroLike: Debian
37
37
  family: debian
38
38
  ids:
39
+ - gigi # LMDE 7
39
40
  - lory # Parrot lory
40
41
  - orchid # VanillaOS
41
- - gigi # LMDE 7
42
+ - yirmibes # pardus-25
42
43
 
43
44
  # forky
44
45
  - id: forky
@@ -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,8 +1,7 @@
1
1
  ######################################################################################################
2
2
  # var: use this exclusions, attention this can lead to lost something
3
3
  var/backups/*
4
- var/cache/*
5
- var/lib/aide/*
4
+ var/cache/* var/lib/aide/*
6
5
  var/lib/apt/*~
7
6
  var/lib/apt/cache/*
8
7
  var/lib/apt/cdroms.list
@@ -14,7 +13,10 @@ var/lib/apt/mirrors/
14
13
  var/lib/apt/periodic/
15
14
  var/lib/aptitude/*.old
16
15
  var/lib/cache/*
17
- var/lib/dbus/machine-id
16
+
17
+ # NON CANCELLARE QUESTO SU DEVUAN!
18
+ # var/lib/dbus/machine-id
19
+
18
20
  var/lib/dhcp/*
19
21
  var/lib/dkms/wireguard/*
20
22
  var/lib/dpkg/*~old
@@ -22,8 +24,11 @@ var/lib/gems/2.7.0/cache/*
22
24
  var/log/*.log
23
25
  var/log/*.log.?
24
26
  var/log/*/*
25
- var/spool/*
26
- var/tmp/*
27
27
 
28
+ # Modifica per var/spool: non cancellare la directory intera,
29
+ # ma svuota solo directory specifiche se necessario.
30
+ # Se cancelli "var/spool/*" cron e rsyslog non trovano la cartella e danno errore.
31
+ # var/spool/* var/spool/mail/*
32
+ var/spool/postfix/*
28
33
 
29
- #var/lib/snapd/*
34
+ var/tmp/*
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import Distro from '../classes/distro.js';
9
9
  import Diversions from '../classes/diversions.js';
10
- import { execSync } from 'child_process';
10
+ import { execSync } from '../lib/utils.js';
11
11
  import * as fs from 'fs';
12
12
  import * as path from 'path';
13
13
  const ALPINE_PACKAGES = [
@@ -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,70 +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 'node:child_process';
10
- // 🔧 [Change 1] - Removed unused `{ link }` import to clean up unnecessary dependencies.
11
9
  import fs from 'node:fs';
12
10
  import path from 'node:path';
13
11
  // libraries
14
- import { exec } from '../lib/utils.js';
12
+ import { shx } from '../lib/utils.js';
15
13
  import Pacman from './pacman.js';
16
14
  import Utils from './utils.js';
17
15
  const startMessage = 'eggs-start-message';
18
16
  const stopMessage = 'eggs-stop-message';
19
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
+ */
20
27
  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.
23
28
  if (!user || !userPasswd || !rootPasswd) {
24
29
  throw new Error('Missing user credentials for CLI autologin setup.');
25
30
  }
31
+ // --- SYSTEMD ---
26
32
  if (Utils.isSystemd()) {
27
33
  Utils.warning("systemd: creating CLI autologin");
28
- const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
34
+ const fileOverride = `${chroot}/etc/systemd/system/getty@tty1.service.d/override.conf`;
29
35
  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.
36
+ // Clean existing override directory using shx
32
37
  if (fs.existsSync(dirOverride)) {
33
- try {
34
- fs.rmSync(dirOverride, { recursive: true, force: true });
35
- }
36
- catch (err) {
37
- Utils.error(`Failed to remove ${dirOverride}: ${err}`);
38
- }
38
+ shx.rm('-rf', dirOverride);
39
39
  }
40
40
  // Exclude OpenSUSE since it uses a different login mechanism.
41
41
  if (distro !== 'Opensuse') {
42
- // 🔧 [Change 4] - Used `fs.mkdirSync()` instead of shell command for better cross-platform reliability.
43
- fs.mkdirSync(dirOverride, { recursive: true });
42
+ shx.mkdir('-r', dirOverride);
44
43
  let content = '';
45
44
  content += '[Service]\n';
46
45
  content += 'ExecStart=\n';
47
- 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.
46
+ content += `ExecStart=-/usr/sbin/agetty --noclear --autologin ${user} %I $TERM\n`;
50
47
  try {
51
48
  fs.writeFileSync(fileOverride, content);
52
- fs.chmodSync(fileOverride, 0o755);
49
+ shx.chmod(0o755, fileOverride);
53
50
  }
54
51
  catch (err) {
55
52
  Utils.error(`Failed to write ${fileOverride}: ${err}`);
56
53
  }
57
54
  }
58
- await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
59
- 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
+ // Backup inittab
66
61
  if (fs.existsSync(inittab)) {
67
- fs.copyFileSync(inittab, `${inittab}.bak`);
62
+ shx.cp(inittab, `${inittab}.bak`);
68
63
  }
69
64
  let content = '';
70
65
  const search = `tty1::respawn:/sbin/getty 38400 tty1`;
@@ -81,32 +76,133 @@ export default class CliAutologin {
81
76
  content = '#!/bin/sh\n';
82
77
  content += `/bin/login -f ${user}\n`;
83
78
  fs.writeFileSync(autologin, content, 'utf-8');
84
- execSync(`chmod +x ${autologin}`);
85
- await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
86
- await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
79
+ shx.chmod('+x', autologin);
80
+ // --- SYSVINIT ---
87
81
  }
88
82
  else if (Utils.isSysvinit()) {
89
83
  Utils.warning("sysvinit: creating CLI autologin");
90
84
  const inittab = chroot + '/etc/inittab';
91
- // 🔧 [Change 7] - Added backup for SysVInit `inittab` as well.
92
- // Provides consistency and safety across all init systems.
85
+ // Backup for SysVInit
93
86
  if (fs.existsSync(inittab)) {
94
- fs.copyFileSync(inittab, `${inittab}.bak`);
87
+ shx.cp(inittab, `${inittab}.bak`);
95
88
  }
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';
89
+ let content = fs.readFileSync(inittab, 'utf8');
90
+ // Robust Regex Replacement for tty1 line
91
+ // Forces /sbin/agetty and adds --noclear
92
+ const regex = /^(1:[0-9]*:respawn:)(.*getty\s+.*tty1.*)$/gm;
93
+ if (regex.test(content)) {
94
+ regex.lastIndex = 0; // Reset index
95
+ content = content.replace(regex, (match, prefix, oldCmd) => {
96
+ return `# ORIGINAL DISABLED BY EGGS: ${match}\n${prefix}/sbin/agetty --autologin ${user} --noclear 38400 tty1 linux`;
97
+ });
98
+ }
99
+ else {
100
+ // Fallback: append config
101
+ Utils.warning("Standard tty1 line not found in inittab. Appending autologin configuration.");
102
+ content += `\n# Autologin added by penguins-eggs\n1:2345:respawn:/sbin/agetty --autologin ${user} --noclear 38400 tty1 linux\n`;
104
103
  }
105
104
  fs.writeFileSync(inittab, content, 'utf-8');
106
- await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
107
- await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
108
105
  }
106
+ await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
107
+ await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
109
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
+ */
115
+ async remove(chroot = '/') {
116
+ // --- SYSTEMD REMOVE ---
117
+ if (Utils.isSystemd()) {
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);
128
+ }
129
+ // Pulizia messaggi di benvenuto
130
+ this.msgRemove(`${chroot}/etc/motd`);
131
+ this.msgRemove(`${chroot}/etc/issue`);
132
+ // --- OPENRC REMOVE ---
133
+ }
134
+ else if (Utils.isOpenRc()) {
135
+ const inittab = chroot + '/etc/inittab';
136
+ // Safe Restore: Se esiste il backup, usalo.
137
+ if (fs.existsSync(`${inittab}.bak`)) {
138
+ shx.cp(`${inittab}.bak`, inittab);
139
+ shx.rm(`${inittab}.bak`);
140
+ }
141
+ else {
142
+ // Fallback: ripristino manuale delle stringhe (Legacy)
143
+ const search = 'autologin';
144
+ const replace = `tty1::respawn:/sbin/getty 38400 tty1`;
145
+ let content = '';
146
+ const lines = fs.readFileSync(inittab, 'utf8').split('\n');
147
+ for (let i = 0; i < lines.length; i++) {
148
+ if (lines[i].includes(search))
149
+ lines[i] = replace;
150
+ content += lines[i] + '\n';
151
+ }
152
+ fs.writeFileSync(inittab, content, 'utf-8');
153
+ }
154
+ this.msgRemove(`${chroot}/etc/motd`);
155
+ this.msgRemove(`${chroot}/etc/issue`);
156
+ // Rimuove lo script binario di supporto per OpenRC
157
+ const autologin = `${chroot}/bin/autologin`;
158
+ if (fs.existsSync(autologin)) {
159
+ shx.rm(autologin);
160
+ }
161
+ // --- SYSVINIT REMOVE ---
162
+ }
163
+ else if (Utils.isSysvinit()) {
164
+ const inittab = chroot + '/etc/inittab';
165
+ // Safe Restore per SysVinit
166
+ if (fs.existsSync(`${inittab}.bak`)) {
167
+ // console.log(`Restoring ${inittab} from backup...`);
168
+ shx.cp(`${inittab}.bak`, inittab);
169
+ shx.rm(`${inittab}.bak`);
170
+ }
171
+ else {
172
+ // Fallback: Pulisce le righe inserite
173
+ const search = '--autologin';
174
+ const replace = '1:2345:respawn:/sbin/getty 38400 tty1';
175
+ let content = '';
176
+ const lines = fs.readFileSync(inittab, 'utf8').split('\n');
177
+ for (let i = 0; i < lines.length; i++) {
178
+ if (lines[i].includes(search))
179
+ lines[i] = replace;
180
+ content += lines[i] + '\n';
181
+ }
182
+ fs.writeFileSync(inittab, content, 'utf-8');
183
+ }
184
+ this.msgRemove(`${chroot}/etc/motd`);
185
+ this.msgRemove(`${chroot}/etc/issue`);
186
+ }
187
+ }
188
+ async msgRemove(path) {
189
+ if (fs.existsSync(path)) {
190
+ if (!fs.lstatSync(path).isSymbolicLink()) {
191
+ let content = fs.readFileSync(path, 'utf8');
192
+ content = content.replace(/eggs-start-message[\s\S]*?eggs-stop-message/g, '');
193
+ fs.writeFileSync(path, content, 'utf-8');
194
+ }
195
+ }
196
+ }
197
+ /**
198
+ *
199
+ * @param distro
200
+ * @param version
201
+ * @param user
202
+ * @param userPasswd
203
+ * @param rootPasswd
204
+ * @param chroot
205
+ */
110
206
  async addIssue(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
111
207
  const fileIssue = `${chroot}/etc/issue`;
112
208
  if (fs.existsSync(fileIssue)) {
@@ -117,8 +213,6 @@ export default class CliAutologin {
117
213
  content += `This is a ${distro}/${version} system created by Penguins' eggs.\n`;
118
214
  content += `You can login with user: ${chalk.bold(user)} and password: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n`;
119
215
  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
216
  try {
123
217
  fs.writeFileSync(fileIssue, content);
124
218
  }
@@ -128,6 +222,15 @@ export default class CliAutologin {
128
222
  }
129
223
  }
130
224
  }
225
+ /**
226
+ *
227
+ * @param distro
228
+ * @param version
229
+ * @param user
230
+ * @param userPasswd
231
+ * @param rootPasswd
232
+ * @param chroot
233
+ */
131
234
  async addMotd(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
132
235
  const fileMotd = `${chroot}/etc/motd`;
133
236
  let installer = 'sudo eggs krill';
@@ -140,19 +243,18 @@ export default class CliAutologin {
140
243
  }
141
244
  }
142
245
  if (!fs.existsSync(fileMotd)) {
143
- await exec(`touch ${fileMotd}`);
246
+ shx.touch(fileMotd);
144
247
  }
145
248
  this.msgRemove(fileMotd);
146
249
  let eggsMotd = fs.readFileSync(fileMotd, 'utf8');
147
250
  eggsMotd += startMessage + '\n';
148
251
  eggsMotd += Utils.flag() + '\n';
149
252
  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`;
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`;
154
257
  eggsMotd += stopMessage + '\n';
155
- // 🔧 [Change 9] - Same as above: safe write with error handling to improve reliability.
156
258
  try {
157
259
  fs.writeFileSync(fileMotd, eggsMotd);
158
260
  }
@@ -160,68 +262,4 @@ export default class CliAutologin {
160
262
  Utils.error(`Failed to write ${fileMotd}: ${err}`);
161
263
  }
162
264
  }
163
- async remove(chroot = '/') {
164
- if (Utils.isSystemd()) {
165
- const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
166
- const dirOverride = path.dirname(fileOverride);
167
- // 🔧 [Change 10] - Replaced shell-based deletion with `fs.rmSync()` for safety and consistency.
168
- if (fs.existsSync(dirOverride)) {
169
- try {
170
- fs.rmSync(dirOverride, { recursive: true, force: true });
171
- }
172
- catch (err) {
173
- Utils.error(`Failed to remove ${dirOverride}: ${err}`);
174
- }
175
- }
176
- this.msgRemove(`${chroot}/etc/motd`);
177
- this.msgRemove(`${chroot}/etc/issue`);
178
- }
179
- else if (Utils.isOpenRc()) {
180
- 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
- }
190
- fs.writeFileSync(inittab, content, 'utf-8');
191
- this.msgRemove(`${chroot}/etc/motd`);
192
- this.msgRemove(`${chroot}/etc/issue`);
193
- 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
- if (autologin.startsWith(chroot)) {
197
- execSync(`rm -f ${autologin}`);
198
- }
199
- }
200
- else if (Utils.isSysvinit()) {
201
- 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';
210
- }
211
- fs.writeFileSync(inittab, content, 'utf-8');
212
- this.msgRemove(`${chroot}/etc/motd`);
213
- this.msgRemove(`${chroot}/etc/issue`);
214
- }
215
- }
216
- async msgRemove(path) {
217
- if (fs.existsSync(path)) {
218
- 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
- let content = fs.readFileSync(path, 'utf8');
222
- content = content.replace(/eggs-start-message[\s\S]*?eggs-stop-message/g, '');
223
- fs.writeFileSync(path, content, 'utf-8');
224
- }
225
- }
226
- }
227
265
  }
@@ -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
  }