penguins-eggs 9.1.30 → 9.1.35

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 (95) hide show
  1. package/README.md +59 -18
  2. package/addons/eggs/theme/applications/install-debian.desktop +2 -2
  3. package/conf/distros/buster/calamares/modules/locale.yml +3 -3
  4. package/conf/distros/rolling/calamares/modules/packages.yml +1 -0
  5. package/conf/eggs.yaml +2 -2
  6. package/conf/exclude.list +81 -96
  7. package/lib/classes/bleach.js +8 -1
  8. package/lib/classes/compressors.d.ts +7 -0
  9. package/lib/classes/compressors.js +38 -1
  10. package/lib/classes/daddy.js +6 -29
  11. package/lib/classes/distro.js +18 -4
  12. package/lib/classes/incubation/fisherman-helper/packages.js +7 -4
  13. package/lib/classes/keyboards.d.ts +10 -12
  14. package/lib/classes/keyboards.js +19 -23
  15. package/lib/classes/locales.js +15 -10
  16. package/lib/classes/ovary.js +18 -6
  17. package/lib/classes/utils.js +19 -6
  18. package/lib/commands/{install.d.ts → krill.d.ts} +1 -0
  19. package/lib/commands/{install.js → krill.js} +2 -2
  20. package/lib/commands/produce.js +8 -30
  21. package/lib/components/elements/information.js +0 -2
  22. package/lib/{classes/krill_prepare.d.ts → krill/krill-prepare.d.ts} +9 -2
  23. package/lib/{classes/krill_prepare.js → krill/krill-prepare.js} +62 -12
  24. package/lib/krill/krill-sequence.d.ts +148 -0
  25. package/lib/krill/krill-sequence.js +533 -0
  26. package/lib/krill/modules/add-user.d.ts +15 -0
  27. package/lib/krill/modules/add-user.js +41 -0
  28. package/lib/krill/modules/bootloader-config-arch.d.ts +9 -0
  29. package/lib/krill/modules/bootloader-config-arch.js +13 -0
  30. package/lib/krill/modules/bootloader-config-ubuntu.d.ts +9 -0
  31. package/lib/krill/modules/bootloader-config-ubuntu.js +93 -0
  32. package/lib/krill/modules/bootloader-config.d.ts +9 -0
  33. package/lib/krill/modules/bootloader-config.js +23 -0
  34. package/lib/krill/modules/bootloader.d.ts +10 -0
  35. package/lib/krill/modules/bootloader.js +17 -0
  36. package/lib/krill/modules/change-password.d.ts +10 -0
  37. package/lib/krill/modules/change-password.js +16 -0
  38. package/lib/krill/modules/del-live-user.d.ts +9 -0
  39. package/lib/krill/modules/del-live-user.js +37 -0
  40. package/lib/krill/modules/fstab.d.ts +9 -0
  41. package/lib/krill/modules/fstab.js +93 -0
  42. package/lib/krill/modules/grubcfg.d.ts +12 -0
  43. package/lib/krill/modules/grubcfg.js +33 -0
  44. package/lib/krill/modules/hostname.d.ts +8 -0
  45. package/lib/krill/modules/hostname.js +13 -0
  46. package/lib/krill/modules/hosts.d.ts +9 -0
  47. package/lib/krill/modules/hosts.js +30 -0
  48. package/lib/krill/modules/initramfs-cfg.d.ts +9 -0
  49. package/lib/krill/modules/initramfs-cfg.js +29 -0
  50. package/lib/krill/modules/initramfs.d.ts +8 -0
  51. package/lib/krill/modules/initramfs.js +30 -0
  52. package/lib/krill/modules/locale.d.ts +8 -0
  53. package/lib/krill/modules/locale.js +47 -0
  54. package/lib/krill/modules/l/303/262cale-cfg.d.ts +5 -0
  55. package/lib/krill/modules/l/303/262cale-cfg.js +58 -0
  56. package/lib/krill/modules/machine-id.d.ts +10 -0
  57. package/lib/krill/modules/machine-id.js +21 -0
  58. package/lib/krill/modules/mkfs.d.ts +8 -0
  59. package/lib/krill/modules/mkfs.js +33 -0
  60. package/lib/krill/modules/mount-fs.d.ts +12 -0
  61. package/lib/krill/modules/mount-fs.js +63 -0
  62. package/lib/krill/modules/mount-vfs.d.ts +12 -0
  63. package/lib/krill/modules/mount-vfs.js +40 -0
  64. package/lib/krill/modules/network-cfg.d.ts +14 -0
  65. package/lib/krill/modules/network-cfg.js +49 -0
  66. package/lib/krill/modules/partitions.d.ts +15 -0
  67. package/lib/krill/modules/partitions.js +307 -0
  68. package/lib/krill/modules/remove-installer-link.d.ts +8 -0
  69. package/lib/krill/modules/remove-installer-link.js +34 -0
  70. package/lib/krill/modules/set-keyboard.d.ts +5 -0
  71. package/lib/krill/modules/set-keyboard.js +50 -0
  72. package/lib/krill/modules/set-timezone.d.ts +9 -0
  73. package/lib/krill/modules/set-timezone.js +21 -0
  74. package/lib/krill/modules/umount.d.ts +9 -0
  75. package/lib/krill/modules/umount.js +26 -0
  76. package/lib/krill/modules/unpackfs.d.ts +8 -0
  77. package/lib/krill/modules/unpackfs.js +17 -0
  78. package/lib/lib/cli-autologin.js +3 -3
  79. package/lib/lib/select_keyboard_variant.js +1 -0
  80. package/manpages/doc/man/eggs.html +122 -90
  81. package/mkinitcpio/README.md +6 -67
  82. package/mkinitcpio/archlinux/mkinitcpio-install.conf +5 -0
  83. package/mkinitcpio/archlinux/mkinitcpio-produce.conf +13 -0
  84. package/mkinitcpio/manjaro/README.md +31 -0
  85. package/mkinitcpio/manjaro/mkinitcpio-install.conf +7 -0
  86. package/mkinitcpio/manjaro/mkinitcpio-produce.conf +7 -0
  87. package/package.json +10 -11
  88. package/scripts/_eggs +8 -8
  89. package/scripts/eggs.bash +1 -1
  90. package/scripts/mom-cli.sh +8 -8
  91. package/lib/classes/i18n.d.ts +0 -34
  92. package/lib/classes/i18n.js +0 -126
  93. package/lib/classes/krill_install.d.ts +0 -227
  94. package/lib/classes/krill_install.js +0 -1370
  95. package/mkinitcpio/manjaro/mkinitcpio.conf +0 -4
