penguins-eggs 25.10.30 → 25.11.12

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 (131) hide show
  1. package/.oclif.manifest.json +4 -4
  2. package/README.md +3 -3
  3. package/addons/eggs/adapt/applications/eggs-adapt.desktop +0 -0
  4. package/addons/eggs/pve/applications/eggs-pve.desktop +0 -0
  5. package/addons/eggs/rsupport/applications/eggs-rsupport.desktop +0 -0
  6. package/addons/eggs/theme/applications/install-system.desktop +0 -0
  7. package/assets/calamares/install-system.sh +0 -0
  8. package/assets/penguins-eggs.desktop +0 -0
  9. package/assets/penguins-krill.desktop +0 -0
  10. package/assets/penguins-links-add.desktop +0 -0
  11. package/assets/penguins-live-installer.desktop +0 -0
  12. package/bin/dev.js +0 -0
  13. package/conf/distros/alpine/calamares/calamares-modules/machineid-openrc/machineid-openrc.sh +0 -0
  14. package/conf/distros/alpine/calamares/modules/packages.mustache +1 -0
  15. package/conf/distros/alpine/calamares/modules/removeuser.mustache +2 -14
  16. package/conf/distros/alpine/calamares/modules/unpackfs.mustache +2 -2
  17. package/conf/distros/archlinux/calamares/modules/bootloader.yml +1 -1
  18. package/conf/distros/archlinux/calamares/modules/partition.yml +385 -8
  19. package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
  20. package/conf/distros/buster/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +0 -0
  21. package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
  22. package/conf/distros/buster/calamares/modules/shellprocess@boot_deploy.yml +1 -16
  23. package/conf/distros/fedora/calamares/calamares-modules/bootloaderspecification/bootloaderspecification.sh +0 -0
  24. package/conf/distros/noble/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
  25. package/conf/distros/noble/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
  26. package/conf/distros/noble/calamares/libexec/calamares-aptsources.sh +0 -0
  27. package/conf/distros/noble/calamares/libexec/calamares-l10n-helper.sh +0 -0
  28. package/conf/distros/noble/calamares/libexec/calamares-logs-helper.sh +1 -1
  29. package/conf/distros/noble/calamares/libexec/calamares-nomodeset.sh +0 -0
  30. package/conf/distros/noble/calamares/modules/shellprocess@boot_deploy.yml +1 -11
  31. package/conf/distros/noble/calamares/modules/shellprocess@logs.yml +1 -1
  32. package/conf/distros/opensuse/calamares/calamares-modules/bootloaderspecification/bootloaderspecification.sh +0 -0
  33. package/conf/distros/opensuse/calamares/settings.yml +0 -0
  34. package/conf/distros/opensuse/calamares/zstd2lzo.sh +0 -0
  35. package/conf/distros/trixie/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
  36. package/conf/distros/trixie/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +0 -0
  37. package/conf/distros/trixie/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
  38. package/conf/distros/trixie/calamares/modules/shellprocess@boot_deploy.yml +2 -10
  39. package/conf/init/unattended.sh +0 -0
  40. package/dist/classes/cli-autologin.d.ts +1 -39
  41. package/dist/classes/cli-autologin.js +85 -110
  42. package/dist/classes/daddy.d.ts +30 -12
  43. package/dist/classes/daddy.js +166 -137
  44. package/dist/classes/distro.js +11 -27
  45. package/dist/classes/diversions.d.ts +3 -37
  46. package/dist/classes/diversions.js +72 -103
  47. package/dist/classes/incubation/customize/customize-partitions.js +8 -1
  48. package/dist/classes/incubation/fisherman-helper/packages.js +1 -1
  49. package/dist/classes/incubation/fisherman.d.ts +5 -0
  50. package/dist/classes/incubation/fisherman.js +21 -1
  51. package/dist/classes/incubation/incubator.d/noble.js +6 -2
  52. package/dist/classes/incubation/incubator.js +4 -5
  53. package/dist/classes/keyboards.d.ts +11 -30
  54. package/dist/classes/keyboards.js +100 -251
  55. package/dist/classes/ovary.d/initrd.js +2 -7
  56. package/dist/classes/pacman.d/archlinux.js +5 -5
  57. package/dist/classes/pacman.d/debian.js +0 -2
  58. package/dist/classes/pacman.d/opensuse.js +2 -2
  59. package/dist/classes/pacman.js +7 -9
  60. package/dist/commands/tools/repo.js +198 -31
  61. package/dist/krill/classes/sequence.d/unpackfs.js +3 -2
  62. package/dracut/create-symlink +0 -0
  63. package/dracut/export +0 -0
  64. package/dracut/export-dracut-analysis +0 -0
  65. package/dracut/export-dracut-log +0 -0
  66. package/dracut/mkisofs +0 -0
  67. package/dracut/modules.d/00debug-shell/debug-hook.sh +0 -0
  68. package/dracut/modules.d/00debug-shell/module-setup.sh +0 -0
  69. package/dracut/modules.d/90block/block-cmdline.sh +0 -0
  70. package/dracut/modules.d/90block/module-setup.sh +0 -0
  71. package/dracut/modules.d/95iso-scan/iso-scan-fallback.sh +0 -0
  72. package/dracut/modules.d/95iso-scan/iso-scan.sh +0 -0
  73. package/dracut/modules.d/95iso-scan/module-setup.sh +0 -0
  74. package/dracut/modules.d/95luks-loop/luks-loop.sh +0 -0
  75. package/dracut/modules.d/95luks-loop/module-setup.sh +0 -0
  76. package/dracut/renew-initramfs +0 -0
  77. package/dracut/sbin2bin +0 -0
  78. package/dracut/update-dracut-conf-d +0 -0
  79. package/dracut/update-dracut-modules +0 -0
  80. package/eui/eui-autostart-cinnamon.desktop +0 -0
  81. package/eui/eui-autostart-xfce.desktop +0 -0
  82. package/eui/eui-create-image.sh +0 -0
  83. package/eui/eui-start.sh +0 -0
  84. package/package.json +130 -124
  85. package/perrisbrewery/scripts/postinst +0 -0
  86. package/perrisbrewery/scripts/postrm +0 -0
  87. package/perrisbrewery/scripts/preinst +0 -0
  88. package/perrisbrewery/scripts/prerm +0 -0
  89. package/perrisbrewery/template/dependencies.yaml +7 -6
  90. package/scripts/99clean +0 -0
  91. package/scripts/adapt.sh +0 -0
  92. package/scripts/boot-encrypted-root.sh +0 -0
  93. package/scripts/bros/waydroid-helper.sh +0 -0
  94. package/scripts/lsb_release +0 -0
  95. package/scripts/mom.sh +0 -0
  96. package/scripts/mount-encrypted-home.sh +0 -0
  97. package/scripts/pve-live.service +0 -0
  98. package/scripts/pve-live.sh +0 -0
  99. package/scripts/resy +0 -0
  100. package/conf/distros/focal/calamares/calamares-modules/.keepit +0 -0
  101. package/conf/distros/focal/calamares/calamares-modules/cleanup/cleanup.sh +0 -20
  102. package/conf/distros/focal/calamares/calamares-modules/cleanup/module.yml +0 -9
  103. package/conf/distros/focal/calamares/calamares-modules/sources-yolk/module.yml +0 -8
  104. package/conf/distros/focal/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -50
  105. package/conf/distros/focal/calamares/calamares-modules/sources-yolk-undo/module.yml +0 -8
  106. package/conf/distros/focal/calamares/modules/after_bootloader_context.yml +0 -19
  107. package/conf/distros/focal/calamares/modules/automirror.yml +0 -6
  108. package/conf/distros/focal/calamares/modules/before_bootloader_context.yml +0 -19
  109. package/conf/distros/focal/calamares/modules/before_bootloader_mkdirs_context.yml +0 -11
  110. package/conf/distros/focal/calamares/modules/bootloader.yml +0 -34
  111. package/conf/distros/focal/calamares/modules/displaymanager.yml +0 -12
  112. package/conf/distros/focal/calamares/modules/finished.yml +0 -4
  113. package/conf/distros/focal/calamares/modules/fstab.yml +0 -13
  114. package/conf/distros/focal/calamares/modules/grubcfg.yml +0 -5
  115. package/conf/distros/focal/calamares/modules/locale.yml +0 -9
  116. package/conf/distros/focal/calamares/modules/machineid.yml +0 -9
  117. package/conf/distros/focal/calamares/modules/mount.yml +0 -41
  118. package/conf/distros/focal/calamares/modules/packages.mustache +0 -5
  119. package/conf/distros/focal/calamares/modules/partition.yml +0 -10
  120. package/conf/distros/focal/calamares/modules/removeuser.mustache +0 -3
  121. package/conf/distros/focal/calamares/modules/shellprocess_add386arch.yml +0 -6
  122. package/conf/distros/focal/calamares/modules/shellprocess_bug-LP#1829805.yml +0 -5
  123. package/conf/distros/focal/calamares/modules/shellprocess_logs.yml +0 -6
  124. package/conf/distros/focal/calamares/modules/unpackfs.mustache +0 -6
  125. package/conf/distros/focal/calamares/modules/users.yml +0 -19
  126. package/conf/distros/focal/calamares/modules/welcome.yml +0 -26
  127. package/conf/distros/focal/calamares/settings.yml +0 -72
  128. package/dist/classes/incubation/incubator.d/bionic.d.ts +0 -32
  129. package/dist/classes/incubation/incubator.d/bionic.js +0 -83
  130. package/dist/classes/incubation/incubator.d/focal.d.ts +0 -32
  131. package/dist/classes/incubation/incubator.d/focal.js +0 -85
