penguins-eggs 10.0.57 → 10.0.60

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 (238) hide show
  1. package/.oclif.manifest.json +8 -1
  2. package/README.md +35 -34
  3. package/addons/eggs/theme/livecd/grub.main.full.cfg +0 -6
  4. package/assets/config.cfg +30 -0
  5. package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +8 -1
  6. package/conf/distros/buster/calamares/modules/partition.yml +159 -23
  7. package/conf/distros/buster/calamares/modules/removeuser.yml +1 -1
  8. package/conf/exclude.list.d/master.list +1 -0
  9. package/conf/krill.yaml +8 -0
  10. package/dist/classes/distro.js +1 -1
  11. package/dist/classes/incubation/incubator.d/alpine.js +1 -1
  12. package/dist/classes/incubation/incubator.d/bionic.js +1 -1
  13. package/dist/classes/incubation/incubator.d/buster.js +1 -1
  14. package/dist/classes/incubation/incubator.d/noble.js +1 -1
  15. package/dist/classes/incubation/incubator.d/openmamba.js +1 -1
  16. package/dist/classes/incubation/incubator.d/opensuse.js +1 -1
  17. package/dist/classes/incubation/incubator.d/rolling.js +1 -1
  18. package/dist/classes/ovary.d/bind-live-fs.d.ts +18 -0
  19. package/dist/classes/ovary.d/bind-live-fs.js +185 -0
  20. package/dist/classes/ovary.d/bind-vfs.d.ts +17 -0
  21. package/dist/classes/ovary.d/bind-vfs.js +37 -0
  22. package/dist/classes/ovary.d/create-xdg-autostart.d.ts +13 -0
  23. package/dist/classes/ovary.d/create-xdg-autostart.js +194 -0
  24. package/dist/classes/ovary.d/edit-live-fs.d.ts +19 -0
  25. package/dist/classes/ovary.d/edit-live-fs.js +249 -0
  26. package/dist/classes/ovary.d/fertilization.d.ts +12 -0
  27. package/dist/classes/ovary.d/fertilization.js +46 -0
  28. package/dist/classes/ovary.d/finished.d.ts +13 -0
  29. package/dist/classes/ovary.d/finished.js +41 -0
  30. package/dist/classes/ovary.d/initrd.d.ts +21 -0
  31. package/dist/classes/ovary.d/initrd.js +72 -0
  32. package/dist/classes/ovary.d/kernel-copy.d.ts +12 -0
  33. package/dist/classes/ovary.d/kernel-copy.js +36 -0
  34. package/dist/classes/ovary.d/live-create-structure.d.ts +12 -0
  35. package/dist/classes/ovary.d/live-create-structure.js +90 -0
  36. package/dist/classes/ovary.d/make-dot-disk.d.ts +12 -0
  37. package/dist/classes/ovary.d/make-dot-disk.js +40 -0
  38. package/dist/classes/ovary.d/make-efi.d.ts +12 -0
  39. package/dist/classes/ovary.d/make-efi.js +268 -0
  40. package/dist/classes/ovary.d/make-iso.d.ts +13 -0
  41. package/dist/classes/ovary.d/make-iso.js +45 -0
  42. package/dist/classes/ovary.d/make-squashfs.d.ts +18 -0
  43. package/dist/classes/ovary.d/make-squashfs.js +117 -0
  44. package/dist/classes/ovary.d/merged.d.ts +31 -0
  45. package/dist/classes/ovary.d/merged.js +87 -0
  46. package/dist/classes/ovary.d/produce.d.ts +23 -0
  47. package/dist/classes/ovary.d/produce.js +287 -0
  48. package/dist/classes/ovary.d/rexec.d.ts +13 -0
  49. package/dist/classes/ovary.d/rexec.js +34 -0
  50. package/dist/classes/ovary.d/syslinux.d.ts +12 -0
  51. package/dist/classes/ovary.d/syslinux.js +79 -0
  52. package/dist/classes/ovary.d/user-create-live.d.ts +14 -0
  53. package/dist/classes/ovary.d/user-create-live.js +86 -0
  54. package/dist/classes/ovary.d/users-remove.d.ts +9 -0
  55. package/dist/classes/ovary.d/users-remove.js +38 -0
  56. package/dist/classes/ovary.d/xorriso-commend.d.ts +14 -0
  57. package/dist/classes/ovary.d/xorriso-commend.js +119 -0
  58. package/dist/classes/ovary.d.ts +46 -167
  59. package/dist/classes/ovary.js +49 -1818
  60. package/dist/classes/pacman.d/archlinux.js +2 -1
  61. package/dist/classes/settings.d.ts +0 -1
  62. package/dist/classes/settings.js +2 -2
  63. package/dist/classes/utils.d.ts +6 -5
  64. package/dist/classes/utils.js +10 -16
  65. package/dist/commands/install.d.ts +1 -0
  66. package/dist/commands/install.js +7 -4
  67. package/dist/commands/kill.js +1 -1
  68. package/dist/commands/status.js +1 -1
  69. package/dist/commands/update.js +3 -3
  70. package/dist/interfaces/i-luks-passphrase.d.ts +11 -0
  71. package/dist/interfaces/i-luks-passphrase.js +8 -0
  72. package/dist/interfaces/index.d.ts +1 -0
  73. package/dist/{classes → krill/classes}/cfs.js +1 -1
  74. package/dist/krill/classes/krill_enums.d.ts +24 -0
  75. package/dist/krill/classes/krill_enums.js +26 -0
  76. package/dist/krill/classes/prepare.d/confirm.d.ts +5 -0
  77. package/dist/krill/classes/prepare.d/confirm.js +30 -0
  78. package/dist/krill/classes/prepare.d/keyboard.d.ts +14 -0
  79. package/dist/krill/classes/prepare.d/keyboard.js +62 -0
  80. package/dist/krill/classes/prepare.d/location.d.ts +17 -0
  81. package/dist/krill/classes/prepare.d/location.js +59 -0
  82. package/dist/krill/classes/prepare.d/network.d.ts +14 -0
  83. package/dist/krill/classes/prepare.d/network.js +68 -0
  84. package/dist/krill/classes/prepare.d/partitions.d.ts +14 -0
  85. package/dist/krill/classes/prepare.d/partitions.js +86 -0
  86. package/dist/krill/classes/prepare.d/summary.d.ts +15 -0
  87. package/dist/krill/classes/prepare.d/summary.js +69 -0
  88. package/dist/krill/classes/prepare.d/users.d.ts +6 -0
  89. package/dist/krill/classes/prepare.d/users.js +63 -0
  90. package/dist/krill/classes/prepare.d/welcome.d.ts +6 -0
  91. package/dist/krill/classes/prepare.d/welcome.js +30 -0
  92. package/dist/krill/{prepare.d.ts → classes/prepare.d.ts} +21 -35
  93. package/dist/krill/classes/prepare.js +314 -0
  94. package/dist/krill/{modules/add-user.js → classes/sequence.d/add_user.js} +1 -1
  95. package/dist/krill/{modules → classes/sequence.d}/bootloader.d.ts +1 -1
  96. package/dist/krill/{modules → classes/sequence.d}/bootloader.js +3 -3
  97. package/dist/krill/{modules/bootloader-config.js → classes/sequence.d/bootloader_config.js} +2 -2
  98. package/dist/krill/{modules/change-password.js → classes/sequence.d/change_password.js} +1 -1
  99. package/dist/krill/{modules/del-live-user.js → classes/sequence.d/del_live_user.js} +2 -2
  100. package/dist/krill/{modules → classes/sequence.d}/fstab.d.ts +1 -1
  101. package/dist/krill/{modules → classes/sequence.d}/fstab.js +75 -14
  102. package/dist/krill/{modules → classes/sequence.d}/grubcfg.d.ts +1 -1
  103. package/dist/krill/{modules → classes/sequence.d}/grubcfg.js +6 -2
  104. package/dist/krill/{modules → classes/sequence.d}/hostname.d.ts +1 -1
  105. package/dist/krill/{modules → classes/sequence.d}/initramfs.d.ts +1 -1
  106. package/dist/krill/{modules → classes/sequence.d}/initramfs.js +2 -2
  107. package/dist/krill/classes/sequence.d/initramfs_cfg.js +35 -0
  108. package/dist/krill/{modules → classes/sequence.d}/locale.d.ts +1 -1
  109. package/dist/krill/{modules → classes/sequence.d}/locale.js +2 -2
  110. package/dist/krill/{modules/m-keyboard.js → classes/sequence.d/m_keyboard.js} +2 -2
  111. package/dist/krill/{modules/machine-id.js → classes/sequence.d/machine_id.js} +2 -2
  112. package/dist/krill/{modules → classes/sequence.d}/mkfs.d.ts +1 -1
  113. package/dist/krill/{modules → classes/sequence.d}/mkfs.js +24 -2
  114. package/dist/krill/{modules/mount-fs.js → classes/sequence.d/mount_fs.js} +9 -3
  115. package/dist/krill/{modules/mount-vfs.js → classes/sequence.d/mount_vfs.js} +1 -1
  116. package/dist/krill/{modules/network-cfg.js → classes/sequence.d/network_cfg.js} +15 -6
  117. package/dist/krill/{modules → classes/sequence.d}/packages.d.ts +1 -1
  118. package/dist/krill/{modules → classes/sequence.d}/packages.js +3 -3
  119. package/dist/krill/{modules/partition.d.ts → classes/sequence.d/partition.d/bios_luks.d.ts} +4 -7
  120. package/dist/krill/classes/sequence.d/partition.d/bios_luks.js +73 -0
  121. package/dist/krill/classes/sequence.d/partition.d/bios_standard.d.ts +17 -0
  122. package/dist/krill/classes/sequence.d/partition.d/bios_standard.js +36 -0
  123. package/dist/krill/classes/sequence.d/partition.d/uefi_luks.d.ts +17 -0
  124. package/dist/krill/classes/sequence.d/partition.d/uefi_luks.js +78 -0
  125. package/dist/krill/classes/sequence.d/partition.d/uefi_standard.d.ts +10 -0
  126. package/dist/krill/classes/sequence.d/partition.d/uefi_standard.js +32 -0
  127. package/dist/krill/classes/sequence.d/partition.d.ts +14 -0
  128. package/dist/krill/classes/sequence.d/partition.js +84 -0
  129. package/dist/krill/{modules → classes/sequence.d}/umount.d.ts +1 -1
  130. package/dist/krill/{modules → classes/sequence.d}/umount.js +2 -2
  131. package/dist/krill/{modules → classes/sequence.d}/unpackfs.d.ts +1 -1
  132. package/dist/krill/{modules → classes/sequence.d}/unpackfs.js +2 -2
  133. package/dist/krill/{sequence.d.ts → classes/sequence.d.ts} +40 -58
  134. package/dist/krill/{sequence.js → classes/sequence.js} +43 -32
  135. package/dist/{components → krill/components}/information.js +3 -3
  136. package/dist/{components → krill/components}/keyboard.js +1 -1
  137. package/dist/{components → krill/components}/location.js +1 -1
  138. package/dist/{components → krill/components}/network.js +1 -1
  139. package/dist/{components → krill/components}/partitions.d.ts +4 -2
  140. package/dist/{components → krill/components}/partitions.js +36 -20
  141. package/dist/{components → krill/components}/summary.d.ts +2 -1
  142. package/dist/{components → krill/components}/summary.js +2 -6
  143. package/dist/{components → krill/components}/title.js +1 -1
  144. package/dist/{components → krill/components}/users.js +1 -1
  145. package/dist/{components → krill/components}/welcome.js +1 -1
  146. package/dist/{interfaces/i-krill.d.ts → krill/interfaces/i_krill.d.ts} +3 -1
  147. package/dist/{interfaces/i-krill-config.d.ts → krill/interfaces/i_krill_config.d.ts} +3 -1
  148. package/dist/krill/lib/get_luks_passphrase.d.ts +8 -0
  149. package/dist/krill/lib/get_luks_passphrase.js +40 -0
  150. package/dist/{lib → krill/lib}/kill_me_softly.js +2 -2
  151. package/dist/{lib → krill/lib}/select_filesystem_type.js +2 -9
  152. package/dist/{lib → krill/lib}/select_installation_device.js +10 -4
  153. package/dist/{lib → krill/lib}/select_installation_mode.d.ts +2 -1
  154. package/dist/{lib → krill/lib}/select_installation_mode.js +2 -1
  155. package/dist/{lib → krill/lib}/select_keyboard_layout.js +1 -1
  156. package/dist/{lib → krill/lib}/select_keyboard_model.js +1 -1
  157. package/dist/{lib → krill/lib}/select_keyboard_option.js +1 -1
  158. package/dist/{lib → krill/lib}/select_keyboard_variant.js +1 -1
  159. package/dist/{lib → krill/lib}/select_languages.js +1 -1
  160. package/dist/krill/lib/select_replaced_partition.d.ts +8 -0
  161. package/dist/krill/lib/select_replaced_partition.js +31 -0
  162. package/dist/{lib → krill/lib}/select_user_swap_choice.d.ts +2 -1
  163. package/dist/{lib → krill/lib}/select_user_swap_choice.js +4 -3
  164. package/dist/lib/utils.d.ts +8 -0
  165. package/dist/lib/utils.js +8 -0
  166. package/package.json +25 -24
  167. package/scripts/_eggs +7 -5
  168. package/scripts/eggs.bash +3 -3
  169. package/dist/krill/modules/initramfs-cfg.js +0 -22
  170. package/dist/krill/modules/partition.js +0 -345
  171. package/dist/krill/prepare.js +0 -626
  172. /package/dist/{index-old.d.ts → index_old.d.ts} +0 -0
  173. /package/dist/{index-old.js → index_old.js} +0 -0
  174. /package/dist/{classes → krill/classes}/cfs.d.ts +0 -0
  175. /package/dist/krill/{modules/add-user.d.ts → classes/sequence.d/add_user.d.ts} +0 -0
  176. /package/dist/krill/{modules/bootloader-config.d.ts → classes/sequence.d/bootloader_config.d.ts} +0 -0
  177. /package/dist/krill/{modules/change-password.d.ts → classes/sequence.d/change_password.d.ts} +0 -0
  178. /package/dist/krill/{modules/del-live-user.d.ts → classes/sequence.d/del_live_user.d.ts} +0 -0
  179. /package/dist/krill/{modules → classes/sequence.d}/hostname.js +0 -0
  180. /package/dist/krill/{modules/initramfs-cfg.d.ts → classes/sequence.d/initramfs_cfg.d.ts} +0 -0
  181. /package/dist/krill/{modules/locale-cfg.d.ts → classes/sequence.d/locale_cfg.d.ts} +0 -0
  182. /package/dist/krill/{modules/locale-cfg.js → classes/sequence.d/locale_cfg.js} +0 -0
  183. /package/dist/krill/{modules/m-keyboard.d.ts → classes/sequence.d/m_keyboard.d.ts} +0 -0
  184. /package/dist/krill/{modules/machine-id.d.ts → classes/sequence.d/machine_id.d.ts} +0 -0
  185. /package/dist/krill/{modules/mount-fs.d.ts → classes/sequence.d/mount_fs.d.ts} +0 -0
  186. /package/dist/krill/{modules/mount-vfs.d.ts → classes/sequence.d/mount_vfs.d.ts} +0 -0
  187. /package/dist/krill/{modules/network-cfg.d.ts → classes/sequence.d/network_cfg.d.ts} +0 -0
  188. /package/dist/krill/{modules/remove-installer-link.d.ts → classes/sequence.d/remove_installer_link.d.ts} +0 -0
  189. /package/dist/krill/{modules/remove-installer-link.js → classes/sequence.d/remove_installer_link.js} +0 -0
  190. /package/dist/{components → krill/components}/finished.d.ts +0 -0
  191. /package/dist/{components → krill/components}/finished.js +0 -0
  192. /package/dist/{components → krill/components}/information.d.ts +0 -0
  193. /package/dist/{components → krill/components}/install.d.ts +0 -0
  194. /package/dist/{components → krill/components}/install.js +0 -0
  195. /package/dist/{components → krill/components}/keyboard.d.ts +0 -0
  196. /package/dist/{components → krill/components}/location.d.ts +0 -0
  197. /package/dist/{components → krill/components}/network.d.ts +0 -0
  198. /package/dist/{components → krill/components}/steps.d.ts +0 -0
  199. /package/dist/{components → krill/components}/steps.js +0 -0
  200. /package/dist/{components → krill/components}/title.d.ts +0 -0
  201. /package/dist/{components → krill/components}/users.d.ts +0 -0
  202. /package/dist/{components → krill/components}/welcome.d.ts +0 -0
  203. /package/dist/{interfaces/i-krill.js → krill/interfaces/i_krill.js} +0 -0
  204. /package/dist/{interfaces/i-krill-config.js → krill/interfaces/i_krill_config.js} +0 -0
  205. /package/dist/{lib → krill/lib}/get_address.d.ts +0 -0
  206. /package/dist/{lib → krill/lib}/get_address.js +0 -0
  207. /package/dist/{lib → krill/lib}/get_dns.d.ts +0 -0
  208. /package/dist/{lib → krill/lib}/get_dns.js +0 -0
  209. /package/dist/{lib → krill/lib}/get_domain.d.ts +0 -0
  210. /package/dist/{lib → krill/lib}/get_domain.js +0 -0
  211. /package/dist/{lib → krill/lib}/get_gateway.d.ts +0 -0
  212. /package/dist/{lib → krill/lib}/get_gateway.js +0 -0
  213. /package/dist/{lib → krill/lib}/get_hostname.d.ts +0 -0
  214. /package/dist/{lib → krill/lib}/get_hostname.js +0 -0
  215. /package/dist/{lib → krill/lib}/get_netmask.d.ts +0 -0
  216. /package/dist/{lib → krill/lib}/get_netmask.js +0 -0
  217. /package/dist/{lib → krill/lib}/get_password.d.ts +0 -0
  218. /package/dist/{lib → krill/lib}/get_password.js +0 -0
  219. /package/dist/{lib → krill/lib}/get_userfullname.d.ts +0 -0
  220. /package/dist/{lib → krill/lib}/get_userfullname.js +0 -0
  221. /package/dist/{lib → krill/lib}/get_username.d.ts +0 -0
  222. /package/dist/{lib → krill/lib}/get_username.js +0 -0
  223. /package/dist/{lib → krill/lib}/kill_me_softly.d.ts +0 -0
  224. /package/dist/{lib → krill/lib}/select_address_type.d.ts +0 -0
  225. /package/dist/{lib → krill/lib}/select_address_type.js +0 -0
  226. /package/dist/{lib → krill/lib}/select_filesystem_type.d.ts +0 -0
  227. /package/dist/{lib → krill/lib}/select_installation_device.d.ts +0 -0
  228. /package/dist/{lib → krill/lib}/select_interface.d.ts +0 -0
  229. /package/dist/{lib → krill/lib}/select_interface.js +0 -0
  230. /package/dist/{lib → krill/lib}/select_keyboard_layout.d.ts +0 -0
  231. /package/dist/{lib → krill/lib}/select_keyboard_model.d.ts +0 -0
  232. /package/dist/{lib → krill/lib}/select_keyboard_option.d.ts +0 -0
  233. /package/dist/{lib → krill/lib}/select_keyboard_variant.d.ts +0 -0
  234. /package/dist/{lib → krill/lib}/select_languages.d.ts +0 -0
  235. /package/dist/{lib → krill/lib}/select_regions.d.ts +0 -0
  236. /package/dist/{lib → krill/lib}/select_regions.js +0 -0
  237. /package/dist/{lib → krill/lib}/select_zones.d.ts +0 -0
  238. /package/dist/{lib → krill/lib}/select_zones.js +0 -0
