penguins-eggs 25.11.29 → 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 (92) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/README.md +72 -110
  3. package/README.pdf +11041 -10623
  4. package/conf/derivatives.yaml +2 -1
  5. package/conf/exclude.list.d/var.list +11 -6
  6. package/dist/appimage/dependency-manager.js +1 -1
  7. package/dist/classes/cli-autologin.js +77 -52
  8. package/dist/classes/compressors.d.ts +7 -10
  9. package/dist/classes/compressors.js +44 -31
  10. package/dist/classes/distro.js +2 -2
  11. package/dist/classes/diversions.js +2 -3
  12. package/dist/classes/incubation/fisherman-helper/initcpio.d.ts +2 -5
  13. package/dist/classes/incubation/fisherman-helper/initcpio.js +7 -4
  14. package/dist/classes/incubation/fisherman-helper/settings.js +1 -1
  15. package/dist/classes/incubation/fisherman.js +1 -1
  16. package/dist/classes/incubation/incubator.js +1 -1
  17. package/dist/classes/ovary.d/create-xdg-autostart.js +1 -1
  18. package/dist/classes/ovary.d/edit-live-fs.d.ts +1 -12
  19. package/dist/classes/ovary.d/edit-live-fs.js +129 -135
  20. package/dist/classes/ovary.d/make-dot-disk.js +1 -1
  21. package/dist/classes/ovary.d/produce.js +1 -1
  22. package/dist/classes/ovary.d/user-create-live.d.ts +4 -10
  23. package/dist/classes/ovary.d/user-create-live.js +82 -84
  24. package/dist/classes/ovary.d/users-remove.d.ts +5 -6
  25. package/dist/classes/ovary.d/users-remove.js +61 -31
  26. package/dist/classes/ovary.d.ts +2 -2
  27. package/dist/classes/ovary.js +2 -2
  28. package/dist/classes/pacman.d/alpine.js +2 -2
  29. package/dist/classes/pacman.d/archlinux.js +2 -2
  30. package/dist/classes/pacman.d/debian.js +2 -3
  31. package/dist/classes/pacman.d/fedora.js +2 -3
  32. package/dist/classes/pacman.d/openmamba.js +2 -3
  33. package/dist/classes/pacman.d/opensuse.js +2 -3
  34. package/dist/classes/pacman.d.ts +0 -5
  35. package/dist/classes/pacman.js +3 -16
  36. package/dist/classes/pve-live.js +1 -1
  37. package/dist/classes/settings.js +1 -1
  38. package/dist/classes/sys-users.d.ts +76 -0
  39. package/dist/classes/sys-users.js +206 -0
  40. package/dist/classes/utils.d/kernel.js +3 -3
  41. package/dist/classes/utils.d.ts +15 -6
  42. package/dist/classes/utils.js +79 -46
  43. package/dist/classes/xdg.js +1 -1
  44. package/dist/classes/yolk.js +2 -4
  45. package/dist/commands/export/appimage.js +3 -3
  46. package/dist/commands/export/pkg.js +3 -3
  47. package/dist/commands/export/tarballs.js +3 -3
  48. package/dist/commands/krill.js +1 -1
  49. package/dist/commands/produce.js +9 -4
  50. package/dist/commands/setup/install.js +1 -1
  51. package/dist/commands/setup/purge.js +1 -1
  52. package/dist/commands/tools/yolk.js +1 -1
  53. package/dist/commands/update.js +1 -2
  54. package/dist/interfaces/i-exec.d.ts +1 -0
  55. package/dist/krill/classes/prepare.d/location.js +1 -1
  56. package/dist/krill/classes/prepare.d/partitions.js +1 -1
  57. package/dist/krill/classes/prepare.d/users.js +2 -2
  58. package/dist/krill/classes/prepare.js +5 -5
  59. package/dist/krill/classes/sequence.d/add_user.d.ts +3 -15
  60. package/dist/krill/classes/sequence.d/add_user.js +87 -57
  61. package/dist/krill/classes/sequence.d/change_password.d.ts +5 -7
  62. package/dist/krill/classes/sequence.d/change_password.js +25 -10
  63. package/dist/krill/classes/sequence.d/del_live_user.d.ts +5 -7
  64. package/dist/krill/classes/sequence.d/del_live_user.js +39 -25
  65. package/dist/krill/classes/sequence.d/fstab.js +1 -1
  66. package/dist/krill/classes/sequence.d/grubcfg.d.ts +3 -7
  67. package/dist/krill/classes/sequence.d/grubcfg.js +33 -13
  68. package/dist/krill/classes/sequence.d/mkfs.js +1 -2
  69. package/dist/krill/classes/sequence.d/unpackfs.d.ts +2 -4
  70. package/dist/krill/classes/sequence.d/unpackfs.js +8 -5
  71. package/dist/krill/classes/sequence.js +2 -3
  72. package/dist/krill/components/title.js +2 -2
  73. package/dist/krill/lib/select_installation_device.js +1 -1
  74. package/dist/krill/lib/select_replaced_partition.js +1 -1
  75. package/dist/lib/utils.d.ts +51 -19
  76. package/dist/lib/utils.js +225 -20
  77. package/manpages/doc/man/eggs.1.gz +0 -0
  78. package/manpages/doc/man/eggs.html +8 -8
  79. package/package.json +9 -9
  80. package/perrisbrewery/template/dependencies.yaml +1 -0
  81. package/scripts/boot-encrypted-root.sh +220 -0
  82. package/scripts/mount-encrypted-home.sh +324 -0
  83. package/dracut/create-symlink +0 -71
  84. package/dracut/dracut-log.txt +0 -3
  85. package/dracut/export +0 -4
  86. package/dracut/export-dracut-analysis +0 -51
  87. package/dracut/export-dracut-log +0 -2
  88. package/dracut/mkisofs +0 -10
  89. package/dracut/renew-initramfs +0 -17
  90. package/dracut/sbin2bin +0 -10
  91. package/dracut/update-dracut-conf-d +0 -2
  92. package/dracut/update-dracut-modules +0 -62
