penguins-eggs 10.0.60 → 10.1.1

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 (138) hide show
  1. package/.oclif.manifest.json +62 -1
  2. package/README.md +145 -75
  3. package/addons/eggs/theme/calamares/modules/{_users.yml → users.yml} +3 -3
  4. package/addons/eggs/theme/livecd/grub.main.full.cfg +1 -1
  5. package/addons/eggs/theme/livecd/grub.main.simple.cfg +1 -1
  6. package/conf/derivatives.yaml +4 -3
  7. package/conf/derivatives_fedora.yaml +6 -0
  8. package/conf/distros/alpine/calamares/modules/users.yml +3 -3
  9. package/conf/distros/bionic/calamares/calamares-modules/grubcfg/grubcfg.yml +1 -1
  10. package/conf/distros/bionic/calamares/modules/users.yml +3 -3
  11. package/conf/distros/buster/calamares/modules/users.yml +4 -3
  12. package/conf/distros/fedora/calamares/modules/users.yml +3 -3
  13. package/conf/distros/noble/calamares/modules/focal-jammy/users.yml +3 -3
  14. package/conf/distros/noble/calamares/modules/users.yml +1 -0
  15. package/conf/distros/opensuse/calamares/modules/users.yml +3 -3
  16. package/conf/distros/rolling/calamares/modules/users.yml +3 -3
  17. package/conf/eggs.yaml +1 -1
  18. package/conf/love.yaml +4 -4
  19. package/dist/classes/compressors.js +1 -1
  20. package/dist/classes/distro.d.ts +27 -3
  21. package/dist/classes/distro.js +361 -289
  22. package/dist/classes/ovary.d/bind-live-fs.js +22 -30
  23. package/dist/classes/ovary.d/edit-live-fs.d.ts +1 -0
  24. package/dist/classes/ovary.d/edit-live-fs.js +9 -13
  25. package/dist/classes/ovary.d/fertilization.js +6 -1
  26. package/dist/classes/ovary.d/initrd.js +11 -15
  27. package/dist/classes/ovary.d/kernel-copy.js +2 -16
  28. package/dist/classes/ovary.d/make-efi.js +8 -5
  29. package/dist/classes/ovary.d/make-squashfs.d.ts +1 -1
  30. package/dist/classes/ovary.d/make-squashfs.js +17 -24
  31. package/dist/classes/ovary.d/merged.d.ts +9 -13
  32. package/dist/classes/ovary.d/merged.js +38 -48
  33. package/dist/classes/ovary.d/produce.d.ts +1 -1
  34. package/dist/classes/ovary.d/produce.js +38 -32
  35. package/dist/classes/ovary.d/syslinux.js +4 -4
  36. package/dist/classes/ovary.d/user-create-live.js +12 -5
  37. package/dist/classes/ovary.d.ts +8 -3
  38. package/dist/classes/ovary.js +8 -3
  39. package/dist/classes/pacman.d/archlinux.js +1 -5
  40. package/dist/classes/pacman.js +2 -1
  41. package/dist/classes/systemctl.d.ts +1 -1
  42. package/dist/classes/systemctl.js +1 -1
  43. package/dist/classes/tailor.js +2 -1
  44. package/dist/classes/utils.d/architecture.d.ts +41 -0
  45. package/dist/classes/utils.d/architecture.js +87 -0
  46. package/dist/classes/utils.d/console-output.d.ts +26 -0
  47. package/dist/classes/utils.d/console-output.js +46 -0
  48. package/dist/classes/utils.d/filesystem.d.ts +53 -0
  49. package/dist/classes/utils.d/filesystem.js +152 -0
  50. package/dist/classes/utils.d/formatters.d.ts +32 -0
  51. package/dist/classes/utils.d/formatters.js +64 -0
  52. package/dist/classes/utils.d/kernel.d.ts +83 -0
  53. package/dist/classes/utils.d/kernel.js +288 -0
  54. package/dist/classes/utils.d/network.d.ts +43 -0
  55. package/dist/classes/utils.d/network.js +133 -0
  56. package/dist/classes/utils.d/package-info.d.ts +55 -0
  57. package/dist/classes/utils.d/package-info.js +137 -0
  58. package/dist/classes/utils.d/snapshot.d.ts +44 -0
  59. package/dist/classes/utils.d/snapshot.js +102 -0
  60. package/dist/classes/utils.d/system.d.ts +63 -0
  61. package/dist/classes/utils.d/system.js +200 -0
  62. package/dist/classes/utils.d/user-interaction.d.ts +39 -0
  63. package/dist/classes/utils.d/user-interaction.js +104 -0
  64. package/dist/classes/utils.d.ts +90 -322
  65. package/dist/classes/utils.js +105 -1013
  66. package/dist/commands/dad.d.ts +1 -0
  67. package/dist/commands/dad.js +1 -0
  68. package/dist/commands/export/pkg.js +6 -6
  69. package/dist/commands/export/tarballs.js +11 -16
  70. package/dist/commands/kill.js +1 -1
  71. package/dist/commands/love.d.ts +1 -0
  72. package/dist/commands/love.js +21 -7
  73. package/dist/commands/pods.d.ts +22 -0
  74. package/dist/commands/pods.js +92 -0
  75. package/dist/commands/produce.d.ts +1 -0
  76. package/dist/commands/produce.js +21 -1
  77. package/dist/commands/update.js +2 -2
  78. package/dist/index.d.ts +6 -52
  79. package/dist/index.js +6 -145
  80. package/dist/krill/classes/krill_enums.d.ts +14 -1
  81. package/dist/krill/classes/krill_enums.js +16 -1
  82. package/dist/krill/classes/prepare.d/partitions.js +3 -3
  83. package/dist/krill/classes/prepare.d.ts +46 -21
  84. package/dist/krill/classes/prepare.js +187 -187
  85. package/dist/krill/classes/sequence.d/add_user.js +21 -3
  86. package/dist/krill/classes/sequence.d/partition.js +2 -2
  87. package/dist/krill/classes/sequence.d.ts +18 -21
  88. package/dist/krill/classes/sequence.js +156 -423
  89. package/dist/krill/components/information.js +13 -7
  90. package/dist/{krill/lib → lib}/kill_me_softly.js +2 -2
  91. package/dist/penguins-eggs_10.1.1-0_amd64.deb +0 -0
  92. package/dist/penguins-eggs_10.1.1-0_amd64.deb.sha256 +1 -0
  93. package/package.json +32 -27
  94. package/perrisbrewery/scripts/postinst +98 -0
  95. package/perrisbrewery/scripts/postrm +82 -0
  96. package/perrisbrewery/scripts/preinst +40 -0
  97. package/perrisbrewery/scripts/prerm +47 -0
  98. package/perrisbrewery/template/control.template +17 -0
  99. package/perrisbrewery/template/dependencies-bionic.yaml +33 -0
  100. package/perrisbrewery/template/dependencies.yaml +37 -0
  101. package/perrisbrewery/template/man.template.md +110 -0
  102. package/pods/README.md +14 -0
  103. package/pods/almalinux.sh +10 -0
  104. package/pods/archlinux.sh +10 -0
  105. package/pods/ci/README.md +5 -0
  106. package/pods/ci/kernel-overlay-install.sh +114 -0
  107. package/pods/ci/minimal/almalinux-container2host.sh +165 -0
  108. package/pods/ci/minimal/archlinux-container2host.sh +125 -0
  109. package/pods/ci/minimal/debian-container2host.sh +173 -0
  110. package/pods/ci/minimal/fedora-container2host.sh +170 -0
  111. package/pods/ci/minimal/manjaro-container2host.sh +123 -0
  112. package/pods/ci/minimal/opensuse-container2host.sh +143 -0
  113. package/pods/ci/penguins-eggs-execute.sh +22 -0
  114. package/pods/ci/penguins-eggs-install.sh +115 -0
  115. package/pods/ci/run +34 -0
  116. package/pods/ci/run-on-almalinux.sh +50 -0
  117. package/pods/ci/run-on-archlinux.sh +64 -0
  118. package/pods/ci/run-on-debian.sh +51 -0
  119. package/pods/ci/run-on-devuan.sh +48 -0
  120. package/pods/ci/run-on-fedora.sh +51 -0
  121. package/pods/ci/run-on-manjaro.sh +61 -0
  122. package/pods/ci/run-on-opensuse.sh +58 -0
  123. package/pods/ci/run-on-rockylinux.sh +51 -0
  124. package/pods/ci/run-on-ubuntu.sh +52 -0
  125. package/pods/debian.sh +23 -0
  126. package/pods/devuan.sh +26 -0
  127. package/pods/fedora.sh +12 -0
  128. package/pods/lmde.sh +22 -0
  129. package/pods/manjaro.sh +10 -0
  130. package/pods/opensuse.sh +12 -0
  131. package/pods/podman.command.sh +85 -0
  132. package/pods/rocky.sh +12 -0
  133. package/pods/run-build-packages-debs.sh +45 -0
  134. package/pods/run-create-debs.sh +23 -0
  135. package/pods/ubuntu.sh +24 -0
  136. package/scripts/_eggs +14 -5
  137. package/scripts/eggs.bash +5 -4
  138. /package/dist/{krill/lib → lib}/kill_me_softly.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * penguins-eggs