@@ -1,626 +0,0 @@
1
- /**
2
- * ./src/krill/prepare.tsx
3
- * penguins-eggs v.10.0.0 / ecmascript 2020
4
- * author: Piero Proietti
5
- * email: piero.proietti@gmail.com
6
- * license: MIT
7
- * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
8
- */
9
- /** OEM Installation (https://github.com/calamares/calamares/issues/871)
10
- *
11
- * Thanks to Adriaan De Groot (calamares author)
12
- *
13
- * There are two phases involved here, both of which could confusingly be called "OEM mode".
14
- * To be clear, the goal of the two phases is to end up with Linux (some distro) installed
15
- * on a piece of hardware which is passed to a customer's hands. On first boot, the
16
- * hardware is (re)configured with user input.
17
- *
18
- * Phase 1, OEM preparation
19
- * is about creating the image that will be used on first boot; so that is a normal partition,
20
- * create a standard user (e.g. "live") with autologin, populate a default desktop with a big
21
- * icon "first run this" or set up autostart of the configurator.
22
- * It is roughly a standard installation, with a little more configuration of the desktop
23
- * of the live user.
24
- *
25
- * - welcome - no need
26
- * - locale - en_US.UTF-8
27
- * - keyboard - us
28
- * - partition - ext4
29
- * - users - live/evolution root/evolution
30
- * - network - dhcp
31
- * - summary - no need
32
- *
33
- * Phase 2, "OEM user"
34
- * Set User Information on first Boot, from the "live" user, a new user for actual login --
35
- * along with whatever other configurations are wanted for the distro for the actual user.
36
- *
37
- * - welcome
38
- * - locale
39
- * - keyboard
40
- * - partition - no need
41
- * - users
42
- * - network
43
- * - summary
44
- *
45
- * Phase one should allow an empty password for the live user, and it would be useful to read
46
- * configuration from a file instead of having to go through the UI. It should install a
47
- * phase-2-configured Calamares into the target system
48
- * (either through a package, or as part of the image).
49
- *
50
- * Phase two is possible with the "dont-chroot" flag and (again) careful configuration.
51
- * Typically you drop the partition module (that was done in phase 1) and keep the users
52
- * module, add in a delete-calamares script (note to downstreams: that kind of module
53
- * should be upstreamed), add some user configuration (e.g. Plasma LNF if you're a
54
- * KDE-shipping-distro). To get all that you just need Calamares installed and the
55
- * relevant /etc/calamares/ files.
56
- */
57
- import os from 'os';
58
- import React from 'react';
59
- import { render } from 'ink';
60
- import axios from 'axios';
61
- import shx from 'shelljs';
62
- import fs from 'fs';
63
- import Keyboards from '../classes/keyboards.js';
64
- import Locales from '../classes/locales.js';
65
- import Systemctl from '../classes/systemctl.js';
66
- import Utils from '../classes/utils.js';
67
- import Welcome from '../components/welcome.js';
68
- import Location from '../components/location.js';
69
- import Partitions from '../components/partitions.js';
70
- import Keyboard from '../components/keyboard.js';
71
- import Users from '../components/users.js';
72
- import Network from '../components/network.js';
73
- import Summary from '../components/summary.js';
74
- //import Install from '../components/install.js'
75
- import selectLanguages from '../lib/select_languages.js';
76
- import selectRegions from '../lib/select_regions.js';
77
- import selectZones from '../lib/select_zones.js';
78
- import selectInstallationDevice from '../lib/select_installation_device.js';
79
- import selectInstallationMode from '../lib/select_installation_mode.js';
80
- import selectUserSwapChoice from '../lib/select_user_swap_choice.js';
81
- import selectFileSystemType from '../lib/select_filesystem_type.js';
82
- import getUsername from '../lib/get_username.js';
83
- import getUserfullname from '../lib/get_userfullname.js';
84
- import getHostname from '../lib/get_hostname.js';
85
- import getPassword from '../lib/get_password.js';
86
- import selectKeyboardModel from '../lib/select_keyboard_model.js';
87
- import selectKeyboardLayout from '../lib/select_keyboard_layout.js';
88
- import selectKeyboardVariant from '../lib/select_keyboard_variant.js';
89
- import selectKeyboardOption from '../lib/select_keyboard_option.js';
90
- import selectInterface from '../lib/select_interface.js';
91
- import selectAddressType from '../lib/select_address_type.js';
92
- import getAddress from '../lib/get_address.js';
93
- import getNetmask from '../lib/get_netmask.js';
94
- import getGateway from '../lib/get_gateway.js';
95
- import getDomain from '../lib/get_domain.js';
96
- import getDns from '../lib/get_dns.js';
97
- import Sequence from './sequence.js';
98
- const config_file = '/etc/penguins-eggs.d/krill.yaml';
99
- /**
100
- *
101
- */
102
- export default class Krill {
103
- krillConfig = {};
104
- locales = new Locales();
105
- keyboards = new Keyboards();
106
- unattended = false;
107
- nointeractive = false;
108
- chroot = false;
109
- halt = false;
110
- /**
111
- * constructor
112
- * @param unattended
113
- * @param nointeractive
114
- * @param halt
115
- */
116
- constructor(unattended = false, nointeractive = false, halt = false, chroot = false) {
117
- this.unattended = unattended;
118
- this.nointeractive = nointeractive;
119
- this.chroot = chroot;
120
- this.halt = halt;
121
- }
122
- /**
123
- *
124
- * @param krillConfig
125
- * @param ip
126
- * @param random
127
- * @param domain
128
- * @param suspend
129
- * @param small
130
- * @param none
131
- * @param cryped
132
- * @param pve
133
- * @param verbose
134
- */
135
- async prepare(krillConfig = {}, ip = false, random = false, domain = '', suspend = false, small = false, none = false, cryped = false, pve = false, btrfs = false, verbose = false) {
136
- /**
137
- * Check for disk presence
138
- */
139
- const drives = shx.exec('lsblk |grep disk|cut -f 1 "-d "', { silent: true }).stdout.trim().split('\n');
140
- if (drives[0] === '') {
141
- await Utils.pressKeyToExit(`No disk to install the system in this machine.\nkrill installer refuses to continue`);
142
- }
143
- /**
144
- * check for lvm2
145
- */
146
- if (await this.pvExist()) {
147
- await Utils.pressKeyToExit(`There is a lvm2 volume in the system, remove it manually before installation.\nkrill installer refuses to continue`);
148
- process.exit();
149
- }
150
- /**
151
- * stop udisks2.service
152
- */
153
- const systemdCtl = new Systemctl(verbose);
154
- if (await systemdCtl.isActive('udisks2.service')) {
155
- await systemdCtl.stop('udisks2.service');
156
- }
157
- let oWelcome = {};
158
- let oLocation = {};
159
- let oKeyboard = {};
160
- let oPartitions = {};
161
- let oUsers = {};
162
- let oNetwork = {};
163
- /**
164
- * load default values
165
- */
166
- if (!fs.existsSync(config_file)) {
167
- console.log(`cannot find configuration file ${config_file},`);
168
- process.exit(1);
169
- }
170
- this.krillConfig = krillConfig;
171
- oWelcome = { language: this.krillConfig.language };
172
- // Try to auto-configure timezone by internet
173
- const url = `https://geoip.kde.org/v1/calamares`;
174
- try {
175
- const response = await axios.get(url);
176
- if (response.statusText === 'OK') {
177
- const data = JSON.stringify(response.data);
178
- const obj = JSON.parse(data);
179
- this.krillConfig.region = obj.time_zone.substring(0, obj.time_zone.indexOf('/'));
180
- this.krillConfig.zone = obj.time_zone.substring(obj.time_zone.indexOf('/') + 1);
181
- }
182
- }
183
- catch (error) {
184
- console.error('error: ' + error);
185
- }
186
- oLocation = {
187
- language: this.krillConfig.language,
188
- region: this.krillConfig.region,
189
- zone: this.krillConfig.zone
190
- };
191
- oKeyboard = {
192
- keyboardModel: this.krillConfig.keyboardModel,
193
- keyboardLayout: this.krillConfig.keyboardLayout,
194
- keyboardVariant: this.krillConfig.keyboardVariant,
195
- keyboardOption: this.krillConfig.keyboardOption
196
- };
197
- let driveList = [];
198
- drives.forEach((element) => {
199
- driveList.push('/dev/' + element);
200
- });
201
- // Elimino i dischi zram
202
- driveList = driveList.filter(device => !device.includes('zram'));
203
- let installationDevice = driveList[0];
204
- if (driveList.length > 1) {
205
- installationDevice = await selectInstallationDevice();
206
- }
207
- oPartitions = {
208
- installationDevice: installationDevice,
209
- installationMode: this.krillConfig.installationMode,
210
- filesystemType: this.krillConfig.filesystemType,
211
- userSwapChoice: this.krillConfig.userSwapChoice
212
- };
213
- if (btrfs) {
214
- oPartitions.filesystemType = 'btrfs';
215
- }
216
- if (suspend) {
217
- oPartitions.userSwapChoice = 'suspend';
218
- }
219
- else if (small) {
220
- oPartitions.userSwapChoice = 'small';
221
- }
222
- else if (none) {
223
- oPartitions.userSwapChoice = 'none';
224
- }
225
- let hostname = this.krillConfig.hostname;
226
- if (hostname === '') {
227
- hostname = shx.exec('cat /etc/hostname', { silent: true }).trim();
228
- }
229
- if (ip) {
230
- hostname = 'ip-' + Utils.address().replaceAll('.', '-');
231
- }
232
- if (random) {
233
- const fl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).trim();
234
- const n = shx.exec(`tr -dc 0-9 </dev/urandom | head -c 3 ; echo ''`, { silent: true }).trim();
235
- const sl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).trim();
236
- hostname = `${os.hostname()}-${fl}${n}${sl}`;
237
- }
238
- oUsers = {
239
- username: this.krillConfig.name,
240
- fullname: this.krillConfig.fullname,
241
- password: this.krillConfig.password,
242
- rootPassword: this.krillConfig.rootPassword,
243
- autologin: this.krillConfig.autologin,
244
- hostname: hostname
245
- };
246
- oNetwork =
247
- {
248
- iface: await Utils.iface(),
249
- addressType: this.krillConfig.addressType,
250
- address: Utils.address(),
251
- netmask: Utils.netmask(),
252
- gateway: Utils.gateway(),
253
- dns: Utils.getDns(),
254
- domain: Utils.getDomain()
255
- };
256
- /**
257
- * interactive
258
- */
259
- if (!this.unattended) {
260
- oWelcome = await this.welcome();
261
- oLocation = await this.location(oWelcome.language);
262
- //let kl = oWelcome.language.substring(oWelcome.language.indexOf('_'),2).toLowerCase()
263
- oKeyboard = await this.keyboard();
264
- oPartitions = await this.partitions(installationDevice, cryped, pve, btrfs);
265
- oUsers = await this.users();
266
- oNetwork = await this.network();
267
- }
268
- await this.summary(oLocation, oKeyboard, oPartitions, oUsers);
269
- /**
270
- * INSTALL
271
- */
272
- const sequence = new Sequence(oLocation, oKeyboard, oPartitions, oUsers, oNetwork);
273
- await sequence.start(domain, this.unattended, this.nointeractive, this.chroot, this.halt, verbose);
274
- }
275
- /**
276
- * WELCOME
277
- */
278
- async welcome() {
279
- let language = this.krillConfig.language;
280
- if (language === '' || language === undefined) {
281
- language = await this.locales.getDefault(); // 'en_US.UTF-8'
282
- }
283
- let welcomeElem;
284
- while (true) {
285
- welcomeElem = React.createElement(Welcome, { language: language });
286
- if (await confirm(welcomeElem, "Confirm Welcome datas?")) {
287
- break;
288
- }
289
- language = await selectLanguages(language);
290
- }
291
- return { language: language };
292
- }
293
- /**
294
- * LOCATION
295
- */
296
- async location(language) {
297
- let region = this.krillConfig.region;
298
- if (region === '' || region === undefined) {
299
- let region = shx.exec('cut -f1 -d/ < /etc/timezone', { silent: true }).stdout.trim();
300
- }
301
- let zone = this.krillConfig.zone;
302
- if (zone === '' || zone === undefined) {
303
- zone = shx.exec('cut -f2 -d/ < /etc/timezone', { silent: true }).stdout.trim();
304
- }
305
- // Try to auto-configure timezone by internet
306
- const url = `https://geoip.kde.org/v1/calamares`;
307
- try {
308
- const response = await axios.get(url);
309
- if (response.statusText === 'OK') {
310
- const data = JSON.stringify(response.data);
311
- const obj = JSON.parse(data);
312
- region = obj.time_zone.substring(0, obj.time_zone.indexOf('/'));
313
- zone = obj.time_zone.substring(obj.time_zone.indexOf('/') + 1);
314
- }
315
- }
316
- catch (error) {
317
- console.error('error: ' + error);
318
- }
319
- let locationElem;
320
- while (true) {
321
- locationElem = React.createElement(Location, { language: language, region: region, zone: zone });
322
- if (await confirm(locationElem, "Confirm location datas?")) {
323
- break;
324
- }
325
- region = await selectRegions(region);
326
- zone = await selectZones(region);
327
- }
328
- return {
329
- language: language,
330
- region: region,
331
- zone: zone
332
- };
333
- }
334
- /**
335
- * KEYBOARD
336
- */
337
- async keyboard() {
338
- let keyboardModel = this.krillConfig.keyboardModel;
339
- if (keyboardModel === '' || keyboardModel === undefined) {
340
- keyboardModel = await this.keyboards.getModel();
341
- }
342
- let keyboardLayout = this.krillConfig.keyboardLayout;
343
- if (keyboardLayout === '' || keyboardLayout === undefined) {
344
- keyboardLayout = await this.keyboards.getLayout();
345
- }
346
- let keyboardVariant = this.krillConfig.keyboardVariant;
347
- if (keyboardVariant === '' || keyboardVariant === undefined) {
348
- keyboardVariant = await this.keyboards.getVariant();
349
- }
350
- let keyboardOption = this.krillConfig.keyboardOption;
351
- if (keyboardOption === '' || keyboardOption === undefined) {
352
- keyboardOption = await this.keyboards.getOption();
353
- }
354
- let keyboardElem;
355
- while (true) {
356
- keyboardElem = React.createElement(Keyboard, { keyboardModel: keyboardModel, keyboardLayout: keyboardLayout, keyboardVariant: keyboardVariant, keyboardOptions: keyboardOption });
357
- if (await confirm(keyboardElem, "Confirm Keyboard datas?")) {
358
- break;
359
- }
360
- else {
361
- keyboardModel = 'pc105';
362
- keyboardModel = await selectKeyboardModel(keyboardModel);
363
- keyboardLayout = 'us';
364
- keyboardLayout = await selectKeyboardLayout(keyboardLayout);
365
- keyboardVariant = '';
366
- keyboardVariant = await selectKeyboardVariant(keyboardLayout);
367
- keyboardOption = '';
368
- keyboardOption = await selectKeyboardOption(keyboardOption);
369
- if (keyboardModel === '') {
370
- keyboardModel = 'pc105';
371
- }
372
- }
373
- }
374
- return {
375
- keyboardModel: keyboardModel,
376
- keyboardLayout: keyboardLayout,
377
- keyboardVariant: keyboardVariant,
378
- keyboardOption: keyboardOption
379
- };
380
- }
381
- /**
382
- * PARTITIONS
383
- */
384
- async partitions(installationDevice = "", crypted = false, pve = false, btrfs = false) {
385
- // Calamares won't use any devices with iso9660 filesystem on it.
386
- if (installationDevice == "") {
387
- const drives = shx.exec('lsblk |grep disk|cut -f 1 "-d "', { silent: true }).stdout.trim().split('\n');
388
- const driveList = [];
389
- drives.forEach((element) => {
390
- driveList.push('/dev/' + element);
391
- });
392
- installationDevice = driveList[0]; // it was just /dev/sda before
393
- }
394
- let installationMode = this.krillConfig.installationMode;
395
- if (installationMode === '' || installationMode === undefined) {
396
- installationMode = 'standard';
397
- }
398
- if (crypted) {
399
- installationMode = 'full-encrypted';
400
- }
401
- else if (pve) {
402
- installationMode = 'lvm2';
403
- }
404
- let filesystemType = 'ext4';
405
- let userSwapChoice = 'small';
406
- let partitionsElem;
407
- while (true) {
408
- partitionsElem = React.createElement(Partitions, { installationDevice: installationDevice, installationMode: installationMode, filesystemType: filesystemType, userSwapChoice: userSwapChoice });
409
- if (await confirm(partitionsElem, "Confirm Partitions datas?")) {
410
- break;
411
- }
412
- else {
413
- installationDevice = '';
414
- installationMode = 'standard';
415
- if (crypted) {
416
- installationMode = 'full-encrypted';
417
- }
418
- else if (pve) {
419
- installationMode = 'lvm2';
420
- }
421
- if (btrfs) {
422
- filesystemType = 'btrfs';
423
- }
424
- else {
425
- filesystemType = 'ext4';
426
- }
427
- userSwapChoice = '';
428
- }
429
- installationDevice = await selectInstallationDevice();
430
- installationMode = await selectInstallationMode();
431
- filesystemType = await selectFileSystemType();
432
- userSwapChoice = await selectUserSwapChoice();
433
- }
434
- return {
435
- installationDevice: installationDevice,
436
- installationMode: installationMode,
437
- filesystemType: filesystemType,
438
- userSwapChoice: userSwapChoice
439
- };
440
- }
441
- /**
442
- * USERS
443
- */
444
- async users() {
445
- let username = this.krillConfig.name;
446
- if (username === '' || username === undefined) {
447
- username = 'artisan';
448
- }
449
- let fullname = this.krillConfig.fullname;
450
- if (fullname === '' || fullname === undefined) {
451
- fullname = username;
452
- }
453
- let password = this.krillConfig.password;
454
- if (password === '' || password === undefined) {
455
- password = 'evolution';
456
- }
457
- let rootPassword = this.krillConfig.rootPassword;
458
- if (rootPassword === '' || rootPassword === undefined) {
459
- rootPassword = 'evolution';
460
- }
461
- let hostname = this.krillConfig.hostname;
462
- if (hostname === '' || hostname === undefined) {
463
- hostname = shx.exec('cat /etc/hostname').trim();
464
- }
465
- let autologin = true;
466
- let sameUserPassword = true;
467
- let usersElem;
468
- while (true) {
469
- usersElem = React.createElement(Users, { username: username, fullname: fullname, hostname: hostname, password: password, rootPassword: rootPassword, autologin: autologin, sameUserPassword: sameUserPassword });
470
- if (await confirm(usersElem, "Confirm Users datas?")) {
471
- break;
472
- }
473
- username = await getUsername(username);
474
- fullname = await getUserfullname(fullname);
475
- password = await getPassword(username, password);
476
- rootPassword = await getPassword('root', password);
477
- hostname = await getHostname(hostname);
478
- }
479
- return {
480
- username: username,
481
- fullname: fullname,
482
- password: password,
483
- rootPassword: rootPassword,
484
- autologin: autologin,
485
- hostname: hostname
486
- };
487
- }
488
- /**
489
- * Network
490
- */
491
- async network() {
492
- const i = {};
493
- const ifaces = fs.readdirSync('/sys/class/net/');
494
- i.iface = await Utils.iface();
495
- i.addressType = 'dhcp';
496
- i.address = Utils.address();
497
- i.netmask = Utils.netmask();
498
- i.gateway = Utils.gateway();
499
- i.dns = Utils.getDns();
500
- i.domain = Utils.getDomain();
501
- let dnsString = '';
502
- for (let c = 0; c < i.dns.length; c++) {
503
- dnsString += i.dns[c].trim();
504
- if (c < i.dns.length - 1) {
505
- dnsString += '; ';
506
- }
507
- }
508
- let networkElem;
509
- while (true) {
510
- networkElem = React.createElement(Network, { iface: i.iface, addressType: i.addressType, address: i.address, netmask: i.netmask, gateway: i.gateway, domain: i.domain, dns: dnsString });
511
- if (await confirm(networkElem, "Confirm Network datas?")) {
512
- break;
513
- }
514
- i.iface = await selectInterface(i.iface, ifaces);
515
- i.addressType = await selectAddressType();
516
- if (i.addressType === 'static') {
517
- i.address = await getAddress(i.address);
518
- i.netmask = await getNetmask(i.netmask);
519
- i.gateway = await getGateway(i.gateway);
520
- i.domain = await getDomain(i.domain);
521
- if (i.domain.at(0) !== '.') {
522
- i.domain = '.' + i.domain;
523
- }
524
- i.dns = (await getDns(dnsString)).split(';');
525
- dnsString = '';
526
- for (let c = 0; c < i.dns.length; c++) {
527
- dnsString += i.dns[c].trim();
528
- if (c < i.dns.length - 1) {
529
- dnsString += '; ';
530
- }
531
- }
532
- }
533
- }
534
- return i;
535
- }
536
- /**
537
- * SUMMARY
538
- */
539
- async summary(location, keyboard, partitions, users) {
540
- let summaryElem;
541
- let message = `Double check the installation disk: ${partitions.installationDevice}\nwill be completely erased!`;
542
- if (this.unattended && this.nointeractive) {
543
- message = `Unattended installation will start in 5 seconds...\npress CTRL-C to abort!`;
544
- }
545
- while (true) {
546
- 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 });
547
- if (this.unattended && this.nointeractive) {
548
- redraw(summaryElem);
549
- await sleep(5000);
550
- break;
551
- }
552
- else if (this.unattended && !this.nointeractive) {
553
- if (await confirm(summaryElem, "Read the Summary, confirm or abort")) {
554
- break;
555
- }
556
- else {
557
- process.exit(0);
558
- }
559
- }
560
- else if (await confirm(summaryElem, "Confirm Summary datas?")) {
561
- break;
562
- }
563
- }
564
- }
565
- /**
566
- * return true if pv exist
567
- */
568
- async pvExist() {
569
- let exist = false;
570
- const check = `#!/bin/sh\npvdisplay |grep "PV Name" >/dev/null && echo 1|| echo 0`;
571
- if (shx.exec(check, { silent: true }).stdout.trim() === '1') {
572
- exist = true;
573
- }
574
- return exist;
575
- }
576
- }
577
- /**
578
- * confirm
579
- * @returns
580
- */
581
- async function confirm(elem, msg = "Confirm") {
582
- redraw(elem);
583
- const result = JSON.parse(await Utils.customConfirmAbort(msg));
584
- let retval = false;
585
- if (result.confirm === 'Yes') {
586
- retval = true;
587
- }
588
- else if (result.confirm === 'Abort') {
589
- process.exit();
590
- }
591
- return retval;
592
- }
593
- /**
594
- * Occorre farglierlo rigenerare a forza
595
- * anche quando NON cambiano i dati
596
- * forceUpdate
597
- */
598
- function redraw(elem) {
599
- let opt = {};
600
- opt.patchConsole = true;
601
- opt.debug = false;
602
- console.clear();
603
- render(elem, opt);
604
- }
605
- /**
606
- *
607
- * @param mask
608
- */
609
- function netmask2CIDR(mask) {
610
- const countCharOccurences = (string, char) => string.split(char).length - 1;
611
- const decimalToBinary = (dec) => (dec >>> 0).toString(2);
612
- const getNetMaskParts = (nmask) => nmask.split('.').map(Number);
613
- const netmask2CIDR = (netmask) => countCharOccurences(getNetMaskParts(netmask)
614
- .map(part => decimalToBinary(part))
615
- .join(''), '1');
616
- }
617
- /**
618
- *
619
- * @param ms
620
- * @returns
621
- */
622
- function sleep(ms = 0) {
623
- return new Promise((resolve) => {
624
- setTimeout(resolve, ms);
625
- });
626
- }
File without changes
File without changes
File without changes