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
@@ -13,6 +13,7 @@ export default class Dad extends Command {
13
13
  clean: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
14
  default: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ nointeractive: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
17
  help: import("@oclif/core/interfaces").BooleanFlag<void>;
17
18
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
19
  };
@@ -18,6 +18,7 @@ export default class Dad extends Command {
18
18
  clean: Flags.boolean({ char: 'c', description: 'remove old configuration before to create' }),
19
19
  default: Flags.boolean({ char: 'd', description: 'reset to default values' }),
20
20
  file: Flags.string({ char: 'f', description: 'use a file configuration custom' }),
21
+ nointeractive: Flags.boolean({ char: 'n', description: 'no user interaction' }),
21
22
  help: Flags.help({ char: 'h' }),
22
23
  verbose: Flags.boolean({ char: 'v' })
23
24
  };
@@ -86,7 +86,7 @@ export default class ExportPkg extends Command {
86
86
  Utils.warning("manjaro PKGBUILD");
87
87
  localPath = `/home/${this.user}/penguins-packs/manjaro/penguins-eggs`;
88
88
  remotePath = this.Tu.config.remotePathPackages + "/manjaro";
89
- filter = `penguins-eggs-10.?.*-?-any.pkg.tar.*`;
89
+ filter = `penguins-eggs-10.?.*-*-any.pkg.tar.*`;
90
90
  /**
91
91
  * Arch
92
92
  */
@@ -95,7 +95,7 @@ export default class ExportPkg extends Command {
95
95
  Utils.warning("aur PKGBUILD");
96
96
  localPath = `/home/${this.user}/penguins-packs/aur/penguins-eggs`;
97
97
  remotePath = this.Tu.config.remotePathPackages + "/aur";
98
- filter = `penguins-eggs-10.?.*-?-any.pkg.tar.zst`;
98
+ filter = `penguins-eggs-10.?.*-*-any.pkg.tar.zst`;
99
99
  }
100
100
  /**
101
101
  * Debian
@@ -103,13 +103,13 @@ export default class ExportPkg extends Command {
103
103
  }
104
104
  else if (familyId === "debian") {
105
105
  Utils.warning("debian deb");
106
- localPath = `/home/${this.user}/penguins-eggs/perrisbrewery/workdir`;
106
+ localPath = `/home/${this.user}/penguins-eggs/dist`;
107
107
  remotePath = this.Tu.config.remotePathPackages + "/debs";
108
108
  let arch = Utils.uefiArch();
109
109
  if (this.all) {
110
110
  arch = '*';
111
111
  }
112
- filter = `penguins-eggs_10.?.*-?_${arch}.deb`;
112
+ filter = `penguins-eggs_10.?.*-*_${arch}.deb`;
113
113
  /**
114
114
  * fedora
115
115
  */
@@ -118,7 +118,7 @@ export default class ExportPkg extends Command {
118
118
  Utils.warning("fedora rpm packages");
119
119
  localPath = `/home/${this.user}/rpmbuild/RPMS/x86_64`;
120
120
  remotePath = this.Tu.config.remotePathPackages + "/fedora";
121
- filter = `penguins-eggs-10.?.*-?fedora.*.rpm`;
121
+ filter = `penguins-eggs-10.?.*-*fedora.*.rpm`;
122
122
  /**
123
123
  * openmamba
124
124
  */
@@ -127,7 +127,7 @@ export default class ExportPkg extends Command {
127
127
  Utils.warning("openmamba rpm packages");
128
128
  localPath = `/usr/src/RPM/RPMS/x86_64`;
129
129
  remotePath = this.Tu.config.remotePathPackages + "/openmamba";
130
- filter = `penguins-eggs-10.?.*-?mamba.*.rpm`;
130
+ filter = `penguins-eggs-10.?.*-*mamba.*.rpm`;
131
131
  /**
132
132
  * opensuse
133
133
  */
@@ -10,7 +10,8 @@ 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 fs from 'fs';
13
+ import { globSync } from 'glob';
14
+ import path from 'path';
14
15
  // pjson
15
16
  import { createRequire } from 'module';
16
17
  const require = createRequire(import.meta.url);
@@ -51,32 +52,26 @@ export default class ExportTarballs extends Command {
51
52
  const remoteMountpoint = `/tmp/eggs-${(Math.random() + 1).toString(36).slice(7)}`;
52
53
  const localPath = `/home/${this.user}/penguins-eggs/dist/`;
53
54
  const remotePath = `${this.Tu.config.remotePathPackages}/tarballs/`;
54
- const filter = `eggs-v10.?.*-*-linux-x64.tar.gz`;
55
- const tarName = `penguins-eggs-tarball-${pjson.version}-1-linux-x64.tar.gz`;
56
- // remove old tarball
57
- let cmd = `rm -f ${localPath}${tarName}`;
58
- await exec(cmd, this.echo);
59
- // rename new tarball
60
- cmd = `mv ${localPath}${filter} ${localPath}${tarName}`;
61
- await exec(cmd, this.echo);
62
- // check if new tarball exists
63
- if (!fs.existsSync(`${localPath}${tarName}`)) {
64
- console.log(`No ${tarName} exists!`);
55
+ const tarNamePattern = `penguins-eggs_${pjson.version}-*-linux-x64.tar.gz`;
56
+ const searchPattern = path.join(localPath, tarNamePattern);
57
+ const matchingFiles = globSync(searchPattern);
58
+ if (matchingFiles.length === 0) {
59
+ console.log(`No ${searchPattern} exists!`);
65
60
  console.log(`Create it using: pnpm tarballs`);
66
61
  process.exit(1);
67
62
  }
68
- cmd = `mkdir ${remoteMountpoint}\n`;
63
+ let cmd = `mkdir ${remoteMountpoint}\n`;
69
64
  cmd += `sshfs ${this.Tu.config.remoteUser}@${this.Tu.config.remoteHost}:${remotePath} ${remoteMountpoint}\n`;
70
65
  if (this.clean) {
71
- cmd += `rm -f ${remoteMountpoint}/penguins-eggs-tarball*\n`;
66
+ cmd += `rm -f ${remoteMountpoint}/${tarNamePattern}\n`;
72
67
  }
73
- cmd += `cp ${localPath}${tarName} ${remoteMountpoint}/${tarName}\n`;
68
+ cmd += `cp ${localPath}${tarNamePattern} ${remoteMountpoint}/\n`;
74
69
  cmd += 'sync\n';
75
70
  cmd += `umount ${remoteMountpoint}\n`;
76
71
  cmd += `rm -rf ${remoteMountpoint}\n`;
77
72
  if (!this.verbose) {
78
73
  if (this.clean) {
79
- console.log(`remove: ${this.Tu.config.remoteUser}@${this.Tu.config.remoteHost}:${remotePath}/penguins-eggs-tarball*`);
74
+ console.log(`remove: ${this.Tu.config.remoteUser}@${this.Tu.config.remoteHost}:${remotePath}/${tarNamePattern}`);
80
75
  }
81
76
  }
82
77
  await exec(cmd, this.echo);
@@ -8,7 +8,7 @@
8
8
  import { Command, Flags } from '@oclif/core';
9
9
  import Settings from '../classes/settings.js';
10
10
  import Utils from '../classes/utils.js';
11
- import killMeSoftly from '../krill/lib/kill_me_softly.js';
11
+ import killMeSoftly from '../lib/kill_me_softly.js';
12
12
  /**
13
13
  *
14
14
  */
@@ -15,6 +15,7 @@ export default class Love extends Command {
15
15
  static flags: {
16
16
  help: import("@oclif/core/interfaces").BooleanFlag<void>;
17
17
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ nointeractive: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
19
  };
19
20
  run(): Promise<void>;
20
21
  }
@@ -21,20 +21,34 @@ export default class Love extends Command {
21
21
  static examples = ['eggs auto'];
22
22
  static flags = {
23
23
  help: Flags.help({ char: 'h' }),
24
- verbose: Flags.boolean({ char: 'v' })
24
+ verbose: Flags.boolean({ char: 'v' }),
25
+ nointeractive: Flags.boolean({ char: 'n', description: 'no user interaction' }),
25
26
  };
26
27
  async run() {
27
28
  const { args, flags } = await this.parse(Love);
28
29
  let verbose = false;
30
+ let flagVerbose = '';
29
31
  if (flags.verbose) {
30
32
  verbose = true;
33
+ flagVerbose = '--verbose';
34
+ }
35
+ let nointeractive = false;
36
+ let flagNointeractive = '';
37
+ if (flags.nointeractive) {
38
+ nointeractive = true;
39
+ flagNointeractive = '--nointeractive';
31
40
  }
32
41
  const echo = Utils.setEcho(verbose);
33
42
  Utils.titles(this.id + ' ' + this.argv);
34
- // No sudo!
43
+ let cmdSudo = '';
35
44
  if (process.getuid && process.getuid() === 0) {
36
- Utils.warning(`You must be kind in love, please don't use sudo!`);
37
- process.exit(0);
45
+ cmdSudo = '';
46
+ }
47
+ else if (fs.existsSync('/usr/bin/sudo')) {
48
+ cmdSudo = 'sudo';
49
+ }
50
+ else if (fs.existsSync('/usr/bin/doas')) {
51
+ cmdSudo = 'doas';
38
52
  }
39
53
  let loveConf = '/etc/penguins-eggs.d/love.yaml';
40
54
  if (!fs.existsSync(loveConf)) {
@@ -44,12 +58,12 @@ export default class Love extends Command {
44
58
  console.log('The following commands will be executed:');
45
59
  console.log();
46
60
  for (const cmd of cmds) {
47
- console.log(`- ${cmd}`);
61
+ console.log(`- ${cmdSudo} ${cmd} ${flagVerbose} ${flagNointeractive}`);
48
62
  }
49
63
  console.log();
50
- if (await Utils.customConfirm()) {
64
+ if (nointeractive || await Utils.customConfirm()) {
51
65
  for (const cmd of cmds) {
52
- await exec(cmd);
66
+ await exec(`${cmdSudo} ${cmd} ${flagVerbose} ${flagNointeractive}`);
53
67
  }
54
68
  }
55
69
  else {
@@ -0,0 +1,22 @@
1
+ /**
2
+ * ./src/commands/cuckoo.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
+ import { Command } from '@oclif/core';
9
+ export default class Pods extends Command {
10
+ static args: {
11
+ distro: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
12
+ };
13
+ static description: string;
14
+ static examples: string[];
15
+ static flags: {
16
+ help: import("@oclif/core/interfaces").BooleanFlag<void>;
17
+ };
18
+ /**
19
+ *
20
+ */
21
+ run(): Promise<void>;
22
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * ./src/commands/cuckoo.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
+ import { Args, Command, Flags } from '@oclif/core';
9
+ import fs from 'fs';
10
+ import Utils from '../classes/utils.js';
11
+ import { exec } from '../lib/utils.js';
12
+ import path from 'node:path';
13
+ import { execSync } from 'node:child_process';
14
+ // _dirname
15
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
16
+ export default class Pods extends Command {
17
+ static args = {
18
+ distro: Args.string({ description: 'distro to build', name: 'distro', required: false })
19
+ };
20
+ static description = 'eggs pods: build ISOs from containers';
21
+ static examples = [
22
+ 'eggs pods archlinux',
23
+ 'eggs pods debian',
24
+ 'eggs pods ubuntu',
25
+ ];
26
+ static flags = {
27
+ help: Flags.help({ char: 'h' })
28
+ };
29
+ /**
30
+ *
31
+ */
32
+ async run() {
33
+ Utils.titles(this.id + ' ' + this.argv);
34
+ const { args, flags } = await this.parse(Pods);
35
+ if (!isPodmanInstalledSync()) {
36
+ console.log('You need to install podmand to use this command');
37
+ process.exit(0);
38
+ }
39
+ if (process.getuid && process.getuid() === 0) {
40
+ Utils.warning('You must use eggs pods without sudo');
41
+ process.exit(0);
42
+ }
43
+ // mode
44
+ let pathPods = path.resolve(__dirname, `../../pods`);
45
+ const userHome = `/home/${await Utils.getPrimaryUser()}/`;
46
+ if (Utils.isSources()) {
47
+ console.log("Using eggs pods from sources.\nThe pods directory of the source will be used ");
48
+ }
49
+ else {
50
+ console.log("Using eggs pods from package.");
51
+ if (!fs.existsSync(`${userHome}/pods`)) {
52
+ console.log(`The pods directory will be created in the user home ${userHome}, do you want to continue?`);
53
+ if (await Utils.customConfirm()) {
54
+ console.log(`Creating a pods folder under ${userHome}`);
55
+ await exec(`cp -r ${Utils.rootPenguin()}/pods ${userHome}`);
56
+ }
57
+ }
58
+ pathPods = path.resolve(`${userHome}/pods`);
59
+ }
60
+ console.log(`Using ${pathPods}`);
61
+ let distro = 'debian';
62
+ if (this.argv['0'] !== undefined) {
63
+ distro = this.argv['0'];
64
+ }
65
+ let cmd = `${pathPods}/${distro}.sh`;
66
+ if (fs.existsSync(cmd)) {
67
+ console.log(`We are building a egg from a ${distro} container`);
68
+ if (!await Utils.customConfirm()) {
69
+ process.exit(0);
70
+ }
71
+ await exec(cmd);
72
+ }
73
+ else {
74
+ console.log(`No script: ${cmd} fpr ${distro} container`);
75
+ }
76
+ }
77
+ }
78
+ /**
79
+ *
80
+ * @returns
81
+ */
82
+ function isPodmanInstalledSync() {
83
+ let podmanInstalled = false;
84
+ try {
85
+ execSync('podman --version', { stdio: 'ignore' });
86
+ podmanInstalled = true;
87
+ }
88
+ catch (error) {
89
+ console.error('Podman does not appear to be installed or is not in the PATH.\n');
90
+ }
91
+ return podmanInstalled;
92
+ }
@@ -16,6 +16,7 @@ export default class Produce extends Command {
16
16
  cryptedclone: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  excludes: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
18
  help: import("@oclif/core/interfaces").BooleanFlag<void>;
19
+ kernel: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
20
  links: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
21
  max: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
22
  noicon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -37,6 +37,7 @@ export default class Produce extends Command {
37
37
  cryptedclone: Flags.boolean({ char: 'C', description: 'crypted clone' }),
38
38
  excludes: Flags.string({ description: 'use: static, homes, home', multiple: true }),
39
39
  help: Flags.help({ char: 'h' }),
40
+ kernel: Flags.string({ char: 'k', description: 'kernel version' }),
40
41
  links: Flags.string({ description: 'desktop links', multiple: true }),
41
42
  max: Flags.boolean({ char: 'm', description: 'max compression: xz -Xbcj ...' }),
42
43
  noicon: Flags.boolean({ char: 'N', description: 'no icon eggs on desktop' }),
@@ -145,6 +146,25 @@ export default class Produce extends Command {
145
146
  const { noicon } = flags;
146
147
  // if clone or cryptedclone unsecure = true
147
148
  const unsecure = flags.unsecure || clone || cryptedclone;
149
+ let { kernel } = flags;
150
+ if (kernel === undefined) {
151
+ kernel = '';
152
+ }
153
+ if (kernel !== '') {
154
+ if (!fs.existsSync(`/usr/lib/modules/${kernel}`)) {
155
+ let kernelModules = `/usr/lib/modules/`;
156
+ if (!fs.existsSync(kernelModules)) {
157
+ kernelModules = `/lib/modules/`;
158
+ }
159
+ let kernels = fs.readdirSync(kernelModules);
160
+ console.log("modules available:");
161
+ for (const k of kernels) {
162
+ console.log(`- ${k}`);
163
+ }
164
+ console.log(`\nNo available modules for kernel version "${kernel}" in /usr/lib/modules/`);
165
+ process.exit(1);
166
+ }
167
+ }
148
168
  /**
149
169
  * theme: if not defined will use eggs
150
170
  */
@@ -190,7 +210,7 @@ export default class Produce extends Command {
190
210
  Utils.warning(message);
191
211
  }
192
212
  if (await ovary.fertilization(prefix, basename, theme, compression, !nointeractive)) {
193
- await ovary.produce(clone, cryptedclone, scriptOnly, yolkRenew, release, myAddons, myLinks, excludes, nointeractive, noicon, unsecure, verbose);
213
+ await ovary.produce(kernel, clone, cryptedclone, scriptOnly, yolkRenew, release, myAddons, myLinks, excludes, nointeractive, noicon, unsecure, verbose);
194
214
  ovary.finished(scriptOnly);
195
215
  }
196
216
  }
@@ -39,7 +39,7 @@ export default class Update extends Command {
39
39
  if (Utils.isSources()) {
40
40
  Utils.warning(`You are on penguins-eggs v. ${Utils.getPackageVersion()} from sources`);
41
41
  }
42
- else if (Utils.isDebPackage()) {
42
+ else if (Utils.isPackage()) {
43
43
  Utils.warning(`You are on eggs-${Utils.getPackageVersion()} installed as package`);
44
44
  }
45
45
  await this.chooseUpdate();
@@ -117,7 +117,7 @@ export default class Update extends Command {
117
117
  await Tu.loadSettings();
118
118
  Utils.warning('import from lan');
119
119
  if (this.distro.familyId === "debian") {
120
- const filterDeb = `penguins-eggs_10.?.*-?_${Utils.uefiArch()}.deb`;
120
+ const filterDeb = `penguins-eggs_10.?.*-*_${Utils.uefiArch()}.deb`;
121
121
  const cmd = `scp ${Tu.config.remoteUser}@${Tu.config.remoteHost}:${Tu.config.remotePathPackages}/debs/${filterDeb} /tmp`;
122
122
  await exec(cmd, { capture: true, echo: true });
123
123
  if (await Utils.customConfirm(`Want to install ${filterDeb}`)) {
package/dist/index.d.ts CHANGED
@@ -1,54 +1,8 @@
1
- import { Errors, Interfaces } from '@oclif/core';
2
- type CaptureOptions = {
3
- print?: boolean;
4
- stripAnsi?: boolean;
5
- };
6
- type CaptureResult<T> = {
7
- error?: Error & Partial<Errors.CLIError>;
8
- result?: T;
9
- stderr: string;
10
- stdout: string;
11
- };
12
1
  /**
13
- * Capture the stderr and stdout output of a function
14
- * @param fn async function to run
15
- * @param opts options
16
- * - print: Whether to print the output to the console
17
- * - stripAnsi: Whether to strip ANSI codes from the output
18
- * @returns {Promise<CaptureResult<T>>} Captured output
19
- * - error: Error object if the function throws an error
20
- * - result: Result of the function if it returns a value and succeeds
21
- * - stderr: Captured stderr output
22
- * - stdout: Captured stdout output
2
+ * ./src/index.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
23
7
  */
24
- export declare function captureOutput<T>(fn: () => Promise<unknown>, opts?: CaptureOptions): Promise<CaptureResult<T>>;
25
- /**
26
- * Capture the stderr and stdout output of a command in your CLI
27
- * @param args Command arguments, e.g. `['my:command', '--flag']` or `'my:command --flag'`
28
- * @param loadOpts options for loading oclif `Config`
29
- * @param captureOpts options for capturing the output
30
- * - print: Whether to print the output to the console
31
- * - stripAnsi: Whether to strip ANSI codes from the output
32
- * @returns {Promise<CaptureResult<T>>} Captured output
33
- * - error: Error object if the command throws an error
34
- * - result: Result of the command if it returns a value and succeeds
35
- * - stderr: Captured stderr output
36
- * - stdout: Captured stdout output
37
- */
38
- export declare function runCommand<T>(args: string | string[], loadOpts?: Interfaces.LoadOptions, captureOpts?: CaptureOptions): Promise<CaptureResult<T>>;
39
- /**
40
- * Capture the stderr and stdout output of a hook in your CLI
41
- * @param hook Hook name
42
- * @param options options to pass to the hook
43
- * @param loadOpts options for loading oclif `Config`
44
- * @param captureOpts options for capturing the output
45
- * - print: Whether to print the output to the console
46
- * - stripAnsi: Whether to strip ANSI codes from the output
47
- * @returns {Promise<CaptureResult<T>>} Captured output
48
- * - error: Error object if the hook throws an error
49
- * - result: Result of the hook if it returns a value and succeeds
50
- * - stderr: Captured stderr output
51
- * - stdout: Captured stdout output
52
- */
53
- export declare function runHook<T>(hook: string, options: Record<string, unknown>, loadOpts?: Interfaces.LoadOptions, captureOpts?: CaptureOptions): Promise<CaptureResult<T>>;
54
- export {};
8
+ export { run } from '@oclif/core';
package/dist/index.js CHANGED
@@ -1,147 +1,8 @@
1
- import { Config, Errors, run } from '@oclif/core';
2
- import makeDebug from 'debug';
3
- import { dirname } from 'node:path';
4
- const debug = makeDebug('oclif-test');
5
- function traverseFilePathUntil(filename, predicate) {
6
- let current = filename;
7
- while (!predicate(current)) {
8
- current = dirname(current);
9
- }
10
- return current;
11
- }
12
- function findRoot() {
13
- return (process.env.OCLIF_TEST_ROOT ??
14
- // eslint-disable-next-line unicorn/prefer-module
15
- Object.values(require.cache).find((m) => m?.children.includes(module))?.filename ??
16
- traverseFilePathUntil(
17
- // eslint-disable-next-line unicorn/prefer-module
18
- require.main?.path ?? module.path, (p) => !(p.includes('node_modules') || p.includes('.pnpm') || p.includes('.yarn'))));
19
- }
20
- function makeLoadOptions(loadOpts) {
21
- return loadOpts ?? { root: findRoot() };
22
- }
23
1
  /**
24
- * Split a string into an array of strings, preserving quoted substrings
25
- *
26
- * @example
27
- * splitString('foo bar --name "foo"') // ['foo bar', '--name', 'foo']
28
- * splitString('foo bar --name "foo bar"') // ['foo bar', '--name', 'foo bar']
29
- * splitString('foo bar --name="foo bar"') // ['foo bar', '--name=foo bar']
30
- * splitString('foo bar --name=foo bar') // ['foo bar', '--name=foo', 'bar']
31
- *
32
- * @param str input string
33
- * @returns array of strings with quotes removed
2
+ * ./src/index.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
34
7
  */
35
- function splitString(str) {
36
- return (str.match(/(?:[^\s"]+|"[^"]*")+/g) ?? []).map((s) => s.replaceAll(/^"|"$|(?<==)"/g, ''));
37
- }
38
- /**
39
- * Capture the stderr and stdout output of a function
40
- * @param fn async function to run
41
- * @param opts options
42
- * - print: Whether to print the output to the console
43
- * - stripAnsi: Whether to strip ANSI codes from the output
44
- * @returns {Promise<CaptureResult<T>>} Captured output
45
- * - error: Error object if the function throws an error
46
- * - result: Result of the function if it returns a value and succeeds
47
- * - stderr: Captured stderr output
48
- * - stdout: Captured stdout output
49
- */
50
- export async function captureOutput(fn, opts) {
51
- const print = opts?.print ?? false;
52
- const stripAnsi = opts?.stripAnsi ?? true;
53
- const originals = {
54
- NODE_ENV: process.env.NODE_ENV,
55
- stderr: process.stderr.write,
56
- stdout: process.stdout.write,
57
- };
58
- const output = {
59
- stderr: [],
60
- stdout: [],
61
- };
62
- //const toString = (str: Uint8Array | string): string => (stripAnsi ? ansis.strip(str.toString()) : str.toString())
63
- const toString = (str) => (stripAnsi ? str.toString() : str.toString());
64
- const getStderr = () => output.stderr.map((b) => toString(b)).join('');
65
- const getStdout = () => output.stdout.map((b) => toString(b)).join('');
66
- const mock = (std) => (str, encoding, cb) => {
67
- output[std].push(str);
68
- if (print) {
69
- if (encoding !== null && typeof encoding === 'function') {
70
- cb = encoding;
71
- encoding = undefined;
72
- }
73
- originals[std].apply(process[std], [str, encoding, cb]);
74
- }
75
- else if (typeof cb === 'function')
76
- cb();
77
- return true;
78
- };
79
- process.stdout.write = mock('stdout');
80
- process.stderr.write = mock('stderr');
81
- process.env.NODE_ENV = 'test';
82
- try {
83
- const result = await fn();
84
- return {
85
- result: result,
86
- stderr: getStderr(),
87
- stdout: getStdout(),
88
- };
89
- }
90
- catch (error) {
91
- return {
92
- ...(error instanceof Errors.CLIError && { error: { ...error, message: toString(error.message) } }),
93
- ...(error instanceof Error && { error: { ...error, message: toString(error.message) } }),
94
- stderr: getStderr(),
95
- stdout: getStdout(),
96
- };
97
- }
98
- finally {
99
- process.stderr.write = originals.stderr;
100
- process.stdout.write = originals.stdout;
101
- process.env.NODE_ENV = originals.NODE_ENV;
102
- }
103
- }
104
- /**
105
- * Capture the stderr and stdout output of a command in your CLI
106
- * @param args Command arguments, e.g. `['my:command', '--flag']` or `'my:command --flag'`
107
- * @param loadOpts options for loading oclif `Config`
108
- * @param captureOpts options for capturing the output
109
- * - print: Whether to print the output to the console
110
- * - stripAnsi: Whether to strip ANSI codes from the output
111
- * @returns {Promise<CaptureResult<T>>} Captured output
112
- * - error: Error object if the command throws an error
113
- * - result: Result of the command if it returns a value and succeeds
114
- * - stderr: Captured stderr output
115
- * - stdout: Captured stdout output
116
- */
117
- export async function runCommand(args, loadOpts, captureOpts) {
118
- const loadOptions = makeLoadOptions(loadOpts);
119
- const argsArray = splitString((Array.isArray(args) ? args : [args]).join(' '));
120
- const [id, ...rest] = argsArray;
121
- const finalArgs = id === '.' ? rest : argsArray;
122
- debug('loadOpts: %O', loadOptions);
123
- debug('args: %O', finalArgs);
124
- return captureOutput(async () => run(finalArgs, loadOptions), captureOpts);
125
- }
126
- /**
127
- * Capture the stderr and stdout output of a hook in your CLI
128
- * @param hook Hook name
129
- * @param options options to pass to the hook
130
- * @param loadOpts options for loading oclif `Config`
131
- * @param captureOpts options for capturing the output
132
- * - print: Whether to print the output to the console
133
- * - stripAnsi: Whether to strip ANSI codes from the output
134
- * @returns {Promise<CaptureResult<T>>} Captured output
135
- * - error: Error object if the hook throws an error
136
- * - result: Result of the hook if it returns a value and succeeds
137
- * - stderr: Captured stderr output
138
- * - stdout: Captured stdout output
139
- */
140
- export async function runHook(hook, options, loadOpts, captureOpts) {
141
- const loadOptions = makeLoadOptions(loadOpts);
142
- debug('loadOpts: %O', loadOptions);
143
- return captureOutput(async () => {
144
- const config = await Config.load(loadOptions);
145
- return config.runHook(hook, options);
146
- }, captureOpts);
147
- }
8
+ export { run } from '@oclif/core';
@@ -9,7 +9,7 @@
9
9
  *
10
10
  */
11
11
  export declare enum InstallationMode {
12
- Standard = "Erase disk",
12
+ EraseDisk = "Erase disk",
13
13
  Luks = "Erase disk/Encrypted",
14
14
  Replace = "Replace partition"
15
15
  }
@@ -22,3 +22,16 @@ export declare enum SwapChoice {
22
22
  Suspend = "suspend",
23
23
  File = "file"
24
24
  }
25
+ export declare enum Bios {
26
+ Legacy = "legacy",
27
+ EFI = "efi"
28
+ }
29
+ export declare enum FsType {
30
+ ext2 = "ext2",
31
+ ext3 = "ext3",
32
+ ext4 = "ext4",
33
+ btrfs = "btrfs",
34
+ xfs = "xfs",
35
+ zfs = "zfs",
36
+ ntfs = "ntfs"
37
+ }
@@ -10,7 +10,7 @@
10
10
  */
11
11
  export var InstallationMode;
12
12
  (function (InstallationMode) {
13
- InstallationMode["Standard"] = "Erase disk";
13
+ InstallationMode["EraseDisk"] = "Erase disk";
14
14
  InstallationMode["Luks"] = "Erase disk/Encrypted";
15
15
  InstallationMode["Replace"] = "Replace partition";
16
16
  })(InstallationMode || (InstallationMode = {}));
@@ -24,3 +24,18 @@ export var SwapChoice;
24
24
  SwapChoice["Suspend"] = "suspend";
25
25
  SwapChoice["File"] = "file";
26
26
  })(SwapChoice || (SwapChoice = {}));
27
+ export var Bios;
28
+ (function (Bios) {
29
+ Bios["Legacy"] = "legacy";
30
+ Bios["EFI"] = "efi";
31
+ })(Bios || (Bios = {}));
32
+ export var FsType;
33
+ (function (FsType) {
34
+ FsType["ext2"] = "ext2";
35
+ FsType["ext3"] = "ext3";
36
+ FsType["ext4"] = "ext4";
37
+ FsType["btrfs"] = "btrfs";
38
+ FsType["xfs"] = "xfs";
39
+ FsType["zfs"] = "zfs";
40
+ FsType["ntfs"] = "ntfs";
41
+ })(FsType || (FsType = {}));