penguins-eggs 9.1.31 → 9.1.37

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 (127) hide show
  1. package/README.md +61 -20
  2. package/addons/eggs/adapt/applications/eggs-adapt.desktop +0 -0
  3. package/addons/eggs/adapt/bin/adapt +0 -0
  4. package/addons/eggs/ichoice/bin/eggs-ichoice.sh +0 -0
  5. package/addons/eggs/pve/applications/eggs-pve.desktop +0 -0
  6. package/addons/eggs/rsupport/applications/eggs-rsupport.desktop +0 -0
  7. package/addons/eggs/theme/applications/install-debian.desktop +2 -2
  8. package/addons/neon/theme/applications/install-debian.desktop +0 -0
  9. package/addons/telos/theme/applications/install-debian.desktop +0 -0
  10. package/addons/ufficiozero/theme/applications/install-debian.desktop +0 -0
  11. package/addons/waydroid/theme/applications/install-debian.desktop +0 -0
  12. package/assets/calamares/install-debian +0 -0
  13. package/assets/penguins-eggs.desktop +0 -0
  14. package/assets/penguins-krill.desktop +0 -0
  15. package/assets/penguins-links-add.desktop +0 -0
  16. package/assets/penguins-live-installer.desktop +0 -0
  17. package/bin/dev +0 -0
  18. package/conf/distros/bionic/calamares/calamares-modules/after-bootloader/after-bootloader.sh +0 -0
  19. package/conf/distros/bionic/calamares/calamares-modules/before-bootloader/before-bootloader.sh +0 -0
  20. package/conf/distros/bionic/calamares/calamares-modules/before-bootloader-mkdirs/before-bootloader-mkdirs.sh +0 -0
  21. package/conf/distros/bionic/calamares/calamares-modules/bug/bug.sh +0 -0
  22. package/conf/distros/bionic/calamares/calamares-modules/grubcfg/main.py +0 -0
  23. package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
  24. package/conf/distros/buster/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +0 -0
  25. package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
  26. package/conf/distros/buster/calamares/modules/locale.yml +3 -3
  27. package/conf/distros/focal/calamares/calamares-modules/automirror/main.py +0 -0
  28. package/conf/eggs.yaml +2 -2
  29. package/conf/exclude.list +81 -96
  30. package/conf/tools.yaml +1 -1
  31. package/lib/classes/compressors.d.ts +7 -0
  32. package/lib/classes/compressors.js +38 -1
  33. package/lib/classes/daddy.js +6 -29
  34. package/lib/classes/distro.js +25 -12
  35. package/lib/classes/incubation/fisherman-helper/packages.js +6 -3
  36. package/lib/classes/keyboards.d.ts +10 -12
  37. package/lib/classes/keyboards.js +19 -23
  38. package/lib/classes/locales.js +15 -10
  39. package/lib/classes/ovary.js +53 -17
  40. package/lib/classes/utils.js +20 -6
  41. package/lib/commands/{install.d.ts → krill.d.ts} +1 -0
  42. package/lib/commands/{install.js → krill.js} +2 -2
  43. package/lib/commands/produce.js +8 -30
  44. package/lib/components/elements/information.js +0 -2
  45. package/lib/{classes/krill_prepare.d.ts → krill/krill-prepare.d.ts} +9 -2
  46. package/lib/{classes/krill_prepare.js → krill/krill-prepare.js} +62 -12
  47. package/lib/krill/krill-sequence.d.ts +148 -0
  48. package/lib/krill/krill-sequence.js +533 -0
  49. package/lib/krill/modules/add-user.d.ts +15 -0
  50. package/lib/krill/modules/add-user.js +41 -0
  51. package/lib/krill/modules/bootloader-config-arch.d.ts +9 -0
  52. package/lib/krill/modules/bootloader-config-arch.js +13 -0
  53. package/lib/krill/modules/bootloader-config-ubuntu.d.ts +9 -0
  54. package/lib/krill/modules/bootloader-config-ubuntu.js +93 -0
  55. package/lib/krill/modules/bootloader-config.d.ts +9 -0
  56. package/lib/krill/modules/bootloader-config.js +23 -0
  57. package/lib/krill/modules/bootloader.d.ts +10 -0
  58. package/lib/krill/modules/bootloader.js +43 -0
  59. package/lib/krill/modules/change-password.d.ts +10 -0
  60. package/lib/krill/modules/change-password.js +16 -0
  61. package/lib/krill/modules/del-live-user.d.ts +9 -0
  62. package/lib/krill/modules/del-live-user.js +37 -0
  63. package/lib/krill/modules/fstab.d.ts +9 -0
  64. package/lib/krill/modules/fstab.js +93 -0
  65. package/lib/krill/modules/grubcfg.d.ts +12 -0
  66. package/lib/krill/modules/grubcfg.js +33 -0
  67. package/lib/krill/modules/hostname.d.ts +8 -0
  68. package/lib/krill/modules/hostname.js +13 -0
  69. package/lib/krill/modules/hosts.d.ts +9 -0
  70. package/lib/krill/modules/hosts.js +30 -0
  71. package/lib/krill/modules/initramfs-cfg.d.ts +9 -0
  72. package/lib/krill/modules/initramfs-cfg.js +29 -0
  73. package/lib/krill/modules/initramfs.d.ts +8 -0
  74. package/lib/krill/modules/initramfs.js +42 -0
  75. package/lib/krill/modules/locale-cfg.d.ts +5 -0
  76. package/lib/krill/modules/locale-cfg.js +58 -0
  77. package/lib/krill/modules/locale.d.ts +8 -0
  78. package/lib/krill/modules/locale.js +47 -0
  79. package/lib/krill/modules/machine-id.d.ts +10 -0
  80. package/lib/krill/modules/machine-id.js +21 -0
  81. package/lib/krill/modules/mkfs.d.ts +8 -0
  82. package/lib/krill/modules/mkfs.js +33 -0
  83. package/lib/krill/modules/mount-fs.d.ts +12 -0
  84. package/lib/krill/modules/mount-fs.js +63 -0
  85. package/lib/krill/modules/mount-vfs.d.ts +12 -0
  86. package/lib/krill/modules/mount-vfs.js +40 -0
  87. package/lib/krill/modules/network-cfg.d.ts +14 -0
  88. package/lib/krill/modules/network-cfg.js +49 -0
  89. package/lib/krill/modules/partitions.d.ts +15 -0
  90. package/lib/krill/modules/partitions.js +307 -0
  91. package/lib/krill/modules/remove-installer-link.d.ts +8 -0
  92. package/lib/krill/modules/remove-installer-link.js +34 -0
  93. package/lib/krill/modules/set-keyboard.d.ts +5 -0
  94. package/lib/krill/modules/set-keyboard.js +50 -0
  95. package/lib/krill/modules/set-timezone.d.ts +9 -0
  96. package/lib/krill/modules/set-timezone.js +21 -0
  97. package/lib/krill/modules/umount.d.ts +9 -0
  98. package/lib/krill/modules/umount.js +26 -0
  99. package/lib/krill/modules/unpackfs.d.ts +8 -0
  100. package/lib/krill/modules/unpackfs.js +17 -0
  101. package/lib/lib/cli-autologin.js +3 -3
  102. package/lib/lib/select_keyboard_variant.js +1 -0
  103. package/lib/lib/utils.d.ts +27 -0
  104. package/lib/lib/utils.js +54 -19
  105. package/manpages/doc/man/eggs.html +122 -90
  106. package/mkinitcpio/README.md +8 -1
  107. package/mkinitcpio/archlinux/README.md +116 -0
  108. package/mkinitcpio/archlinux/mkinitcpio-install.conf +5 -0
  109. package/mkinitcpio/archlinux/mkinitcpio-produce.conf +13 -0
  110. package/mkinitcpio/manjaro/README.md +31 -11
  111. package/mkinitcpio/manjaro/mkinitcpio-install.conf +7 -0
  112. package/mkinitcpio/manjaro/{mkinitcpio.conf → mkinitcpio-produce.conf} +1 -1
  113. package/package.json +117 -112
  114. package/scripts/_eggs +8 -8
  115. package/scripts/bros/waydroid-helper.sh +0 -0
  116. package/scripts/eggs-adapt.sh +0 -0
  117. package/scripts/eggs.bash +1 -1
  118. package/scripts/install-eggs-ppa.sh +0 -0
  119. package/scripts/mom-cli.sh +8 -8
  120. package/scripts/pve-live.service +0 -0
  121. package/scripts/pve-live.sh +0 -0
  122. package/scripts/resy.sh +0 -0
  123. package/scripts/userexist.sh +0 -0
  124. package/lib/classes/i18n.d.ts +0 -34
  125. package/lib/classes/i18n.js +0 -126
  126. package/lib/classes/krill_install.d.ts +0 -227
  127. package/lib/classes/krill_install.js +0 -1370
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tslib_1 = require("tslib");
7
+ const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
8
+ /**
9
+ * locale
10
+ */
11
+ async function locale() {
12
+ /**
13
+ * influcence: - /etc/default/locale
14
+ * - /etc/locale.conf
15
+ * - /etc/timezone
16
+ */
17
+ let defaultLocale = 'en_US.UTF-8';
18
+ // /etc/default/locale
19
+ let file = this.installTarget + '/etc/default/locale';
20
+ let content = ``;
21
+ content += `LANG=${defaultLocale}\n`;
22
+ content += `LC_CTYPE=${defaultLocale}\n`;
23
+ content += `LC_NUMERIC=${defaultLocale}\n`;
24
+ content += `LC_TIME=${defaultLocale}\n`;
25
+ content += `LC_COLLATE=${defaultLocale}\n`;
26
+ content += `LC_MONETARY=${defaultLocale}\n`;
27
+ content += `LC_MESSAGES=${defaultLocale}\n`;
28
+ content += `LC_PAPER=${defaultLocale}\n`;
29
+ content += `LC_NAME=${defaultLocale}\n`;
30
+ content += `LC_ADDRESS=${defaultLocale}\n`;
31
+ content += `LC_TELEPHONE=${defaultLocale}\n`;
32
+ content += `LC_MEASUREMENT=${defaultLocale}\n`;
33
+ content += `LC_IDENTIFICATION=${defaultLocale}\n`;
34
+ content += `LC_ALL=${defaultLocale}\n`;
35
+ utils_1.default.write(file, content);
36
+ // /etc/locale.conf
37
+ file = this.installTarget + '/etc/locale.conf';
38
+ utils_1.default.write(file, content);
39
+ // timezone
40
+ try {
41
+ await this.setTimezone();
42
+ }
43
+ catch (error) {
44
+ await utils_1.default.pressKeyToExit(JSON.stringify(error));
45
+ }
46
+ }
47
+ exports.default = locale;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
3
+ */
4
+ import Sequence from '../krill-sequence';
5
+ /**
6
+ * On Ubuntu
7
+ * /etc/machine-id must exist to be re-created
8
+ * https://unix.stackexchange.com/questions/402999/is-it-ok-to-change-etc-machine-id
9
+ */
10
+ export default function machineId(this: Sequence): Promise<void>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tslib_1 = require("tslib");
7
+ const utils_1 = require("../../lib/utils");
8
+ const fs_1 = tslib_1.__importDefault(require("fs"));
9
+ /**
10
+ * On Ubuntu
11
+ * /etc/machine-id must exist to be re-created
12
+ * https://unix.stackexchange.com/questions/402999/is-it-ok-to-change-etc-machine-id
13
+ */
14
+ async function machineId() {
15
+ let file = `${this.installTarget}/etc/machine-id`;
16
+ if (fs_1.default.existsSync(file)) {
17
+ await (0, utils_1.exec)(`rm ${file}`, this.echo);
18
+ }
19
+ await (0, utils_1.exec)(`touch ${file}`);
20
+ }
21
+ exports.default = machineId;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
3
+ */
4
+ import Sequence from '../krill-sequence';
5
+ /**
6
+ * mkfs
7
+ */
8
+ export default function mkfs(this: Sequence): Promise<boolean>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../lib/utils");
7
+ /**
8
+ * mkfs
9
+ */
10
+ async function mkfs() {
11
+ const result = true;
12
+ if (this.efi) {
13
+ await (0, utils_1.exec)(`mkdosfs -F 32 -I ${this.devices.efi.name} ${this.toNull}`, this.echo);
14
+ }
15
+ if (this.devices.boot.name !== 'none') {
16
+ if (this.devices.boot.fsType === undefined) {
17
+ this.devices.boot.fsType = `ext2`;
18
+ this.devices.boot.mountPoint = '/boot';
19
+ }
20
+ await (0, utils_1.exec)(`mke2fs -Ft ${this.devices.boot.fsType} ${this.devices.boot.name} ${this.toNull}`, this.echo);
21
+ }
22
+ if (this.devices.root.name !== 'none') {
23
+ await (0, utils_1.exec)(`mke2fs -Ft ${this.devices.root.fsType} ${this.devices.root.name} ${this.toNull}`, this.echo);
24
+ }
25
+ if (this.devices.data.name !== 'none') {
26
+ await (0, utils_1.exec)(`mke2fs -Ft ${this.devices.data.fsType} ${this.devices.data.name} ${this.toNull}`, this.echo);
27
+ }
28
+ if (this.devices.swap.name !== 'none') {
29
+ await (0, utils_1.exec)(`mkswap ${this.devices.swap.name} ${this.toNull}`, this.echo);
30
+ }
31
+ return result;
32
+ }
33
+ exports.default = mkfs;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
3
+ */
4
+ import Sequence from '../krill-sequence';
5
+ /**
6
+ * mountFs
7
+ */
8
+ export declare function mountFs(this: Sequence): Promise<boolean>;
9
+ /**
10
+ * umountFs
11
+ */
12
+ export declare function umountFs(this: Sequence): Promise<boolean>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /**
3
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.umountFs = exports.mountFs = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const utils_1 = require("../../lib/utils");
9
+ const fs_1 = tslib_1.__importDefault(require("fs"));
10
+ /**
11
+ * mountFs
12
+ */
13
+ async function mountFs() {
14
+ if (!fs_1.default.existsSync(this.installTarget)) {
15
+ await (0, utils_1.exec)(`mkdir ${this.installTarget} ${this.toNull}`, this.echo);
16
+ }
17
+ // root
18
+ await (0, utils_1.exec)(`mount ${this.devices.root.name} ${this.installTarget}${this.devices.root.mountPoint} ${this.toNull}`, this.echo);
19
+ await (0, utils_1.exec)(`tune2fs -c 0 -i 0 ${this.devices.root.name} ${this.toNull}`, this.echo);
20
+ await (0, utils_1.exec)(`rm -rf ${this.installTarget}/lost+found ${this.toNull}`, this.echo);
21
+ // boot
22
+ if (this.devices.boot.name !== `none`) {
23
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}/boot -p ${this.toNull}`, this.echo);
24
+ await (0, utils_1.exec)(`mount ${this.devices.boot.name} ${this.installTarget}${this.devices.boot.mountPoint} ${this.toNull}`, this.echo);
25
+ await (0, utils_1.exec)(`tune2fs -c 0 -i 0 ${this.devices.boot.name} ${this.toNull}`, this.echo);
26
+ }
27
+ // data
28
+ if (this.devices.data.name !== `none`) {
29
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}${this.devices.data.mountPoint} -p ${this.toNull}`, this.echo);
30
+ await (0, utils_1.exec)(`mount ${this.devices.data.name} ${this.installTarget}${this.devices.data.mountPoint} ${this.toNull}`, this.echo);
31
+ await (0, utils_1.exec)(`tune2fs -c 0 -i 0 ${this.devices.data.name} ${this.toNull}`, this.echo);
32
+ }
33
+ // efi
34
+ if (this.efi) {
35
+ if (!fs_1.default.existsSync(this.installTarget + this.devices.efi.mountPoint)) {
36
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}${this.devices.efi.mountPoint} -p ${this.toNull}`, this.echo);
37
+ await (0, utils_1.exec)(`mount ${this.devices.efi.name} ${this.installTarget}${this.devices.efi.mountPoint} ${this.toNull}`, this.echo);
38
+ }
39
+ }
40
+ return true;
41
+ }
42
+ exports.mountFs = mountFs;
43
+ /**
44
+ * umountFs
45
+ */
46
+ async function umountFs() {
47
+ // efi
48
+ if (this.efi) {
49
+ await this.umount(this.devices.efi.name);
50
+ }
51
+ // data
52
+ if (this.devices.data.name !== `none`) {
53
+ await this.umount(this.devices.data.name);
54
+ }
55
+ // boot
56
+ if (this.devices.boot.name !== `none`) {
57
+ await this.umount(this.devices.boot.name);
58
+ }
59
+ // root
60
+ await this.umount(this.devices.root.name);
61
+ return true;
62
+ }
63
+ exports.umountFs = umountFs;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
3
+ */
4
+ import Sequence from '../krill-sequence';
5
+ /**
6
+ * mountvfs()
7
+ */
8
+ export declare function mountVfs(this: Sequence): Promise<void>;
9
+ /**
10
+ *
11
+ */
12
+ export declare function umountVfs(this: Sequence): Promise<void>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.umountVfs = exports.mountVfs = void 0;
7
+ const utils_1 = require("../../lib/utils");
8
+ /**
9
+ * mountvfs()
10
+ */
11
+ async function mountVfs() {
12
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}/dev ${this.toNull}`, this.echo);
13
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}/dev/pts ${this.toNull}`, this.echo);
14
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}/proc ${this.toNull}`, this.echo);
15
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}/sys ${this.toNull}`, this.echo);
16
+ await (0, utils_1.exec)(`mkdir ${this.installTarget}/run ${this.toNull}`, this.echo);
17
+ await (0, utils_1.exec)(`mount -o bind /dev ${this.installTarget}/dev ${this.toNull}`, this.echo);
18
+ await (0, utils_1.exec)(`mount -o bind /dev/pts ${this.installTarget}/dev/pts ${this.toNull}`, this.echo);
19
+ await (0, utils_1.exec)(`mount -o bind /proc ${this.installTarget}/proc ${this.toNull}`, this.echo);
20
+ await (0, utils_1.exec)(`mount -o bind /sys ${this.installTarget}/sys ${this.toNull}`, this.echo);
21
+ if (this.efi) {
22
+ await (0, utils_1.exec)(`mount -o bind /sys/firmware/efi/efivars ${this.installTarget}/sys/firmware/efi/efivars ${this.toNull}`, this.echo);
23
+ }
24
+ await (0, utils_1.exec)(`mount -o bind /run ${this.installTarget}/run ${this.toNull}`, this.echo);
25
+ }
26
+ exports.mountVfs = mountVfs;
27
+ /**
28
+ *
29
+ */
30
+ async function umountVfs() {
31
+ await this.umount(`${this.installTarget}/dev/pts`);
32
+ await this.umount(`${this.installTarget}/dev`);
33
+ await this.umount(`${this.installTarget}/proc`);
34
+ await this.umount(`${this.installTarget}/run`);
35
+ if (this.efi) {
36
+ await this.umount(`${this.installTarget}/sys/firmware/efi/efivars`);
37
+ }
38
+ await this.umount(`${this.installTarget}/sys`);
39
+ }
40
+ exports.umountVfs = umountVfs;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
3
+ */
4
+ import Sequence from '../krill-sequence';
5
+ /**
6
+ /**
7
+ * networkcfg
8
+ *
9
+ * we have:
10
+ * - debian: /etc/network/interface
11
+ * - ubuntu: netplan
12
+ * - manjaro: ? // ip address add 192.168.61/24 + dev enp6s18
13
+ */
14
+ export default function networkCfg(this: Sequence): Promise<void>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /**
3
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tslib_1 = require("tslib");
7
+ const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
8
+ const pacman_1 = tslib_1.__importDefault(require("../../classes/pacman"));
9
+ /**
10
+ /**
11
+ * networkcfg
12
+ *
13
+ * we have:
14
+ * - debian: /etc/network/interface
15
+ * - ubuntu: netplan
16
+ * - manjaro: ? // ip address add 192.168.61/24 + dev enp6s18
17
+ */
18
+ async function networkCfg() {
19
+ if (this.distro.familyId === 'debian') {
20
+ // if netplan, don't create entries in /etc/network/interfaces
21
+ if (!pacman_1.default.packageIsInstalled('netplan.io')) {
22
+ const file = this.installTarget + '/etc/network/interfaces';
23
+ let content = '# created by eggs\n\n';
24
+ content += 'auto lo\n';
25
+ content += 'iface lo inet loopback\n\n';
26
+ content += 'auto ' + this.network.iface + '\n';
27
+ content += 'iface ' + this.network.iface + ' inet ' + this.network.addressType + '\n';
28
+ if (this.network.addressType !== 'dhcp') {
29
+ content += ' address ' + this.network.address + '\n';
30
+ content += ' netmask ' + this.network.netmask + '\n';
31
+ content += ' gateway ' + this.network.gateway + '\n';
32
+ }
33
+ utils_1.default.write(file, content);
34
+ }
35
+ }
36
+ /**
37
+ * resolv.conf
38
+ */
39
+ if (this.network.addressType !== 'dhcp') {
40
+ const file = this.installTarget + '/etc/resolv.conf';
41
+ let content = '# created by eggs\n\n';
42
+ content += 'domain ' + this.network.domain + '\n';
43
+ for (const element of this.network.dns) {
44
+ content += 'nameserver ' + element + '\n';
45
+ }
46
+ utils_1.default.write(file, content);
47
+ }
48
+ }
49
+ exports.default = networkCfg;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
3
+ */
4
+ import Sequence from '../krill-sequence';
5
+ /**
6
+ *
7
+ * @param this
8
+ */
9
+ export default function partition(this: Sequence): Promise<boolean>;
10
+ /**
11
+ *
12
+ * @param installDevice
13
+ * @returns
14
+ */
15
+ export declare function lvmPartInfo(installDevice?: string): Promise<[string, number, number, number]>;
@@ -0,0 +1,307 @@
1
+ "use strict";
2
+ /**
3
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.lvmPartInfo = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const utils_1 = require("../../lib/utils");
9
+ const utils_2 = tslib_1.__importDefault(require("../../classes/utils"));
10
+ const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
11
+ // import React from 'react';
12
+ // import { render, RenderOptions } from 'ink'
13
+ /**
14
+ *
15
+ * @param this
16
+ */
17
+ async function partition() {
18
+ let echoYes = utils_2.default.setEcho(true);
19
+ let retVal = false;
20
+ const installDevice = this.partitions.installationDevice;
21
+ /**
22
+ * Support for NVMe
23
+ *
24
+ * /dev/sda1 = /dev/nvme0n1p1
25
+ */
26
+ let p = '';
27
+ if (installDevice.includes('nvme')) {
28
+ p = 'p';
29
+ }
30
+ const installMode = this.partitions.installationMode;
31
+ if (installMode === 'standard' && !this.efi) {
32
+ /**
33
+ * ===========================================================================================
34
+ * BIOS: working
35
+ * ===========================================================================================
36
+ */
37
+ await (0, utils_1.exec)(`parted --script ${installDevice} mklabel msdos`, this.echo);
38
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 1MiB 8192MiB`, this.echo); //dev/sda1 swap
39
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 8192MiB 100%`, this.echo); //dev/sda2 root
40
+ await (0, utils_1.exec)(`parted ${installDevice} set 1 boot on`, this.echo);
41
+ await (0, utils_1.exec)(`parted ${installDevice} set 1 esp on`, this.echo);
42
+ // SWAP
43
+ this.devices.swap.name = `${installDevice}${p}1`;
44
+ this.devices.swap.fsType = 'swap';
45
+ this.devices.swap.mountPoint = 'none';
46
+ // ROOT
47
+ this.devices.root.name = `${installDevice}${p}2`;
48
+ this.devices.root.fsType = 'ext4';
49
+ this.devices.root.mountPoint = '/';
50
+ // BOOT/DATA/EFI
51
+ this.devices.boot.name = `none`;
52
+ this.devices.data.name = `none`;
53
+ this.devices.efi.name = `none`;
54
+ retVal = true;
55
+ }
56
+ else if (installMode === 'full-encrypted' && !this.efi) {
57
+ /**
58
+ * ===========================================================================================
59
+ * BIOS: full-encrypt:
60
+ * ===========================================================================================
61
+ */
62
+ await (0, utils_1.exec)(`parted --script ${installDevice} mklabel msdos`, this.echo);
63
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 1MiB 512MiB`, this.echo); // sda1
64
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 512MiB 8704MiB`, this.echo); // sda2
65
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 8704MiB 100%`, this.echo); // sda3
66
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
67
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
68
+ // BOOT 512M
69
+ this.devices.boot.name = `${installDevice}${p}1`; // 'boot'
70
+ this.devices.boot.fsType = 'ext4';
71
+ this.devices.boot.mountPoint = '/boot';
72
+ // SWAP 8G
73
+ // this.redraw(<Install message={`Formatting LUKS ${installDevice}2`} percent={0} />)
74
+ let crytoSwap = await (0, utils_1.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}2`, echoYes);
75
+ if (crytoSwap.code !== 0) {
76
+ utils_2.default.warning(`Error: ${crytoSwap.code} ${crytoSwap.data}`);
77
+ process.exit(1);
78
+ }
79
+ // this.redraw(<Install message={`Opening ${installDevice}${p}2 as swap_crypted`} percent={0} />)
80
+ let crytoSwapOpen = await (0, utils_1.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}${p}2 swap_crypted`, echoYes);
81
+ if (crytoSwapOpen.code !== 0) {
82
+ utils_2.default.warning(`Error: ${crytoSwapOpen.code} ${crytoSwapOpen.data}`);
83
+ process.exit(1);
84
+ }
85
+ this.devices.swap.name = '/dev/mapper/swap_crypted';
86
+ this.devices.swap.cryptedFrom = `${installDevice}${p}2`;
87
+ this.devices.swap.fsType = 'swap';
88
+ this.devices.swap.mountPoint = 'none';
89
+ // ROOT
90
+ // this.redraw(<Install message={`Formatting LUKS ${installDevice}${p}3`} percent={0} />)
91
+ let crytoRoot = await (0, utils_1.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}3`, echoYes);
92
+ if (crytoRoot.code !== 0) {
93
+ utils_2.default.warning(`Error: ${crytoRoot.code} ${crytoRoot.data}`);
94
+ process.exit(1);
95
+ }
96
+ // this.redraw(<Install message={`Opening ${installDevice}${p}3 as root_crypted`} percent={0} />)
97
+ let crytoRootOpen = await (0, utils_1.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}${p}3 root_crypted`, echoYes);
98
+ if (crytoRootOpen.code !== 0) {
99
+ utils_2.default.warning(`Error: ${crytoRootOpen.code} ${crytoRootOpen.data}`);
100
+ process.exit(1);
101
+ }
102
+ this.devices.root.name = '/dev/mapper/root_crypted';
103
+ this.devices.root.cryptedFrom = `${installDevice}${p}3`;
104
+ this.devices.root.fsType = 'ext4';
105
+ this.devices.root.mountPoint = '/';
106
+ // BOOT/DATA/EFI
107
+ this.devices.data.name = `none`;
108
+ this.devices.efi.name = `none`;
109
+ retVal = true;
110
+ }
111
+ else if (installMode === 'standard' && this.efi) {
112
+ /**
113
+ * ===========================================================================================
114
+ * UEFI: working
115
+ * ===========================================================================================
116
+ */
117
+ await (0, utils_1.exec)(`parted --script ${installDevice} mklabel gpt`, this.echo);
118
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
119
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart swap linux-swap 768MiB 8960MiB`, this.echo); // sda2 swap
120
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart root ext4 8960MiB 100%`, this.echo); // sda3 root
121
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
122
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
123
+ this.devices.efi.name = `${installDevice}${p}1`;
124
+ this.devices.efi.fsType = 'F 32 -I';
125
+ this.devices.efi.mountPoint = '/boot/efi';
126
+ this.devices.boot.name = `none`;
127
+ this.devices.swap.name = `${installDevice}${p}2`;
128
+ this.devices.swap.fsType = 'swap';
129
+ this.devices.root.name = `${installDevice}${p}3`;
130
+ this.devices.root.fsType = 'ext4';
131
+ this.devices.root.mountPoint = '/';
132
+ // BOOT/DATA/EFI
133
+ this.devices.boot.name = `none`;
134
+ this.devices.data.name = `none`;
135
+ // this.devices.efi.name = `none`
136
+ retVal = true;
137
+ }
138
+ else if (installMode === 'full-encrypted' && this.efi) {
139
+ /**
140
+ * ===========================================================================================
141
+ * UEFI, full-encrypt
142
+ * ===========================================================================================
143
+ */
144
+ await (0, utils_1.exec)(`parted --script ${installDevice} mklabel gpt`, this.echo);
145
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
146
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart boot ext4 256MiB 768MiB`, this.echo); // sda2 boot
147
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart swap linux-swap 768MiB 8960MiB`, this.echo); // sda3 swap
148
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart root ext4 8960MiB 100%`, this.echo); // sda4 root
149
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
150
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
151
+ // EFI 256M
152
+ this.devices.efi.name = `${installDevice}${p}1`; // 'efi'
153
+ this.devices.efi.fsType = 'F 32 -I';
154
+ this.devices.efi.mountPoint = '/boot/efi';
155
+ // BOOT 512M
156
+ this.devices.boot.name = `${installDevice}${p}2`; // 'boot'
157
+ this.devices.boot.fsType = 'ext4';
158
+ this.devices.boot.mountPoint = '/boot';
159
+ /**
160
+ * cryptsetup return codes are:
161
+ *
162
+ * 1 wrong parameters,
163
+ * 2 no permission (bad passphrase),
164
+ * 3 out of memory,
165
+ * 4 wrong device specified,
166
+ * 5 device already exists or device is busy.
167
+ *
168
+ * sometime due scarce memory 2GB, we can have the process killed
169
+ */
170
+ // SWAP 8G
171
+ // redraw(<Install message={`Formatting LUKS ${installDevice}${p}3`} percent={0} />)
172
+ let crytoSwap = await (0, utils_1.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}3`, echoYes);
173
+ if (crytoSwap.code !== 0) {
174
+ utils_2.default.warning(`Error: ${crytoSwap.code} ${crytoSwap.data}`);
175
+ process.exit(1);
176
+ }
177
+ // this.redraw(<Install message={`Opening ${installDevice}${p}3 as swap_crypted`} percent={0} />)
178
+ let crytoSwapOpen = await (0, utils_1.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}${p}3 swap_crypted`, echoYes);
179
+ if (crytoSwapOpen.code !== 0) {
180
+ utils_2.default.warning(`Error: ${crytoSwapOpen.code} ${crytoSwapOpen.data}`);
181
+ process.exit(1);
182
+ }
183
+ this.devices.swap.name = '/dev/mapper/swap_crypted';
184
+ this.devices.swap.cryptedFrom = `${installDevice}${p}3`;
185
+ this.devices.swap.fsType = 'swap';
186
+ this.devices.swap.mountPoint = 'none';
187
+ // ROOT
188
+ // this.redraw(<Install message={`Formatting LUKS ${installDevice}${p}4`} percent={0} />)
189
+ let crytoRoot = await (0, utils_1.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}4`, echoYes);
190
+ if (crytoRoot.code !== 0) {
191
+ utils_2.default.warning(`Error: ${crytoRoot.code} ${crytoRoot.data}`);
192
+ process.exit(1);
193
+ }
194
+ // this.redraw(<Install message={`Opening ${installDevice}${p}4 as root_crypted`} percent={0} />)
195
+ let crytoRootOpen = await (0, utils_1.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}${p}4 root_crypted`, echoYes);
196
+ if (crytoRootOpen.code !== 0) {
197
+ utils_2.default.warning(`Error: ${crytoRootOpen.code} ${crytoRootOpen.data}`);
198
+ process.exit(1);
199
+ }
200
+ this.devices.root.name = '/dev/mapper/root_crypted';
201
+ this.devices.root.cryptedFrom = `${installDevice}${p}4`;
202
+ this.devices.root.fsType = 'ext4';
203
+ this.devices.root.mountPoint = '/';
204
+ // BOOT/DATA/EFI
205
+ // this.devices.boot.name = `none`
206
+ this.devices.data.name = `none`;
207
+ // this.devices.efi.name = `none`
208
+ retVal = true;
209
+ }
210
+ else if (installMode === 'lvm2' && !this.efi) {
211
+ /**
212
+ * ===========================================================================================
213
+ * PROXMOX VE: BIOS and lvm2
214
+ * ===========================================================================================
215
+ */
216
+ // Creo partizioni
217
+ await (0, utils_1.exec)(`parted --script ${installDevice} mklabel msdos`, this.echo);
218
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart primary ext2 1 512`, this.echo); // sda1
219
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext2 512 100%`, this.echo); // sda2
220
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
221
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 2 lvm on`, this.echo); // sda2
222
+ const partInfo = await lvmPartInfo(installDevice);
223
+ const lvmPartname = partInfo[0];
224
+ const lvmSwapSize = partInfo[1];
225
+ const lvmRootSize = partInfo[2];
226
+ await (0, utils_1.exec)(`pvcreate /dev/${lvmPartname}`, this.echo);
227
+ await (0, utils_1.exec)(`vgcreate pve /dev/${lvmPartname}`, this.echo);
228
+ await (0, utils_1.exec)(`vgchange -an`, this.echo);
229
+ await (0, utils_1.exec)(`lvcreate -L ${lvmSwapSize} -nswap pve`, this.echo);
230
+ await (0, utils_1.exec)(`lvcreate -L ${lvmRootSize} -nroot pve`, this.echo);
231
+ await (0, utils_1.exec)(`lvcreate -l 100%FREE -ndata pve`, this.echo);
232
+ await (0, utils_1.exec)(`vgchange -a y pve`, this.echo);
233
+ this.devices.efi.name = `none`;
234
+ this.devices.boot.name = `${installDevice}${p}1`;
235
+ this.devices.root.fsType = 'ext2';
236
+ this.devices.root.mountPoint = '/boot';
237
+ this.devices.root.name = `/dev/pve/root`;
238
+ this.devices.root.fsType = 'ext4';
239
+ this.devices.root.mountPoint = '/';
240
+ this.devices.data.name = `/dev/pve/data`;
241
+ this.devices.data.fsType = 'ext4';
242
+ this.devices.data.mountPoint = '/var/lib/vz';
243
+ this.devices.swap.name = `/dev/pve/swap`;
244
+ retVal = true;
245
+ }
246
+ else if (this.partitions.installationMode === 'lvm2' && this.efi) {
247
+ /**
248
+ * ===========================================================================================
249
+ * PROXMOX VE: lvm2 and UEFI
250
+ * ===========================================================================================
251
+ */
252
+ await (0, utils_1.exec)(`parted --script ${installDevice} mklabel gpt`, this.echo);
253
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
254
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart boot ext2 256MiB 768MiB`, this.echo); // sda2 boot
255
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart lvm ext4 768MiB 100%`, this.echo); // sda3 lmv2
256
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
257
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
258
+ await (0, utils_1.exec)(`parted --script ${installDevice} set 3 lvm on`, this.echo); // sda3
259
+ const partInfo = await lvmPartInfo(installDevice);
260
+ const lvmPartname = partInfo[0];
261
+ const lvmSwapSize = partInfo[1];
262
+ const lvmRootSize = partInfo[2];
263
+ await (0, utils_1.exec)(`pvcreate /dev/${lvmPartname}`, this.echo);
264
+ await (0, utils_1.exec)(`vgcreate pve /dev/${lvmPartname}`, this.echo);
265
+ await (0, utils_1.exec)(`vgchange -an`, this.echo);
266
+ await (0, utils_1.exec)(`lvcreate -L ${lvmSwapSize} -nswap pve`, this.echo);
267
+ await (0, utils_1.exec)(`lvcreate -L ${lvmRootSize} -nroot pve`, this.echo);
268
+ await (0, utils_1.exec)(`lvcreate -l 100%FREE -ndata pve`, this.echo);
269
+ await (0, utils_1.exec)(`vgchange -a y pve`, this.echo);
270
+ this.devices.efi.name = `${installDevice}${p}1`;
271
+ this.devices.efi.fsType = 'F 32 -I';
272
+ this.devices.efi.mountPoint = '/boot/efi';
273
+ this.devices.boot.name = `${installDevice}${p}2`;
274
+ this.devices.boot.fsType = 'ext4';
275
+ this.devices.boot.mountPoint = '/boot';
276
+ this.devices.root.name = `/dev/pve/root`;
277
+ this.devices.root.fsType = 'ext4';
278
+ this.devices.root.mountPoint = '/';
279
+ this.devices.data.name = `/dev/pve/data`;
280
+ this.devices.data.fsType = 'ext4';
281
+ this.devices.data.mountPoint = '/var/lib/vz';
282
+ this.devices.swap.name = `/dev/pve/swap`;
283
+ retVal = true;
284
+ }
285
+ return retVal;
286
+ }
287
+ exports.default = partition;
288
+ /**
289
+ *
290
+ * @param installDevice
291
+ * @returns
292
+ */
293
+ async function lvmPartInfo(installDevice = '/dev/sda') {
294
+ // Partizione LVM
295
+ const lvmPartname = shelljs_1.default.exec(`fdisk ${installDevice} -l | grep LVM | awk '{print $1}' | cut -d "/" -f3`).stdout.trim();
296
+ const lvmByteSize = Number(shelljs_1.default.exec(`cat /proc/partitions | grep ${lvmPartname}| awk '{print $3}' | grep "[0-9]"`).stdout.trim());
297
+ const lvmSize = lvmByteSize / 1024;
298
+ // La partizione di root viene posta ad 1/4 della partizione LVM, limite max 100 GB
299
+ const lvmSwapSize = 8192;
300
+ let lvmRootSize = lvmSize / 8;
301
+ if (lvmRootSize < 20480) {
302
+ lvmRootSize = 20480;
303
+ }
304
+ const lvmDataSize = lvmSize - lvmRootSize - lvmSwapSize;
305
+ return [lvmPartname, lvmSwapSize, lvmRootSize, lvmDataSize];
306
+ }
307
+ exports.lvmPartInfo = lvmPartInfo;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
3
+ */
4
+ import Sequence from '../krill-sequence';
5
+ /**
6
+ * removeInstallerLink
7
+ */
8
+ export default function removeInstallerLink(this: Sequence): Promise<void>;