penguins-eggs 10.0.45 → 10.0.48

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 (96) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/README.md +27 -27
  3. package/conf/distros/alpine/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +13 -0
  4. package/conf/distros/alpine/calamares/calamares-modules/dpkg-unsafe-io/module.yml +6 -0
  5. package/conf/distros/alpine/calamares/calamares-modules/dpkg-unsafe-io-undo/module.yml +6 -0
  6. package/conf/distros/alpine/calamares/calamares-modules/sources-yolk/module.yml +8 -0
  7. package/conf/distros/alpine/calamares/calamares-modules/sources-yolk/sources-yolk.sh +50 -0
  8. package/conf/distros/alpine/calamares/calamares-modules/sources-yolk-undo/module.yml +8 -0
  9. package/conf/distros/alpine/calamares/modules/bootloader.yml +1 -1
  10. package/conf/distros/alpine/calamares/modules/displaymanager.yml +2 -3
  11. package/conf/distros/alpine/calamares/modules/finished.yml +2 -2
  12. package/conf/distros/alpine/calamares/modules/fstab.yml +1 -1
  13. package/conf/distros/alpine/calamares/modules/locale.yml +0 -1
  14. package/conf/distros/alpine/calamares/modules/luksopenswaphookcfg.yml +1 -1
  15. package/conf/distros/alpine/calamares/modules/machineid.yml +1 -1
  16. package/conf/distros/alpine/calamares/modules/mount.yml +1 -1
  17. package/conf/distros/alpine/calamares/modules/packages.yml +2 -2
  18. package/conf/distros/alpine/calamares/modules/partition.yml +1 -1
  19. package/conf/distros/alpine/calamares/modules/removeuser.yml +2 -2
  20. package/conf/distros/alpine/calamares/modules/unpackfs.yml +1 -1
  21. package/conf/distros/alpine/calamares/modules/users.yml +1 -0
  22. package/conf/distros/alpine/calamares/modules/welcome.yml +1 -1
  23. package/conf/distros/alpine/calamares/settings.yml +81 -8
  24. package/conf/distros/buster/calamares/modules/displaymanager.yml +1 -2
  25. package/conf/distros/buster/calamares/modules/finished.yml +1 -2
  26. package/conf/distros/buster/calamares/modules/removeuser.yml +1 -1
  27. package/conf/distros/fedora/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +13 -0
  28. package/conf/distros/fedora/calamares/calamares-modules/dpkg-unsafe-io/module.yml +6 -0
  29. package/conf/distros/fedora/calamares/calamares-modules/dpkg-unsafe-io-undo/module.yml +6 -0
  30. package/conf/distros/fedora/calamares/calamares-modules/sources-yolk/module.yml +8 -0
  31. package/conf/distros/fedora/calamares/calamares-modules/sources-yolk/sources-yolk.sh +50 -0
  32. package/conf/distros/fedora/calamares/calamares-modules/sources-yolk-undo/module.yml +8 -0
  33. package/conf/distros/fedora/calamares/modules/bootloader.yml +1 -1
  34. package/conf/distros/fedora/calamares/modules/displaymanager.yml +2 -3
  35. package/conf/distros/fedora/calamares/modules/finished.yml +2 -2
  36. package/conf/distros/fedora/calamares/modules/fstab.yml +1 -1
  37. package/conf/distros/fedora/calamares/modules/locale.yml +0 -1
  38. package/conf/distros/fedora/calamares/modules/luksopenswaphookcfg.yml +1 -1
  39. package/conf/distros/fedora/calamares/modules/machineid.yml +1 -1
  40. package/conf/distros/fedora/calamares/modules/mount.yml +1 -1
  41. package/conf/distros/fedora/calamares/modules/packages.yml +2 -2
  42. package/conf/distros/fedora/calamares/modules/partition.yml +1 -1
  43. package/conf/distros/fedora/calamares/modules/removeuser.yml +2 -2
  44. package/conf/distros/fedora/calamares/modules/unpackfs.yml +1 -1
  45. package/conf/distros/fedora/calamares/modules/users.yml +1 -0
  46. package/conf/distros/fedora/calamares/modules/welcome.yml +1 -1
  47. package/conf/distros/fedora/calamares/settings.yml +81 -8
  48. package/conf/distros/opensuse/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +13 -0
  49. package/conf/distros/opensuse/calamares/calamares-modules/dpkg-unsafe-io/module.yml +6 -0
  50. package/conf/distros/opensuse/calamares/calamares-modules/dpkg-unsafe-io-undo/module.yml +6 -0
  51. package/conf/distros/opensuse/calamares/calamares-modules/sources-yolk/module.yml +8 -0
  52. package/conf/distros/opensuse/calamares/calamares-modules/sources-yolk/sources-yolk.sh +50 -0
  53. package/conf/distros/opensuse/calamares/calamares-modules/sources-yolk-undo/module.yml +8 -0
  54. package/conf/distros/opensuse/calamares/modules/bootloader.yml +1 -1
  55. package/conf/distros/opensuse/calamares/modules/displaymanager.yml +2 -3
  56. package/conf/distros/opensuse/calamares/modules/finished.yml +2 -2
  57. package/conf/distros/opensuse/calamares/modules/fstab.yml +1 -1
  58. package/conf/distros/opensuse/calamares/modules/locale.yml +0 -1
  59. package/conf/distros/opensuse/calamares/modules/luksopenswaphookcfg.yml +1 -1
  60. package/conf/distros/opensuse/calamares/modules/machineid.yml +1 -1
  61. package/conf/distros/opensuse/calamares/modules/mount.yml +1 -1
  62. package/conf/distros/opensuse/calamares/modules/packages.yml +2 -2
  63. package/conf/distros/opensuse/calamares/modules/partition.yml +1 -1
  64. package/conf/distros/opensuse/calamares/modules/removeuser.yml +2 -2
  65. package/conf/distros/opensuse/calamares/modules/unpackfs.yml +1 -1
  66. package/conf/distros/opensuse/calamares/modules/users.yml +1 -0
  67. package/conf/distros/opensuse/calamares/modules/welcome.yml +1 -1
  68. package/conf/distros/opensuse/calamares/settings.yml +81 -8
  69. package/conf/distros/rolling/calamares/modules/displaymanager.yml +1 -2
  70. package/conf/distros/rolling/calamares/modules/finished.yml +1 -1
  71. package/conf/distros/rolling/calamares/modules/shellprocess_removelink.yml +1 -1
  72. package/dist/classes/families/archlinux.js +2 -1
  73. package/dist/classes/incubation/fisherman-helper/displaymanager.d.ts +1 -1
  74. package/dist/classes/incubation/fisherman-helper/displaymanager.js +27 -26
  75. package/dist/classes/incubation/fisherman-helper/settings.js +1 -1
  76. package/dist/classes/incubation/fisherman.d.ts +19 -26
  77. package/dist/classes/incubation/fisherman.js +102 -57
  78. package/dist/classes/incubation/incubator.d.ts +4 -0
  79. package/dist/classes/incubation/incubator.js +37 -3
  80. package/dist/classes/ovary.js +39 -22
  81. package/dist/classes/settings.js +2 -2
  82. package/dist/commands/calamares.js +5 -3
  83. package/dist/commands/export/pkg.js +4 -4
  84. package/dist/interfaces/i-calamares-displaymanager.d.ts +17 -0
  85. package/dist/interfaces/i-calamares-displaymanager.js +1 -0
  86. package/dist/interfaces/i-calamares-finished.d.ts +12 -0
  87. package/dist/interfaces/i-calamares-finished.js +1 -0
  88. package/dist/interfaces/i-calamares-packages.d.ts +28 -0
  89. package/dist/interfaces/i-calamares-packages.js +1 -0
  90. package/dist/interfaces/i-calamares-partition.d.ts +28 -6
  91. package/dist/interfaces/i-calamares-partition.js +0 -7
  92. package/manpages/doc/man/eggs.1.gz +0 -0
  93. package/manpages/doc/man/eggs.html +4 -4
  94. package/package.json +7 -7
  95. package/dist/classes/n8.d.ts +0 -18
  96. package/dist/classes/n8.js +0 -36