@@ -9,37 +9,35 @@ export default class Keyboard {
9
9
  options: string[];
10
10
  constructor();
11
11
  /**
12
- *
13
- * @returns
12
+ * XKBMODEL[]
14
13
  */
15
14
  getModels(): IXkbModel[];
16
15
  /**
17
- * 012345678901234567890123456789
18
- * us English (US)
16
+ * XKBLAYOUT=[]
19
17
  */
20
18
  getLayouts(): IXkbLayout[];
21
19
  /**
22
- *
20
+ * IXkbVariant[]
23
21
  */
24
22
  getVariants(layout: string): IXkbVariant[];
25
23
  /**
26
- *
24
+ * XKBOPTIONS[]
27
25
  */
28
26
  getOptions(): IXkbOption[];
29
27
  /**
30
- *
28
+ * XKBMODEL='pc105'
31
29
  */
32
- getVariant(): Promise<string>;
30
+ getModel(): Promise<string>;
33
31
  /**
34
- *
32
+ * XKBLAYOUT='us'
35
33
  */
36
34
  getLayout(): Promise<string>;
37
35
  /**
38
- *
36
+ * XKBVARIANT=''
39
37
  */
40
- getModel(): Promise<string>;
38
+ getVariant(): Promise<string>;
41
39
  /**
42
- *
40
+ * XKBOPTIONS=''
43
41
  */
44
42
  getOption(): Promise<string>;
45
43
  }
