penguins-eggs 25.11.21 → 25.12.7

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 (114) hide show
  1. package/.oclif.manifest.json +53 -41
  2. package/README.md +80 -36
  3. package/README.pdf +21575 -3241
  4. package/addons/eggs/theme/livecd/full.grub.main.cfg +39 -4
  5. package/addons/eggs/theme/livecd/full.isolinux.main.cfg +47 -4
  6. package/bin/run.js +11 -0
  7. package/conf/derivatives.yaml +4 -2
  8. package/conf/exclude.list.d/var.list +11 -6
  9. package/dist/appimage/dependency-manager.d.ts +31 -0
  10. package/dist/appimage/dependency-manager.js +292 -0
  11. package/dist/appimage/first-run-check.js +3 -3
  12. package/dist/bin/run.js +11 -0
  13. package/dist/classes/cli-autologin.js +78 -53
  14. package/dist/classes/compressors.d.ts +7 -10
  15. package/dist/classes/compressors.js +44 -31
  16. package/dist/classes/daddy.js +11 -11
  17. package/dist/classes/distro.js +2 -2
  18. package/dist/classes/diversions.js +2 -3
  19. package/dist/classes/incubation/fisherman-helper/initcpio.d.ts +4 -0
  20. package/dist/classes/incubation/fisherman-helper/initcpio.js +14 -4
  21. package/dist/classes/incubation/fisherman-helper/settings.js +1 -1
  22. package/dist/classes/incubation/fisherman.js +1 -3
  23. package/dist/classes/incubation/incubator.js +1 -1
  24. package/dist/classes/network.d.ts +1 -1
  25. package/dist/classes/ovary.d/create-xdg-autostart.js +1 -1
  26. package/dist/classes/ovary.d/edit-live-fs.d.ts +1 -12
  27. package/dist/classes/ovary.d/edit-live-fs.js +216 -186
  28. package/dist/classes/ovary.d/fertilization.js +1 -1
  29. package/dist/classes/ovary.d/make-dot-disk.js +1 -1
  30. package/dist/classes/ovary.d/produce.js +1 -1
  31. package/dist/classes/ovary.d/user-create-live.d.ts +4 -10
  32. package/dist/classes/ovary.d/user-create-live.js +82 -84
  33. package/dist/classes/ovary.d/users-remove.d.ts +5 -6
  34. package/dist/classes/ovary.d/users-remove.js +61 -31
  35. package/dist/classes/ovary.d/xorriso-command.js +1 -5
  36. package/dist/classes/ovary.d.ts +2 -2
  37. package/dist/classes/ovary.js +2 -2
  38. package/dist/classes/pacman.d/alpine.js +2 -2
  39. package/dist/classes/pacman.d/archlinux.js +2 -2
  40. package/dist/classes/pacman.d/debian.js +2 -3
  41. package/dist/classes/pacman.d/fedora.js +2 -3
  42. package/dist/classes/pacman.d/openmamba.js +2 -3
  43. package/dist/classes/pacman.d/opensuse.js +2 -3
  44. package/dist/classes/pacman.d.ts +21 -12
  45. package/dist/classes/pacman.js +55 -47
  46. package/dist/classes/pve-live.js +1 -1
  47. package/dist/classes/settings.js +1 -1
  48. package/dist/classes/sys-users.d.ts +76 -0
  49. package/dist/classes/sys-users.js +206 -0
  50. package/dist/classes/utils.d/kernel.js +3 -3
  51. package/dist/classes/utils.d.ts +16 -11
  52. package/dist/classes/utils.js +92 -56
  53. package/dist/classes/xdg.js +1 -1
  54. package/dist/classes/yolk.js +2 -4
  55. package/dist/commands/config.js +3 -14
  56. package/dist/commands/cuckoo.js +1 -1
  57. package/dist/commands/export/appimage.js +3 -3
  58. package/dist/commands/export/pkg.js +3 -3
  59. package/dist/commands/export/tarballs.js +3 -3
  60. package/dist/commands/krill.js +1 -1
  61. package/dist/commands/produce.js +9 -4
  62. package/dist/commands/{setup.d.ts → setup/install.d.ts} +1 -5
  63. package/dist/commands/setup/install.js +71 -0
  64. package/dist/commands/setup/purge.d.ts +17 -0
  65. package/dist/commands/setup/purge.js +71 -0
  66. package/dist/commands/tools/yolk.js +1 -1
  67. package/dist/commands/update.d.ts +15 -0
  68. package/dist/commands/update.js +74 -7
  69. package/dist/interfaces/i-exec.d.ts +1 -0
  70. package/dist/krill/classes/prepare.d/location.js +1 -1
  71. package/dist/krill/classes/prepare.d/partitions.js +1 -1
  72. package/dist/krill/classes/prepare.d/users.js +2 -2
  73. package/dist/krill/classes/prepare.js +5 -5
  74. package/dist/krill/classes/sequence.d/add_user.d.ts +3 -15
  75. package/dist/krill/classes/sequence.d/add_user.js +87 -57
  76. package/dist/krill/classes/sequence.d/change_password.d.ts +5 -7
  77. package/dist/krill/classes/sequence.d/change_password.js +25 -10
  78. package/dist/krill/classes/sequence.d/del_live_user.d.ts +5 -7
  79. package/dist/krill/classes/sequence.d/del_live_user.js +39 -25
  80. package/dist/krill/classes/sequence.d/fstab.js +1 -1
  81. package/dist/krill/classes/sequence.d/grubcfg.d.ts +3 -7
  82. package/dist/krill/classes/sequence.d/grubcfg.js +33 -13
  83. package/dist/krill/classes/sequence.d/mkfs.js +1 -2
  84. package/dist/krill/classes/sequence.d/unpackfs.d.ts +2 -4
  85. package/dist/krill/classes/sequence.d/unpackfs.js +8 -5
  86. package/dist/krill/classes/sequence.js +2 -3
  87. package/dist/krill/components/title.js +4 -4
  88. package/dist/krill/lib/select_installation_device.js +1 -1
  89. package/dist/krill/lib/select_replaced_partition.js +1 -1
  90. package/dist/lib/utils.d.ts +51 -19
  91. package/dist/lib/utils.js +225 -39
  92. package/manpages/doc/man/eggs.1.gz +0 -0
  93. package/manpages/doc/man/eggs.html +29 -17
  94. package/package.json +13 -14
  95. package/perrisbrewery/template/dependencies.yaml +1 -0
  96. package/scripts/_eggs +35 -7
  97. package/scripts/boot-encrypted-root.sh +220 -0
  98. package/scripts/eggs.bash +2 -1
  99. package/scripts/mount-encrypted-home.sh +324 -0
  100. package/dist/appimage/prerequisites.d.ts +0 -34
  101. package/dist/appimage/prerequisites.js +0 -350
  102. package/dist/commands/setup.js +0 -90
  103. package/dracut/create-symlink +0 -71
  104. package/dracut/dracut-log.txt +0 -3
  105. package/dracut/export +0 -4
  106. package/dracut/export-dracut-analysis +0 -51
  107. package/dracut/export-dracut-log +0 -2
  108. package/dracut/mkisofs +0 -10
  109. package/dracut/renew-initramfs +0 -17
  110. package/dracut/sbin2bin +0 -10
  111. package/dracut/update-dracut-conf-d +0 -2
  112. package/dracut/update-dracut-modules +0 -62
  113. package/scripts/appimage-build.sh +0 -152
  114. package/scripts/appimage-install.sh +0 -43
