penguins-eggs 10.0.30 → 10.0.31

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.
@@ -15,65 +15,56 @@ import { exec } from '../../lib/utils.js';
15
15
  */
16
16
  export default async function mKeyboard() {
17
17
  /**
18
- * influence: - /etc/default/keyboard (x11)
19
- * - /etc/vconsole.conf (console)
18
+ * influence: - /etc/default/keyboard (console)
20
19
  * - /etc/X11/xorg.conf.d/00-keyboard.conf
21
- *
22
- * Problem: Actually don't update /etc/default/keyboard (x11)
23
- * /etc/vconsole.conf is update in installed systems
20
+ * - /ext/vconsole.conf (non systemd)
24
21
  */
25
- // systemd as default
26
- let cmd = `chroot ${this.installTarget} localectl set-keymap ${this.keyboardLayout}`;
27
- if (!Utils.isSystemd()) {
28
- cmd = `chroot ${this.installTarget} setupcon ${this.toNull}`;
29
- }
30
- try {
22
+ if (this.distro.familyId === 'archlinux' || this.distro.familyId === 'debian') {
23
+ let cmd = '';
24
+ let content = '';
25
+ if (Utils.isSystemd()) {
26
+ cmd = `chroot ${this.installTarget} localectl set-keymap ${this.keyboardLayout}`;
27
+ content = '# See penguins-eggs/src/krill/modules/set-keyboard.ts\n\n';
28
+ content += "# Read and parsed by systemd-localed. It's probably wise not to edit this file\n";
29
+ content += '# manually too freely.\n';
30
+ content += 'Section "InputClass"\n';
31
+ content += ' Identifier "system-keyboard"\n';
32
+ content += ' MatchIsKeyboard "on"\n';
33
+ content += ' Option "XkbLayout" "' + this.keyboardLayout + '"\n';
34
+ content += 'EndSection\n';
35
+ if (fs.existsSync(this.installTarget + '/etc/X11/xorg.conf.d')) {
36
+ Utils.write(this.installTarget + '/etc/X11/xorg.conf.d/00-keyboard.conf', content);
37
+ }
38
+ }
39
+ else {
40
+ /**
41
+ * configuro vconsole.conf
42
+ */
43
+ cmd = `chroot ${this.installTarget} setupcon ${this.toNull}`;
44
+ content = '# See penguins-eggs/src/krill/modules/set-keyboard.ts\n\n';
45
+ content += 'KEYMAP="' + this.keyboardLayout + '"\n';
46
+ content += 'FONT=\n';
47
+ content += 'FONT_MAP=\n';
48
+ Utils.write(this.installTarget + '/etc/vconsole.conf', content);
49
+ }
31
50
  await exec(cmd, this.echo);
32
51
  }
33
- catch (error) {
34
- console.log(error);
35
- Utils.pressKeyToExit(cmd, true);
36
- }
37
- /**
38
- * this must to be not necessary but...
39
- *
40
- * force change /etc/default/keyboard (x11)
41
- * force change /etc/vconsole.conf
42
- * force change /etc/X11/xorg.conf.d/00-keyboard.conf
43
- */
44
- let content = '# KEYBOARD CONFIGURATION FILE\n\n';
45
- content += '# Consult the keyboard(5) manual page.\n\n';
46
- content += '# See penguins-eggs/src/krill/modules/m-keyboard.ts\n\n';
47
- content += 'XKBMODEL="' + this.keyboardModel + '"\n';
48
- content += 'XKBLAYOUT="' + this.keyboardLayout + '"\n';
49
- content += 'XKBVARIANT="' + this.keyboardVariant + '"\n';
50
- content += 'XKBOPTIONS=""\n';
51
- content += '\n';
52
- content += 'BACKSPACE="guess"\n';
53
- Utils.write(this.installTarget + '/etc/default/keyboard', content);
54
- /**
55
- * vconsole.conf: dovrebbe dipendere da systemd
56
- */
57
- if (Utils.isSystemd()) {
58
- content = '# See penguins-eggs/src/krill/modules/set-keyboard.ts\n\n';
59
- content += 'KEYMAP="' + this.keyboardLayout + '"\n';
60
- content += 'FONT=\n';
61
- content += 'FONT_MAP=\n';
62
- Utils.write(this.installTarget + '/etc/vconsole.conf', content);
63
- }
64
- /**
65
- * 00-keyboard.conf: dovrebbe dipendere da X
66
- */
67
- content = '# See penguins-eggs/src/krill/modules/set-keyboard.ts\n\n';
68
- content += "# Read and parsed by systemd-localed. It's probably wise not to edit this file\n";
69
- content += '# manually too freely.\n';
70
- content += 'Section "InputClass"\n';
71
- content += ' Identifier "system-keyboard"\n';
72
- content += ' MatchIsKeyboard "on"\n';
73
- content += ' Option "XkbLayout" "' + this.keyboardLayout + '"\n';
74
- content += 'EndSection\n';
75
- // Not always exist /etc/X11/xorg.conf.d
76
- if (fs.existsSync(this.installTarget + '/etc/X11/xorg.conf.d')) {
77
- Utils.write(this.installTarget + '/etc/X11/xorg.conf.d/00-keyboard.conf', content);
52
+ else if (this.distro.familyId === 'alpine') {
53
+ /**
54
+ * https://docs.alpinelinux.org/user-handbook/0.1a/Installing/manual.html
55
+ */
56
+ await exec(`chroot ${this.installTarget} setup-keymap ${this.keyboardLayout} ${this.keyboardLayout}`);
57
+ // X11 is OK for Alpine
58
+ let content = "";
59
+ content += `Section "InputClass"\n`;
60
+ content += `Identifier "system-keyboard"\n`;
61
+ content += `MatchIsKeyboard "on"\n`;
62
+ content += `Option "XkbLayout" "${this.keyboardLayout}"\n`;
63
+ content += `Option "XkbModel" "${this.keyboardModel}"\n`;
64
+ content += `EndSection\n`;
65
+ let file = "/etc/X11/xorg.conf.d/00-keyboard.conf";
66
+ if (fs.existsSync(this.installTarget + '/etc/X11/xorg.conf.d')) {
67
+ Utils.write(this.installTarget + '/etc/X11/xorg.conf.d/00-keyboard.conf', content);
68
+ }
78
69
  }
79
70
  }
@@ -7,7 +7,6 @@
7
7
  * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
8
8
  */
9
9
  import fs from 'node:fs';
10
- import Distro from '../../classes/distro.js';
11
10
  import { exec } from '../../lib/utils.js';
12
11
  /**
13
12
  * On Ubuntu
@@ -15,12 +14,13 @@ import { exec } from '../../lib/utils.js';
15
14
  * https://unix.stackexchange.com/questions/402999/is-it-ok-to-change-etc-machine-id
16
15
  */
17
16
  export default async function machineId() {
17
+ // We delete the machine-id file to force its recreation
18
18
  const file = `${this.installTarget}/etc/machine-id`;
19
19
  if (fs.existsSync(file)) {
20
20
  await exec(`rm ${file}`, this.echo);
21
21
  }
22
- const distro = new Distro();
23
- if (distro.familyId === 'alpine') {
22
+ // On Alpine, we need to create the machine-id file
23
+ if (this.distro.familyId === 'alpine') {
24
24
  await exec(`dbus-uuidgen > ${this.installTarget}/var/lib/dbus/machine-id`);
25
25
  await exec(`cp ${this.installTarget}/var/lib/dbus/machine-id ${this.installTarget}/etc/machine-id`);
26
26
  }
@@ -7,8 +7,8 @@
7
7
  * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
8
8
  */
9
9
  import { IKrillConfig } from '../interfaces/i-krill-config.js';
10
- import Locales from '../classes/locales.js';
11
10
  import Keyboards from '../classes/keyboards.js';
11
+ import Locales from '../classes/locales.js';
12
12
  import { INet } from '../interfaces/index.js';
13
13
  import { IWelcome, ILocation, IKeyboard, IPartitions, IUsers } from '../interfaces/i-krill.js';
14
14
  /**
@@ -57,14 +57,13 @@
57
57
  import os from 'os';
58
58
  import React from 'react';
59
59
  import { render } from 'ink';
60
- import Utils from '../classes/utils.js';
61
60
  import axios from 'axios';
62
61
  import shx from 'shelljs';
63
62
  import fs from 'fs';
64
- import Systemctl from '../classes/systemctl.js';
65
- import Locales from '../classes/locales.js';
66
63
  import Keyboards from '../classes/keyboards.js';
67
- import Pacman from '../classes/pacman.js';
64
+ import Locales from '../classes/locales.js';
65
+ import Systemctl from '../classes/systemctl.js';
66
+ import Utils from '../classes/utils.js';
68
67
  import Welcome from '../components/welcome.js';
69
68
  import Location from '../components/location.js';
70
69
  import Partitions from '../components/partitions.js';
@@ -195,10 +194,12 @@ export default class Krill {
195
194
  keyboardVariant: this.krillConfig.keyboardVariant,
196
195
  keyboardOption: this.krillConfig.keyboardOption
197
196
  };
198
- const driveList = [];
197
+ let driveList = [];
199
198
  drives.forEach((element) => {
200
199
  driveList.push('/dev/' + element);
201
200
  });
201
+ // Elimino i dischi zram
202
+ driveList = driveList.filter(device => !device.includes('zram'));
202
203
  let installationDevice = driveList[0];
203
204
  if (driveList.length > 1) {
204
205
  installationDevice = await selectInstallationDevice();
@@ -399,9 +400,6 @@ export default class Krill {
399
400
  installationMode = 'lvm2';
400
401
  }
401
402
  let filesystemType = 'ext4';
402
- if (Pacman.packageIsInstalled("btrfs-progs")) {
403
- filesystemType = 'btrfs';
404
- }
405
403
  let userSwapChoice = 'small';
406
404
  let partitionsElem;
407
405
  while (true) {
@@ -538,9 +536,9 @@ export default class Krill {
538
536
  */
539
537
  async summary(location, keyboard, partitions, users) {
540
538
  let summaryElem;
541
- let message = "Double check the installation disk: " + partitions.installationDevice;
539
+ let message = `Double check the installation disk: ${partitions.installationDevice}\nwill be completely erased!`;
542
540
  if (this.unattended && this.nointeractive) {
543
- message = "Unattended installation will start in 5 seconds...\npress CTRL-C to abort!";
541
+ message = `Unattended installation will start in 5 seconds...\npress CTRL-C to abort!`;
544
542
  }
545
543
  while (true) {
546
544
  summaryElem = React.createElement(Summary, { username: users.username, password: users.password, rootPassword: users.rootPassword, hostname: users.hostname, region: location.region, zone: location.zone, language: location.language, keyboardModel: keyboard.keyboardModel, keyboardLayout: keyboard.keyboardLayout, installationDevice: partitions.installationDevice, filesystemType: partitions.filesystemType, message: message });
@@ -70,7 +70,6 @@ import removeInstallerLink from './modules/remove-installer-link.js';
70
70
  import initramfsCfg from './modules/initramfs-cfg.js';
71
71
  import initramfs from './modules/initramfs.js';
72
72
  import delLiveUser from './modules/del-live-user.js';
73
- import mTimezone from './modules/m-timezone.js';
74
73
  import umount from './modules/umount.js';
75
74
  import mkfs from './modules/mkfs.js';
76
75
  import hostname from './modules/hostname.js';
@@ -103,7 +102,6 @@ export default class Sequence {
103
102
  delLiveUser: typeof delLiveUser;
104
103
  umountFs: typeof umountFs;
105
104
  umountVfs: typeof umountVfs;
106
- timezone: typeof mTimezone;
107
105
  umount: typeof umount;
108
106
  mkfs: typeof mkfs;
109
107
  hostname: typeof hostname;
@@ -13,12 +13,12 @@ import Install from '../components/install.js';
13
13
  import Finished from '../components/finished.js';
14
14
  import fs from 'fs';
15
15
  import yaml from 'js-yaml';
16
- import Utils from '../classes/utils.js';
16
+ import { installer } from '../classes/incubation/installer.js';
17
17
  import CliAutologin from '../classes/cli-autologin.js';
18
+ import Distro from '../classes/distro.js';
18
19
  import Pacman from '../classes/pacman.js';
19
- import { installer } from '../classes/incubation/installer.js';
20
+ import Utils from '../classes/utils.js';
20
21
  import Xdg from '../classes/xdg.js';
21
- import Distro from '../classes/distro.js';
22
22
  import { exec } from '../lib/utils.js';
23
23
  // import krill modules
24
24
  import partition from './modules/partition.js';
@@ -51,13 +51,13 @@ import initramfs from './modules/initramfs.js';
51
51
  import delLiveUser from './modules/del-live-user.js';
52
52
  // umount already imported
53
53
  // to order in same wat
54
- import mTimezone from './modules/m-timezone.js';
55
54
  import umount from './modules/umount.js';
56
55
  import mkfs from './modules/mkfs.js';
57
56
  import hostname from './modules/hostname.js';
58
57
  import CFS from '../classes/cfs.js';
59
58
  import Title from '../components/title.js';
60
59
  import cliCursor from 'cli-cursor';
60
+ import { spawnSync } from 'child_process';
61
61
  /**
62
62
  * hatching: installazione o cova!!!
63
63
  */
@@ -98,7 +98,6 @@ export default class Sequence {
98
98
  umountFs = umountFs;
99
99
  umountVfs = umountVfs;
100
100
  // to order in same way
101
- timezone = mTimezone;
102
101
  umount = umount;
103
102
  mkfs = mkfs;
104
103
  hostname = hostname;
@@ -154,7 +153,6 @@ export default class Sequence {
154
153
  this.devices.root = {};
155
154
  this.devices.data = {};
156
155
  this.devices.swap = {};
157
- //this.distro = new Distro(this.remix)
158
156
  this.distro = new Distro();
159
157
  this.efi = fs.existsSync('/sys/firmware/efi/efivars');
160
158
  this.luksFile = `${this.distro.liveMediumPath}live/${this.luksName}`;
@@ -356,17 +354,15 @@ export default class Sequence {
356
354
  * - autologin
357
355
  */
358
356
  if (!this.is_clone) {
359
- if (this.distro.familyId !== 'alpine') {
360
- // locale
361
- message = "Locale";
362
- percent = 0.70;
363
- try {
364
- redraw(React.createElement(Install, { message: message, percent: percent }));
365
- await this.locale();
366
- }
367
- catch (error) {
368
- await Utils.pressKeyToExit(JSON.stringify(error));
369
- }
357
+ // locale
358
+ message = "Locale";
359
+ percent = 0.70;
360
+ try {
361
+ redraw(React.createElement(Install, { message: message, percent: percent }));
362
+ await this.locale();
363
+ }
364
+ catch (error) {
365
+ await Utils.pressKeyToExit(JSON.stringify(error));
370
366
  }
371
367
  // keyboard
372
368
  message = "settings keyboard";
@@ -628,23 +624,25 @@ export default class Sequence {
628
624
  * only show the result
629
625
  */
630
626
  async finished() {
631
- await redraw(React.createElement(Finished, { installationDevice: this.partitions.installationDevice, hostName: this.users.hostname, userName: this.users.username }));
632
627
  let cmd = "reboot";
633
628
  if (this.halt) {
634
629
  cmd = "poweroff";
635
630
  }
631
+ let message = `Press a key to ${cmd}`;
632
+ if (this.unattended && this.nointeractive) {
633
+ message = `System will ${cmd} in 5 seconds...`;
634
+ }
635
+ await redraw(React.createElement(Finished, { installationDevice: this.partitions.installationDevice, hostName: this.users.hostname, userName: this.users.username }));
636
636
  if (this.unattended && this.nointeractive) {
637
- console.log(`System will ${cmd} in 5 seconds...`);
638
637
  await sleep(5000);
639
- await exec(cmd, { echo: true });
638
+ await exec(cmd, { echo: false });
640
639
  }
641
640
  else {
642
- Utils.pressKeyToExit(`Press a key to ${cmd}`);
643
- await exec(cmd, { echo: true });
641
+ spawnSync('read _ ', { shell: true, stdio: [0, 1, 2] });
642
+ await exec(cmd, { echo: false });
644
643
  }
645
644
  }
646
645
  }
647
- // const ifaces: string[] = fs.readdirSync('/sys/class/net/')
648
646
  /**
649
647
  *
650
648
  * @param elem
@@ -17,13 +17,14 @@ export default async function selectFileSystemType() {
17
17
  else {
18
18
  partitions.defaultFileSystemType = 'ext4';
19
19
  }
20
- partitions.defaultFileSystemType = 'ext4';
20
+ const choices = ['ext4'];
21
21
  if (Pacman.packageIsInstalled('btrfs-progs')) {
22
- partitions.defaultFileSystemType = 'btrfs';
22
+ choices.push('btrfs');
23
23
  }
24
+ partitions.defaultFileSystemType = 'ext4';
24
25
  const questions = [
25
26
  {
26
- choices: ['btrfs', 'ext4'],
27
+ choices: choices,
27
28
  default: partitions.defaultFileSystemType,
28
29
  message: 'Select file system tyèe',
29
30
  name: 'fileSystemChoices',
Binary file