@@ -1,18 +1,15 @@
1
1
  /**
2
2
  * ./src/classes/daddy.ts
3
- * penguins-eggs v.25.7.x / ecmascript 2020
4
- * author: Piero Proietti
5
- * email: piero.proietti@gmail.com
3
+ * penguins-eggs v.25.7.x / ECMAScript 2020
4
+ * author: Piero Proietti (modified by Hossein Seilani)
6
5
  * license: MIT
7
6
  */
8
7
  import chalk from 'chalk';
9
8
  import inquirer from 'inquirer';
10
9
  import yaml from 'js-yaml';
11
- import fs from 'node:fs';
12
- // _dirname
10
+ import fs from 'node:fs/promises';
13
11
  import path from 'node:path';
14
12
  import { exec } from '../lib/utils.js';
15
- // We need to remove .js extension from import
16
13
  import Pacman from '../classes/pacman.js';
17
14
  import Settings from '../classes/settings.js';
18
15
  import Utils from '../classes/utils.js';
@@ -20,159 +17,191 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname);
20
17
  export default class Daddy {
21
18
  settings = {};
22
19
  /**
23
- * editConfif
24
- * @param c
25
- * @returns
20
+ * [CHANGE 1] Modular, type-safe, interactive configuration editor
21
+ * This method asks the user for LiveCD parameters using inquirer and returns
22
+ * a fully typed IEggsConfig object. It replaces the older JSON.stringify/parse approach.
26
23
  */
27
- async editConfig(c) {
28
- // Utils.titles('dad')
29
- console.log(chalk.cyan('Edit and save Live system parameters'));
30
- console.log();
31
- let compressionOpt = 0;
32
- if (c.compression === 'xz') {
33
- compressionOpt = 1;
24
+ async editConfig(config) {
25
+ console.log(chalk.cyan('Edit and save Live system parameters\n'));
26
+ // Determine default compression option
27
+ let compressionOpt;
28
+ switch (config.compression) {
29
+ case 'xz':
30
+ compressionOpt = 1;
31
+ break;
32
+ case 'xz -Xbcj x86':
33
+ compressionOpt = 2;
34
+ break;
35
+ default:
36
+ compressionOpt = 0;
37
+ break;
38
+ }
39
+ // Provide a default snapshot prefix if empty
40
+ if (!config.snapshot_prefix) {
41
+ config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId);
34
42
  }
35
- else if (c.compression === 'xz -Xbcj x86') {
36
- compressionOpt = 2;
43
+ /**
44
+ * // Define type-safe inquirer questions
45
+ * const questions: inquirer.QuestionCollection<IEggsConfig> = [
46
+ */
47
+ const questions = [
48
+ {
49
+ type: 'input',
50
+ name: 'snapshot_prefix',
51
+ message: 'LiveCD iso prefix: ',
52
+ default: config.snapshot_prefix,
53
+ },
54
+ {
55
+ type: 'input',
56
+ name: 'snapshot_basename',
57
+ message: 'LiveCD iso basename: ',
58
+ default: config.snapshot_basename,
59
+ },
60
+ {
61
+ type: 'input',
62
+ name: 'user_opt',
63
+ message: 'LiveCD user:',
64
+ default: config.user_opt,
65
+ },
66
+ {
67
+ type: 'input',
68
+ name: 'user_opt_passwd',
69
+ message: 'LiveCD user password:',
70
+ default: config.user_opt_passwd,
71
+ },
72
+ {
73
+ type: 'input',
74
+ name: 'root_passwd',
75
+ message: 'LiveCD root password:',
76
+ default: config.root_passwd,
77
+ },
78
+ {
79
+ type: 'list',
80
+ name: 'compression',
81
+ message: 'LiveCD compression: ',
82
+ choices: ['fast', 'max'],
83
+ default: compressionOpt,
84
+ },
85
+ ];
86
+ try {
87
+ // Prompt the user and return the typed config object
88
+ const answers = await inquirer.prompt(questions);
89
+ return answers;
37
90
  }
38
- if (c.snapshot_prefix === '') {
39
- c.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId);
91
+ catch (err) {
92
+ console.error(chalk.red('Error editing configuration:'), err);
93
+ throw err;
40
94
  }
41
- return new Promise((resolve) => {
42
- const questions = [
43
- {
44
- default: c.snapshot_prefix,
45
- message: 'LiveCD iso prefix: ',
46
- name: 'snapshot_prefix',
47
- type: 'input'
48
- },
49
- {
50
- default: c.snapshot_basename,
51
- message: 'LiveCD iso basename: ',
52
- name: 'snapshot_basename',
53
- type: 'input'
54
- },
55
- {
56
- default: c.user_opt,
57
- message: 'LiveCD user:',
58
- name: 'user_opt',
59
- type: 'input'
60
- },
61
- {
62
- default: c.user_opt_passwd,
63
- message: 'LiveCD user password: ',
64
- name: 'user_opt_passwd',
65
- type: 'input'
66
- },
67
- {
68
- default: c.root_passwd,
69
- message: 'LiveCD root password: ',
70
- name: 'root_passwd',
71
- type: 'input'
72
- },
73
- {
74
- choices: ['fast', 'max'],
75
- default: compressionOpt,
76
- message: 'LiveCD compression: ',
77
- name: 'compression',
78
- type: 'list'
79
- }
80
- ];
81
- inquirer.prompt(questions).then((options) => {
82
- resolve(JSON.stringify(options));
83
- });
84
- });
85
95
  }
86
96
  /**
87
- *
88
- * @param reset
89
- * @param isCustom
90
- * @param fileCustom
91
- * @param verbose
97
+ * [CHANGE 2] Central method to manage environment, configuration and save
98
+ * This method is modular, type-safe, and handles:
99
+ * - Pacman and distro templates check
100
+ * - Load, reset, or apply custom configuration
101
+ * - Save configuration to disk
102
+ * - Provide clear guidance to the user
92
103
  */
93
104
  async helpMe(reset = false, isCustom = false, fileCustom = '', verbose = false) {
94
- if (isCustom) {
95
- console.log('using custom file:', fileCustom);
105
+ try {
106
+ if (isCustom)
107
+ console.log('Using custom file:', fileCustom);
108
+ // Step 1: Check system prerequisites
109
+ await this.checkPacman(verbose);
110
+ // Step 2: Load settings
111
+ this.settings = new Settings();
112
+ const loaded = await this.settings.load();
113
+ let config = loaded ? this.settings.config : {};
114
+ // Step 3: Apply reset or custom configuration
115
+ if (reset || isCustom) {
116
+ await this.applyResetOrCustomConfig(config, isCustom, fileCustom);
117
+ }
118
+ else {
119
+ config = await this.editConfig(config);
120
+ }
121
+ // Step 4: Save final configuration
122
+ await this.settings.save(config);
123
+ // Step 5: Display help messages
124
+ this.displayFinalHelp();
96
125
  }
97
- // Controllo configurazione
126
+ catch (err) {
127
+ console.error(chalk.red('An error occurred in helpMe:'), err);
128
+ }
129
+ }
130
+ /**
131
+ * Check and install Pacman configuration and templates if missing
132
+ */
133
+ async checkPacman(verbose) {
98
134
  if (!Pacman.configurationCheck()) {
99
- console.log('- creating configuration dir...');
135
+ console.log('- creating configuration directory...');
100
136
  await Pacman.configurationInstall(verbose);
101
137
  }
102
- // Templates
103
138
  if (!Pacman.distroTemplateCheck()) {
104
- console.log('- distro template install...');
139
+ console.log('- installing distro template...');
105
140
  await Pacman.distroTemplateInstall(verbose);
106
141
  }
107
- //Calamares
108
- if (!Pacman.calamaresExists() &&
109
- Pacman.isInstalledGui() &&
110
- Pacman.isCalamaresAvailable()) {
111
- console.log('- this is a GUI system, calamares is available, but NOT installed');
142
+ if (!Pacman.calamaresExists() && Pacman.isInstalledGui() && Pacman.isCalamaresAvailable()) {
143
+ console.log('- GUI system detected, calamares is available but not installed.');
112
144
  }
113
- // show and edit configuration
114
- this.settings = new Settings();
115
- let config = {};
116
- let jsonConf = '';
117
- if (await this.settings.load()) {
118
- config = this.settings.config;
119
- config.compression = 'fast';
120
- if (reset || isCustom) {
121
- // add fstype to snapshot_prefix
122
- if (config.snapshot_prefix === '') {
123
- let fstype = ((await exec(`findmnt -n -o FSTYPE /`, { capture: true })).data.trim());
124
- if (fstype === 'ext4') {
125
- fstype = '';
126
- }
127
- else {
128
- // btrfs-, etc
129
- fstype += '-';
130
- }
131
- // excluded now
132
- fstype = '';
133
- config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId) + fstype;
134
- }
135
- jsonConf = JSON.stringify(config);
136
- }
137
- else {
138
- jsonConf = await this.editConfig(config);
145
+ }
146
+ /**
147
+ * Apply reset or custom configuration
148
+ */
149
+ async applyResetOrCustomConfig(config, isCustom, fileCustom) {
150
+ // Reset snapshot prefix if empty
151
+ 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()}-`;
139
156
  }
140
- // Custom configuration
141
- if (isCustom) {
142
- const conf = fs.readFileSync(fileCustom, 'utf8');
143
- const confCustom = yaml.load(conf);
144
- config.snapshot_basename = confCustom.snapshot_basename;
145
- config.snapshot_prefix = confCustom.snapshot_prefix;
146
- config.user_opt = confCustom.user_opt;
147
- config.user_opt_passwd = confCustom.user_opt_passwd;
148
- config.root_passwd = confCustom.root_passwd;
149
- config.theme = confCustom.theme;
150
- jsonConf = JSON.stringify(config);
157
+ catch (err) {
158
+ console.warn('Unable to detect FSTYPE:', err);
151
159
  }
152
- // Save new configuration
153
- const confNew = JSON.parse(jsonConf);
154
- config.snapshot_basename = confNew.snapshot_basename;
155
- config.snapshot_prefix = confNew.snapshot_prefix;
156
- config.user_opt = confNew.user_opt;
157
- config.user_opt_passwd = confNew.user_opt_passwd;
158
- config.root_passwd = confNew.root_passwd;
159
- config.theme = confNew.theme;
160
- await this.settings.save(config);
160
+ config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId) + fstype;
161
+ }
162
+ // Apply custom YAML if needed
163
+ if (isCustom && fileCustom) {
164
+ await this.applyCustomYAML(config, fileCustom);
165
+ }
166
+ }
167
+ /**
168
+ * Load and apply a custom YAML configuration
169
+ * [CHANGE 3] Async reading of file and type-safe parsing
170
+ */
171
+ async applyCustomYAML(config, fileCustom) {
172
+ try {
173
+ const conf = await fs.readFile(fileCustom, 'utf8');
174
+ const confCustom = yaml.load(conf);
175
+ // Safely copy fields from YAML to config
176
+ config.snapshot_basename = confCustom.snapshot_basename ?? config.snapshot_basename;
177
+ config.snapshot_prefix = confCustom.snapshot_prefix ?? config.snapshot_prefix;
178
+ config.user_opt = confCustom.user_opt ?? config.user_opt;
179
+ config.user_opt_passwd = confCustom.user_opt_passwd ?? config.user_opt_passwd;
180
+ config.root_passwd = confCustom.root_passwd ?? config.root_passwd;
181
+ config.theme = confCustom.theme ?? config.theme;
161
182
  }
183
+ catch (err) {
184
+ console.error(chalk.red('Failed to load custom YAML config:'), err);
185
+ throw err;
186
+ }
187
+ }
188
+ /**
189
+ * Display final guidance and tips to the user
190
+ * [CHANGE 4] Modular, clear, user-friendly messages
191
+ */
192
+ displayFinalHelp() {
162
193
  console.log();
163
194
  console.log(chalk.cyan('Your configuration was saved on: /etc/penguins-eggs.d'));
195
+ console.log(chalk.cyan('You can create a clean ISO with: ') + chalk.white('sudo eggs produce'));
196
+ console.log(chalk.cyan('Or a full personal clone: ') + chalk.white('sudo eggs produce --clone'));
164
197
  console.log();
165
- console.log(chalk.cyan(`You can create a clean ISO with: `) + chalk.white(`sudo eggs produce`));
166
- console.log(chalk.cyan(`or a full personal clone: `) + chalk.white(`sudo eggs produce --clone`));
167
- console.log();
168
- console.log(chalk.cyan(`If you don't have enough space to remaster, you can mount`));
169
- console.log(chalk.cyan(`some remote or local space. Follow the samples:`));
170
- console.log(chalk.cyan(`- first, create an hidden mountpoint under the nest:`));
171
- console.log(chalk.white(`sudo mkdir /home/eggs/.mnt -p`));
172
- console.log(chalk.cyan(`- then, mount remote space:`));
173
- console.log(chalk.white(`sudo sshfs -o allow_other root@192.168.1.2:/zfs/iso /home/eggs/.mnt`));
174
- console.log(chalk.cyan('- or, mount a local partition:'));
175
- console.log(chalk.white(`sudo mount /dev/sdx1 /home/eggs/.mnt`));
198
+ console.log(chalk.cyan('If you don’t have enough space to remaster, you can mount remote or local space:'));
199
+ console.log(chalk.cyan('- Create a hidden mountpoint under the nest:'));
200
+ console.log(chalk.white('sudo mkdir /home/eggs/.mnt -p'));
201
+ console.log(chalk.cyan('- Mount remote space:'));
202
+ console.log(chalk.white('sudo sshfs -o allow_other root@192.168.1.2:/zfs/iso /home/eggs/.mnt'));
203
+ console.log(chalk.cyan('- Or mount a local partition:'));
204
+ console.log(chalk.white('sudo mount /dev/sdx1 /home/eggs/.mnt'));
176
205
  console.log();
177
206
  console.log(chalk.cyan('More help? ') + chalk.white('eggs mom'));
178
207
  }
@@ -67,10 +67,9 @@ class Distro {
67
67
  this.distroId = "Bigcommunity";
68
68
  }
69
69
  /**
70
- * Alpine, Fedora, openmamba, opensuse, VoidLinux solo distroId.
70
+ * Alpine, Fedora, openmamba, opensuse analyze **distroId**
71
71
  *
72
- * Debian, Devuan, Ubuntu e derivate ricadono in
73
- * default e si analizza il codebaseId
72
+ * Arch, Debian, Devuan, Ubuntu and derivatives we analyze **codebaseId**
74
73
  *
75
74
  */
76
75
  if (this.distroId === 'Alpine') {
@@ -118,7 +117,7 @@ class Distro {
118
117
  }
119
118
  else {
120
119
  /**
121
- * We must analize codenameId
120
+ * Debian/ARCH: we analize **codenameId**
122
121
  */
123
122
  /**
124
123
  * Arch
@@ -177,13 +176,6 @@ class Distro {
177
176
  this.distroLike = 'Debian';
178
177
  this.distroUniqueId = 'trixie';
179
178
  this.liveMediumPath = '/run/live/medium/'; //initramfs
180
- // this.liveMediumPath = '/run/initramfs/live/' // dracut
181
- /**
182
- * dracut su trixie
183
- if (Pacman.packageIsInstalled('dracut')) {
184
- this.liveMediumPath = '/run/initramfs/live/'
185
- }
186
- */
187
179
  /**
188
180
  * Debian 14 forky
189
181
  */
@@ -219,14 +211,6 @@ class Distro {
219
211
  else if (this.codenameId === 'excalibur') {
220
212
  this.distroLike = 'Devuan';
221
213
  this.distroUniqueId = 'excalibur';
222
- /**
223
- * Ubuntu bionic
224
- */
225
- }
226
- else if (this.codenameId === 'bionic') {
227
- this.distroLike = 'Ubuntu';
228
- this.distroUniqueId = 'bionic';
229
- this.liveMediumPath = '/lib/live/mount/medium/';
230
214
  /**
231
215
  * Ubuntu focal
232
216
  */
@@ -264,11 +248,11 @@ class Distro {
264
248
  /**
265
249
  * derivatives: families archlinux, debian
266
250
  */
267
- let file = path.resolve(__dirname, '../../conf/derivatives.yaml');
251
+ let archDebianDerivatives = path.resolve(__dirname, '../../conf/derivatives.yaml');
268
252
  if (fs.existsSync('/etc/penguins-eggs.d/derivatives.yaml')) {
269
- file = '/etc/penguins-eggs.d/derivatives.yaml';
253
+ archDebianDerivatives = '/etc/penguins-eggs.d/derivatives.yaml';
270
254
  }
271
- const content = fs.readFileSync(file, 'utf8');
255
+ const content = fs.readFileSync(archDebianDerivatives, 'utf8');
272
256
  const distros = yaml.load(content);
273
257
  for (const distro of distros) {
274
258
  if (distro.ids !== undefined) {
@@ -287,11 +271,11 @@ class Distro {
287
271
  * derivatives: family fedora
288
272
  */
289
273
  if (!found) {
290
- let file = path.resolve(__dirname, '../../conf/derivatives_fedora.yaml');
274
+ let fedoraDerivatives = path.resolve(__dirname, '../../conf/derivatives_fedora.yaml');
291
275
  if (fs.existsSync('/etc/penguins-eggs.d/derivatives_fedora.yaml')) {
292
- file = '/etc/penguins-eggs.d/derivatives_fedora.yaml';
276
+ fedoraDerivatives = '/etc/penguins-eggs.d/derivatives_fedora.yaml';
293
277
  }
294
- const content = fs.readFileSync(file, 'utf8');
278
+ const content = fs.readFileSync(fedoraDerivatives, 'utf8');
295
279
  const elem = yaml.load(content);
296
280
  if (elem.includes(this.distroId)) {
297
281
  this.familyId = 'fedora';
@@ -327,7 +311,7 @@ class Distro {
327
311
  this.usrLibPath = '/usr/lib64/';
328
312
  }
329
313
  /**
330
- * Manjarolinux e derivate (biglinux)
314
+ * Manjarolinux anf derivatives (biglinux)
331
315
  */
332
316
  if (Diversions.isManjaroBased(this.distroId)) {
333
317
  this.liveMediumPath = '/run/miso/bootmnt/';
@@ -345,7 +329,7 @@ class Distro {
345
329
  const data = fs.readFileSync(os_release, 'utf8');
346
330
  lines = data.split('\n');
347
331
  }
348
- // per ogni riga
332
+ // read every line
349
333
  for (const line of lines) {
350
334
  if (line.startsWith('HOME_URL=')) {
351
335
  this.homeUrl = line.slice('HOME_URL='.length).replaceAll('"', '');
@@ -1,53 +1,19 @@
1
1
  /**
2
2
  * ./src/classes/diversions.ts
3
3
  * penguins-eggs v.25.7.x / ecmascript 2020
4
- * author: Piero Proietti
5
- * email: piero.proietti@gmail.com
4
+ * author: Piero Proietti (modified by Hossein Seilani)
6
5
  * license: MIT
7
- */
8
- /**
9
- * contiene le variazione di nome
10
- * per ogni famiglia
6
+ *
7
+ * NEW VERSION: Improved and cleaned with detailed comments and new changes
11
8
  */
12
9
  import { IDistro } from '../interfaces/index.js';
13
10
  export default class Diversions {
14
- /**
15
- *
16
- * @param familyId
17
- * @returns
18
- */
19
11
  static isSystemDBoot(familyId: string, isEfi: boolean): boolean;
20
- /**
21
- *
22
- * @param familyId
23
- * @returns deluser
24
- */
25
12
  static deluser(familyId: string): string;
26
- /**
27
- *
28
- * @param familyId
29
- * @returns
30
- */
31
13
  static grubName(familyId: string): string;
32
- /**
33
- * grubForce
34
- */
35
14
  static grubForce(familyId: string): string;
36
- /**
37
- *
38
- * @param familyId
39
- * @param volid
40
- * @returns
41
- */
42
15
  static kernelParameters(familyId: string, volid: string, fullCrypt?: boolean): string;
43
- /**
44
- *
45
- * @returns
46
- */
47
16
  static distro(): IDistro;
48
- /**
49
- * isManjaroBased
50
- */
51
17
  static isManjaroBased(distro: string): boolean;
52
18
  static bootloaders(familyId: string): string;
53
19
  }