@@ -68,8 +68,7 @@ class Keyboard {
68
68
  }
69
69
  }
70
70
  /**
71
- *
72
- * @returns
71
+ * XKBMODEL[]
73
72
  */
74
73
  getModels() {
75
74
  // 0123456789012345678901234567890123456789
@@ -84,12 +83,9 @@ class Keyboard {
84
83
  return oModels;
85
84
  }
86
85
  /**
87
- * 012345678901234567890123456789
88
- * us English (US)
86
+ * XKBLAYOUT=[]
89
87
  */
90
88
  getLayouts() {
91
- // 0123456789012345678901234567890123456789
92
- // us English (US)
93
89
  const oLayouts = [];
94
90
  for (const layout of this.layouts) {
95
91
  const l = {};
@@ -100,7 +96,7 @@ class Keyboard {
100
96
  return oLayouts;
101
97
  }
102
98
  /**
103
- *
99
+ * IXkbVariant[]
104
100
  */
105
101
  getVariants(layout) {
106
102
  // 0123456789012345678901234567890123456789
@@ -118,7 +114,7 @@ class Keyboard {
118
114
  return aoVariants;
119
115
  }
120
116
  /**
121
- *
117
+ * XKBOPTIONS[]
122
118
  */
123
119
  getOptions() {
124
120
  // 0123456789012345678901234567890123456789
@@ -133,27 +129,27 @@ class Keyboard {
133
129
  return aoOptions;
134
130
  }
135
131
  /**
136
- *
132
+ * XKBMODEL='pc105'
137
133
  */
138
- async getVariant() {
134
+ async getModel() {
139
135
  const file = '/etc/default/keyboard';
140
- const cmd = `grep XKBVARIANT < ${file} | cut -f2 -d=|cut -f2 "-d\\""`;
141
- let keyboardVariant = 'pc195';
136
+ const cmd = `grep XKBMODEL < ${file} |cut -f2 -d= | cut -f2 "-d\\""`;
137
+ let keyboardModel = 'pc105';
142
138
  if (fs_1.default.existsSync(file)) {
143
139
  const result = await (0, utils_1.exec)(cmd, { capture: true, echo: false, ignore: false });
144
140
  if (result.code === 0) {
145
- keyboardVariant = result.data.trim();
141
+ keyboardModel = result.data.trim();
146
142
  }
147
143
  }
148
- return keyboardVariant;
144
+ return keyboardModel;
149
145
  }
150
146
  /**
151
- *
147
+ * XKBLAYOUT='us'
152
148
  */
153
149
  async getLayout() {
154
150
  const file = '/etc/default/keyboard';
155
151
  const cmd = `grep XKBLAYOUT < /etc/default/keyboard | cut -f2 -d= | cut -f2 "-d\\""`;
156
- let keyboardLayout = 'pc195';
152
+ let keyboardLayout = 'us';
157
153
  if (fs_1.default.existsSync(file)) {
158
154
  const result = await (0, utils_1.exec)(cmd, { capture: true, echo: false, ignore: false });
159
155
  if (result.code === 0) {
@@ -163,22 +159,22 @@ class Keyboard {
163
159
  return keyboardLayout;
164
160
  }
165
161
  /**
166
- *
162
+ * XKBVARIANT=''
167
163
  */
168
- async getModel() {
164
+ async getVariant() {
169
165
  const file = '/etc/default/keyboard';
170
- const cmd = `grep XKBMODEL < ${file} |cut -f2 -d= | cut -f2 "-d\\""`;
171
- let keyboardModel = 'pc195';
166
+ const cmd = `grep XKBVARIANT < ${file} | cut -f2 -d=|cut -f2 "-d\\""`;
167
+ let keyboardVariant = '';
172
168
  if (fs_1.default.existsSync(file)) {
173
169
  const result = await (0, utils_1.exec)(cmd, { capture: true, echo: false, ignore: false });
174
170
  if (result.code === 0) {
175
- keyboardModel = result.data.trim();
171
+ keyboardVariant = result.data.trim();
176
172
  }
177
173
  }
178
- return keyboardModel;
174
+ return keyboardVariant;
179
175
  }
180
176
  /**
181
- *
177
+ * XKBOPTIONS=''
182
178
  */
183
179
  async getOption() {
184
180
  const file = '/etc/default/keyboard';
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const utils_1 = require("../lib/utils");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
+ const distro_1 = tslib_1.__importDefault(require("./distro"));
6
7
  class Locales {
7
8
  /**
8
9
  *
9
10
  */
10
11
  async getEnabled() {
12
+ // Restituisce i locales abilitati in Debian, per manjaro quelli presenti
13
+ // in /etc/locale.gen anche se #disabilitati
11
14
  const cmd = `localectl list-locales`;
12
15
  let enabledLocales = [];
13
16
  const result = await (0, utils_1.exec)(cmd, { capture: true, echo: false, ignore: false });
@@ -23,17 +26,19 @@ class Locales {
23
26
  *
24
27
  */
25
28
  async getSupported() {
26
- const file = '/usr/share/i18n/SUPPORTED';
27
- const cmd = `cut -f1 -d.|grep UTF-0 < ${file}`;
28
- let lines = [];
29
- const retLines = [];
30
- if (fs_1.default.existsSync(file)) {
31
- lines = fs_1.default.readFileSync(file, 'utf-8').split('\n');
32
- for (const line of lines) {
33
- retLines.push(line.replace(' UTF-8', ''));
34
- }
29
+ const distro = new distro_1.default();
30
+ let supporteds = [];
31
+ if (distro.familyId === 'debian') {
32
+ supporteds = fs_1.default.readFileSync('/usr/share/i18n/SUPPORTED', 'utf-8').split('\n');
33
+ }
34
+ else if (distro.familyId === 'archlinux') {
35
+ supporteds = (await (0, utils_1.exec)('localectl list-locales', { capture: true, echo: false, ignore: false })).data.split('\n');
36
+ }
37
+ const elements = [];
38
+ for (const elem of supporteds) {
39
+ elements.push(elem.replace(' UTF-8', ''));
35
40
  }
36
- return retLines;
41
+ return elements;
37
42
  }
38
43
  /**
39
44
  *
@@ -542,6 +542,7 @@ class Ovary {
542
542
  }
543
543
  let lackVmlinuzImage = false;
544
544
  if (fs_1.default.existsSync(this.settings.kernel_image)) {
545
+ console.log('kernel image:' + this.settings.kernel_image);
545
546
  await (0, utils_1.exec)(`cp ${this.settings.kernel_image} ${this.settings.work_dir.pathIso}/live/`, this.echo);
546
547
  }
547
548
  else {
@@ -561,7 +562,12 @@ class Ovary {
561
562
  let initrdImg = utils_2.default.initrdImg();
562
563
  initrdImg = initrdImg.substring(initrdImg.lastIndexOf('/') + 1);
563
564
  utils_2.default.warning(`Creating ${initrdImg} in ${this.settings.work_dir.pathIso}/live/`);
564
- await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/manjaro/mkinitcpio.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, utils_2.default.setEcho(true));
565
+ if (this.settings.distro.distroId === 'ManjaroLinux') {
566
+ await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/manjaro/mkinitcpio-produce.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, utils_2.default.setEcho(true));
567
+ }
568
+ else if (this.settings.distro.distroId === 'Arch') {
569
+ await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/archlinux/mkinitcpio-produce.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, utils_2.default.setEcho(true));
570
+ }
565
571
  }
566
572
  /**
567
573
  * We must upgrade to initrdCreate for Debian/Ubuntu
@@ -609,7 +615,13 @@ class Ovary {
609
615
  /**
610
616
  * exclude all the accurence of cryptdisks in rc0.d, etc
611
617
  */
612
- let fexcludes = ["/boot/efi/EFI", "/etc/fstab", "/etc/mtab", "/etc/udev/rules.d/70-persistent-cd.rules", "/etc/udev/rules.d/70-persistent-net.rules"];
618
+ let fexcludes = [
619
+ "/boot/efi/EFI",
620
+ "/etc/fstab",
621
+ "/etc/mtab",
622
+ "/etc/udev/rules.d/70-persistent-cd.rules",
623
+ "/etc/udev/rules.d/70-persistent-net.rules"
624
+ ];
613
625
  for (let i in fexcludes) {
614
626
  this.addRemoveExclusion(true, fexcludes[i]);
615
627
  }
@@ -632,12 +644,12 @@ class Ovary {
632
644
  //this.addRemoveExclusion(true, '/etc/localtime')
633
645
  }
634
646
  this.addRemoveExclusion(true, this.settings.config.snapshot_dir /* .absolutePath() */);
635
- const compression = `-comp ${this.settings.config.compression}`;
636
647
  if (fs_1.default.existsSync(`${this.settings.work_dir.pathIso}/live/filesystem.squashfs`)) {
637
648
  fs_1.default.unlinkSync(`${this.settings.work_dir.pathIso}/live/filesystem.squashfs`);
638
649
  }
639
- // let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${compression} -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes} `
640
- let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${compression} -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes} `;
650
+ const compression = `-comp ${this.settings.config.compression}`;
651
+ // let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${compression} -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes}`
652
+ let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${compression} -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes}`;
641
653
  cmd = cmd.replace(/\s\s+/g, ' ');
642
654
  utils_2.default.writeX(`${this.settings.work_dir.path}mksquashfs`, cmd);
643
655
  if (!scriptOnly) {
@@ -1076,7 +1088,7 @@ class Ovary {
1076
1088
  */
1077
1089
  addRemoveExclusion(add, exclusion) {
1078
1090
  if (exclusion.startsWith('/')) {
1079
- exclusion = exclusion.slice(1); // remove / initial Non compatible with
1091
+ exclusion = exclusion.slice(1); // remove / initial Non compatible with rsync
1080
1092
  }
1081
1093
  if (add) {
1082
1094
  this.settings.session_excludes += this.settings.session_excludes === '' ? `-e '${exclusion}' ` : ` '${exclusion}' `;
@@ -18,6 +18,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
18
18
  const pacman_1 = tslib_1.__importDefault(require("./pacman"));
19
19
  // import { green, whiteBright } from 'chalk'
20
20
  const child_process_1 = require("child_process");
21
+ const distro_1 = tslib_1.__importDefault(require("./distro"));
21
22
  const pjson = require('../../package.json');
22
23
  /**
23
24
  * Utils: general porpourse utils
@@ -81,15 +82,19 @@ class Utils {
81
82
  }
82
83
  });
83
84
  }
84
- // if vmlinuz exist in /boot
85
85
  if (!fs_1.default.existsSync(vmlinuz)) {
86
+ // check if vmlinuz exist in /boot
86
87
  if (fs_1.default.existsSync('/boot' + vmlinuz)) {
87
88
  vmlinuz = '/boot' + vmlinuz;
88
89
  }
90
+ else {
91
+ vmlinuz = '/path/to/vmlinuz';
92
+ }
89
93
  }
90
- // if vmlinux don't exist
91
- if (!fs_1.default.existsSync(vmlinuz)) {
92
- vmlinuz = '/path/to/vmlinuz';
94
+ // Arch
95
+ let distro = new distro_1.default();
96
+ if (distro.distroId === 'Arch') {
97
+ vmlinuz = '/boot/vmlinuz-linux';
93
98
  }
94
99
  // btrfs
95
100
  if (vmlinuz.indexOf('@') > 0) {
@@ -121,7 +126,14 @@ class Utils {
121
126
  initrd = 'initrd';
122
127
  version = vmlinuz.substring(vmlinuz.indexOf('-'));
123
128
  }
124
- return path + initrd + version;
129
+ let distro = new distro_1.default();
130
+ if (distro.distroId === 'Arch') {
131
+ initrd = '/boot/initramfs-linux.img';
132
+ }
133
+ else {
134
+ initrd = path + initrd + version;
135
+ }
136
+ return initrd;
125
137
  }
126
138
  /**
127
139
  * Occore vedere un modo per creare machine-id dove non esiste
@@ -482,7 +494,8 @@ class Utils {
482
494
  const paths = [
483
495
  '/lib/live/mount',
484
496
  '/lib/live/mount/rootfs/filesystem.squashfs',
485
- '/live/aufs' // mx-linux
497
+ '/live/aufs',
498
+ '/run/miso/sfs/livefs' // manjaro qonos
486
499
  ];
487
500
  for (let i = 0; i < paths.length; i++) {
488
501
  if (Utils.isMountpoint(paths[i])) {
@@ -16,6 +16,7 @@ export default class Install extends Command {
16
16
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
17
17
  verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
18
  };
19
+ static aliases: string[];
19
20
  static description: string;
20
21
  static examples: string[];
21
22
  /**
@@ -10,7 +10,7 @@ const tslib_1 = require("tslib");
10
10
  const core_1 = require("@oclif/core");
11
11
  const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
12
12
  const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
13
- const krill_prepare_1 = tslib_1.__importDefault(require("../classes/krill_prepare"));
13
+ const krill_prepare_1 = tslib_1.__importDefault(require("../krill/krill-prepare"));
14
14
  const pacman_1 = tslib_1.__importDefault(require("../classes/pacman"));
15
15
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
16
16
  /**
@@ -72,6 +72,6 @@ Install.flags = {
72
72
  help: core_1.Flags.help({ char: 'h' }),
73
73
  verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
74
74
  };
75
+ Install.aliases = [`install`];
75
76
  Install.description = 'command-line system installer - the egg became a penguin!';
76
- // static aliases = ['krill']
77
77
  Install.examples = ['$ eggs install\nInstall the system using GUI or CLI installer\n'];
@@ -18,7 +18,6 @@ const config_1 = tslib_1.__importDefault(require("./config"));
18
18
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
19
19
  const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
20
20
  const node_path_1 = tslib_1.__importDefault(require("node:path"));
21
- const settings_1 = tslib_1.__importDefault(require("../classes/settings"));
22
21
  class Produce extends core_1.Command {
23
22
  async run() {
24
23
  utils_1.default.titles(this.id + ' ' + this.argv);
@@ -60,44 +59,23 @@ class Produce extends core_1.Command {
60
59
  if (flags.basename !== undefined) {
61
60
  basename = flags.basename;
62
61
  }
63
- /**
64
- * Analisi del tipo di compressione del kernel
65
- *
66
- */
67
62
  const compressors = new compressors_1.default();
68
63
  await compressors.populate();
69
- let fastest = 'gzip';
70
- if (compressors.isEnabled.zstd) {
71
- fastest = 'zstd -Xcompression-level 1 -b 262144';
72
- }
73
- else if (compressors.isEnabled.lz4) {
74
- fastest = 'lz4';
75
- }
76
- /**
77
- * jessie e stretch will use gzip for fastest
78
- */
79
- const settings = new settings_1.default();
80
- if (settings.distro.codenameLikeId === 'jessie' || settings.distro.codenameLikeId === 'stretch') {
81
- fastest = 'gzip';
82
- }
83
- let compression = ''; // se vuota, compression viene definita da loadsettings, default xz
84
- if (flags.fast) {
85
- compression = fastest;
64
+ let compression = compressors.normal();
65
+ if (flags.max) {
66
+ compression = compressors.max();
86
67
  }
87
- else if (flags.normal) {
88
- compression = 'xz';
68
+ else if (flags.fast) {
69
+ compression = compressors.fast();
89
70
  }
90
- else if (flags.max) {
91
- compression = 'xz -Xbcj x86';
71
+ const release = flags.release;
72
+ if (release) {
73
+ compression = compressors.max();
92
74
  }
93
75
  const backup = flags.backup;
94
76
  const verbose = flags.verbose;
95
77
  const scriptOnly = flags.script;
96
78
  const yolkRenew = flags.yolk;
97
- const release = flags.release;
98
- if (release) {
99
- compression = 'xz -Xbcj x86';
100
- }
101
79
  /**
102
80
  * theme: if not defined will use eggs
103
81
  */
@@ -89,8 +89,6 @@ async function information(verbose = false) {
89
89
  react_1.default.createElement(ink_1.Text, { color: "cyan" },
90
90
  settings.distro.distroLike,
91
91
  " ",
92
- settings.distro.releaseLike,
93
- " ",
94
92
  settings.distro.codenameLikeId))))));
95
93
  // render(<Distro />)
96
94
  const dependencies = await pacman_1.default.prerequisitesCheck();
@@ -1,5 +1,12 @@
1
- import Locales from './locales';
2
- import Keyboards from './keyboards';
1
+ /**
2
+ * penguins-eggs: krill
3
+ *
4
+ * author: Piero Proietti
5
+ * mail: piero.proietti@gmail.com
6
+ *
7
+ */
8
+ import Locales from '../classes/locales';
9
+ import Keyboards from '../classes/keyboards';
3
10
  import { INet } from '../interfaces';
4
11
  import { IWelcome, ILocation, IKeyboard, IPartitions, IUsers } from '../interfaces/i-krill';
5
12
  export default class Krill {
@@ -1,14 +1,42 @@
1
1
  "use strict";
2
+ /**
3
+ * penguins-eggs: krill
4
+ *
5
+ * author: Piero Proietti
6
+ * mail: piero.proietti@gmail.com
7
+ *
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  const tslib_1 = require("tslib");
11
+ /**
12
+ * Ideally, I want to respect calamares way, remplementing the same (SEMPLIFIED) steps
13
+ * for CLI
14
+ *
15
+ * Phase 1 - prepare.
16
+ * View modules are shown as UI pages, jobs from job modules
17
+ * are executed immediately in the background.
18
+ * - welcome
19
+ * - locale
20
+ * - keyboard
21
+ * - partition
22
+ * - keyboard
23
+ * - users
24
+ * - network
25
+ * - summary
26
+ */
27
+ /**
28
+ * problems:
29
+ *
30
+ */
4
31
  const react_1 = tslib_1.__importDefault(require("react"));
5
32
  const ink_1 = require("ink");
6
- const utils_1 = tslib_1.__importDefault(require("./utils"));
33
+ const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
34
+ const axios_1 = tslib_1.__importDefault(require("axios"));
7
35
  const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
8
36
  const fs_1 = tslib_1.__importDefault(require("fs"));
9
- const systemctl_1 = tslib_1.__importDefault(require("./systemctl"));
10
- const locales_1 = tslib_1.__importDefault(require("./locales"));
11
- const keyboards_1 = tslib_1.__importDefault(require("./keyboards"));
37
+ const systemctl_1 = tslib_1.__importDefault(require("../classes/systemctl"));
38
+ const locales_1 = tslib_1.__importDefault(require("../classes/locales"));
39
+ const keyboards_1 = tslib_1.__importDefault(require("../classes/keyboards"));
12
40
  // libraries
13
41
  const exec = require('../lib/utils').exec;
14
42
  const welcome_1 = tslib_1.__importDefault(require("../components/welcome"));
@@ -40,7 +68,7 @@ const get_netmask_1 = tslib_1.__importDefault(require("../lib/get_netmask"));
40
68
  const get_gateway_1 = tslib_1.__importDefault(require("../lib/get_gateway"));
41
69
  const get_domain_1 = tslib_1.__importDefault(require("../lib/get_domain"));
42
70
  const get_dns_1 = tslib_1.__importDefault(require("../lib/get_dns"));
43
- const krill_install_1 = tslib_1.__importDefault(require("./krill_install"));
71
+ const krill_sequence_1 = tslib_1.__importDefault(require("./krill-sequence"));
44
72
  class Krill {
45
73
  constructor() {
46
74
  this.locales = new locales_1.default();
@@ -78,13 +106,14 @@ class Krill {
78
106
  const oUsers = await this.users();
79
107
  const oNetwork = await this.network();
80
108
  await this.summary(oLocation, oKeyboard, oPartitions);
109
+ // installation
81
110
  await this.install(oLocation, oKeyboard, oPartitions, oUsers, oNetwork, verbose);
82
111
  }
83
112
  /**
84
113
  * WELCOME
85
114
  */
86
115
  async welcome() {
87
- let language = await this.locales.getDefault();
116
+ let language = 'en_US.UTF-8'; // await this.locales.getDefault()
88
117
  let welcomeElem;
89
118
  while (true) {
90
119
  welcomeElem = react_1.default.createElement(welcome_1.default, { language: language });
@@ -99,8 +128,23 @@ class Krill {
99
128
  * LOCATION
100
129
  */
101
130
  async location(language) {
131
+ // get timezone local
102
132
  let region = shelljs_1.default.exec('cut -f1 -d/ < /etc/timezone', { silent: true }).stdout.trim();
103
133
  let zone = shelljs_1.default.exec('cut -f2 -d/ < /etc/timezone', { silent: true }).stdout.trim();
134
+ // Try to auto-configure timezone by internet
135
+ const url = `https://geoip.kde.org/v1/calamares`;
136
+ try {
137
+ const response = await axios_1.default.get(url);
138
+ if (response.statusText === 'OK') {
139
+ const data = JSON.stringify(response.data);
140
+ const obj = JSON.parse(data);
141
+ region = obj.time_zone.substring(0, obj.time_zone.indexOf('/'));
142
+ zone = obj.time_zone.substring(obj.time_zone.indexOf('/') + 1);
143
+ }
144
+ }
145
+ catch (error) {
146
+ console.error('error: ' + error);
147
+ }
104
148
  let locationElem;
105
149
  while (true) {
106
150
  locationElem = react_1.default.createElement(location_1.default, { language: language, region: region, zone: zone });
@@ -132,11 +176,17 @@ class Krill {
132
176
  }
133
177
  else {
134
178
  keyboardModel = 'pc105';
179
+ keyboardModel = await (0, select_keyboard_model_1.default)(keyboardModel);
180
+ keyboardLayout = 'us';
181
+ keyboardLayout = await (0, select_keyboard_layout_1.default)(keyboardLayout);
182
+ keyboardVariant = '';
183
+ keyboardVariant = await (0, select_keyboard_variant_1.default)(keyboardLayout);
184
+ keyboardOption = '';
185
+ keyboardOption = await (0, select_keyboard_option_1.default)(keyboardOption);
186
+ if (keyboardModel === '') {
187
+ keyboardModel = 'pc105';
188
+ }
135
189
  }
136
- keyboardModel = await (0, select_keyboard_model_1.default)(keyboardModel);
137
- keyboardLayout = await (0, select_keyboard_layout_1.default)(keyboardLayout);
138
- keyboardVariant = await (0, select_keyboard_variant_1.default)(keyboardLayout);
139
- keyboardOption = await (0, select_keyboard_option_1.default)(keyboardOption);
140
190
  }
141
191
  return {
142
192
  keyboardModel: keyboardModel,
@@ -286,8 +336,8 @@ class Krill {
286
336
  * INSTALL
287
337
  */
288
338
  async install(location, keyboard, partitions, users, network, verbose = false) {
289
- const hatching = new krill_install_1.default(location, keyboard, partitions, users, network);
290
- hatching.install(verbose);
339
+ const sequence = new krill_sequence_1.default(location, keyboard, partitions, users, network);
340
+ sequence.install(verbose);
291
341
  }
292
342
  /**
293
343
  * return true if pv exist