2
+ * penguins-eggs - Refactored distros.ts
3
3
  * class: distro.ts
4
4
  * author: Piero Proietti
5
5
  * email: piero.proietti@gmail.com
@@ -14,7 +14,265 @@ import Diversions from './diversions.js';
14
14
  // _dirname
15
15
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
16
16
  /**
17
- * Classe
17
+ * Default configurations for each family
18
+ */
19
+ const FAMILY_CONFIGS = {
20
+ debian: {
21
+ familyId: 'debian',
22
+ distroLike: 'Debian',
23
+ codenameId: '',
24
+ codenameLikeId: '',
25
+ liveMediumPath: '/run/live/medium/',
26
+ isCalamaresAvailable: true
27
+ },
28
+ archlinux: {
29
+ familyId: 'archlinux',
30
+ distroLike: 'Arch',
31
+ codenameId: 'rolling',
32
+ codenameLikeId: 'rolling',
33
+ liveMediumPath: '/run/archiso/bootmnt/',
34
+ squashfs: 'arch/x86_64/airootfs.sfs'
35
+ },
36
+ fedora: {
37
+ familyId: 'fedora',
38
+ distroLike: 'Fedora',
39
+ codenameId: 'rolling',
40
+ codenameLikeId: 'fedora',
41
+ liveMediumPath: '/run/initramfs/live/'
42
+ },
43
+ alpine: {
44
+ familyId: 'alpine',
45
+ distroLike: 'Alpine',
46
+ codenameId: 'rolling',
47
+ codenameLikeId: 'alpine',
48
+ liveMediumPath: '/mnt/'
49
+ },
50
+ opensuse: {
51
+ familyId: 'opensuse',
52
+ distroLike: 'Opensuse',
53
+ codenameId: 'rolling',
54
+ codenameLikeId: 'opensuse',
55
+ liveMediumPath: '/run/initramfs/live/',
56
+ usrLibPath: '/usr/lib64/'
57
+ },
58
+ openmamba: {
59
+ familyId: 'openmamba',
60
+ distroLike: 'openmamba',
61
+ codenameId: 'rolling',
62
+ codenameLikeId: 'openmamba',
63
+ liveMediumPath: '/run/initramfs/live/'
64
+ },
65
+ aldus: {
66
+ familyId: 'aldus',
67
+ distroLike: 'Aldus',
68
+ codenameId: 'rolling',
69
+ codenameLikeId: 'aldus',
70
+ liveMediumPath: '/run/initramfs/live/'
71
+ },
72
+ voidlinux: {
73
+ familyId: 'voidlinux',
74
+ distroLike: 'Voidlinux',
75
+ codenameId: 'rolling',
76
+ codenameLikeId: 'voidlinux',
77
+ liveMediumPath: '/run/initramfs/live/'
78
+ }
79
+ };
80
+ /**
81
+ * Special codename configurations
82
+ */
83
+ const CODENAME_CONFIGS = {
84
+ // Debian versions
85
+ jessie: { distroLike: 'Debian', codenameLikeId: 'jessie', liveMediumPath: '/lib/live/mount/medium/', isCalamaresAvailable: false },
86
+ stretch: { distroLike: 'Debian', codenameLikeId: 'stretch', liveMediumPath: '/lib/live/mount/medium/', isCalamaresAvailable: false },
87
+ buster: { distroLike: 'Debian', codenameLikeId: 'buster' },
88
+ bullseye: { distroLike: 'Debian', codenameLikeId: 'bullseye' },
89
+ bookworm: { distroLike: 'Debian', codenameLikeId: 'bookworm' },
90
+ trixie: { distroLike: 'Debian', codenameLikeId: 'trixie' },
91
+ // Devuan versions
92
+ beowulf: { distroLike: 'Devuan', codenameLikeId: 'beowulf' },
93
+ chimaera: { distroLike: 'Devuan', codenameLikeId: 'chimaera' },
94
+ daedalus: { distroLike: 'Devuan', codenameLikeId: 'daedalus' },
95
+ excalibur: { distroLike: 'Devuan', codenameLikeId: 'excalibur' },
96
+ // Ubuntu versions
97
+ bionic: { distroLike: 'Ubuntu', codenameLikeId: 'bionic', liveMediumPath: '/lib/live/mount/medium/' },
98
+ focal: { distroLike: 'Ubuntu', codenameLikeId: 'focal' },
99
+ jammy: { distroLike: 'Ubuntu', codenameLikeId: 'jammy' },
100
+ noble: { distroLike: 'Ubuntu', codenameLikeId: 'noble' },
101
+ devel: { distroLike: 'Ubuntu', codenameLikeId: 'devel' }
102
+ };
103
+ /**
104
+ * Distribution family detector
105
+ */
106
+ class DistroDetector {
107
+ static detectByDistroId(distroId) {
108
+ const fedoraDistros = ['Almalinux', 'Fedora', 'Nobara', 'Rocky'];
109
+ if (distroId === 'Alpine')
110
+ return 'alpine';
111
+ if (fedoraDistros.includes(distroId))
112
+ return 'fedora';
113
+ if (distroId === 'Openmamba')
114
+ return 'openmamba';
115
+ if (distroId.includes('Opensuse'))
116
+ return 'opensuse';
117
+ if (distroId === 'Voidlinux')
118
+ return 'voidlinux';
119
+ if (distroId === 'Aldus')
120
+ return 'aldus';
121
+ return null;
122
+ }
123
+ static detectByCodename(codenameId) {
124
+ if (codenameId === 'rolling' || codenameId === 'n/a')
125
+ return 'archlinux';
126
+ if (CODENAME_CONFIGS[codenameId])
127
+ return 'debian'; // All debian-family codenames
128
+ return null;
129
+ }
130
+ static detectFromDerivatives(distroId, codenameId) {
131
+ // Check debian/arch derivatives
132
+ const derivativesPath = this.getDerivativesPath('derivatives.yaml');
133
+ if (fs.existsSync(derivativesPath)) {
134
+ const result = this.searchInDerivatives(derivativesPath, codenameId);
135
+ if (result)
136
+ return result;
137
+ }
138
+ // Check fedora derivatives
139
+ const fedoraDerivativesPath = this.getDerivativesPath('derivatives_fedora.yaml');
140
+ if (fs.existsSync(fedoraDerivativesPath)) {
141
+ const result = this.searchInFedoraDerivatives(fedoraDerivativesPath, distroId);
142
+ if (result)
143
+ return result;
144
+ }
145
+ return null;
146
+ }
147
+ static getDerivativesPath(filename) {
148
+ const userPath = `/etc/penguins-eggs.d/${filename}`;
149
+ const defaultPath = path.resolve(__dirname, `../../conf/${filename}`);
150
+ return fs.existsSync(userPath) ? userPath : defaultPath;
151
+ }
152
+ static searchInDerivatives(filePath, codenameId) {
153
+ try {
154
+ const content = fs.readFileSync(filePath, 'utf8');
155
+ const distros = yaml.load(content);
156
+ for (const distro of distros) {
157
+ if (distro.ids?.includes(codenameId)) {
158
+ return {
159
+ familyId: distro.family,
160
+ config: {
161
+ distroLike: distro.distroLike,
162
+ codenameLikeId: distro.id,
163
+ familyId: distro.family
164
+ }
165
+ };
166
+ }
167
+ }
168
+ }
169
+ catch (error) {
170
+ console.warn(`Warning: Could not read derivatives file ${filePath}:`, error);
171
+ }
172
+ return null;
173
+ }
174
+ static searchInFedoraDerivatives(filePath, distroId) {
175
+ try {
176
+ const content = fs.readFileSync(filePath, 'utf8');
177
+ const distros = yaml.load(content);
178
+ if (distros.includes(distroId)) {
179
+ return {
180
+ familyId: 'fedora',
181
+ config: {
182
+ familyId: 'fedora',
183
+ distroLike: 'Fedora',
184
+ codenameId: 'rolling',
185
+ codenameLikeId: 'fedora',
186
+ liveMediumPath: '/run/initramfs/live/'
187
+ }
188
+ };
189
+ }
190
+ }
191
+ catch (error) {
192
+ console.warn(`Warning: Could not read fedora derivatives file ${filePath}:`, error);
193
+ }
194
+ return null;
195
+ }
196
+ }
197
+ /**
198
+ * OS Release parser
199
+ */
200
+ class OsReleaseParser {
201
+ static parseUrls() {
202
+ const defaultUrls = {
203
+ homeUrl: 'https://penguins-eggs.net',
204
+ supportUrl: 'https://penguins-eggs.net',
205
+ bugReportUrl: 'https://github.com/pieroproietti/penguins-eggs/issues'
206
+ };
207
+ const osReleasePath = '/etc/os-release';
208
+ if (!fs.existsSync(osReleasePath)) {
209
+ return defaultUrls;
210
+ }
211
+ try {
212
+ const data = fs.readFileSync(osReleasePath, 'utf8');
213
+ const lines = data.split('\n');
214
+ const result = { ...defaultUrls };
215
+ for (const line of lines) {
216
+ if (line.startsWith('HOME_URL=')) {
217
+ result.homeUrl = line.slice('HOME_URL='.length).replaceAll('"', '');
218
+ }
219
+ else if (line.startsWith('SUPPORT_URL=')) {
220
+ result.supportUrl = line.slice('SUPPORT_URL='.length).replaceAll('"', '');
221
+ }
222
+ else if (line.startsWith('BUG_REPORT_URL=')) {
223
+ result.bugReportUrl = line.slice('BUG_REPORT_URL='.length).replaceAll('"', '');
224
+ }
225
+ }
226
+ return result;
227
+ }
228
+ catch (error) {
229
+ console.warn('Warning: Could not parse /etc/os-release:', error);
230
+ return defaultUrls;
231
+ }
232
+ }
233
+ }
234
+ /**
235
+ * Distribution configurator
236
+ */
237
+ class DistroConfigurator {
238
+ static applySpecialConfigurations(config) {
239
+ // Apply family-specific configurations
240
+ this.applyFamilySpecificConfig(config);
241
+ // Apply distro-specific configurations
242
+ this.applyDistroSpecificConfig(config);
243
+ }
244
+ static applyFamilySpecificConfig(config) {
245
+ // Debian family: dynamic usrLibPath
246
+ if (config.familyId === 'debian') {
247
+ config.usrLibPath = '/usr/lib/' + Utils.usrLibPath();
248
+ }
249
+ // OpenSUSE: specific usrLibPath
250
+ if (config.familyId === 'opensuse') {
251
+ config.usrLibPath = '/usr/lib64/';
252
+ }
253
+ }
254
+ static applyDistroSpecificConfig(config) {
255
+ // Manjaro-based distributions
256
+ if (Diversions.isManjaroBased(config.distroId)) {
257
+ config.liveMediumPath = '/run/miso/bootmnt/';
258
+ config.squashfs = 'manjaro/x86_64/livefs.sfs';
259
+ config.codenameId = shell.exec('lsb_release -cs', { silent: true }).stdout.toString().trim();
260
+ }
261
+ // BigLinux variants
262
+ if (config.distroId.includes('Biglinux')) {
263
+ config.distroId = 'Biglinux';
264
+ }
265
+ if (config.distroId.includes('Bigcommunity')) {
266
+ config.distroId = 'Bigcommunity';
267
+ }
268
+ // Debian sid → trixie
269
+ if (config.distroId === 'Debian' && config.codenameId === 'sid') {
270
+ config.codenameId = 'trixie';
271
+ }
272
+ }
273
+ }
274
+ /**
275
+ * Main Distro class - Refactored
18
276
  */
