penguins-eggs 8.1.0 → 9.0.9

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 (317) hide show
  1. package/README.md +256 -167
  2. package/addons/README.md +78 -84
  3. package/addons/{pve → blissos}/theme/applications/install-debian.desktop +0 -0
  4. package/addons/{deblinux → blissos}/theme/artwork/install-debian.png +0 -0
  5. package/addons/blissos/theme/calamares/branding/blissos-logo.png +0 -0
  6. package/addons/{guadalinex → blissos}/theme/calamares/branding/branding.desc +0 -0
  7. package/addons/blissos/theme/calamares/branding/languages.png +0 -0
  8. package/addons/blissos/theme/calamares/branding/show.qml +75 -0
  9. package/addons/blissos/theme/calamares/branding/slide1.png +0 -0
  10. package/addons/blissos/theme/calamares/branding/slide2.png +0 -0
  11. package/addons/blissos/theme/calamares/branding/slide3.png +0 -0
  12. package/addons/blissos/theme/calamares/branding/welcome.png +0 -0
  13. package/addons/{guadalinex → blissos}/theme/calamares/modules/partition.yml +1 -1
  14. package/addons/blissos/theme/livecd/README.md +23 -0
  15. package/{conf/distros/buster/grub/theme.cfg → addons/blissos/theme/livecd/grub.theme.cfg} +10 -10
  16. package/{conf/distros/buster/isolinux/stdmenu.template.cfg → addons/blissos/theme/livecd/isolinux.theme.cfg} +4 -0
  17. package/addons/blissos/theme/livecd/splash.png +0 -0
  18. package/addons/eggs/adapt/applications/eggs-adapt.desktop +1 -1
  19. package/addons/eggs/theme/livecd/README.md +21 -6
  20. package/addons/eggs/theme/livecd/{theme.cfg → grub.theme.cfg} +13 -12
  21. package/addons/eggs/theme/livecd/isolinux.theme.cfg +46 -0
  22. package/addons/eggs/theme/livecd/splash.png +0 -0
  23. package/addons/neon/theme/livecd/README.md +23 -0
  24. package/addons/{ufficiozero/theme/livecd/theme.cfg → neon/theme/livecd/grub.theme.cfg} +13 -12
  25. package/addons/neon/theme/livecd/isolinux.theme.cfg +46 -0
  26. package/addons/neon/theme/livecd/splash.pcx +0 -0
  27. package/addons/neon/theme/livecd/splash.png +0 -0
  28. package/addons/templates/grub.template +28 -0
  29. package/addons/templates/isolinux.template +29 -0
  30. package/addons/ufficiozero/theme/applications/install-debian.desktop +17 -2
  31. package/assets/penguins-minstall.desktop +95 -0
  32. package/bin/dev +17 -0
  33. package/bin/dev.cmd +3 -0
  34. package/bin/run +2 -4
  35. package/conf/distros/bionic/calamares/settings.yml +5 -5
  36. package/conf/distros/bookworm/README.md +9 -0
  37. package/conf/distros/bullseye/README.md +6 -8
  38. package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +1 -1
  39. package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.working.sh +1 -1
  40. package/conf/distros/buster/calamares/modules/shellprocess_eggs-cleanup.yml +6 -0
  41. package/conf/distros/buster/calamares/settings.yml +14 -3
  42. package/conf/distros/chimaera/README.md +3 -0
  43. package/conf/distros/daedalus/README.md +3 -0
  44. package/conf/distros/focal/calamares/settings.yml +2 -2
  45. package/conf/distros/hirsute/README.md +1 -1
  46. package/conf/distros/impish/README.md +9 -0
  47. package/conf/distros/jammy/README.md +9 -0
  48. package/conf/distros/jessie/krill/krill-modules/sources-yolk/sources-yolk.sh +1 -1
  49. package/conf/distros/rolling/README.md +3 -0
  50. package/conf/distros/rolling/calamares/calamares-modules/remove-link/module.yml +9 -0
  51. package/conf/distros/rolling/calamares/calamares-modules/remove-link/remove-link.sh +3 -0
  52. package/conf/distros/rolling/calamares/modules/displaymanager.yml +22 -0
  53. package/conf/distros/rolling/calamares/modules/finished.yml +6 -0
  54. package/conf/distros/rolling/calamares/modules/fstab.yml +13 -0
  55. package/conf/distros/rolling/calamares/modules/locale.yml +97 -0
  56. package/conf/distros/rolling/calamares/modules/luksopenswaphookcfg.yml +6 -0
  57. package/conf/distros/rolling/calamares/modules/mount.yml +38 -0
  58. package/conf/distros/rolling/calamares/modules/packages.yml +8 -0
  59. package/conf/distros/rolling/calamares/modules/removeuser.yml +15 -0
  60. package/conf/distros/rolling/calamares/modules/unpackfs.yml +7 -0
  61. package/conf/distros/rolling/calamares/modules/users.yml +20 -0
  62. package/conf/distros/rolling/calamares/modules/welcome.yml +19 -0
  63. package/conf/distros/{bullseye → rolling}/calamares/settings.yml +17 -12
  64. package/conf/distros/thirtyfive/README.md +3 -0
  65. package/conf/distros/tumbleweed/README.md +3 -0
  66. package/conf/eggs.yaml +3 -3
  67. package/conf/exclude.list +12 -7
  68. package/conf/tools.yaml +1 -1
  69. package/lib/classes/basket.js +24 -20
  70. package/lib/classes/bleach.js +19 -19
  71. package/lib/classes/compressors.js +15 -14
  72. package/lib/classes/daddy.js +44 -31
  73. package/lib/classes/distro.d.ts +3 -2
  74. package/lib/classes/distro.js +313 -173
  75. package/lib/classes/family/archlinux.d.ts +69 -0
  76. package/lib/classes/family/archlinux.js +182 -0
  77. package/lib/classes/family/debian.d.ts +64 -0
  78. package/lib/classes/family/debian.js +227 -0
  79. package/lib/classes/family/fedora.d.ts +63 -0
  80. package/lib/classes/family/fedora.js +169 -0
  81. package/lib/classes/family/suse.d.ts +63 -0
  82. package/lib/classes/family/suse.js +169 -0
  83. package/lib/classes/i18n.js +16 -16
  84. package/lib/classes/incubation/branding.js +5 -4
  85. package/lib/classes/incubation/distros/bionic.js +1 -2
  86. package/lib/classes/incubation/distros/buster.js +2 -2
  87. package/lib/classes/incubation/distros/focal.js +3 -2
  88. package/lib/classes/incubation/distros/jessie.js +1 -25
  89. package/lib/classes/incubation/distros/{bullseye.d.ts → rolling.d.ts} +3 -3
  90. package/lib/classes/incubation/distros/{bullseye.js → rolling.js} +15 -16
  91. package/lib/classes/incubation/fisherman-helper/displaymanager.js +2 -7
  92. package/lib/classes/incubation/fisherman-helper/packages.js +31 -32
  93. package/lib/classes/incubation/fisherman.d.ts +17 -17
  94. package/lib/classes/incubation/fisherman.js +84 -71
  95. package/lib/classes/incubation/incubator.js +116 -74
  96. package/lib/classes/incubation/installer.d.ts +2 -2
  97. package/lib/classes/incubation/installer.js +6 -20
  98. package/lib/classes/initrd.d.ts +1 -1
  99. package/lib/classes/initrd.js +37 -30
  100. package/lib/classes/krill_install.js +155 -138
  101. package/lib/classes/krill_prepare.d.ts +6 -2
  102. package/lib/classes/krill_prepare.js +72 -60
  103. package/lib/classes/n8.js +6 -11
  104. package/lib/classes/ovary.d.ts +29 -11
  105. package/lib/classes/ovary.js +750 -611
  106. package/lib/classes/pacman.d.ts +55 -56
  107. package/lib/classes/pacman.js +520 -419
  108. package/lib/classes/pve-live.js +6 -6
  109. package/lib/classes/settings.js +47 -56
  110. package/lib/classes/systemctl.d.ts +6 -6
  111. package/lib/classes/systemctl.js +7 -7
  112. package/lib/classes/tools.d.ts +1 -1
  113. package/lib/classes/tools.js +10 -10
  114. package/lib/classes/utils.d.ts +10 -13
  115. package/lib/classes/utils.js +128 -107
  116. package/lib/classes/xdg.js +112 -91
  117. package/lib/classes/yolk.js +38 -31
  118. package/lib/commands/adapt.d.ts +3 -3
  119. package/lib/commands/adapt.js +12 -12
  120. package/lib/commands/bro.d.ts +14 -0
  121. package/lib/commands/bro.js +31 -0
  122. package/lib/commands/calamares.d.ts +7 -7
  123. package/lib/commands/calamares.js +22 -54
  124. package/lib/commands/config.d.ts +5 -5
  125. package/lib/commands/config.js +68 -74
  126. package/lib/commands/dad.d.ts +5 -5
  127. package/lib/commands/dad.js +11 -11
  128. package/lib/commands/export/deb.d.ts +8 -8
  129. package/lib/commands/export/deb.js +16 -16
  130. package/lib/commands/export/docs.d.ts +2 -2
  131. package/lib/commands/export/docs.js +9 -9
  132. package/lib/commands/export/iso.d.ts +4 -4
  133. package/lib/commands/export/iso.js +12 -17
  134. package/lib/commands/info.d.ts +9 -3
  135. package/lib/commands/info.js +14 -164
  136. package/lib/commands/install.d.ts +5 -4
  137. package/lib/commands/install.js +25 -15
  138. package/lib/commands/kill.d.ts +3 -3
  139. package/lib/commands/kill.js +11 -13
  140. package/lib/commands/mom.d.ts +2 -2
  141. package/lib/commands/mom.js +8 -8
  142. package/lib/commands/produce.d.ts +14 -14
  143. package/lib/commands/produce.js +48 -46
  144. package/lib/commands/remove.d.ts +5 -5
  145. package/lib/commands/remove.js +46 -57
  146. package/lib/commands/tools/clean.d.ts +3 -3
  147. package/lib/commands/tools/clean.js +10 -12
  148. package/lib/commands/tools/locales.d.ts +4 -4
  149. package/lib/commands/tools/locales.js +8 -8
  150. package/lib/commands/tools/skel.d.ts +4 -4
  151. package/lib/commands/tools/skel.js +10 -15
  152. package/lib/commands/tools/stat.d.ts +7 -4
  153. package/lib/commands/tools/stat.js +20 -13
  154. package/lib/commands/tools/yolk.d.ts +3 -3
  155. package/lib/commands/tools/yolk.js +13 -13
  156. package/lib/commands/update.d.ts +5 -10
  157. package/lib/commands/update.js +56 -72
  158. package/lib/components/elements/information.d.ts +4 -0
  159. package/lib/components/elements/information.js +166 -0
  160. package/lib/components/elements/steps.js +1 -1
  161. package/lib/components/elements/title.js +7 -10
  162. package/lib/components/finished.js +5 -5
  163. package/lib/components/install.js +5 -5
  164. package/lib/components/keyboard.js +5 -5
  165. package/lib/components/location.js +5 -5
  166. package/lib/components/network.js +5 -5
  167. package/lib/components/partitions.d.ts +2 -1
  168. package/lib/components/partitions.js +9 -7
  169. package/lib/components/summary.js +5 -5
  170. package/lib/components/users.js +6 -6
  171. package/lib/components/welcome.js +6 -6
  172. package/lib/index.d.ts +1 -1
  173. package/lib/index.js +2 -2
  174. package/lib/interfaces/i-distro.d.ts +3 -2
  175. package/lib/interfaces/i-krill.d.ts +1 -0
  176. package/lib/interfaces/i-settings.d.ts +2 -2
  177. package/lib/lib/cli-autologin.d.ts +19 -2
  178. package/lib/lib/cli-autologin.js +114 -39
  179. package/lib/lib/dependencies.d.ts +9 -6
  180. package/lib/lib/dependencies.js +22 -13
  181. package/lib/lib/get_address.js +2 -2
  182. package/lib/lib/get_dns.js +2 -2
  183. package/lib/lib/get_domain.js +2 -2
  184. package/lib/lib/get_gateway.js +2 -2
  185. package/lib/lib/get_hostname.js +2 -2
  186. package/lib/lib/get_netmask.js +2 -2
  187. package/lib/lib/get_password.js +3 -2
  188. package/lib/lib/get_root_password.js +2 -2
  189. package/lib/lib/get_userfullname.js +2 -2
  190. package/lib/lib/get_username.js +2 -2
  191. package/lib/lib/select_address_type.js +2 -5
  192. package/lib/lib/select_filesystem_type.js +5 -14
  193. package/lib/lib/select_installation_device.js +3 -3
  194. package/lib/lib/select_interface.js +1 -1
  195. package/lib/lib/select_keyboard_layout.js +2 -10
  196. package/lib/lib/select_languages.js +2 -2
  197. package/lib/lib/select_regions.js +1 -12
  198. package/lib/lib/select_user_swap_choice.js +4 -4
  199. package/lib/lib/select_zones.js +483 -62
  200. package/manpages/doc/man/eggs.html +508 -0
  201. package/manpages/doc/man/eggs.roll.gz +0 -0
  202. package/oclif.manifest.json +1 -1
  203. package/package.json +115 -107
  204. package/scripts/_eggs +246 -0
  205. package/scripts/bros/waydroid-helper.sh +92 -0
  206. package/scripts/eggs.bash +67 -21
  207. package/scripts/mom-cli.sh +6 -5
  208. package/scripts/not-used/eggs-cleanup.sh +7 -0
  209. package/scripts/not-used/install-eggs-ppa.sh +2 -0
  210. package/scripts/{mkinitramfs → not-used/mkinitramfs} +0 -0
  211. package/scripts/{pve-live.sh → not-used/pve-live.sh} +0 -0
  212. package/addons/debian/theme/applications/install-debian.desktop +0 -13
  213. package/addons/debian/theme/artwork/install-debian.png +0 -0
  214. package/addons/debian/theme/branding/branding.desc +0 -27
  215. package/addons/debian/theme/branding/debian-logo.png +0 -0
  216. package/addons/debian/theme/branding/show.qml +0 -51
  217. package/addons/debian/theme/branding/slide1.png +0 -0
  218. package/addons/debian/theme/branding/welcome.png +0 -0
  219. package/addons/deblinux/theme/README.md +0 -16
  220. package/addons/deblinux/theme/applications/install-debian.desktop +0 -13
  221. package/addons/deblinux/theme/calamares/branding/branding.desc +0 -23
  222. package/addons/deblinux/theme/calamares/branding/deblinux-logo.png +0 -0
  223. package/addons/deblinux/theme/calamares/branding/show.qml +0 -46
  224. package/addons/deblinux/theme/calamares/branding/slide1.png +0 -0
  225. package/addons/deblinux/theme/calamares/branding/welcome.png +0 -0
  226. package/addons/deblinux/theme/calamares/modules/partition.yml +0 -233
  227. package/addons/eggs/theme/livecd/grub.template.cfg +0 -60
  228. package/addons/eggs/theme/livecd/menu.template.cfg +0 -54
  229. package/addons/guadalinex/theme/README.md +0 -9
  230. package/addons/guadalinex/theme/applications/install-debian.desktop +0 -28
  231. package/addons/guadalinex/theme/artwork/install-debian.png +0 -0
  232. package/addons/guadalinex/theme/calamares/branding/guadalinex-logo.png +0 -0
  233. package/addons/guadalinex/theme/calamares/branding/show.qml +0 -85
  234. package/addons/guadalinex/theme/calamares/branding/slide1.png +0 -0
  235. package/addons/guadalinex/theme/calamares/branding/slide2.png +0 -0
  236. package/addons/guadalinex/theme/calamares/branding/slide3.png +0 -0
  237. package/addons/guadalinex/theme/calamares/branding/slide4.png +0 -0
  238. package/addons/guadalinex/theme/calamares/branding/slide5.png +0 -0
  239. package/addons/guadalinex/theme/calamares/branding/slide6.png +0 -0
  240. package/addons/guadalinex/theme/calamares/branding/slide7.png +0 -0
  241. package/addons/guadalinex/theme/calamares/branding/welcome.png +0 -0
  242. package/addons/guadalinex/theme/livecd/menu.template.cfg +0 -54
  243. package/addons/guadalinex/theme/livecd/splash.png +0 -0
  244. package/addons/guadalinex/theme/livecd/theme.cfg +0 -42
  245. package/addons/openos/theme/applications/Install-OpenOS-Neon_RLTS-Desktop.png +0 -0
  246. package/addons/openos/theme/applications/install-debian.desktop +0 -24
  247. package/addons/openos/theme/artwork/install-debian.png +0 -0
  248. package/addons/openos/theme/calamares/branding/branding.desc +0 -28
  249. package/addons/openos/theme/calamares/branding/openos-logo.png +0 -0
  250. package/addons/openos/theme/calamares/branding/show.qml +0 -203
  251. package/addons/openos/theme/calamares/branding/slide1.png +0 -0
  252. package/addons/openos/theme/calamares/branding/slide10.png +0 -0
  253. package/addons/openos/theme/calamares/branding/slide11.png +0 -0
  254. package/addons/openos/theme/calamares/branding/slide12.png +0 -0
  255. package/addons/openos/theme/calamares/branding/slide13.png +0 -0
  256. package/addons/openos/theme/calamares/branding/slide14.png +0 -0
  257. package/addons/openos/theme/calamares/branding/slide15.png +0 -0
  258. package/addons/openos/theme/calamares/branding/slide16.png +0 -0
  259. package/addons/openos/theme/calamares/branding/slide2.png +0 -0
  260. package/addons/openos/theme/calamares/branding/slide3.png +0 -0
  261. package/addons/openos/theme/calamares/branding/slide4.png +0 -0
  262. package/addons/openos/theme/calamares/branding/slide5.png +0 -0
  263. package/addons/openos/theme/calamares/branding/slide6.png +0 -0
  264. package/addons/openos/theme/calamares/branding/slide7.png +0 -0
  265. package/addons/openos/theme/calamares/branding/slide8.png +0 -0
  266. package/addons/openos/theme/calamares/branding/slide9.png +0 -0
  267. package/addons/openos/theme/calamares/branding/welcome.png +0 -0
  268. package/addons/openos/theme/calamares/branding.desc +0 -24
  269. package/addons/openos/theme/calamares/lang/calamares-default_ar.qm +0 -0
  270. package/addons/openos/theme/calamares/lang/calamares-default_en.qm +0 -0
  271. package/addons/openos/theme/calamares/lang/calamares-default_eo.qm +0 -0
  272. package/addons/openos/theme/calamares/lang/calamares-default_fr.qm +0 -0
  273. package/addons/openos/theme/calamares/lang/calamares-default_nl.qm +0 -0
  274. package/addons/openos/theme/calamares/modules/partition.yml +0 -233
  275. package/addons/openos/theme/livecd/grub.template.cfg +0 -60
  276. package/addons/openos/theme/livecd/menu.template.cfg +0 -54
  277. package/addons/openos/theme/livecd/splash.png +0 -0
  278. package/addons/openos/theme/livecd/theme.cfg +0 -42
  279. package/addons/pve/theme/applications/penguins-pve.desktop +0 -24
  280. package/addons/pve/theme/artwork/install-debian.png +0 -0
  281. package/addons/pve/theme/calamares/branding/branding.desc +0 -1
  282. package/addons/pve/theme/calamares/branding/pve-logo.png +0 -0
  283. package/addons/pve/theme/calamares/branding/show.qml +0 -227
  284. package/addons/pve/theme/calamares/branding/slide1.png +0 -0
  285. package/addons/pve/theme/calamares/branding/slide2.png +0 -0
  286. package/addons/pve/theme/calamares/branding/slide3.png +0 -0
  287. package/addons/pve/theme/calamares/branding/slide4.png +0 -0
  288. package/addons/pve/theme/calamares/branding/slide5.png +0 -0
  289. package/addons/pve/theme/calamares/branding/slide6.png +0 -0
  290. package/addons/pve/theme/calamares/branding/slide7.png +0 -0
  291. package/addons/pve/theme/calamares/branding/slide8.png +0 -0
  292. package/addons/pve/theme/calamares/branding/slide9.png +0 -0
  293. package/addons/pve/theme/calamares/branding/welcome.png +0 -0
  294. package/addons/pve/theme/calamares/modules/partition.yml +0 -233
  295. package/addons/pve/theme/livecd/README.md +0 -8
  296. package/addons/pve/theme/livecd/grub.template.cfg +0 -60
  297. package/addons/pve/theme/livecd/menu.template.cfg +0 -54
  298. package/addons/pve/theme/livecd/splash.png +0 -0
  299. package/addons/pve/theme/livecd/theme.cfg +0 -42
  300. package/addons/ufficiozero/theme/artwork/install-debian.png +0 -0
  301. package/addons/ufficiozero/theme/livecd/README.md +0 -8
  302. package/addons/ufficiozero/theme/livecd/grub.template.cfg +0 -60
  303. package/addons/ufficiozero/theme/livecd/menu.template.cfg +0 -54
  304. package/changelog.md +0 -130
  305. package/conf/distros/bullseye/calamares/calamares-modules/bootloader-config/bootloader-config.sh +0 -28
  306. package/conf/distros/bullseye/calamares/calamares-modules/bootloader-config/module.yml +0 -8
  307. package/conf/distros/buster/grub/grub.template.cfg +0 -58
  308. package/conf/distros/buster/grub/loopback.cfg +0 -1
  309. package/conf/distros/buster/isolinux/isolinux.template.cfg +0 -8
  310. package/conf/distros/buster/isolinux/menu.template.cfg +0 -56
  311. package/conf/distros/focal/grub/grub.template.cfg +0 -67
  312. package/conf/distros/focal/isolinux/menu.template.cfg +0 -54
  313. package/lib/classes/incubation/distros/beowulf.d.ts +0 -30
  314. package/lib/classes/incubation/distros/beowulf.js +0 -69
  315. package/lib/classes/krill_install_compare.d.ts +0 -200
  316. package/lib/classes/krill_install_compare.js +0 -1110
  317. package/manpages/doc/man/eggs.1.gz +0 -0