@@ -62,7 +62,7 @@ export default class Utils {
62
62
  */
63
63
  static isOpenRc(): boolean;
64
64
  /**
65
- * Occore vedere un modo per creare machine-id dove non esiste
65
+ * Usata da pacman e config credo non serva affatto
66
66
  */
67
67
  static machineId(): string;
68
68
  /**
@@ -153,11 +153,10 @@ export default class Utils {
153
153
  */
154
154
  static getUsedSpace(): number;
155
155
  /**
156
- * Extimate the linuxfs dimension
157
- * probably is better to rename it as
158
- * getLiveSpaceRootNeed
159
- * @returns {number} Byte
160
- */
156
+ * Estimate the linuxfs dimension
157
+ * (Refactored to use native FS instead of dd/od)
158
+ * @returns {number} GB
159
+ */
161
160
  static getLiveRootSpace(type?: string): number;
162
161
  /**
163
162
  * Return true if i686 architecture
@@ -327,4 +326,14 @@ export default class Utils {
327
326
  static wardrobe(): Promise<string>;
328
327
  static getOsRelease(): IOsRelease;
329
328
  static sleep(ms?: number): Promise<void>;
329
+ /**
330
+ * chpasswdPath
331
+ * @returns
332
+ */
333
+ static chpasswdPath(): string;
334
+ /**
335
+ *
336
+ * @param cmd
337
+ */
338
+ static commandExists(cmd: string): boolean;
330
339
  }
@@ -7,13 +7,12 @@
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
17
  import Kernel from './utils.d/kernel.js';
19
18
  // libraries