@@ -7,16 +7,15 @@
7
7
  *
8
8
  * Refactored Utils class - imports from modular utilities
9
9
  */
10
- import shx from 'shelljs';
10
+ import { shx, spawnSync } from '../lib/utils.js';
11
11
  import fs from 'fs';
12
12
  import dns from 'dns';
13
13
  import path from 'path';
14
14
  import os from 'os';
15
15
  import inquirer from 'inquirer';
16
- import { execSync, spawnSync } from 'child_process';
17
16
  import chalk from 'chalk';
18
- import { Netmask } from 'netmask';
19
17
  import Kernel from './utils.d/kernel.js';
18
+ // libraries
20
19
  import Distro from './distro.js';
21
20
  // pjson
22
21
  import { createRequire } from 'module';
@@ -155,18 +154,12 @@ export default class Utils {
155
154
  static isOpenRc() {
156
155
  let isOpenRc = false;
157
156
  if (!this.isContainer()) {
158
- try {
159
- execSync('command -v openrc');
160
- isOpenRc = true;
161
- }
162
- catch (error) {
163
- isOpenRc = false;
164
- }
157
+ isOpenRc = Utils.commandExists('openrc');
165
158
  }
166
159
  return isOpenRc;
167
160
  }
168
161
  /**
169
- * Occore vedere un modo per creare machine-id dove non esiste
162
+ * Usata da pacman e config credo non serva affatto
170
163
  */
171
164
  static machineId() {
172
165
  let result = '';
@@ -403,7 +396,7 @@ export default class Utils {
403
396
  *
404
397
  * @param volid
405
398
  */
406
- static getVolid(volid = 'unknown') {
399
+ static VolidTrim(volid = 'unknown') {
407
400
  // // 28 + 4 .iso = 32 lunghezza max di volid
408
401
  if (volid.length >= 32) {
409
402
  volid = volid.substring(0, 32);
@@ -436,49 +429,71 @@ export default class Utils {
436
429
  return fileSizeInBytes;
437
430
  }
438
431
  /**
439
- * Extimate the linuxfs dimension
440
- * probably is better to rename it as
441
- * getLiveSpaceRootNeed
442
- * @returns {number} Byte
443
- */
432
+ * Estimate the linuxfs dimension
433
+ * (Refactored to use native FS instead of dd/od)
434
+ * @returns {number} GB
435
+ */
444
436
  static getLiveRootSpace(type = 'debian-live') {
445
437
  let squashFs = '/run/live/medium/live/filesystem.squashfs';
446
438
  if (type === 'mx') {
447
439
  squashFs = '/live/boot-dev/antiX/linuxfs';
448
440
  }
449
- // Ottengo la dimensione del file compresso
450
- const compressedFs = fs.statSync(squashFs).size;
451
- // get compression factor by reading the linuxfs squasfs file, if available
452
- const compressedFs_compression_type = shx.exec(`dd if=${compressedFs} bs=1 skip=20 count=2 status=none 2>/dev/null| /usr/bin/od -An -tdI`);
453
- let compression_factor = 0;
454
- if (compressedFs_compression_type === '1') {
455
- compression_factor = 37; // gzip
456
- }
457
- else if (compressedFs_compression_type === '2') {
458
- compression_factor = 52; // lzo, not used by antiX
459
- }
460
- else if (compressedFs_compression_type === '3') {
461
- compression_factor = 52; // lzma, not used by antiX
462
- }
463
- else if (compressedFs_compression_type === '4') {
464
- compression_factor = 31; // xz
465
- }
466
- else if (compressedFs_compression_type === '5') {
467
- compression_factor = 52; // lz4
468
- }
469
- else {
470
- compression_factor = 30; // anything else or linuxfs not reachable (toram), should be pretty conservative
441
+ // 1. Leggiamo il tipo di compressione DIRETTAMENTE dall'header del file SquashFS
442
+ // L'identificativo della compressione è a offset 20 (2 bytes, little endian)
443
+ // 1=gzip, 2=lzo, 3=lzma, 4=xz, 5=lz4, 6=zstd
444
+ let compressionId = 0;
445
+ try {
446
+ if (fs.existsSync(squashFs)) {
447
+ const fd = fs.openSync(squashFs, 'r');
448
+ const buffer = Buffer.alloc(2);
449
+ // Leggi 2 byte alla posizione 20
450
+ fs.readSync(fd, buffer, 0, 2, 20);
451
+ fs.closeSync(fd);
452
+ compressionId = buffer.readUInt16LE(0);
453
+ }
471
454
  }
455
+ catch (e) {
456
+ console.error("Error reading squashfs header:", e);
457
+ }
458
+ // 2. Determiniamo il fattore di compressione in base all'ID letto
459
+ let compression_factor = 30; // Default conservative
460
+ switch (compressionId) {
461
+ case 1: // gzip
462
+ compression_factor = 37;
463
+ break;
464
+ case 2: // lzo
465
+ compression_factor = 52;
466
+ break;
467
+ case 3: // lzma
468
+ compression_factor = 52;
469
+ break;
470
+ case 4: // xz
471
+ compression_factor = 31;
472
+ break;
473
+ case 5: // lz4
474
+ compression_factor = 52;
475
+ break;
476
+ case 6: // zstd (aggiunto per completezza)
477
+ compression_factor = 37; // simile a gzip come ratio medio
478
+ break;
479
+ default:
480
+ compression_factor = 30;
481
+ }
482
+ // 3. Calcolo dimensione Linux FS
483
+ // Nota: shx.exec ritorna un oggetto, dobbiamo prendere .stdout e pulirlo
472
484
  let rootfs_file_size = 0;
473
- const linuxfs_file_size = (Number(shx.exec('df /live/linux --output=used --total | /usr/bin/tail -n1').stdout.trim()) * 1024 * 100) / compression_factor;
485
+ const dfCmdLinux = 'df /live/linux --output=used --total | /usr/bin/tail -n1';
486
+ const dfResultLinux = shx.exec(dfCmdLinux, { silent: true }).stdout.trim();
487
+ const linuxfs_used = Number(dfResultLinux) || 0; // Gestione caso NaN
488
+ const linuxfs_file_size = (linuxfs_used * 1024 * 100) / compression_factor;
489
+ // 4. Calcolo persist-root (se esiste)
474
490
  if (fs.existsSync('/live/persist-root')) {
475
- rootfs_file_size = Number(shx.exec('df /live/persist-root --output=used --total | /usr/bin/tail -n1').stdout.trim()) * 1024;
491
+ const dfCmdRoot = 'df /live/persist-root --output=used --total | /usr/bin/tail -n1';
492
+ const dfResultRoot = shx.exec(dfCmdRoot, { silent: true }).stdout.trim();
493
+ rootfs_file_size = (Number(dfResultRoot) || 0) * 1024;
476
494
  }
477
495
  let rootSpaceNeeded;
478
496
  if (type === 'mx') {
479
- /**
480
- * add rootfs file size to the calculated linuxfs file size. Probaby conservative, as rootfs will likely have some overlap with linuxfs
481
- */
482
497
  rootSpaceNeeded = linuxfs_file_size + rootfs_file_size;
483
498
  }
484
499
  else {
@@ -714,13 +729,16 @@ export default class Utils {
714
729
  }
715
730
  return cidr;
716
731
  }
717
- /**
718
- *
719
- * broadcast
720
- */
721
732
  static broadcast() {
722
- let n = new Netmask(Utils.cidr());
723
- return n.broadcast;
733
+ const netmask = Utils.netmask();
734
+ const ip = Utils.address();
735
+ const ipParts = ip.split('.').map(Number);
736
+ const maskParts = netmask.split('.').map(Number);
737
+ const broadcastParts = ipParts.map((part, index) => {
738
+ // Bitwise OR tra il blocco IP e il blocco Netmask invertito (255 - mask)
739
+ return part | (255 - maskParts[index]);
740
+ });
741
+ return broadcastParts.join('.');
724
742
  }
725
743
  /**
726
744
  * dns
@@ -842,7 +860,7 @@ export default class Utils {
842
860
  msg = 'Press a key to continue...';
843
861
  }
844
862
  console.log(msg);
845
- const pressKeyToExit = spawnSync('read _ ', { shell: true, stdio: [0, 1, 2] });
863
+ const pressKeyToExit = spawnSync('read _ ', [], { shell: true, stdio: [0, 1, 2] });
846
864
  if (!procContinue) {
847
865
  process.exit(0);
848
866
  }
@@ -854,7 +872,7 @@ export default class Utils {
854
872
  msg = 'Press a key to continue...';
855
873
  }
856
874
  console.log(msg);
857
- const pressKeyToExit = spawnSync('read _ ', { shell: true, stdio: [0, 1, 2] });
875
+ const pressKeyToExit = spawnSync('read _ ', [], { shell: true, stdio: [0, 1, 2] });
858
876
  if (!procContinue) {
859
877
  process.exit(0);
860
878
  }
@@ -877,13 +895,13 @@ export default class Utils {
877
895
  */
878
896
  static flag() {
879
897
  let type = '';
880
- if (Utils.isAppImage()) {
881
- type = 'AppImage:';
898
+ if (!Utils.isAppImage()) {
899
+ type = ' native';
882
900
  }
883
901
  let title = `${pjson.name}`;
884
- let green = ` ${type} ${title}`.padEnd(25, " ");
902
+ let green = ` ${title}`.padEnd(25, " ");
885
903
  let white = ` Perri's brewery edition `.padEnd(25, " ");
886
- let red = ` v${pjson.version} `.padStart(25, " ");
904
+ let red = ` v${pjson.version}${type} `.padStart(25, " ");
887
905
  return chalk.bgGreen.whiteBright(green) +
888
906
  chalk.bgWhite.blue(white) +
889
907
  chalk.bgRed.whiteBright(red);
@@ -981,4 +999,22 @@ export default class Utils {
981
999
  // console.log('wait...')
982
1000
  return new Promise(resolve => setTimeout(resolve, ms));
983
1001
  }
1002
+ /**
1003
+ * chpasswdPath
1004
+ * @returns
1005
+ */
1006
+ static chpasswdPath() {
1007
+ let chpasswdPath = '/usr/sbin/chpasswd';
1008
+ if (fs.existsSync(chpasswdPath)) {
1009
+ chpasswdPath = '/usr/bin/chpasswd';
1010
+ }
1011
+ return chpasswdPath;
1012
+ }
1013
+ /**
1014
+ *
1015
+ * @param cmd
1016
+ */
1017
+ static commandExists(cmd) {
1018
+ return !!shx.which(cmd);
1019
+ }
984
1020
  }
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import fs from 'node:fs';
9
9
  import path from 'node:path';
10
- import shx from 'shelljs';
10
+ import { shx } from '../lib/utils.js';
11
11
  // libraries
12
12
  import { exec } from '../lib/utils.js';
13
13
  import Distro from './distro.js';
@@ -7,10 +7,8 @@
7
7
  */
8
8
  import yaml from 'js-yaml';
9
9
  import fs from 'node:fs';
10
- import shx from 'shelljs';
11
- import { exec } from '../lib/utils.js';
10
+ import { shx, exec } from '../lib/utils.js';
12
11
  import Bleach from './bleach.js';
13
- import Pacman from './pacman.js';
14
12
  import Utils from './utils.js';
15
13
  /**
16
14
  *
@@ -31,7 +29,7 @@ export default class Yolk {
31
29
  }
32
30
  Utils.warning(`Creating yolk on ${this.yolkDir}`);
33
31
  Utils.warning('Updating system');
34
- if (!Pacman.commandIsInstalled('dpkg-scanpackages')) {
32
+ if (!Utils.commandExists('dpkg-scanpackages')) {
35
33
  Utils.warning(`I cannot find the command dpkg-scanpackages`);
36
34
  process.exit(0);
37
35
  }
@@ -74,8 +74,7 @@ export default class Config extends Command {
74
74
  i.distroTemplate = !Pacman.distroTemplateCheck();
75
75
  i.addEfi = !Pacman.isUefi();
76
76
  i.calamares = false;
77
- if (!homecrypt &&
78
- !Pacman.calamaresExists() &&
77
+ if (!Pacman.calamaresExists() &&
79
78
  Pacman.isInstalledGui() &&
80
79
  Pacman.isCalamaresAvailable()) {
81
80
  i.calamares = true;
@@ -95,18 +94,8 @@ export default class Config extends Command {
95
94
  }
96
95
  if (Utils.isRoot(this.id)) {
97
96
  if (flags.clean) {
98
- Utils.warning('removing old configurations');
99
- await exec('rm /etc/penguins-eggs.d -rf');
100
- }
101
- /**
102
- * Se stiamo utilizzando eggs da source/appimage
103
- * Aggiungo autocomplete e manPage
104
- */
105
- if (Utils.isSources() || Utils.isAppImage()) {
106
- Utils.warning('creating autocomplete...');
107
- await Pacman.autocompleteInstall(verbose);
108
- Utils.warning('creating eggs man page...');
109
- await Pacman.manPageInstall(verbose);
97
+ Utils.warning('removing penguins-eggs configurations');
98
+ await exec('rm -rf /etc/penguins-eggs.d');
110
99
  }
111
100
  const i = await Config.thatWeNeed(nointeractive, verbose);
112
101
  if (i.needUpdate || i.configurationInstall || i.configurationRefresh || i.distroTemplate) {
@@ -39,7 +39,7 @@ export default class Cuckoo extends Command {
39
39
  host: n.address,
40
40
  subnet: n.cidr,
41
41
  tftpserver: n.address,
42
- broadcast: n.broadcast()
42
+ broadcast: Utils.broadcast()
43
43
  };
44
44
  pxe.dhcpdStart(dhcpOptions);
45
45
  /**
@@ -10,7 +10,7 @@ import Tools from '../../classes/tools.js';
10
10
  import Utils from '../../classes/utils.js';
11
11
  import { exec } from '../../lib/utils.js';
12
12
  import os from 'node:os';
13
- import { execSync } from 'node:child_process';
13
+ import { execSync } from '../../lib/utils.js';
14
14
  export default class ExportAppimage extends Command {
15
15
  static description = 'export penguins-eggs AppImage to the destination host';
16
16
  static examples = ['eggs export pkg', 'eggs export pkg --clean', 'eggs export pkg --all'];
@@ -34,9 +34,9 @@ export default class ExportAppimage extends Command {
34
34
  // Ora servono in più parti
35
35
  this.user = os.userInfo().username;
36
36
  if (this.user === 'root') {
37
- this.user = execSync('echo $SUDO_USER', { encoding: 'utf-8' }).trim();
37
+ this.user = (execSync('echo $DOAS_USER') || '').trim();
38
38
  if (this.user === '') {
39
- this.user = execSync('echo $DOAS_USER', { encoding: 'utf-8' }).trim();
39
+ this.user = (execSync('echo $DOAS_USER') || '').trim();
40
40
  }
41
41
  }
42
42
  this.clean = flags.clean;
@@ -12,7 +12,7 @@ import Tools from '../../classes/tools.js';
12
12
  import Utils from '../../classes/utils.js';
13
13
  import { exec } from '../../lib/utils.js';
14
14
  import os from 'node:os';
15
- import { execSync } from 'node:child_process';
15
+ import { execSync } from '../../lib/utils.js';
16
16
  export default class ExportPkg extends Command {
17
17
  static description = 'export penguins-eggs package to the destination host';
18
18
  static examples = ['eggs export pkg', 'eggs export pkg --clean', 'eggs export pkg --all'];
@@ -38,9 +38,9 @@ export default class ExportPkg extends Command {
38
38
  // Ora servono in più parti
39
39
  this.user = os.userInfo().username;
40
40
  if (this.user === 'root') {
41
- this.user = execSync('echo $SUDO_USER', { encoding: 'utf-8' }).trim();
41
+ this.user = (execSync('echo $DOAS_USER') || '').trim();
42
42
  if (this.user === '') {
43
- this.user = execSync('echo $DOAS_USER', { encoding: 'utf-8' }).trim();
43
+ this.user = (execSync('echo $DOAS_USER') || '').trim();
44
44
  }
45
45
  }
46
46
  this.all = flags.all;
@@ -16,7 +16,7 @@ import path from 'path';
16
16
  import { createRequire } from 'module';
17
17
  const require = createRequire(import.meta.url);
18
18
  const pjson = require('../../../package.json');
19
- import { execSync } from 'node:child_process';
19
+ import { execSync } from '../../lib/utils.js';
20
20
  export default class ExportTarballs extends Command {
21
21
  static description = 'export pkg/iso/tarballs to the destination host';
22
22
  static examples = ['eggs export tarballs', 'eggs export tarballs --clean'];
@@ -40,9 +40,9 @@ export default class ExportTarballs extends Command {
40
40
  // Ora servono in più parti
41
41
  this.user = os.userInfo().username;
42
42
  if (this.user === 'root') {
43
- this.user = execSync('echo $SUDO_USER', { encoding: 'utf-8' }).trim();
43
+ this.user = (execSync('echo $DOAS_USER') || '').trim();
44
44
  if (this.user === '') {
45
- this.user = execSync('echo $DOAS_USER', { encoding: 'utf-8' }).trim();
45
+ this.user = (execSync('echo $DOAS_USER') || '').trim();
46
46
  }
47
47
  }
48
48
  this.clean = flags.clean;
@@ -9,7 +9,7 @@ import { Command, Flags } from '@oclif/core';
9
9
  import yaml from 'js-yaml';
10
10
  import fs from 'node:fs';
11
11
  import https from 'node:https';
12
- import shx from 'shelljs';
12
+ import { shx } from '../lib/utils.js';
13
13
  import Utils from '../classes/utils.js';
14
14
  import Krill from '../krill/classes/prepare.js';
15
15
  const agent = new https.Agent({
@@ -209,14 +209,19 @@ export default class Produce extends Command {
209
209
  let message = "this is a GUI system, calamares is available, but NOT installed\n";
210
210
  Utils.warning(message);
211
211
  }
212
- if (fullcrypt) {
212
+ if (fullcrypt && Utils.isAppImage()) {
213
+ Utils.warning("eggs --fullcrypt cannot be used on AppImage");
214
+ process.exit(0);
215
+ }
216
+ else {
213
217
  const distro = new Distro();
214
- if (distro.familyId === 'debian') {
215
- Utils.info("Use penguins-eggs and this option in particular with extreme caution, and ALWAYS first try it out in a test environment.");
218
+ //
219
+ if (distro.familyId === 'debian' && (distro.codenameId === 'trixie' || distro.codenameId === 'excalibur')) {
220
+ Utils.info("Use eggs --fullcrypt with extreme caution, and ALWAYS first try it out in a test environment.");
216
221
  Utils.sleep(3000);
217
222
  }
218
223
  else {
219
- Utils.warning("This option is still in the experimental phase and can only be tested on Debian trixie");
224
+ Utils.warning("eggs --fullcrypt can be used only with Debian trixie or Devuan excalibur");
220
225
  process.exit(9);
221
226
  }
222
227
  }
@@ -6,12 +6,8 @@
6
6
  * license: MIT
7
7
  */
8
8
  import { Command } from '@oclif/core';
9
- export default class Setup extends Command {
9
+ export default class Install extends Command {
10
10
  static description: string;
11
- static flags: {
12
- check: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
- force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
- };
15
11
  static examples: string[];
16
12
  /**
17
13
  *
@@ -0,0 +1,71 @@
1
+ /**
2
+ * ./src/commands/setup.ts
3
+ * penguins-eggs v.25.11.x / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import Distro from '../../classes/distro.js';
9
+ import Utils from '../../classes/utils.js';
10
+ import Pacman from '../../classes/pacman.js';
11
+ import { Command } from '@oclif/core';
12
+ import { DependencyManager } from '../../appimage/dependency-manager.js';
13
+ import { execSync } from '../../lib/utils.js';
14
+ export default class Install extends Command {
15
+ static description = 'Automatically check and install system prerequisites';
16
+ static examples = [
17
+ 'eggs setup # this help',
18
+ 'sudo eggs setup install # install native dependencies, autocomplete, man, etc',
19
+ 'sudo eggs setup purge # purge all configurations, autocomplete, man, etc installed from penguins-eggs AppImage',
20
+ ];
21
+ /**
22
+ *
23
+ * @returns
24
+ */
25
+ async run() {
26
+ Utils.titles(this.id + ' ' + this.argv);
27
+ /**
28
+ * continue only on AppImage
29
+ */
30
+ if (!Utils.isAppImage()) {
31
+ console.log("The eggs setup command is only applicable on the AppImage version.");
32
+ console.log("On penguins-eggs native package this operation is done by the system package manager.");
33
+ process.exit();
34
+ }
35
+ const appImagePath = process.env.APPIMAGE;
36
+ console.log(`Running AppImage:\n${appImagePath}\n`);
37
+ const distro = new Distro();
38
+ const osInfo = Utils.getOsRelease();
39
+ const codenameId = osInfo.VERSION_CODENAME;
40
+ const releaseId = osInfo.VERSION_ID;
41
+ const distroId = osInfo.ID;
42
+ const { flags } = await this.parse(Install);
43
+ const depsManager = new DependencyManager();
44
+ console.log(`Your system is: ${distroId} ${releaseId} ${codenameId}, family ${distro.familyId}\n`);
45
+ console.log(`Compatible with: ${distro.distroLike} ${distro.distroUniqueId}\n`);
46
+ if (depsManager.isInstalled()) {
47
+ console.log('penguins-eggs distro meta-packages are already installed');
48
+ }
49
+ else {
50
+ console.log('penguins-eggs distro meta-packages are NOT installed');
51
+ }
52
+ if (Utils.isRoot()) {
53
+ console.log();
54
+ Utils.warning(`Are you sure you want to install penguins-eggs AppImage autocomplete, manpages, configurations and distro meta-packages:\n`);
55
+ if (await Utils.customConfirm('Select yes to continue...')) {
56
+ const appImagePath = process.env.APPIMAGE;
57
+ if (appImagePath !== '/usr/bin/eggs') {
58
+ execSync(`mv ${appImagePath} /usr/bin/eggs`);
59
+ console.log(`${appImagePath} moved to /usr/bin/eggs`);
60
+ }
61
+ await Pacman.autocompleteInstall();
62
+ await Pacman.manpageInstall();
63
+ await Pacman.configurationInstall();
64
+ depsManager.installDistroPackages();
65
+ }
66
+ }
67
+ else {
68
+ Utils.useRoot(this.id);
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ./src/commands/setup.ts
3
+ * penguins-eggs v.25.11.x / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import { Command } from '@oclif/core';
9
+ export default class Purge extends Command {
10
+ static description: string;
11
+ static examples: string[];
12
+ /**
13
+ *
14
+ * @returns
15
+ */
16
+ run(): Promise<void>;
17
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * ./src/commands/setup.ts
3
+ * penguins-eggs v.25.11.x / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import Distro from '../../classes/distro.js';
9
+ import Utils from '../../classes/utils.js';
10
+ import Pacman from '../../classes/pacman.js';
11
+ import { Command } from '@oclif/core';
12
+ import { DependencyManager } from '../../appimage/dependency-manager.js';
13
+ import { execSync } from '../../lib/utils.js';
14
+ export default class Purge extends Command {
15
+ static description = 'Automatically check and install system prerequisites';
16
+ static examples = [
17
+ 'eggs setup # this help',
18
+ 'sudo eggs setup install # install native dependencies, autocomplete, man, etc',
19
+ 'sudo eggs setup purge # purge all configurations, autocomplete, man, etc installed from penguins-eggs AppImage',
20
+ ];
21
+ /**
22
+ *
23
+ * @returns
24
+ */
25
+ async run() {
26
+ Utils.titles(this.id + ' ' + this.argv);
27
+ /**
28
+ * continue only on AppImage
29
+ */
30
+ if (!Utils.isAppImage()) {
31
+ console.log("The eggs setup purge command is only applicable on the AppImage version.");
32
+ console.log("On penguins-eggs native package this operation is done by the system package manager.");
33
+ process.exit();
34
+ }
35
+ const appImagePath = process.env.APPIMAGE;
36
+ console.log(`Running AppImage:\n${appImagePath}\n`);
37
+ const distro = new Distro();
38
+ const osInfo = Utils.getOsRelease();
39
+ const codenameId = osInfo.VERSION_CODENAME;
40
+ const releaseId = osInfo.VERSION_ID;
41
+ const distroId = osInfo.ID;
42
+ const { flags } = await this.parse(Purge);
43
+ const depsManager = new DependencyManager();
44
+ console.log(`Your system is: ${distroId} ${releaseId} ${codenameId}, family ${distro.familyId}\n`);
45
+ console.log(`Compatible with: ${distro.distroLike} ${distro.distroUniqueId}\n`);
46
+ if (Utils.isRoot()) {
47
+ console.log();
48
+ Utils.warning(`Are you sure you want to purge penguins-eggs AppImage autocomplete, manpages, configurations and distro meta-aackages:\n ${appImagePath}`);
49
+ if (await Utils.customConfirm('Select yes to continue...')) {
50
+ depsManager.removeDistroPackages();
51
+ await Pacman.autocompleteRemove();
52
+ await Pacman.manpageRemove();
53
+ await Pacman.configurationRemove();
54
+ execSync('rm -f /usr/share/applications/penguins-eggs.desktop');
55
+ execSync('rm -f /usr/bin/penguins-links-add.sh');
56
+ execSync('rm -f /usr/local/bin/g4*');
57
+ console.log('penguins-eggs AppImage stuffs was successfully removed.\n');
58
+ if (appImagePath === '/usr/bin/eggs') {
59
+ execSync(`rm -f ${appImagePath} /usr/bin/eggs`);
60
+ }
61
+ else {
62
+ console.log('You can completely erase AppImage file, using:');
63
+ console.log(`sudo rm ${appImagePath}\n`);
64
+ }
65
+ }
66
+ }
67
+ else {
68
+ Utils.useRoot(this.id);
69
+ }
70
+ }
71
+ }
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Command, Flags } from '@oclif/core';
9
9
  import fs from 'node:fs';
10
- import shx from 'shelljs';
10
+ import { shx } from '../../lib/utils.js';
11
11
  import Utils from '../../classes/utils.js';
12
12
  import Yolk from '../../classes/yolk.js';
13
13
  /**
@@ -43,4 +43,19 @@ export default class Update extends Command {
43
43
  * show
44
44
  */
45
45
  show(url: string): Promise<void>;
46
+ /**
47
+ *
48
+ */
49
+ getLatestAppImage(): Promise<void>;
50
+ /**
51
+ *
52
+ */
53
+ getLatestAppImageUrl(): Promise<string | null>;
54
+ /**
55
+ *
56
+ * @param url
57
+ * @param outputFilename
58
+ * @returns
59
+ */
60
+ downloadWithCurl(url: string, outputFilename: string): Promise<void>;
46
61
  }