@@ -4,8 +4,7 @@
4
4
  #The DM module attempts to set up all the DMs found in this list, in that precise order.
5
5
  #It also sets up autologin, if the feature is enabled in globalstorage.
6
6
  #The displaymanagers list can also be set in globalstorage, and in that case it overrides anything set up here.
7
- displaymanagers:
8
- {{displaymanagers}}
7
+ displaymanagers: none
9
8
 
10
9
  #Enable the following settings to force a desktop environment in your displaymanager configuration file:
11
10
  #defaultDesktopEnvironment:
@@ -37,7 +37,7 @@ restartNowChecked: true
37
37
  # If the checkbox is shown, and the checkbox is checked, then when
38
38
  # Calamares exits from the finished-page it will run this command.
39
39
  # If not set, falls back to "shutdown -r now".
40
- restartNowCommand: {{restartNowCommand}}
40
+ restartNowCommand: none
41
41
 
42
42
  # When the last page is (successfully) reached, send a DBus notification
43
43
  # to the desktop that the installation is done. This works only if the
@@ -1,6 +1,6 @@
1
1
  # Arch
2
2
  # Calamares 3.3
3
- --
3
+ ---
4
4
  dontChroot: false
5
5
  timeout: 30
6
6
  script:
@@ -21,7 +21,8 @@ export default class Archlinux {
21
21
  static async calamaresInstall(verbose = false) {
22
22
  verbose = true; // serve per pacman
23
23
  const echo = Utils.setEcho(verbose);
24
- const cal_eggs = 'calamares-eggs-3.3.9-1-x86_64.pkg.tar.zst'; // 01/09/2024
24
+ // const cal_eggs = 'calamares-eggs-3.3.9-1-x86_64.pkg.tar.zst' // 01/09/2024
25
+ const cal_eggs = 'calamares-eggs-3.3.10-1-x86_64.pkg.tar.zst'; // 24/10/2024
25
26
  let cmd = `wget -O /tmp/${cal_eggs} https://sourceforge.net/projects/penguins-eggs/files/Packages/AUR/${cal_eggs}/download`;
26
27
  try {
27
28
  await exec(cmd, echo);
@@ -8,4 +8,4 @@
8
8
  /**
9
9
  * restituisce displaymanagers in uso
10
10
  */
11
- export declare function displaymanager(): string;
11
+ export declare function displaymanager(): string[];
@@ -10,30 +10,31 @@ import Pacman from '../../pacman.js';
10
10
  * restituisce displaymanagers in uso
11
11
  */
12
12
  export function displaymanager() {
13
- let text = '';
14
- text += addIfExist('slim');
15
- text += addIfExist('sddm');
16
- text += addIfExist('lightdm');
17
- text += addIfExist('gdm');
18
- text += addIfExist('gdm3');
19
- text += addIfExist('mdm');
20
- text += addIfExist('lxdm');
21
- text += addIfExist('kdm');
22
- return text;
23
- }
24
- /*
25
- * @param package2check
26
- */
27
- function addIfExist(package2check) {
28
- let content = '';
29
- if (Pacman.packageIsInstalled(package2check)) {
30
- let displayManager = package2check;
31
- if (package2check === 'gdm3') {
32
- // gdm3 is treat as gdm
33
- displayManager = 'gdm';
34
- }
35
- content = `- ${displayManager}\n`;
36
- // text += text === '' ? `- ${displayManager}\n` : ` - ${displayManager}\n`
37
- }
38
- return content;
13
+ let ret = [];
14
+ if (Pacman.packageIsInstalled('gdm')) {
15
+ ret.push('gdm');
16
+ }
17
+ if (Pacman.packageIsInstalled('gdm3')) {
18
+ // gdm3 viene trattato come gdm
19
+ ret.push('gdm');
20
+ }
21
+ if (Pacman.packageIsInstalled('kdm')) {
22
+ ret.push('kdm');
23
+ }
24
+ if (Pacman.packageIsInstalled('lightdm')) {
25
+ ret.push('lightdm');
26
+ }
27
+ if (Pacman.packageIsInstalled('lxdm')) {
28
+ ret.push('lxdm');
29
+ }
30
+ if (Pacman.packageIsInstalled('mdm')) {
31
+ ret.push('mdm');
32
+ }
33
+ if (Pacman.packageIsInstalled('sddm')) {
34
+ ret.push('sddm');
35
+ }
36
+ if (Pacman.packageIsInstalled('slim')) {
37
+ ret.push('slim');
38
+ }
39
+ return ret;
39
40
  }
@@ -40,7 +40,7 @@ export async function settings(src, dest, theme = 'eggs', isClone = false) {
40
40
  createUsers = '# ';
41
41
  }
42
42
  let hasDisplaymanager = '# ';
43
- if (displaymanager() !== '') {
43
+ if (displaymanager().length > 0) {
44
44
  hasDisplaymanager = '- ';
45
45
  }
46
46
  shx.sed('-i', '{{hasSystemd}}', hasSystemd, settingsDest);
@@ -1,10 +1,3 @@
1
- /**
2
- * ./src/classes/incubation/fisherman.ts
3
- * penguins-eggs v.10.0.0 / ecmascript 2020
4
- * author: Piero Proietti
5
- * email: piero.proietti@gmail.com
6
- * license: MIT
7
- */
8
1
  import { IDistro, IInstaller } from '../../interfaces/index.js';
9
2
  export default class Fisherman {
10
3
  distro: IDistro;
@@ -38,20 +31,32 @@ export default class Fisherman {
38
31
  */
39
32
  createCalamaresSettings(theme?: string, isClone?: boolean): Promise<void>;
40
33
  /**
41
- * usa i moduli-ts
34
+ *
35
+ * @param name
42
36
  */
43
- moduleDisplaymanager(): Promise<void>;
37
+ shellprocess(name: string): Promise<void>;
38
+ /**
39
+ *
40
+ * @param module
41
+ * @param type
42
+ * @param path
43
+ */
44
+ show(name: string, type: string, path: string): void;
45
+ /**
46
+ * ====================================================================================
47
+ * M O D U L E S
48
+ * ====================================================================================
49
+ */
44
50
  /**
45
51
  * Al momento rimane con la vecchia configurazione
46
52
  */
47
- moduleFinished(): Promise<void>;
53
+ moduleDisplaymanager(): Promise<void>;
48
54
  /**
49
- * ====================================================================================
50
- * M O D U L E S
51
- * ====================================================================================
55
+ * Al momento rimane con la vecchia configurazione
52
56
  */
57
+ moduleFinished(): Promise<void>;
53
58
  /**
54
- * usa i moduli-ts
59
+ * Al momento rimane con la vecchia configurazione
55
60
  */
56
61
  modulePackages(distro: IDistro, release?: boolean): Promise<void>;
57
62
  /**
@@ -62,16 +67,4 @@ export default class Fisherman {
62
67
  * Al momento rimane con la vecchia configurazione
63
68
  */
64
69
  moduleUnpackfs(): Promise<void>;
65
- /**
66
- *
67
- * @param name
68
- */
69
- shellprocess(name: string): Promise<void>;
70
- /**
71
- *
72
- * @param module
73
- * @param type
74
- * @param path
75
- */
76
- show(name: string, type: string, path: string): void;
77
70
  }
@@ -10,13 +10,15 @@ import mustache from 'mustache';
10
10
  import fs from 'node:fs';
11
11
  import path from 'node:path';
12
12
  import shx from 'shelljs';
13
+ import yaml from 'js-yaml';
13
14
  import { exec } from '../../lib/utils.js';
14
15
  import { settings } from './fisherman-helper/settings.js';
15
16
  // _dirname
16
17
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
17
- /**
18
- * vecchi require che vanno sostituiti con import
19
- */
18
+ // pjson
19
+ import { createRequire } from 'node:module';
20
+ const require = createRequire(import.meta.url);
21
+ const pjson = require('../../../package.json');
20
22
  import { displaymanager } from './fisherman-helper/displaymanager.js';
21
23
  import { remove as removePackages, tryInstall } from './fisherman-helper/packages.js';
22
24
  export default class Fisherman {
@@ -74,7 +76,7 @@ export default class Fisherman {
74
76
  * @param name
75
77
  * @param replaces [['search','replace']]
76
78
  */
77
- async buildModule(name, vendor = '') {
79
+ async buildModule(name, vendor = 'eggs') {
78
80
  let moduleSource = path.resolve(__dirname, this.installer.templateModules + name + '.yml');
79
81
  /**
80
82
  * We need vendor here to have possibility to load custom modules for calamares
@@ -148,13 +150,68 @@ export default class Fisherman {
148
150
  await settings(this.installer.template, this.installer.configRoot, theme, isClone);
149
151
  }
150
152
  /**
151
- * usa i moduli-ts
153
+ *
154
+ * @param name
155
+ */
156
+ async shellprocess(name) {
157
+ const moduleSource = path.resolve(__dirname, this.installer.templateModules + 'shellprocess_' + name + '.yml');
158
+ const moduleDest = this.installer.modules + 'shellprocess_' + name + '.conf';
159
+ if (fs.existsSync(moduleSource)) {
160
+ if (this.verbose)
161
+ this.show(name, 'shellprocess', moduleDest);
162
+ shx.cp(moduleSource, moduleDest);
163
+ }
164
+ else if (this.verbose) {
165
+ console.log(`calamares: ${name} shellprocess, nothing to do`);
166
+ }
167
+ }
168
+ /**
169
+ *
170
+ * @param module
171
+ * @param type
172
+ * @param path
173
+ */
174
+ show(name, type, path) {
175
+ switch (type) {
176
+ case 'module': {
177
+ console.log('fisherman: ' + chalk.yellow(name) + ' module in ' + chalk.yellow(path));
178
+ break;
179
+ }
180
+ case 'calamares_module': {
181
+ console.log('fisherman: ' + chalk.cyanBright(name) + ' calamares_module in ' + chalk.cyanBright(path));
182
+ break;
183
+ }
184
+ case 'shellprocess': {
185
+ console.log('fisherman: ' + chalk.green(name) + ' shellprocess in ' + chalk.green(path));
186
+ break;
187
+ }
188
+ case 'contextualprocess': {
189
+ console.log('fisherman: ' + chalk.cyanBright(name) + ' shellprocess in ' + chalk.cyanBright(path));
190
+ break;
191
+ }
192
+ // No default
193
+ }
194
+ }
195
+ /**
196
+ * ====================================================================================
197
+ * M O D U L E S
198
+ * ====================================================================================
199
+ */
200
+ /**
201
+ * Al momento rimane con la vecchia configurazione
152
202
  */
153
203
  async moduleDisplaymanager() {
154
204
  const name = 'displaymanager';
155
205
  // const displaymanager = require('./fisherman-helper/displaymanager').displaymanager
156
206
  this.buildModule(name);
157
- shx.sed('-i', '{{displaymanagers}}', displaymanager(), this.installer.modules + name + '.conf');
207
+ let file = this.installer.modules + name + '.conf';
208
+ let fileContent = fs.readFileSync(file, 'utf8');
209
+ let values = yaml.load(fileContent);
210
+ values.displaymanagers = displaymanager();
211
+ let destContent = `# ${name}.conf, created by penguins-eggs ${pjson.version}\n`;
212
+ destContent += '---\n';
213
+ destContent += yaml.dump(values);
214
+ fs.writeFileSync(file, destContent, 'utf8');
158
215
  }
159
216
  /**
160
217
  * Al momento rimane con la vecchia configurazione
@@ -162,16 +219,17 @@ export default class Fisherman {
162
219
  async moduleFinished() {
163
220
  const name = 'finished';
164
221
  await this.buildModule(name);
165
- const restartNowCommand = 'reboot';
166
- shx.sed('-i', '{{restartNowCommand}}', restartNowCommand, this.installer.modules + name + '.conf');
222
+ let file = this.installer.modules + name + '.conf';
223
+ let fileContent = fs.readFileSync(file, 'utf8');
224
+ let values = yaml.load(fileContent);
225
+ values.restartNowCommand = 'reboot';
226
+ let destContent = `# ${name}.conf, created by penguins-eggs ${pjson.version}\n`;
227
+ destContent += '---\n';
228
+ destContent += yaml.dump(values);
229
+ fs.writeFileSync(file, destContent, 'utf8');
167
230
  }
168
231
  /**
169
- * ====================================================================================
170
- * M O D U L E S
171
- * ====================================================================================
172
- */
173
- /**
174
- * usa i moduli-ts
232
+ * Al momento rimane con la vecchia configurazione
175
233
  */
176
234
  async modulePackages(distro, release = false) {
177
235
  const name = 'packages';
@@ -189,6 +247,36 @@ export default class Fisherman {
189
247
  }
190
248
  shx.sed('-i', '{{operations}}', operations, this.installer.modules + name + '.conf');
191
249
  }
250
+ /*
251
+ const name = 'packages'
252
+ this.buildModule(name)
253
+ let file = `/etc/calamares/modules/${name}.conf`
254
+ let fileContent = fs.readFileSync(file, 'utf8')
255
+ let values = yaml.load(fileContent) as ICalamaresPackages
256
+ console.log(values)
257
+ let destContent = `# ${name}.conf, created by penguins-eggs ${pjson.version}\n`
258
+ destContent += '---\n'
259
+ destContent += yaml.dump(values)
260
+
261
+ // const removePackages = require('./fisherman-helper/packages').remove
262
+ // const tryInstall = require('./fisherman-helper/packages').tryInstall
263
+
264
+
265
+ const yamlInstall = tryInstall(distro)
266
+
267
+ let yamlRemove = ''
268
+ if (release) {
269
+ yamlRemove = removePackages(distro)
270
+ }
271
+
272
+ let operations = ''
273
+ if (yamlRemove !== '' || yamlInstall !== '') {
274
+ operations = 'operations:\n' + yamlRemove + yamlInstall
275
+ }
276
+
277
+ shx.sed('-i', '{{operations}}', operations, this.installer.modules + name + '.conf')
278
+ }
279
+ */
192
280
  /**
193
281
  * Al momento rimane con la vecchia configurazione
194
282
  */
@@ -205,47 +293,4 @@ export default class Fisherman {
205
293
  this.buildModule(name);
206
294
  shx.sed('-i', '{{source}}', this.distro.liveMediumPath + this.distro.squashfs, this.installer.modules + name + '.conf');
207
295
  }
208
- /**
209
- *
210
- * @param name
211
- */
212
- async shellprocess(name) {
213
- const moduleSource = path.resolve(__dirname, this.installer.templateModules + 'shellprocess_' + name + '.yml');
214
- const moduleDest = this.installer.modules + 'shellprocess_' + name + '.conf';
215
- if (fs.existsSync(moduleSource)) {
216
- if (this.verbose)
217
- this.show(name, 'shellprocess', moduleDest);
218
- shx.cp(moduleSource, moduleDest);
219
- }
220
- else if (this.verbose) {
221
- console.log(`calamares: ${name} shellprocess, nothing to do`);
222
- }
223
- }
224
- /**
225
- *
226
- * @param module
227
- * @param type
228
- * @param path
229
- */
230
- show(name, type, path) {
231
- switch (type) {
232
- case 'module': {
233
- console.log('fisherman: ' + chalk.yellow(name) + ' module in ' + chalk.yellow(path));
234
- break;
235
- }
236
- case 'calamares_module': {
237
- console.log('fisherman: ' + chalk.cyanBright(name) + ' calamares_module in ' + chalk.cyanBright(path));
238
- break;
239
- }
240
- case 'shellprocess': {
241
- console.log('fisherman: ' + chalk.green(name) + ' shellprocess in ' + chalk.green(path));
242
- break;
243
- }
244
- case 'contextualprocess': {
245
- console.log('fisherman: ' + chalk.cyanBright(name) + ' shellprocess in ' + chalk.cyanBright(path));
246
- break;
247
- }
248
- // No default
249
- }
250
- }
251
296
  }
@@ -29,6 +29,10 @@ export default class Incubator {
29
29
  * config
30
30
  */
31
31
  config(release?: boolean): Promise<void>;
32
+ /**
33
+ *
34
+ */
35
+ private cleanup;
32
36
  /**
33
37
  *
34
38
  */
@@ -5,11 +5,16 @@
5
5
  * email: piero.proietti@gmail.com
6
6
  * license: MIT
7
7
  */
8
+ // pjson
9
+ import { createRequire } from 'node:module';
10
+ const require = createRequire(import.meta.url);
11
+ const pjson = require('../../../package.json');
8
12
  // partition
9
13
  import yaml from 'js-yaml';
10
14
  import fs from 'node:fs';
11
15
  import path from 'node:path';
12
16
  import shx from 'shelljs';
17
+ import { exec } from '../../lib/utils.js';
13
18
  import Pacman from '../pacman.js';
14
19
  import Utils from '../utils.js';
15
20
  import { Alpine } from './distros/alpine.js';
@@ -58,6 +63,7 @@ export default class Incubator {
58
63
  async config(release = false) {
59
64
  const verbose = true;
60
65
  const echo = Utils.setEcho(verbose);
66
+ Utils.warning(`creating ${installer().name} configuration files on ${installer().configRoot}`);
61
67
  this.createInstallerDirs();
62
68
  this.createBranding();
63
69
  // DEBIAN
@@ -178,8 +184,34 @@ export default class Incubator {
178
184
  }
179
185
  }
180
186
  if (Pacman.calamaresExists()) {
181
- partitionCustomize();
187
+ await partitionCustomize();
182
188
  }
189
+ Utils.warning(`cleanup ${installer().name} configuration files`);
190
+ await this.cleanup();
191
+ }
192
+ /**
193
+ *
194
+ */
195
+ async cleanup() {
196
+ // modules
197
+ const elements = fs.readdirSync(this.installer.modules);
198
+ for (const elem of elements) {
199
+ let file = this.installer.modules + elem;
200
+ let fileContent = fs.readFileSync(file, 'utf8');
201
+ let yamlContent = yaml.load(fileContent);
202
+ let destContent = `# ${elem}, created by penguins-eggs ${pjson.version}\n`;
203
+ destContent += '---\n';
204
+ destContent += yaml.dump(yamlContent);
205
+ fs.writeFileSync(file, destContent, 'utf8');
206
+ }
207
+ // settings
208
+ let file = this.installer.configRoot + '/settings.conf';
209
+ let fileContent = fs.readFileSync(file, 'utf8');
210
+ let yamlContent = yaml.load(fileContent);
211
+ let destContent = `# settings.conf, created by penguins-eggs ${pjson.version}\n`;
212
+ destContent += '---\n';
213
+ destContent += yaml.dump(yamlContent);
214
+ fs.writeFileSync(file, destContent, 'utf8');
183
215
  }
184
216
  /**
185
217
  *
@@ -331,10 +363,12 @@ function write(file, content, verbose = false) {
331
363
  /**
332
364
  *
333
365
  */
334
- function partitionCustomize() {
366
+ async function partitionCustomize() {
335
367
  const filePartition = '/etc/calamares/modules/partition.conf';
336
368
  const partition = yaml.load(fs.readFileSync(filePartition, 'utf8'));
337
- partition.defaultFileSystemType = 'ext4';
369
+ // detect filesystem type
370
+ let test = await exec(`df -T / | awk 'NR==2 {print $2}'`, { capture: true, echo: false });
371
+ partition.defaultFileSystemType = test.data.trim();
338
372
  partition.availableFileSystemTypes = ['ext4'];
339
373
  if (Pacman.packageIsInstalled('btrfs-progs')) {
340
374
  partition.availableFileSystemTypes.push('btrfs');
@@ -86,9 +86,7 @@ export default class Ovary {
86
86
  console.log('Ovary: bindLiveFs');
87
87
  }
88
88
  /**
89
- * Attenzione:
90
- * fs.readdirSync('/', { withFileTypes: true })
91
- * viene ignorato da Node8, ma da problemi da Node10 in poi
89
+ * dirs = readdirsync /
92
90
  */
93
91
  const dirs = fs.readdirSync('/');
94
92
  const startLine = '#############################################################';
@@ -101,7 +99,27 @@ export default class Ovary {
101
99
  cmds.push(`# host: ${os.hostname()} user: ${await Utils.getPrimaryUser()}\n`);
102
100
  for (const dir of dirs) {
103
101
  cmds.push(startLine);
104
- if (fs.statSync(`/${dir}`).isDirectory()) {
102
+ let statDir = fs.lstatSync(`/${dir}`);
103
+ /**
104
+ * Link
105
+ */
106
+ if (statDir.isSymbolicLink()) {
107
+ lnkDest = fs.readlinkSync(`/${dir}`);
108
+ cmds.push(`# /${dir} is a symbolic link to /${lnkDest} in the system`, '# we need just to recreate it', `# ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`, "# but we don't know if the destination exist, and I'm too lazy today. So, for now: ", titleLine);
109
+ if (fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
110
+ cmds.push('# SymbolicLink exist... skip');
111
+ }
112
+ else if (fs.existsSync(lnkDest)) {
113
+ cmds.push(`ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`);
114
+ }
115
+ else {
116
+ cmds.push(await rexec(`cp -r /${dir} ${this.settings.work_dir.merged}`, this.verbose));
117
+ }
118
+ /**
119
+ * Directory
120
+ */
121
+ }
122
+ else if (statDir.isDirectory()) {
105
123
  if (dir === 'boot') {
106
124
  cmds.push(`# /boot is copied actually`);
107
125
  cmds.push(await rexec(`cp -r /boot ${this.settings.config.snapshot_mnt}filesystem.squashfs`, this.verbose));
@@ -112,7 +130,7 @@ export default class Ovary {
112
130
  /**
113
131
  * mergedAndOverlay creazione directory, overlay e mount rw
114
132
  */
115
- cmds.push(`${cmd} need to be presente, and rw`, titleLine, '# create mountpoint lower');
133
+ cmds.push(`${cmd} need to be present, and rw`, titleLine, '# create mountpoint lower');
116
134
  cmds.push(await makeIfNotExist(`${this.settings.work_dir.lowerdir}/${dir}`), `# first: mount /${dir} rw in ${this.settings.work_dir.lowerdir}/${dir}`);
117
135
  cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.lowerdir}/${dir}`, this.verbose), '# now remount it ro');
118
136
  cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.lowerdir}/${dir}`, this.verbose), `\n# second: create mountpoint upper, work and ${this.settings.work_dir.merged} and mount ${dir}`);
@@ -138,8 +156,11 @@ export default class Ovary {
138
156
  cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, this.verbose), `# mount -o bind /${dir} ${this.settings.work_dir.merged}/${dir}`);
139
157
  }
140
158
  }
159
+ /**
160
+ * File
161
+ */
141
162
  }
142
- else if (fs.statSync(`/${dir}`).isFile()) {
163
+ else if (statDir.isFile()) {
143
164
  cmds.push(`# /${dir} is just a file`, titleLine);
144
165
  if (fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
145
166
  cmds.push('# file exist... skip');
@@ -148,19 +169,6 @@ export default class Ovary {
148
169
  cmds.push(await rexec(`cp /${dir} ${this.settings.work_dir.merged}`, this.verbose));
149
170
  }
150
171
  }
151
- else if (fs.statSync(`/${dir}`).isSymbolicLink()) {
152
- lnkDest = fs.readlinkSync(`/${dir}`);
153
- cmds.push(`# /${dir} is a symbolic link to /${lnkDest} in the system`, '# we need just to recreate it', `# ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`, "# but we don't know if the destination exist, and I'm too lazy today. So, for now: ", titleLine);
154
- if (fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
155
- cmds.push('# SymbolicLink exist... skip');
156
- }
157
- else if (fs.existsSync(lnkDest)) {
158
- cmds.push(`ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`);
159
- }
160
- else {
161
- cmds.push(await rexec(`cp -r /${dir} ${this.settings.work_dir.merged}`, this.verbose));
162
- }
163
- }
164
172
  cmds.push(endLine);
165
173
  }
166
174
  // Utils.writeXs(`${this.settings.config.snapshot_dir}bind`, cmds)
@@ -1298,8 +1306,17 @@ export default class Ovary {
1298
1306
  if (this.verbose) {
1299
1307
  console.log('Ovary: mergedAndOverlay');
1300
1308
  }
1301
- // agginto bin per autologin su Alpine
1302
- const mountDirs = ['bin', 'etc', 'usr', 'var'];
1309
+ /**
1310
+ * Debian: usrmerged
1311
+ * bin -> usr/bin
1312
+ * lib -> usr/lib
1313
+ * lib64 -> usr/lib64
1314
+ * sbin -> usr/sbin
1315
+ *
1316
+ * 'bin' rimossa da overlay
1317
+ */
1318
+ // aggiunto bin per autologin su Alpine
1319
+ const mountDirs = ['etc', 'usr', 'var'];
1303
1320
  let mountDir = '';
1304
1321
  let overlay = false;
1305
1322
  for (mountDir of mountDirs) {
@@ -1508,7 +1525,7 @@ export default class Ovary {
1508
1525
  /**
1509
1526
  * GUI installed but NOT Desktop Manager: just create motd and issue
1510
1527
  */
1511
- if (displaymanager() === '') {
1528
+ if (displaymanager().length > 0) {
1512
1529
  this.cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
1513
1530
  this.cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
1514
1531
  }
@@ -9,10 +9,10 @@ import chalk from 'chalk';
9
9
  import yaml from 'js-yaml';
10
10
  // packages
11
11
  import fs from 'node:fs';
12
- // pjson
13
- import { createRequire } from 'node:module';
14
12
  import os from 'node:os';
15
13
  import shx from 'shelljs';
14
+ // pjson
15
+ import { createRequire } from 'node:module';
16
16
  const require = createRequire(import.meta.url);
17
17
  const pjson = require('../../package.json');
18
18
  import Distro from './distro.js';
@@ -78,7 +78,7 @@ export default class Calamares extends Command {
78
78
  * Install
79
79
  */
80
80
  if (install) {
81
- Utils.warning('calamares: install package');
81
+ Utils.warning('installing package calamares');
82
82
  await Pacman.calamaresInstall();
83
83
  if (await this.settings.load()) {
84
84
  this.settings.config.force_installer = true;
@@ -92,19 +92,21 @@ export default class Calamares extends Command {
92
92
  * policies
93
93
  */
94
94
  if (policies) {
95
- Utils.warning('calamares: configuring policies');
95
+ Utils.warning('configuring calamares policies');
96
96
  await Pacman.calamaresPolicies();
97
97
  }
98
98
  /**
99
99
  * configure
100
100
  */
101
101
  if (await this.settings.load()) {
102
- Utils.warning(`${installer}: creating configuration files`);
103
102
  await this.settings.loadRemix(theme);
104
103
  const isClone = false;
105
104
  this.incubator = new Incubator(this.settings.remix, this.settings.distro, this.settings.config.user_opt, theme, isClone, verbose);
106
105
  await this.incubator.config(release);
107
106
  }
108
107
  }
108
+ else {
109
+ Utils.useRoot(this.id);
110
+ }
109
111
  }
110
112
  }
@@ -55,17 +55,17 @@ export default class ExportPkg extends Command {
55
55
  else if (distro.familyId === "archlinux") {
56
56
  if (distro.distroId === "ManjaroLinux" || distro.distroId === "BigLinux") {
57
57
  Utils.warning("manjaro packages");
58
- this.manjaro();
58
+ await this.manjaro();
59
59
  }
60
60
  else {
61
61
  Utils.warning("arch packages");
62
- this.aur();
62
+ await this.aur();
63
63
  }
64
64
  }
65
65
  else if (distro.familyId === "alpine") {
66
+ Utils.warning("alpine packages");
66
67
  if (Utils.isRoot()) {
67
- Utils.warning("alpine packages");
68
- this.alpine();
68
+ await this.alpine();
69
69
  }
70
70
  else {
71
71
  Utils.useRoot(this.id);