@@ -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 = '';
@@ -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 {
@@ -845,7 +860,7 @@ export default class Utils {
845
860
  msg = 'Press a key to continue...';
846
861
  }
847
862
  console.log(msg);
848
- const pressKeyToExit = spawnSync('read _ ', { shell: true, stdio: [0, 1, 2] });
863
+ const pressKeyToExit = spawnSync('read _ ', [], { shell: true, stdio: [0, 1, 2] });
849
864
  if (!procContinue) {
850
865
  process.exit(0);
851
866
  }
@@ -857,7 +872,7 @@ export default class Utils {
857
872
  msg = 'Press a key to continue...';
858
873
  }
859
874
  console.log(msg);
860
- const pressKeyToExit = spawnSync('read _ ', { shell: true, stdio: [0, 1, 2] });
875
+ const pressKeyToExit = spawnSync('read _ ', [], { shell: true, stdio: [0, 1, 2] });
861
876
  if (!procContinue) {
862
877
  process.exit(0);
863
878
  }
@@ -881,12 +896,12 @@ export default class Utils {
881
896
  static flag() {
882
897
  let type = '';
883
898
  if (!Utils.isAppImage()) {
884
- type = 'native';
899
+ type = ' native';
885
900
  }
886
901
  let title = `${pjson.name}`;
887
902
  let green = ` ${title}`.padEnd(25, " ");
888
903
  let white = ` Perri's brewery edition `.padEnd(25, " ");
889
- let red = ` v${pjson.version} ${type} `.padStart(25, " ");
904
+ let red = ` v${pjson.version}${type} `.padStart(25, " ");
890
905
  return chalk.bgGreen.whiteBright(green) +
891
906
  chalk.bgWhite.blue(white) +
892
907
  chalk.bgRed.whiteBright(red);
@@ -984,4 +999,22 @@ export default class Utils {
984
999
  // console.log('wait...')
985
1000
  return new Promise(resolve => setTimeout(resolve, ms));
986
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
+ }
987
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
  }
@@ -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
  }
@@ -10,7 +10,7 @@ import Utils from '../../classes/utils.js';
10
10
  import Pacman from '../../classes/pacman.js';
11
11
  import { Command } from '@oclif/core';
12
12
  import { DependencyManager } from '../../appimage/dependency-manager.js';
13
- import { execSync } from 'node:child_process';
13
+ import { execSync } from '../../lib/utils.js';
14
14
  export default class Install extends Command {
15
15
  static description = 'Automatically check and install system prerequisites';
16
16
  static examples = [
@@ -10,7 +10,7 @@ import Utils from '../../classes/utils.js';
10
10
  import Pacman from '../../classes/pacman.js';
11
11
  import { Command } from '@oclif/core';
12
12
  import { DependencyManager } from '../../appimage/dependency-manager.js';
13
- import { execSync } from 'node:child_process';
13
+ import { execSync } from '../../lib/utils.js';
14
14
  export default class Purge extends Command {
15
15
  static description = 'Automatically check and install system prerequisites';
16
16
  static examples = [
@@ -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
  /**
@@ -11,8 +11,7 @@ import Distro from '../classes/distro.js';
11
11
  import Tools from '../classes/tools.js';
12
12
  import Utils from '../classes/utils.js';
13
13
  import Diversions from '../classes/diversions.js';
14
- import { exec } from '../lib/utils.js';
15
- import { spawn } from 'child_process';
14
+ import { exec, spawn } from '../lib/utils.js';
16
15
  import axios from 'axios';
17
16
  import https from 'node:https';
18
17
  const agent = new https.Agent({
@@ -8,4 +8,5 @@
8
8
  export interface IExec {
9
9
  code: number;
10
10
  data: string;
11
+ error?: string;
11
12
  }
@@ -12,7 +12,7 @@ import Location from '../../components/location.js';
12
12
  import selectRegions from '../../lib/select_regions.js';
13
13
  import selectZones from '../../lib/select_zones.js';
14
14
  import axios from 'axios';
15
- import shx from 'shelljs';
15
+ import { shx } from '../../../lib/utils.js';
16
16
  /**
17
17
  *
18
18
  * @param this
@@ -14,7 +14,7 @@ import selectFileSystemType from '../../lib/select_filesystem_type.js';
14
14
  import selectInstallationDevice from '../../lib/select_installation_device.js';
15
15
  import selectReplacedPartition from '../../lib/select_replaced_partition.js';
16
16
  import selectUserSwapChoice from '../../lib/select_user_swap_choice.js';
17
- import shx from 'shelljs';
17
+ import { shx } from '../../../lib/utils.js';
18
18
  import selectInstallationMode from '../../lib/select_installation_mode.js';
19
19
  /**
20
20
  * PARTITIONS
@@ -13,7 +13,7 @@ import getUsername from '../../lib/get_username.js';
13
13
  import getUserfullname from '../../lib/get_userfullname.js';
14
14
  import getPassword from '../../lib/get_password.js';
15
15
  import getHostname from '../../lib/get_hostname.js';
16
- import shx from 'shelljs';
16
+ import { shx } from '../../../lib/utils.js';
17
17
  /**
18
18
  * USERS
19
19
  */
@@ -36,7 +36,7 @@ export async function users() {
36
36
  }
37
37
  let hostname = this.krillConfig.hostname;
38
38
  if (hostname === '' || hostname === undefined) {
39
- hostname = shx.exec('cat /etc/hostname').trim();
39
+ hostname = shx.exec('cat /etc/hostname').stdout.trim();
40
40
  }
41
41
  let autologin = true;
42
42
  let sameUserPassword = true;
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import os from 'os';
10
10
  import fs from 'fs';
11
- import shx from 'shelljs';
11
+ import { shx } from '../../lib/utils.js';
12
12
  import axios from 'axios';
13
13
  import { SwapChoice, InstallationMode, FsType } from './krill_enums.js';
14
14
  import Keyboards from '../../classes/keyboards.js';
@@ -199,15 +199,15 @@ export default class Krill {
199
199
  generateHostname(ip, random) {
200
200
  let hostname = this.krillConfig.hostname;
201
201
  if (hostname === '') {
202
- hostname = shx.exec('cat /etc/hostname', { silent: true }).trim();
202
+ hostname = shx.exec('cat /etc/hostname', { silent: true }).stdout.trim();
203
203
  }
204
204
  if (ip) {
205
205
  hostname = 'ip-' + Utils.address().replaceAll('.', '-');
206
206
  }
207
207
  if (random) {
208
- const fl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).trim();
209
- const n = shx.exec(`tr -dc 0-9 </dev/urandom | head -c 3 ; echo ''`, { silent: true }).trim();
210
- const sl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).trim();
208
+ const fl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).stdout.trim();
209
+ const n = shx.exec(`tr -dc 0-9 </dev/urandom | head -c 3 ; echo ''`, { silent: true }).stdout.trim();
210
+ const sl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).stdout.trim();
211
211
  hostname = `${os.hostname()}-${fl}${n}${sl}`;
212
212
  }
213
213
  return hostname;
@@ -1,20 +1,8 @@
1
1
  /**
2
- * ./src/krill/modules/add-user.ts
2
+ * ./src/krill/classes/secquence.d/add-user.ts
3
3
  * penguins-eggs v.25.7.x / ecmascript 2020
4
- * author: Piero Proietti
5
- * email: piero.proietti@gmail.com
6
- * license: MIT
7
- * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ * * REFACTORED: Uses "The SysUser Master" class.
5
+ * Replaces chroot/binary dependencies with pure Node.js manipulation.
8
6
  */
9
7
  import Sequence from '../sequence.js';
10
- /**
11
- *
12
- * @param this
13
- * @param username
14
- * @param password
15
- * @param fullusername
16
- * @param roomNumber
17
- * @param workPhone
18
- * @param homePhone
19
- */
20
8
  export default function addUser(this: Sequence, username?: string, password?: string, fullusername?: string, roomNumber?: string, workPhone?: string, homePhone?: string): Promise<void>;