19
277
  class Distro {
20
278
  bugReportUrl;
@@ -32,310 +290,124 @@ class Distro {
32
290
  syslinuxPath;
33
291
  usrLibPath;
34
292
  /**
35
- * Costruttore
293
+ * Constructor - Now much cleaner and focused
36
294
  */
37
295
  constructor() {
38
- let found = false;
39
- // Tutti i default sono per Debian
40
- this.bugReportUrl = 'https://github.com-pieroproietti/penguins-eggs/issue';
41
- this.codenameId = '';
42
- this.codenameLikeId = '';
43
- this.distroId = '';
44
- this.distroLike = '';
45
- this.familyId = 'debian';
46
- this.homeUrl = 'https://penguins-eggs.net';
47
- this.isCalamaresAvailable = true;
48
- this.liveMediumPath = '/run/live/medium/';
49
- this.releaseId = '';
50
- this.squashfs = 'live/filesystem.squashfs';
51
- this.supportUrl = 'https://penguins-eggs.net';
52
- this.syslinuxPath = path.resolve(__dirname, `../../syslinux`);
53
- this.usrLibPath = '/usr/lib';
54
- /**
55
- * getOsRelease
56
- */
296
+ // Initialize with defaults
297
+ this.initializeDefaults();
298
+ // Get OS information
57
299
  const osInfo = Utils.getOsRelease();
58
300
  this.distroId = osInfo.ID;
59
301
  this.codenameId = osInfo.VERSION_CODENAME;
60
302
  this.releaseId = osInfo.VERSION_ID;
61
- if (this.distroId === 'Debian' && this.codenameId === 'sid') {
62
- this.codenameId = 'trixie';
63
- }
64
- if (this.distroId.includes('Biglinux')) {
65
- this.distroId = "Biglinux";
66
- }
67
- if (this.distroId.includes('Bigcommunity')) {
68
- this.distroId = "Bigcommunity";
69
- }
70
- /**
71
- * Alpine, Fedora, openmamba, opensuse, VoidLinux solo distroId.
72
- *
73
- * Debian, Devuan, Ubuntu e derivate ricadono in
74
- * default e si analizza il codebaseId
75
- *
76
- */
77
- if (this.distroId === 'Aldos') {
78
- this.familyId = 'aldos';
79
- this.distroLike = 'Aldos';
80
- this.codenameId = 'rolling'; // viene rimosso dal nome
81
- this.codenameLikeId = this.familyId; // per krill
82
- this.liveMediumPath = '/run/initramfs/live/';
83
- /**
84
- * Alpine compatible
85
- */
86
- }
87
- else if (this.distroId === 'Alpine') {
88
- this.familyId = 'alpine';
89
- this.distroLike = this.distroId;
90
- this.codenameId = 'rolling'; // viene rimosso dal nome
91
- this.codenameLikeId = this.familyId; // per krill
92
- this.liveMediumPath = '/mnt/'; // Qua è deciso da noi
93
- /**
94
- * Fedora/RHEL compatible
95
- */
96
- }
97
- else if (this.distroId === 'Almalinux' ||
98
- this.distroId === 'Fedora' ||
99
- this.distroId === 'Nobara' ||
100
- this.distroId === 'Rocky') {
101
- this.familyId = 'fedora';
102
- this.distroLike = 'Fedora';
103
- this.codenameId = 'rolling'; // viene rimosso dal nome
104
- this.codenameLikeId = this.familyId; // per krill
105
- this.liveMediumPath = '/run/initramfs/live/';
106
- /**
107
- * openmamba
108
- */
109
- }
110
- else if (this.distroId === 'Openmamba') {
111
- this.familyId = 'openmamba';
112
- this.distroLike = 'openmamba';
113
- this.codenameId = 'rolling'; // viene rimosso dal nome
114
- this.codenameLikeId = this.familyId; // per krill
115
- this.liveMediumPath = '/run/initramfs/live/';
116
- /**
117
- * opensuse compatible
118
- */
119
- }
120
- else if (this.distroId.includes('Opensuse')) {
121
- this.familyId = 'opensuse';
122
- this.distroLike = this.distroId;
123
- this.codenameId = 'rolling'; // sistemare non
124
- this.codenameLikeId = this.familyId; // per krill
125
- this.liveMediumPath = '/run/initramfs/live/'; // check
126
- /**
127
- * voidlinux compatible
128
- */
129
- }
130
- else if (this.distroId === 'Voidlinux') {
131
- this.familyId = 'voidlinux';
132
- this.distroLike = this.distroId;
133
- this.codenameId = 'rolling';
134
- this.codenameLikeId = this.familyId; // per krill
135
- this.liveMediumPath = '/run/initramfs/live/'; // we must discover
136
- }
137
- else {
138
- /**
139
- * We must analize codenameId
140
- */
141
- /**
142
- * Arch
143
- */
144
- if (this.codenameId === 'rolling' || this.codenameId === 'n/a') {
145
- this.familyId = 'archlinux';
146
- this.distroLike = 'Arch';
147
- this.codenameId = 'rolling';
148
- this.codenameLikeId = 'rolling';
149
- this.liveMediumPath = '/run/archiso/bootmnt/';
150
- this.squashfs = `arch/x86_64/airootfs.sfs`;
151
- /**
152
- * Debian jessie
153
- */
154
- }
155
- else if (this.codenameId === 'jessie') {
156
- this.distroLike = 'Debian';
157
- this.codenameLikeId = 'jessie';
158
- this.liveMediumPath = '/lib/live/mount/medium/';
159
- this.isCalamaresAvailable = false;
160
- /**
161
- * Debian stretch
162
- */
163
- }
164
- else if (this.codenameId === 'stretch') {
165
- this.distroLike = 'Debian';
166
- this.codenameLikeId = 'stretch';
167
- this.liveMediumPath = '/lib/live/mount/medium/';
168
- this.isCalamaresAvailable = false;
169
- /**
170
- * Debian buster
171
- */
172
- }
173
- else if (this.codenameId === 'buster') {
174
- this.distroLike = 'Debian';
175
- this.codenameLikeId = 'buster';
176
- /**
177
- * Debian bullseye
178
- */
179
- }
180
- else if (this.codenameId === 'bullseye') {
181
- this.distroLike = 'Debian';
182
- this.codenameLikeId = 'bullseye';
183
- /**
184
- * Debian bookworm
185
- */
186
- }
187
- else if (this.codenameId === 'bookworm') {
188
- this.distroLike = 'Debian';
189
- this.codenameLikeId = 'bookworm';
190
- /**
191
- * Debian trixie
192
- */
193
- }
194
- else if (this.codenameId === 'trixie') {
195
- this.distroLike = 'Debian';
196
- this.codenameLikeId = 'trixie';
197
- /**
198
- * Devuan beowulf
199
- */
200
- }
201
- else if (this.codenameId === 'beowulf') {
202
- this.distroLike = 'Devuan';
203
- this.codenameLikeId = 'beowulf';
204
- /**
205
- * Devuan chimaera
206
- */
207
- }
208
- else if (this.codenameId === 'chimaera') {
209
- this.distroLike = 'Devuan';
210
- this.codenameLikeId = 'chimaera';
211
- /**
212
- * Devuan daedalus
213
- */
214
- }
215
- else if (this.codenameId === 'daedalus') {
216
- this.distroLike = 'Devuan';
217
- this.codenameLikeId = 'daedalus';
218
- /**
219
- * Devuan excalibur
220
- */
221
- }
222
- else if (this.codenameId === 'excalibur') {
223
- this.distroLike = 'Devuan';
224
- this.codenameLikeId = 'excalibur';
225
- /**
226
- * Ubuntu bionic
227
- */
228
- }
229
- else if (this.codenameId === 'bionic') {
230
- this.distroLike = 'Ubuntu';
231
- this.codenameLikeId = 'bionic';
232
- this.liveMediumPath = '/lib/live/mount/medium/';
233
- /**
234
- * Ubuntu focal
235
- */
236
- }
237
- else if (this.codenameId === 'focal') {
238
- this.distroLike = 'Ubuntu';
239
- this.codenameLikeId = 'focal';
240
- /**
241
- * Ubuntu jammy
242
- */
243
- }
244
- else if (this.codenameId === 'jammy') {
245
- this.distroLike = 'Ubuntu';
246
- this.codenameLikeId = 'jammy';
247
- /**
248
- * Ubuntu noble
249
- */
250
- }
251
- else if (this.codenameId === 'noble') {
252
- this.distroLike = 'Ubuntu';
253
- this.codenameLikeId = 'noble';
254
- /**
255
- * Ubuntu devel
256
- */
303
+ // Configure the distribution
304
+ this.configure();
305
+ }
306
+ /**
307
+ * Initialize with default values
308
+ */
309
+ initializeDefaults() {
310
+ const defaultConfig = FAMILY_CONFIGS.debian;
311
+ const urls = OsReleaseParser.parseUrls();
312
+ Object.assign(this, defaultConfig, urls, {
313
+ squashfs: 'live/filesystem.squashfs',
314
+ syslinuxPath: path.resolve(__dirname, '../../syslinux'),
315
+ usrLibPath: '/usr/lib',
316
+ isCalamaresAvailable: true
317
+ });
318
+ }
319
+ /**
320
+ * Main configuration logic
321
+ */
322
+ configure() {
323
+ try {
324
+ // Step 1: Detect family by distro ID
325
+ let familyId = DistroDetector.detectByDistroId(this.distroId);
326
+ // Step 2: If not found, detect by codename
327
+ if (!familyId) {
328
+ familyId = DistroDetector.detectByCodename(this.codenameId);
257
329
  }
258
- else if (this.codenameId === 'devel') {
259
- this.distroLike = 'Ubuntu';
260
- this.codenameLikeId = 'devel';
330
+ // Step 3: Apply family configuration
331
+ if (familyId && FAMILY_CONFIGS[familyId]) {
332
+ this.applyFamilyConfig(familyId);
261
333
  }
262
334
  else {
263
- /**
264
- * patch per Roy VERIFICARE
265
- */
266
- let file = path.resolve(__dirname, '../../conf/derivatives.yaml');
267
- if (fs.existsSync('/etc/penguins-eggs.d/derivatives.yaml')) {
268
- file = '/etc/penguins-eggs.d/derivatives.yaml';
335
+ // Step 4: Check derivatives
336
+ const derivativeResult = DistroDetector.detectFromDerivatives(this.distroId, this.codenameId);
337
+ if (derivativeResult) {
338
+ this.applyCustomConfig(derivativeResult.familyId, derivativeResult.config);
269
339
  }
270
- const content = fs.readFileSync(file, 'utf8');
271
- const distros = yaml.load(content);
272
- for (const distro of distros) {
273
- if (distro.ids !== undefined) {
274
- for (let n = 0; n < distro.ids.length; n++) {
275
- if (this.codenameId === distro.ids[n]) {
276
- found = true;
277
- this.distroLike = distro.distroLike;
278
- this.codenameLikeId = distro.id;
279
- this.familyId = distro.family;
280
- }
281
- }
282
- }
283
- }
284
- if (!found) {
285
- console.log(`This distro ${this.distroId}/${this.codenameId} is not yet recognized!`);
286
- console.log('');
287
- console.log('You can edit /usr/lib/penguins-eggs/conf/derivatives.yaml to add it -');
288
- console.log('after that - run: sudo eggs dad -d to re-configure eggs.');
289
- console.log('If you can create your new iso, you can contribute to the project');
290
- console.log('by suggesting your modification.');
291
- process.exit(0);
340
+ else {
341
+ this.handleUnknownDistro();
342
+ return;
292
343
  }
293
344
  }
345
+ // Step 5: Apply codename-specific configurations
346
+ this.applyCodenameConfig();
347
+ // Step 6: Apply special configurations
348
+ DistroConfigurator.applySpecialConfigurations(this);
294
349
  }
295
- /**
296
- * Ultimi ritocchi
297
- */
298
- /**
299
- * Debian: /usr/lib/x86_64-linux-gnu
300
- * /usr/lib/aarch64-linux-gnu
301
- */
302
- if (this.familyId === "debian") {
303
- this.usrLibPath = '/usr/lib/' + Utils.usrLibPath();
304
- }
305
- else if (this.familyId === "opensuse") {
306
- this.usrLibPath = '/usr/lib64/';
350
+ catch (error) {
351
+ console.error('Error during distro configuration:', error);
352
+ this.handleUnknownDistro();
307
353
  }
308
- /**
309
- * Manjarolinux e derivate
310
- */
311
- if (Diversions.isManjaroBased(this.distroId)) {
312
- this.liveMediumPath = '/run/miso/bootmnt/';
313
- this.squashfs = 'manjaro/x86_64/livefs.sfs';
314
- this.codenameId = shell.exec(`lsb_release -cs`, { silent: true }).stdout.toString().trim();
354
+ }
355
+ /**
356
+ * Apply family-based configuration
357
+ */
358
+ applyFamilyConfig(familyId) {
359
+ const config = FAMILY_CONFIGS[familyId];
360
+ this.familyId = config.familyId;
361
+ this.distroLike = config.distroLike;
362
+ if (config.codenameId)
363
+ this.codenameId = config.codenameId;
364
+ if (config.codenameLikeId)
365
+ this.codenameLikeId = config.codenameLikeId;
366
+ if (config.liveMediumPath)
367
+ this.liveMediumPath = config.liveMediumPath;
368
+ if (config.squashfs)
369
+ this.squashfs = config.squashfs;
370
+ if (config.usrLibPath)
371
+ this.usrLibPath = config.usrLibPath;
372
+ if (config.isCalamaresAvailable !== undefined)
373
+ this.isCalamaresAvailable = config.isCalamaresAvailable;
374
+ }
375
+ /**
376
+ * Apply custom configuration from derivatives
377
+ */
378
+ applyCustomConfig(familyId, config) {
379
+ this.familyId = familyId;
380
+ // Apply base family config first
381
+ if (FAMILY_CONFIGS[familyId]) {
382
+ this.applyFamilyConfig(familyId);
315
383
  }
316
- /**
317
- * lettura os_release per i pulsanti
318
- */
319
- const os_release = '/etc/os-release';
320
- if (fs.existsSync(os_release)) {
321
- let lines = [];
322
- if (fs.existsSync(os_release)) {
323
- const data = fs.readFileSync(os_release, 'utf8');
324
- lines = data.split('\n');
325
- }
326
- // per ogni riga
327
- for (const line of lines) {
328
- if (line.startsWith('HOME_URL=')) {
329
- this.homeUrl = line.slice('HOME_URL='.length).replaceAll('"', '');
330
- }
331
- else if (line.startsWith('SUPPORT_URL=')) {
332
- this.supportUrl = line.slice('SUPPORT_URL='.length).replaceAll('"', '');
333
- }
334
- else if (line.startsWith('BUG_REPORT_URL=')) {
335
- this.bugReportUrl = line.slice('BUG_REPORT_URL='.length).replaceAll('"', '');
336
- }
384
+ // Then override with custom config
385
+ Object.assign(this, config);
386
+ }
387
+ /**
388
+ * Apply codename-specific configurations
389
+ */
390
+ applyCodenameConfig() {
391
+ const codenameConfig = CODENAME_CONFIGS[this.codenameId];
392
+ if (codenameConfig) {
393
+ Object.assign(this, codenameConfig);
394
+ // Set familyId to debian for debian-family codenames
395
+ if (!this.familyId || this.familyId === 'debian') {
396
+ this.familyId = 'debian';
337
397
  }
338
398
  }
339
399
  }
400
+ /**
401
+ * Handle unknown distribution
402
+ */
403
+ handleUnknownDistro() {
404
+ console.log(`This distro ${this.distroId}/${this.codenameId} is not yet recognized!`);
405
+ console.log('');
406
+ console.log('You can edit /usr/lib/penguins-eggs/conf/derivatives.yaml to add it -');
407
+ console.log('after that - run: sudo eggs dad -d to re-configure eggs.');
408
+ console.log('If you can create your new iso, you can contribute to the project');
409
+ console.log('by suggesting your modification.');
410
+ process.exit(0);
411
+ }
340
412
  }
341
413
  export default Distro;