@@ -1,1110 +0,0 @@
1
- "use strict";
2
- /**
3
- * penguins-eggs: hatching.js
4
- *
5
- * author: Piero Proietti
6
- * mail: piero.proietti@gmail.com
7
- *
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const tslib_1 = require("tslib");
11
- const settings_1 = tslib_1.__importDefault(require("./settings"));
12
- const react_1 = tslib_1.__importDefault(require("react"));
13
- const ink_1 = require("ink");
14
- const install_1 = tslib_1.__importDefault(require("../components/install"));
15
- const finished_1 = tslib_1.__importDefault(require("../components/finished"));
16
- const fs = require("fs");
17
- const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
18
- const shx = require("shelljs");
19
- const utils_1 = tslib_1.__importDefault(require("./utils"));
20
- const cliAutologin = require("../lib/cli-autologin");
21
- const exec = require('../lib/utils').exec;
22
- const child_process_1 = require("child_process");
23
- const pacman_1 = tslib_1.__importDefault(require("./pacman"));
24
- const installer_1 = require("./incubation/installer");
25
- const xdg_1 = tslib_1.__importDefault(require("./xdg"));
26
- const distro_1 = tslib_1.__importDefault(require("./distro"));
27
- /**
28
- * hatch, installazione
29
- */
30
- class Hatching {
31
- /**
32
- * constructor
33
- */
34
- constructor(location, keyboard, partitions, users, network) {
35
- this.installer = {};
36
- this.installTarget = '/tmp/calamares-krill-root';
37
- this.verbose = false;
38
- this.efi = false;
39
- this.devices = {};
40
- this.users = {};
41
- this.network = {};
42
- this.host = {};
43
- // net = {} as INet
44
- this.disk = {};
45
- this.partitions = {};
46
- this.language = '';
47
- this.region = '';
48
- this.zone = '';
49
- this.keyboardModel = '';
50
- this.keyboardLayout = '';
51
- this.keyboardVariant = '';
52
- this.toNull = ' > /dev/null 2>&1';
53
- this.settings = {};
54
- this.remix = {};
55
- this.distro = {};
56
- this.installer = installer_1.installer();
57
- this.settings = new settings_1.default();
58
- this.language = location.language;
59
- this.region = location.region;
60
- this.zone = location.zone;
61
- this.keyboardModel = keyboard.keyboardModel;
62
- this.keyboardLayout = keyboard.keyboardLayout;
63
- this.keyboardVariant = keyboard.keyboardVariant;
64
- this.network = network;
65
- this.disk.fsType = partitions.filesystemType;
66
- this.disk.installationDevice = partitions.installationDevice;
67
- this.disk.partionType = 'simple';
68
- this.partitions = partitions;
69
- this.host.name = users.hostname;
70
- this.host.domain = 'lan';
71
- this.users = users;
72
- this.devices.efi = {};
73
- this.devices.boot = {};
74
- this.devices.root = {};
75
- this.devices.data = {};
76
- this.devices.swap = {};
77
- this.distro = new distro_1.default(this.remix);
78
- }
79
- /**
80
- * install
81
- * @param verbose
82
- * @param umount
83
- * @returns
84
- */
85
- async install(verbose = false) {
86
- this.verbose = verbose;
87
- await this.settings.load();
88
- let percent = 0.0;
89
- let message = "Checking EFI";
90
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
91
- try {
92
- this.efi = fs.existsSync('/sys/firmware/efi/efivars');
93
- }
94
- catch (error) {
95
- message += JSON.stringify(error);
96
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
97
- }
98
- // await checkIt(message)
99
- if (await this.partition(this.disk.installationDevice, this.disk.partionType)) {
100
- message = "Formatting file system ";
101
- percent = 0.01;
102
- try {
103
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
104
- await this.mkfs();
105
- }
106
- catch (error) {
107
- message += JSON.stringify(error);
108
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
109
- }
110
- // await checkIt(message)
111
- // mount
112
- message = "Mounting target file system ";
113
- percent = 0.03;
114
- try {
115
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
116
- await this.mount();
117
- }
118
- catch (error) {
119
- message += JSON.stringify(error);
120
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
121
- }
122
- // await checkIt(message)
123
- // mountvfs
124
- message = "Mounting target file system vfs ";
125
- percent = 0.06;
126
- try {
127
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
128
- await this.mountvfs();
129
- }
130
- catch (error) {
131
- message += JSON.stringify(error);
132
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
133
- }
134
- // await checkIt(message)
135
- // unpackfs
136
- message = "Unpacking filesystem ";
137
- percent = 0.10;
138
- try {
139
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent, spinner: true }));
140
- await this.unpackfs();
141
- }
142
- catch (error) {
143
- message += JSON.stringify(error);
144
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
145
- }
146
- // await checkIt(message)
147
- message = "Syncronize filesystem ";
148
- percent = 0.35;
149
- try {
150
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent, spinner: true }));
151
- await this.syncfs();
152
- }
153
- catch (error) {
154
- message += JSON.stringify(error);
155
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
156
- }
157
- // await checkIt(message)
158
- // We restore users only if present /run/live/medium/live/luks-users-data
159
- if (fs.existsSync('/run/live/medium/live/luks-users-data')) {
160
- message = "Restore users data from backup ";
161
- percent = 0.37;
162
- try {
163
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent, spinner: true }));
164
- await this.restoreUsersData();
165
- }
166
- catch (error) {
167
- message += JSON.stringify(error);
168
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
169
- }
170
- // await checkIt(message)
171
- }
172
- // sources-yolk
173
- message = 'sources-yolk';
174
- percent = 0.40;
175
- try {
176
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent, spinner: true }));
177
- await this.execCalamaresModule('sources-yolk');
178
- }
179
- catch (error) {
180
- message += JSON.stringify(error);
181
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
182
- }
183
- // await checkIt(message)
184
- message = "Setting time zone ";
185
- percent = 0.43;
186
- try {
187
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
188
- await this.setTimezone();
189
- }
190
- catch (error) {
191
- message += JSON.stringify(error);
192
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
193
- }
194
- // await checkIt(message)
195
- message = "Creating fstab ";
196
- percent = 0.47;
197
- try {
198
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
199
- await this.fstab(this.disk.installationDevice);
200
- }
201
- catch (error) {
202
- message += JSON.stringify(error);
203
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
204
- }
205
- // await checkIt(message)
206
- message = "settings keyboard ";
207
- percent = 0.48;
208
- try {
209
- this.setKeyboard();
210
- }
211
- catch (error) {
212
- message += JSON.stringify(error);
213
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
214
- }
215
- // await checkIt(message)
216
- message = "networkcfg";
217
- percent = 0.50;
218
- try {
219
- this.networkcfg();
220
- }
221
- catch (error) {
222
- message += JSON.stringify(error);
223
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
224
- }
225
- // await checkIt(message)
226
- message = "Create hostname ";
227
- percent = 0.53;
228
- try {
229
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
230
- await this.hostname();
231
- }
232
- catch (error) {
233
- message += JSON.stringify(error);
234
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
235
- }
236
- // await checkIt(message)
237
- message = "Creating hosts ";
238
- percent = 0.60;
239
- try {
240
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
241
- await this.hosts();
242
- }
243
- catch (error) {
244
- message += JSON.stringify(error);
245
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
246
- }
247
- // await checkIt(message)
248
- message = "bootloader-config ";
249
- percent = 0.63;
250
- try {
251
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
252
- await this.execCalamaresModule('bootloader-config');
253
- }
254
- catch (error) {
255
- message += JSON.stringify(error);
256
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
257
- }
258
- // await checkIt(message)
259
- message = "bootloader ";
260
- percent = 0.63;
261
- try {
262
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
263
- await this.bootloader();
264
- }
265
- catch (error) {
266
- message += JSON.stringify(error);
267
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
268
- }
269
- // await checkIt(message)
270
- message = "initramfs configure";
271
- percent = 0.65;
272
- try {
273
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
274
- this.initramfsCfg(this.disk.installationDevice);
275
- }
276
- catch (error) {
277
- message += JSON.stringify(error);
278
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
279
- }
280
- // await checkIt(message)
281
- message = "initramfs ";
282
- percent = 0.67;
283
- try {
284
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
285
- await this.initramfs();
286
- }
287
- catch (error) {
288
- message += JSON.stringify(error);
289
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
290
- }
291
- // await checkIt(message)
292
- message = "Removing user live ";
293
- percent = 0.70;
294
- try {
295
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
296
- await this.delLiveUser();
297
- }
298
- catch (error) {
299
- message += JSON.stringify(error);
300
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
301
- }
302
- // await checkIt(message)
303
- // We create user only if NOT present /run/live/medium/live/luks-users-data
304
- if (!fs.existsSync('/run/live/medium/live/luks-users-data')) {
305
- message = "Adding user ";
306
- percent = 0.73;
307
- try {
308
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
309
- await this.addUser(this.users.name, this.users.password, this.users.fullname, '', '', '');
310
- }
311
- catch (error) {
312
- message += JSON.stringify(error);
313
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
314
- }
315
- // await checkIt(message)
316
- }
317
- message = "adding user password ";
318
- percent = 0.77;
319
- try {
320
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
321
- await this.changePassword('root', this.users.rootPassword);
322
- }
323
- catch (error) {
324
- message += JSON.stringify(error);
325
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
326
- }
327
- // await checkIt(message)
328
- if (await pacman_1.default.isGui()) {
329
- try {
330
- message = "autologin GUI";
331
- percent = 0.80;
332
- await xdg_1.default.autologin(utils_1.default.getPrimaryUser(), this.users.name, this.installTarget);
333
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
334
- }
335
- catch (error) {
336
- message += JSON.stringify(error);
337
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
338
- }
339
- }
340
- else { // autologin CLI remove DEFAULT
341
- message = "autologin CLI";
342
- percent = 0.80;
343
- try {
344
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
345
- await cliAutologin.remove(this.installTarget);
346
- }
347
- catch (error) {
348
- message += JSON.stringify(error);
349
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
350
- }
351
- }
352
- // await checkIt(message)
353
- message = "remove installer";
354
- percent = 0.87;
355
- try {
356
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
357
- await this.removeInstaller();
358
- }
359
- catch (error) {
360
- message += JSON.stringify(error);
361
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
362
- }
363
- // await checkIt(message)
364
- message = "sources yolk unmount";
365
- percent = 0.92;
366
- try {
367
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
368
- await this.execCalamaresModule('sources-yolk-unmount');
369
- }
370
- catch (error) {
371
- message += JSON.stringify(error);
372
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
373
- }
374
- // await checkIt(message)
375
- message = "umount";
376
- percent = 0.92;
377
- try {
378
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
379
- await this.umountvfs();
380
- await this.umount();
381
- }
382
- catch (error) {
383
- message += JSON.stringify(error);
384
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
385
- }
386
- // await checkIt(message)
387
- message = "finished";
388
- percent = 100.0;
389
- try {
390
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
391
- this.finished();
392
- }
393
- catch (error) {
394
- message += JSON.stringify(error);
395
- redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
396
- }
397
- }
398
- }
399
- /**
400
- * setTimezone
401
- */
402
- async setTimezone() {
403
- const echo = { echo: false, ignore: false };
404
- if (fs.existsSync('/etc/localtime')) {
405
- const cmd = `chroot ${this.installTarget} unlink /etc/localtime`;
406
- await exec(cmd, echo);
407
- }
408
- const cmd = `chroot ${this.installTarget} ln -sf /usr/share/zoneinfo/${this.region}/${this.zone} /etc/localtime`;
409
- await exec(cmd, echo);
410
- }
411
- /**
412
- *
413
- * @param name
414
- * @param password
415
- * @param fullName
416
- * @param roomNumber
417
- * @param workPhone
418
- * @param homePhone
419
- */
420
- async addUser(name = 'live', password = 'evolution', fullName = '', roomNumber = '', workPhone = '', homePhone = '') {
421
- const echo = { echo: false, ignore: false };
422
- const cmd = `chroot ${this.installTarget} \
423
- adduser ${name} \
424
- --home /home/${name} \
425
- --shell /bin/bash \
426
- --disabled-password \
427
- --gecos "${fullName},${roomNumber},${workPhone},${homePhone}"`;
428
- await exec(cmd, echo);
429
- await exec(`echo ${name}:${password} | chroot ${this.installTarget} chpasswd `, echo);
430
- await exec(`chroot ${this.installTarget} usermod -aG sudo ${name}`, echo);
431
- }
432
- /**
433
- * changePassword
434
- * @param name
435
- * @param newPassword
436
- */
437
- async changePassword(name = 'live', newPassword = 'evolution') {
438
- const echo = utils_1.default.setEcho(this.verbose);
439
- const cmd = `echo ${name}:${newPassword} | chroot ${this.installTarget} chpasswd `;
440
- await exec(cmd, echo);
441
- }
442
- /**
443
- * delUser
444
- * va corretto con users.conf di calamares
445
- */
446
- async delLiveUser() {
447
- const echo = { echo: false, ignore: false };
448
- if (utils_1.default.isLive()) {
449
- const user = this.settings.config.user_opt;
450
- const cmd = `chroot ${this.installTarget} deluser --remove-home ${user}`;
451
- await exec(cmd, echo);
452
- }
453
- }
454
- /**
455
- * grubInstall()
456
- * @param target
457
- * @param options
458
- */
459
- async bootloader() {
460
- const echo = { echo: false, ignore: false };
461
- /**
462
- * Attualmente serve fare l'update qua per EFI
463
- * controllare bootloader-config
464
- */
465
- /**
466
- * await exec('chroot ' + this.installTarget + ' apt update', echo)
467
- * viene eseguita da bootloader-config
468
- */
469
- if (this.efi) {
470
- await exec('chroot ' + this.installTarget + ' apt install grub-efi-' + utils_1.default.machineArch() + ' --yes' + this.toNull, echo);
471
- }
472
- else {
473
- await exec(`chroot ${this.installTarget} apt install grub-pc --yes` + this.toNull, echo);
474
- }
475
- await exec('chroot ' + this.installTarget + ' grub-install ' + this.disk.installationDevice + this.toNull, echo);
476
- await exec('chroot ' + this.installTarget + ' update-grub', echo);
477
- await exec('sleep 1', echo);
478
- // await Utils.customConfirm('installazione per ' + process.arch)
479
- }
480
- /**
481
- *
482
- */
483
- initramfsCfg(installDevice) {
484
- // userSwapChoices = ['none', 'small', 'suspend', 'file']
485
- const file = this.installTarget + '/etc/initramfs-tools/conf.d/resume';
486
- let text = '';
487
- if (this.partitions.userSwapChoice === 'none' || this.partitions.userSwapChoice === 'file') {
488
- text += '#RESUME=none\n';
489
- }
490
- else {
491
- text += 'RESUME=UUID=' + utils_1.default.uuid(this.devices.swap.name);
492
- }
493
- utils_1.default.write(file, text);
494
- }
495
- /**
496
- * initramfs()
497
- */
498
- async initramfs() {
499
- const echo = { echo: false, ignore: false };
500
- await exec('chroot ' + this.installTarget + ' mkinitramfs -o ~/initrd.img-$(uname -r)', echo);
501
- await exec('chroot ' + this.installTarget + ' mv ~/initrd.img-$(uname -r) /boot', echo);
502
- }
503
- /**
504
- * fstab()
505
- * @param devices
506
- */
507
- async fstab(installDevice) {
508
- const file = this.installTarget + '/etc/fstab';
509
- let mountOptsRoot = '';
510
- let mountOptsBoot = '';
511
- let mountOptsData = ``;
512
- let mountOptsEfi = '';
513
- let mountOptsSwap = '';
514
- if (await this.isRotational(installDevice)) {
515
- mountOptsRoot = 'defaults,relatime 0 1';
516
- mountOptsBoot = 'defaults,relatime 0 1';
517
- mountOptsData = 'defaults,relatime 0 1';
518
- mountOptsEfi = 'defaults,relatime 0 2';
519
- mountOptsSwap = 'defaults,relatime 0 2';
520
- }
521
- else {
522
- mountOptsRoot = 'defaults,noatime 0 1';
523
- mountOptsBoot = 'defaults,noatime 0 1';
524
- mountOptsData = 'defaults,noatime 0 1';
525
- mountOptsEfi = 'defaults,noatime 0 2';
526
- mountOptsSwap = 'defaults,noatime 0 2';
527
- }
528
- let text = '';
529
- text += `# ${this.devices.root.name} ${this.devices.root.mountPoint} ${this.devices.root.fsType} ${mountOptsRoot}\n`;
530
- text += `UUID=${utils_1.default.uuid(this.devices.root.name)} ${this.devices.root.mountPoint} ${this.devices.root.fsType} ${mountOptsRoot}\n`;
531
- if (this.devices.boot.name !== `none`) {
532
- text += `# ${this.devices.boot.name} ${this.devices.boot.mountPoint} ${this.devices.boot.fsType} ${mountOptsBoot}\n`;
533
- text += `UUID=${utils_1.default.uuid(this.devices.boot.name)} ${this.devices.boot.mountPoint} ${this.devices.root.fsType} ${mountOptsBoot}\n`;
534
- }
535
- if (this.devices.data.name !== `none`) {
536
- text += `# ${this.devices.data.name} ${this.devices.data.mountPoint} ${this.devices.data.fsType} ${mountOptsData}\n`;
537
- text += `UUID=${utils_1.default.uuid(this.devices.data.name)} ${this.devices.data.mountPoint} ${this.devices.data.fsType} ${mountOptsData}\n`;
538
- }
539
- if (this.efi) {
540
- text += `# ${this.devices.efi.name} ${this.devices.efi.mountPoint} vfat ${mountOptsEfi}\n`;
541
- text += `UUID=${utils_1.default.uuid(this.devices.efi.name)} ${this.devices.efi.mountPoint} vfat ${mountOptsEfi}\n`;
542
- }
543
- text += `# ${this.devices.swap.name} ${this.devices.swap.mountPoint} ${this.devices.swap.fsType} ${mountOptsSwap}\n`;
544
- text += `UUID=${utils_1.default.uuid(this.devices.swap.name)} ${this.devices.swap.mountPoint} ${this.devices.swap.fsType} ${mountOptsSwap}\n`;
545
- utils_1.default.write(file, text);
546
- }
547
- /**
548
- * setKeyboard
549
- */
550
- async setKeyboard() {
551
- const file = this.installTarget + '/etc/default/keyboard';
552
- let content = '# KEYBOARD CONFIGURATION FILE\n\n';
553
- content += '# Consult the keyboard(5) manual page.\n\n';
554
- content += 'XKBMODEL="' + this.keyboardModel + '"\n';
555
- content += 'XKBLAYOUT="' + this.keyboardLayout + '"\n';
556
- content += 'XKBVARIANT="' + this.keyboardVariant + '"\n';
557
- content += 'XKBOPTIONS=""\n';
558
- content += '\n';
559
- content += 'BACKSPACE="guess"\n';
560
- utils_1.default.write(file, content);
561
- // lancio setucon in chroot per salvare la tastiera
562
- const echo = { echo: false, ignore: false };
563
- const cmd = 'chroot ' + this.installTarget + ' ' + 'setupcon ' + this.toNull;
564
- try {
565
- await exec(cmd, echo);
566
- }
567
- catch (error) {
568
- console.log(error);
569
- }
570
- }
571
- /**
572
- * networkcfg
573
- */
574
- async networkcfg() {
575
- const file = this.installTarget + '/etc/network/interfaces';
576
- let content = '# created by eggs\n\n';
577
- content += 'auto lo\n';
578
- content += 'iface lo inet loopback\n\n';
579
- content += 'auto ' + this.network.iface + '\n';
580
- content += 'iface ' + this.network.iface + ' inet ' + this.network.addressType + '\n';
581
- if (this.network.addressType !== 'dhcp') {
582
- content += ' address ' + this.network.address + '\n';
583
- content += ' netmask ' + this.network.netmask + '\n';
584
- content += ' gateway ' + this.network.gateway + '\n';
585
- }
586
- utils_1.default.write(file, content);
587
- /**
588
- * resolv.conf
589
- */
590
- if (this.network.addressType !== 'dhcp') {
591
- const file = this.installTarget + '/etc/resolv.conf';
592
- let content = '# created by eggs\n\n';
593
- content += 'domain ' + this.network.domain + '\n';
594
- for (const element of this.network.dns) {
595
- content += 'nameserver ' + element + '\n';
596
- }
597
- utils_1.default.write(file, content);
598
- }
599
- }
600
- /**
601
- * hostname
602
- */
603
- async hostname() {
604
- const echo = { echo: false, ignore: false };
605
- const file = this.installTarget + '/etc/hostname';
606
- const text = this.host.name;
607
- await exec(`rm ${file} `, echo);
608
- fs.writeFileSync(file, text);
609
- }
610
- /**
611
- * hosts
612
- */
613
- async hosts() {
614
- const file = this.installTarget + '/etc/hosts';
615
- let text = '127.0.0.1 localhost localhost.localdomain\n';
616
- if (this.network.addressType === 'static') {
617
- text += `${this.network.address} ${this.host.name} ${this.host.name}.${this.host.domain} pvelocalhost\n`;
618
- }
619
- else {
620
- text += `127.0.1.1 ${this.host.name} ${this.host.name}.${this.host.domain} \n`;
621
- }
622
- text += `# The following lines are desirable for IPv6 capable hosts\n`;
623
- text += `:: 1 ip6 - localhost ip6 - loopback\n`;
624
- text += `fe00:: 0 ip6 - localnet\n`;
625
- text += `ff00:: 0 ip6 - mcastprefix\n`;
626
- text += `ff02:: 1 ip6 - allnodes\n`;
627
- text += `ff02:: 2 ip6 - allrouters\n`;
628
- text += `ff02:: 3 ip6 - allhosts\n`;
629
- fs.writeFileSync(file, text);
630
- }
631
- /**
632
- * removeInstaller
633
- */
634
- async removeInstaller() {
635
- let file = `${this.installTarget}/usr/bin/penguins-links-add.sh`;
636
- let lines = [];
637
- let content = '';
638
- if (fs.existsSync(file)) {
639
- lines = fs.readFileSync(file, { encoding: 'utf8', flag: 'r' }).split('\n');
640
- for (let i = 0; i < lines.length; i++) {
641
- if (lines[i]) {
642
- if (lines[i].search('penguins-krill.desktop') !== -1) {
643
- lines[i] += '#';
644
- }
645
- if (lines[i].search('penguins-clinstaller.desktop') !== -1) {
646
- lines[i] += '#';
647
- }
648
- if (lines[i].search('install-debian.desktop') !== -1) {
649
- lines[i] += '#';
650
- }
651
- content += lines[i] + '\n';
652
- }
653
- }
654
- }
655
- fs.writeFileSync(file, content);
656
- }
657
- /**
658
- * unpackfs
659
- */
660
- async unpackfs() {
661
- const echo = utils_1.default.setEcho(this.verbose);
662
- const cmd = 'unsquashfs -d ' + this.installTarget + ' -f ' + this.distro.squashFs;
663
- await exec(cmd);
664
- }
665
- /**
666
- * syncfs
667
- */
668
- async syncfs() {
669
- const echo = utils_1.default.setEcho(this.verbose);
670
- let cmd = '';
671
- let f = '';
672
- f += ' --filter="- /cdrom/*"';
673
- f += ' --filter="- /dev/*"';
674
- f += ' --filter="- /home/' + this.settings.config.user_opt + '/*"'; // esclude da rsync solo utente live
675
- f += ' --filter="- /live"';
676
- f += ' --filter="- /media/*"';
677
- f += ' --filter="- /mnt/*"';
678
- f += ' --filter="- /proc/*"';
679
- f += ' --filter="- /swapfile"';
680
- f += ' --filter="- /sys/*"';
681
- f += ' --filter="- /tmp/*"';
682
- // boot
683
- f += ' --filter="- /boot/efi*"';
684
- f += ' --filter="- /boot/grub/device.map"';
685
- f += ' --filter="- /boot/grub/grub.cfg"';
686
- f += ' --filter="- /boot/grub/menu.lst"';
687
- // etc
688
- f += ' --filter="- /etc/fstab.d/*"';
689
- f += ' --filter="- /etc/mtab"';
690
- f += ' --filter="- /etc/popularity-contest.conf"';
691
- f += ' --filter="- /etc/PolicyKit/PolicyKit.conf"';
692
- // var
693
- f += ' --filter="- /var/lib/dbus/machine-id"';
694
- // Added for newer version of live-config/live-boot
695
- f += ' --filter="- /lib/live/image"';
696
- f += ' --filter="- /lib/live/mount"';
697
- f += ' --filter="- /lib/live/overlay"';
698
- f += ' --filter="- /lib/live/rootfs"';
699
- // Added for symlink /lib
700
- f += ' --filter="- /usr/lib/live/image"';
701
- f += ' --filter="- /usr/lib/live/mount"';
702
- f += ' --filter="- /usr/lib/live/overlay"';
703
- f += ' --filter="- /usr/lib/live/rootfs"';
704
- f += ' --filter="- /run/*"';
705
- // --progress \
706
- cmd = `\
707
- rsync \
708
- --archive \
709
- --delete -before \
710
- --delete -excluded \
711
- --info=progress2 \
712
- ${f} \
713
- / ${this.installTarget}`;
714
- await exec(cmd.trim());
715
- }
716
- /**
717
- *
718
- */
719
- async restoreUsersData() {
720
- utils_1.default.warning('Opening volume luks-users-data and map it in /dev/mapper/eggs-users-data.');
721
- utils_1.default.warning('You will insert the same passphrase you choose during the backup production');
722
- child_process_1.execSync('sudo cryptsetup luksOpen /run/live/medium/live/luks-users-data eggs-users-data', { stdio: 'inherit' });
723
- utils_1.default.warning('mounting volume eggs-users-data in /mnt');
724
- child_process_1.execSync('sudo mount /dev/mapper/eggs-users-data /mnt', { stdio: 'inherit' });
725
- utils_1.default.warning('removing live user in the installed system');
726
- child_process_1.execSync('rm -rf /tmp/calamares-krill-root/home/*', { stdio: 'inherit' });
727
- utils_1.default.warning('copying users home in the installed system');
728
- child_process_1.execSync('rsync -a /mnt/home/ /tmp/calamares-krill-root/home/', { stdio: 'inherit' });
729
- utils_1.default.warning('copying users accounts in the installed system');
730
- child_process_1.execSync('cp /mnt/etc/passwd /tmp/calamares-krill-root/etc/', { stdio: 'inherit' });
731
- child_process_1.execSync('cp /mnt/etc/shadow /tmp/calamares-krill-root/etc/', { stdio: 'inherit' });
732
- child_process_1.execSync('cp /mnt/etc/group /tmp/calamares-krill-root/etc/', { stdio: 'inherit' });
733
- utils_1.default.warning('unmount /mnt');
734
- child_process_1.execSync('umount /mnt', { stdio: 'inherit' });
735
- utils_1.default.warning('closing eggs-users-data');
736
- child_process_1.execSync('cryptsetup luksClose eggs-users-data', { stdio: 'inherit' });
737
- }
738
- /**
739
- * mkfs
740
- */
741
- async mkfs() {
742
- // this.disk.fsType = partitions.filesystemType
743
- // this.disk.installationDevice = partitions.installationDevice
744
- // this.disk.partionType = 'simple'
745
- const echo = { echo: false, ignore: false };
746
- const result = true;
747
- if (this.efi) {
748
- await exec(`mkdosfs -F 32 -I ${this.devices.efi.name}` + this.toNull, echo);
749
- }
750
- if (this.devices.boot.name !== 'none') {
751
- if (this.devices.boot.fsType === undefined) {
752
- this.devices.boot.fsType = `ext2`;
753
- this.devices.boot.mountPoint = '/boot';
754
- }
755
- await exec('mke2fs -Ft ' + this.devices.boot.fsType + ' ' + this.devices.boot.name + this.toNull, echo);
756
- }
757
- if (this.devices.root.name !== 'none') {
758
- await exec('mke2fs -Ft ' + this.devices.root.fsType + ' ' + this.devices.root.name + this.toNull, echo);
759
- }
760
- if (this.devices.data.name !== 'none') {
761
- await exec('mke2fs -Ft ' + this.devices.data.fsType + ' ' + this.devices.data.name + this.toNull, echo);
762
- }
763
- if (this.devices.swap.name !== 'none') {
764
- await exec('mkswap ' + this.devices.swap.name + this.toNull, echo);
765
- }
766
- return result;
767
- }
768
- /**
769
- * mount
770
- */
771
- async mount() {
772
- const echo = { echo: false, ignore: false };
773
- if (!fs.existsSync(this.installTarget)) {
774
- await exec(`mkdir ${this.installTarget}` + this.toNull, echo);
775
- }
776
- // root
777
- await exec(`mount ${this.devices.root.name} ${this.installTarget}${this.devices.root.mountPoint}` + this.toNull, echo);
778
- await exec(`tune2fs -c 0 -i 0 ${this.devices.root.name}` + this.toNull, echo);
779
- await exec(`rm -rf ${this.installTarget}/lost+found` + this.toNull, echo);
780
- // boot
781
- if (this.devices.boot.name !== `none`) {
782
- await exec(`mkdir ${this.installTarget}/boot -p` + this.toNull);
783
- await exec(`mount ${this.devices.boot.name} ${this.installTarget}${this.devices.boot.mountPoint}` + this.toNull, echo);
784
- await exec(`tune2fs -c 0 -i 0 ${this.devices.boot.name}` + this.toNull, echo);
785
- }
786
- // data
787
- if (this.devices.data.name !== `none`) {
788
- await exec(`mkdir ${this.installTarget}${this.devices.data.mountPoint} -p` + this.toNull);
789
- await exec(`mount ${this.devices.data.name} ${this.installTarget}${this.devices.data.mountPoint}` + this.toNull, echo);
790
- await exec(`tune2fs -c 0 -i 0 ${this.devices.data.name}` + this.toNull, echo);
791
- }
792
- if (this.efi) {
793
- if (!fs.existsSync(this.installTarget + this.devices.efi.mountPoint)) {
794
- await exec(`mkdir ${this.installTarget}${this.devices.efi.mountPoint} -p` + this.toNull, echo);
795
- await exec(`mount ${this.devices.efi.name} ${this.installTarget}${this.devices.efi.mountPoint}` + this.toNull, echo);
796
- }
797
- }
798
- return true;
799
- }
800
- /**
801
- * umount
802
- */
803
- async umount() {
804
- const echo = { echo: false, ignore: false };
805
- if (this.efi) {
806
- await exec(`umount ${this.installTarget}/boot/efi` + this.toNull, echo);
807
- await exec('sleep 1', echo);
808
- }
809
- if (this.devices.data.name !== `none`) {
810
- await exec(`umount ${this.devices.data.name}` + this.toNull, echo);
811
- }
812
- if (this.devices.boot.name !== `none`) {
813
- await exec(`umount ${this.devices.boot.name}` + this.toNull, echo);
814
- }
815
- await exec(`umount ${this.devices.root.name}` + this.toNull, echo);
816
- await exec('sleep 1', echo);
817
- return true;
818
- }
819
- /**
820
- * mountvfs()
821
- */
822
- async mountvfs() {
823
- const echo = { echo: true, ignore: true };
824
- await exec('mkdir ' + this.installTarget + '/dev' + this.toNull);
825
- await exec('mkdir ' + this.installTarget + '/dev/pts' + this.toNull);
826
- await exec('mkdir ' + this.installTarget + '/proc' + this.toNull);
827
- await exec('mkdir ' + this.installTarget + '/sys' + this.toNull);
828
- await exec('mkdir ' + this.installTarget + '/run' + this.toNull);
829
- await exec(`mount -o bind /dev ${this.installTarget}/dev` + this.toNull, echo);
830
- await exec(`mount -o bind /dev/pts ${this.installTarget}/dev/pts` + this.toNull, echo);
831
- await exec(`mount -o bind /proc ${this.installTarget}/proc` + this.toNull, echo);
832
- await exec(`mount -o bind /sys ${this.installTarget}/sys` + this.toNull, echo);
833
- await exec(`mount -o bind /run ${this.installTarget}/run` + this.toNull, echo);
834
- }
835
- /**
836
- */
837
- async umountvfs() {
838
- const echo = { echo: false, ignore: false };
839
- if (utils_1.default.isMountpoint(`${this.installTarget}/dev/pts`)) {
840
- await exec(`umount ${this.installTarget}/dev/pts` + this.toNull, echo);
841
- await exec('sleep 1', echo);
842
- }
843
- if (utils_1.default.isMountpoint(`${this.installTarget}/dev`)) {
844
- await exec(`umount ${this.installTarget}/dev` + this.toNull, echo);
845
- await exec('sleep 1', echo);
846
- }
847
- if (utils_1.default.isMountpoint(`${this.installTarget}/proc`)) {
848
- await exec(`umount ${this.installTarget}/proc` + this.toNull, echo);
849
- await exec('sleep 1', echo);
850
- }
851
- if (utils_1.default.isMountpoint(`${this.installTarget}/run`)) {
852
- await exec(`umount ${this.installTarget}/run` + this.toNull, echo);
853
- await exec('sleep 1', echo);
854
- }
855
- if (utils_1.default.isMountpoint(`${this.installTarget}/sys/fs/fuse/connections`)) {
856
- await exec(`umount ${this.installTarget}/sys/fs/fuse/connections` + this.toNull, echo);
857
- await exec('sleep 1', echo);
858
- }
859
- if (utils_1.default.isMountpoint(`${this.installTarget}/sys`)) {
860
- await exec(`umount ${this.installTarget}/sys` + this.toNull, echo);
861
- await exec('sleep 1', echo);
862
- }
863
- }
864
- /**
865
- *
866
- * @param device
867
- * @param partitionType
868
- * @param verbose
869
- */
870
- async partition(device, partitionType) {
871
- const echo = { echo: false, ignore: false };
872
- let retVal = false;
873
- await exec('wipefs -a ' + device + this.toNull);
874
- //await exec('dd if=/dev/zero of=' + device + ' bs=512 count=1 conv=notrunc')
875
- if (partitionType === 'simple' && !this.efi) {
876
- /**
877
- * simple, non EFI
878
- */
879
- await exec('parted --script ' + device + ' mklabel msdos' + this.toNull, echo);
880
- await exec('parted --script --align optimal ' + device + ' mkpart primary 1MiB 95%' + this.toNull, echo);
881
- await exec('parted --script ' + device + ' set 1 boot on' + this.toNull, echo);
882
- await exec('parted --script --align optimal ' + device + ' mkpart primary 95% 100%' + this.toNull, echo);
883
- this.devices.efi.name = `none`;
884
- this.devices.boot.name = `none`;
885
- this.devices.root.name = device + '1';
886
- this.devices.root.fsType = 'ext4';
887
- this.devices.root.mountPoint = '/';
888
- this.devices.data.name = `none`;
889
- this.devices.swap.name = device + '2';
890
- this.devices.swap.fsType = 'swap';
891
- this.devices.swap.mountPoint = 'none';
892
- retVal = true;
893
- }
894
- else if (partitionType === 'simple' && this.efi) {
895
- /**
896
- * simple, EFI
897
- */
898
- await exec('parted --script ' + device + ' mklabel gpt mkpart primary 0% 1% mkpart primary 1% 95% mkpart primary linux-swap 95% 100%' + this.toNull, echo);
899
- await exec('parted --script ' + device + ' set 1 boot on' + this.toNull, echo);
900
- await exec('parted --script ' + device + ' set 1 esp on' + this.toNull, echo);
901
- this.devices.efi.name = device + '1';
902
- this.devices.efi.fsType = 'F 32 -I';
903
- this.devices.efi.mountPoint = '/boot/efi';
904
- this.devices.boot.name = `none`;
905
- this.devices.root.name = device + '2';
906
- this.devices.root.fsType = 'ext4';
907
- this.devices.root.mountPoint = '/';
908
- this.devices.data.name = `none`;
909
- this.devices.swap.name = device + '3';
910
- this.devices.swap.fsType = 'swap';
911
- retVal = true;
912
- }
913
- else if (partitionType === 'lvm2' && !this.efi) {
914
- /**
915
- * LVM2, non EFI
916
- */
917
- await exec(`parted --script ${device} mklabel msdos`);
918
- // Creo partizioni
919
- await exec(`parted --script ${device} mkpart primary ext2 1 512`);
920
- await exec(`parted --script --align optimal ${device} set 1 boot on`);
921
- await exec(`parted --script --align optimal ${device} mkpart primary ext2 512 100%`);
922
- await exec(`parted --script ${device} set 2 lvm on`);
923
- // Partizione LVM
924
- const lvmPartname = shx.exec(`fdisk $1 -l | grep 8e | awk '{print $1}' | cut -d "/" -f3`).stdout.trim();
925
- const lvmByteSize = Number(shx.exec(`cat /proc/partitions | grep ${lvmPartname}| awk '{print $3}' | grep "[0-9]"`).stdout.trim());
926
- const lvmSize = lvmByteSize / 1024;
927
- // La partizione di root viene posta ad 1/4 della partizione LVM.
928
- // Viene limitata fino ad un massimo di 100 GB
929
- const lvmSwapSize = 4 * 1024;
930
- let lvmRootSize = lvmSize / 8;
931
- if (lvmRootSize < 20480) {
932
- lvmRootSize = 20480;
933
- }
934
- const lvmDataSize = lvmSize - lvmRootSize - lvmSwapSize;
935
- await exec(`pvcreate /dev/${lvmPartname}`);
936
- await exec(`vgcreate pve /dev/${lvmPartname}`);
937
- await exec(`vgchange -an`);
938
- await exec(`lvcreate -L ${lvmSwapSize} -nswap pve`);
939
- await exec(`lvcreate -L ${lvmRootSize} -nroot pve`);
940
- await exec(`lvcreate -l 100%FREE -ndata pve`);
941
- await exec(`vgchange -a y pve`);
942
- this.devices.efi.name = `none`;
943
- this.devices.boot.name = `${device}1`;
944
- this.devices.root.fsType = 'ext2';
945
- this.devices.root.mountPoint = '/boot';
946
- this.devices.root.name = `/dev/pve/root`;
947
- this.devices.root.fsType = 'ext4';
948
- this.devices.root.mountPoint = '/';
949
- this.devices.data.name = `/dev/pve/data`;
950
- this.devices.data.fsType = 'ext4';
951
- this.devices.data.mountPoint = '/var/lib/vz';
952
- this.devices.swap.name = `/dev/pve/swap`;
953
- retVal = true;
954
- }
955
- else if (partitionType === 'lvm2' && this.efi) {
956
- /**
957
- * LVM2, EFI
958
- */
959
- console.log('LVM2 on UEFI: to be implemented!');
960
- process.exit(0);
961
- }
962
- return retVal;
963
- }
964
- /**
965
- * isRotational
966
- * @param device
967
- */
968
- async isRotational(device) {
969
- device = device.substring(4);
970
- let response;
971
- let retVal = false;
972
- response = shx.exec(`cat /sys/block/${device}/queue/rotational`, { silent: this.verbose }).stdout.trim();
973
- if (response === '1') {
974
- retVal = true;
975
- }
976
- return retVal;
977
- }
978
- /**
979
- * execCalamaresModule
980
- *
981
- * @param name
982
- */
983
- async execCalamaresModule(name) {
984
- const echo = { echo: false, ignore: false };
985
- const moduleName = this.installer.multiarchModules + name + '/module.desc';
986
- if (fs.existsSync(moduleName)) {
987
- console.log('analyzing: ' + moduleName);
988
- const calamaresModule = js_yaml_1.default.load(fs.readFileSync(moduleName, 'utf8'));
989
- let command = calamaresModule.command;
990
- console.log('command: ' + command);
991
- if (command !== '' || command !== undefined) {
992
- command += this.toNull;
993
- await exec(command);
994
- }
995
- }
996
- else {
997
- /**
998
- * patch per ubuntu sostituisce bootloader-config e bootloader
999
- */
1000
- if (name === 'bootloader-config') {
1001
- await this.bootloaderConfigUbuntu();
1002
- }
1003
- }
1004
- }
1005
- /**
1006
- *
1007
- */
1008
- async bootloaderConfigUbuntu() {
1009
- const echo = { echo: false, ignore: false };
1010
- let cmd = '';
1011
- try {
1012
- cmd = 'chroot ' + this.installTarget + ' ' + 'apt-get update -y ' + this.toNull;
1013
- await exec(cmd, echo);
1014
- }
1015
- catch (error) {
1016
- console.log(error);
1017
- }
1018
- try {
1019
- cmd = 'chroot ' + this.installTarget + ' sleep 1' + this.toNull;
1020
- await exec(cmd, echo);
1021
- }
1022
- catch (error) {
1023
- console.log(error);
1024
- }
1025
- let aptInstallOptions = ' apt install -y --no-upgrade --allow-unauthenticated -o Acquire::gpgv::Options::=--ignore-time-conflict ';
1026
- if (this.efi) {
1027
- try {
1028
- cmd = 'chroot ' + this.installTarget + aptInstallOptions + ' grub-efi-' + utils_1.default.machineArch() + ' --allow-unauthenticated ' + this.toNull;
1029
- await exec(cmd, echo);
1030
- }
1031
- catch (error) {
1032
- console.log('cmd: ' + cmd + ' error: ' + error);
1033
- }
1034
- }
1035
- else {
1036
- try {
1037
- cmd = 'chroot ' + this.installTarget + aptInstallOptions + ' grub-pc' + this.toNull;
1038
- await exec(cmd, echo);
1039
- }
1040
- catch (error) {
1041
- console.log('cmd: ' + cmd + ' error: ' + error);
1042
- }
1043
- }
1044
- try {
1045
- cmd = 'chroot ' + this.installTarget + ' sleep 1' + this.toNull;
1046
- await exec(cmd, echo);
1047
- }
1048
- catch (error) {
1049
- console.log('cmd: ' + cmd + ' error: ' + error);
1050
- }
1051
- try {
1052
- cmd = 'chroot ' + this.installTarget + ' grub-install ' + this.disk.installationDevice + this.toNull;
1053
- await exec(cmd, echo);
1054
- }
1055
- catch (error) {
1056
- console.log('cmd: ' + cmd + ' error: ' + error);
1057
- }
1058
- try {
1059
- cmd = 'chroot ' + this.installTarget + ' grub-mkconfig -o /boot/grub/grub.cfg' + this.toNull;
1060
- await exec(cmd, echo);
1061
- }
1062
- catch (error) {
1063
- console.log('cmd: ' + cmd + ' error: ' + error);
1064
- }
1065
- // await Utils.customConfirmAbort(cmd)
1066
- try {
1067
- cmd = 'chroot ' + this.installTarget + ' update-grub' + this.toNull;
1068
- await exec(cmd, echo);
1069
- }
1070
- catch (error) {
1071
- console.log('cmd: ' + cmd + ' error: ' + error);
1072
- }
1073
- try {
1074
- cmd = 'chroot ' + this.installTarget + ' sleep 1' + this.toNull;
1075
- await exec(cmd, echo);
1076
- }
1077
- catch (error) {
1078
- console.log('cmd: ' + cmd + ' error: ' + error);
1079
- }
1080
- }
1081
- /**
1082
- * only show the result
1083
- */
1084
- finished() {
1085
- redraw(react_1.default.createElement(finished_1.default, { installationDevice: this.disk.installationDevice, hostName: this.host.name, userName: this.users.name }));
1086
- require('child_process').spawnSync('read _ ', { shell: true, stdio: [0, 1, 2] });
1087
- shx.exec('reboot');
1088
- }
1089
- }
1090
- exports.default = Hatching;
1091
- const ifaces = fs.readdirSync('/sys/class/net/');
1092
- /**
1093
- * Occorre farglierlo rigenerare a forza
1094
- * anche quando NON cambiano i dati
1095
- * forceUpdate
1096
- */
1097
- function redraw(elem) {
1098
- let opt = {};
1099
- opt.patchConsole = false;
1100
- opt.debug = false;
1101
- shx.exec('clear');
1102
- ink_1.render(elem, opt);
1103
- }
1104
- /**
1105
- *
1106
- * @param message
1107
- */
1108
- async function checkIt(message) {
1109
- await utils_1.default.customConfirm(message);
1110
- }