penguins-eggs 10.0.53 → 10.0.55

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 (346) hide show
  1. package/.oclif.manifest.json +1548 -2
  2. package/README.md +787 -0
  3. package/addons/eggs/theme/livecd/grub.main.simple.cfg +49 -0
  4. package/addons/eggs/theme/livecd/isolinux.theme.cfg +6 -5
  5. package/conf/derivatives.yaml +2 -1
  6. package/conf/distros/fedora/calamares/settings.yml +0 -6
  7. package/dist/classes/bleach.d.ts +32 -0
  8. package/dist/classes/bleach.js +135 -0
  9. package/dist/classes/cfs.d.ts +17 -0
  10. package/dist/classes/cfs.js +39 -0
  11. package/dist/classes/cli-autologin.d.ts +52 -0
  12. package/dist/classes/cli-autologin.js +247 -0
  13. package/dist/classes/compressors.d.ts +54 -0
  14. package/dist/classes/compressors.js +109 -0
  15. package/dist/classes/daddy.d.ts +26 -0
  16. package/dist/classes/daddy.js +167 -0
  17. package/dist/classes/distro.d.ts +32 -0
  18. package/dist/classes/distro.js +360 -0
  19. package/dist/classes/diversions.d.ts +48 -0
  20. package/dist/classes/diversions.js +116 -0
  21. package/dist/classes/incubation/branding.d.ts +17 -0
  22. package/dist/classes/incubation/branding.js +85 -0
  23. package/dist/classes/incubation/fisherman-helper/displaymanager.d.ts +11 -0
  24. package/dist/classes/incubation/fisherman-helper/displaymanager.js +40 -0
  25. package/dist/classes/incubation/fisherman-helper/packages.d.ts +20 -0
  26. package/dist/classes/incubation/fisherman-helper/packages.js +72 -0
  27. package/dist/classes/incubation/fisherman-helper/settings.d.ts +15 -0
  28. package/dist/classes/incubation/fisherman-helper/settings.js +83 -0
  29. package/dist/classes/incubation/fisherman.d.ts +70 -0
  30. package/dist/classes/incubation/fisherman.js +263 -0
  31. package/dist/classes/incubation/incubator.d/alpine.d.ts +32 -0
  32. package/dist/classes/incubation/incubator.d/alpine.js +78 -0
  33. package/dist/classes/incubation/incubator.d/bionic.d.ts +32 -0
  34. package/dist/classes/incubation/incubator.d/bionic.js +83 -0
  35. package/dist/classes/incubation/incubator.d/buster.d.ts +32 -0
  36. package/dist/classes/incubation/incubator.d/buster.js +85 -0
  37. package/dist/classes/incubation/incubator.d/jessie.d.ts +31 -0
  38. package/dist/classes/incubation/incubator.d/jessie.js +44 -0
  39. package/dist/classes/incubation/incubator.d/noble.d.ts +32 -0
  40. package/dist/classes/incubation/incubator.d/noble.js +85 -0
  41. package/dist/classes/incubation/incubator.d/openmamba.d.ts +32 -0
  42. package/dist/classes/incubation/incubator.d/openmamba.js +81 -0
  43. package/dist/classes/incubation/incubator.d/opensuse.d.ts +32 -0
  44. package/dist/classes/incubation/incubator.d/opensuse.js +81 -0
  45. package/dist/classes/incubation/incubator.d/rolling.d.ts +32 -0
  46. package/dist/classes/incubation/incubator.d/rolling.js +80 -0
  47. package/dist/classes/incubation/incubator.d.ts +44 -0
  48. package/dist/classes/incubation/incubator.js +382 -0
  49. package/dist/classes/incubation/installer.d.ts +13 -0
  50. package/dist/classes/incubation/installer.js +52 -0
  51. package/dist/classes/keyboards.d.ts +50 -0
  52. package/dist/classes/keyboards.js +287 -0
  53. package/dist/classes/locales.d.ts +21 -0
  54. package/dist/classes/locales.js +77 -0
  55. package/dist/classes/network.d.ts +37 -0
  56. package/dist/classes/network.js +98 -0
  57. package/dist/classes/ovary.d.ts +198 -0
  58. package/dist/classes/ovary.js +1843 -0
  59. package/dist/classes/pacman.d/aldos.d.ts +52 -0
  60. package/dist/classes/pacman.d/aldos.js +100 -0
  61. package/dist/classes/pacman.d/alpine.d.ts +56 -0
  62. package/dist/classes/pacman.d/alpine.js +162 -0
  63. package/dist/classes/pacman.d/archlinux.d.ts +62 -0
  64. package/dist/classes/pacman.d/archlinux.js +137 -0
  65. package/dist/classes/pacman.d/debian.d.ts +65 -0
  66. package/dist/classes/pacman.d/debian.js +143 -0
  67. package/dist/classes/pacman.d/fedora.d.ts +53 -0
  68. package/dist/classes/pacman.d/fedora.js +101 -0
  69. package/dist/classes/pacman.d/openmamba.d.ts +52 -0
  70. package/dist/classes/pacman.d/openmamba.js +100 -0
  71. package/dist/classes/pacman.d/opensuse.d.ts +53 -0
  72. package/dist/classes/pacman.d/opensuse.js +102 -0
  73. package/dist/classes/pacman.d/voidlinux.d.ts +52 -0
  74. package/dist/classes/pacman.d/voidlinux.js +90 -0
  75. package/dist/classes/pacman.d.ts +139 -0
  76. package/dist/classes/pacman.js +775 -0
  77. package/dist/classes/pve-live.d.ts +17 -0
  78. package/dist/classes/pve-live.js +52 -0
  79. package/dist/classes/pxe.d.ts +74 -0
  80. package/dist/classes/pxe.js +410 -0
  81. package/dist/classes/settings.d.ts +53 -0
  82. package/dist/classes/settings.js +185 -0
  83. package/dist/classes/sources_list.d.ts +28 -0
  84. package/dist/classes/sources_list.js +89 -0
  85. package/dist/classes/systemctl.d.ts +47 -0
  86. package/dist/classes/systemctl.js +86 -0
  87. package/dist/classes/tailor.d.ts +50 -0
  88. package/dist/classes/tailor.js +526 -0
  89. package/dist/classes/tools.d.ts +26 -0
  90. package/dist/classes/tools.js +50 -0
  91. package/dist/classes/users.d.ts +28 -0
  92. package/dist/classes/users.js +143 -0
  93. package/dist/classes/utils.d.ts +324 -0
  94. package/dist/classes/utils.js +976 -0
  95. package/dist/classes/xdg.d.ts +45 -0
  96. package/dist/classes/xdg.js +337 -0
  97. package/dist/classes/yolk.d.ts +33 -0
  98. package/dist/classes/yolk.js +114 -0
  99. package/dist/commands/adapt.d.ts +17 -0
  100. package/dist/commands/adapt.js +33 -0
  101. package/dist/commands/analyze.d.ts +26 -0
  102. package/dist/commands/analyze.js +95 -0
  103. package/dist/commands/calamares.d.ts +29 -0
  104. package/dist/commands/calamares.js +112 -0
  105. package/dist/commands/config.d.ts +35 -0
  106. package/dist/commands/config.js +120 -0
  107. package/dist/commands/cuckoo.d.ts +16 -0
  108. package/dist/commands/cuckoo.js +62 -0
  109. package/dist/commands/dad.d.ts +20 -0
  110. package/dist/commands/dad.js +46 -0
  111. package/dist/commands/export/iso.d.ts +19 -0
  112. package/dist/commands/export/iso.js +55 -0
  113. package/dist/commands/export/pkg.d.ts +29 -0
  114. package/dist/commands/export/pkg.js +163 -0
  115. package/dist/commands/export/tarballs.d.ts +27 -0
  116. package/dist/commands/export/tarballs.js +84 -0
  117. package/dist/commands/install.d.ts +37 -0
  118. package/dist/commands/install.js +88 -0
  119. package/dist/commands/kill.d.ts +24 -0
  120. package/dist/commands/kill.js +50 -0
  121. package/dist/commands/love.d.ts +20 -0
  122. package/dist/commands/love.js +59 -0
  123. package/dist/commands/mom.d.ts +16 -0
  124. package/dist/commands/mom.js +30 -0
  125. package/dist/commands/produce.d.ts +34 -0
  126. package/dist/commands/produce.js +201 -0
  127. package/dist/commands/status.d.ts +23 -0
  128. package/dist/commands/status.js +31 -0
  129. package/dist/commands/syncfrom.d.ts +45 -0
  130. package/dist/commands/syncfrom.js +152 -0
  131. package/dist/commands/syncto.d.ts +40 -0
  132. package/dist/commands/syncto.js +175 -0
  133. package/dist/commands/tools/clean.d.ts +18 -0
  134. package/dist/commands/tools/clean.js +37 -0
  135. package/dist/commands/tools/ppa.d.ts +26 -0
  136. package/dist/commands/tools/ppa.js +138 -0
  137. package/dist/commands/tools/skel.d.ts +18 -0
  138. package/dist/commands/tools/skel.js +44 -0
  139. package/dist/commands/tools/stat.d.ts +31 -0
  140. package/dist/commands/tools/stat.js +70 -0
  141. package/dist/commands/tools/yolk.d.ts +24 -0
  142. package/dist/commands/tools/yolk.js +45 -0
  143. package/dist/commands/update.d.ts +51 -0
  144. package/dist/commands/update.js +219 -0
  145. package/dist/commands/wardrobe/get.d.ts +23 -0
  146. package/dist/commands/wardrobe/get.js +52 -0
  147. package/dist/commands/wardrobe/list.d.ts +24 -0
  148. package/dist/commands/wardrobe/list.js +125 -0
  149. package/dist/commands/wardrobe/show.d.ts +25 -0
  150. package/dist/commands/wardrobe/show.js +97 -0
  151. package/dist/commands/wardrobe/wear.d.ts +26 -0
  152. package/dist/commands/wardrobe/wear.js +84 -0
  153. package/dist/components/finished.d.ts +16 -0
  154. package/dist/components/finished.js +56 -0
  155. package/dist/components/information.d.ts +8 -0
  156. package/dist/components/information.js +154 -0
  157. package/dist/components/install.d.ts +15 -0
  158. package/dist/components/install.js +60 -0
  159. package/dist/components/keyboard.d.ts +16 -0
  160. package/dist/components/keyboard.js +54 -0
  161. package/dist/components/location.d.ts +16 -0
  162. package/dist/components/location.js +59 -0
  163. package/dist/components/network.d.ts +19 -0
  164. package/dist/components/network.js +65 -0
  165. package/dist/components/partitions.d.ts +16 -0
  166. package/dist/components/partitions.js +73 -0
  167. package/dist/components/steps.d.ts +13 -0
  168. package/dist/components/steps.js +148 -0
  169. package/dist/components/summary.d.ts +24 -0
  170. package/dist/components/summary.js +81 -0
  171. package/dist/components/title.d.ts +11 -0
  172. package/dist/components/title.js +35 -0
  173. package/dist/components/users.d.ts +24 -0
  174. package/dist/components/users.js +80 -0
  175. package/dist/components/welcome.d.ts +13 -0
  176. package/dist/components/welcome.js +63 -0
  177. package/dist/index-old.d.ts +8 -0
  178. package/dist/index-old.js +8 -0
  179. package/dist/index.d.ts +54 -0
  180. package/dist/index.js +147 -0
  181. package/dist/interfaces/i-addons.d.ts +12 -0
  182. package/dist/interfaces/i-addons.js +8 -0
  183. package/dist/interfaces/i-analyze.d.ts +17 -0
  184. package/dist/interfaces/i-analyze.js +17 -0
  185. package/dist/interfaces/i-app.d.ts +14 -0
  186. package/dist/interfaces/i-app.js +8 -0
  187. package/dist/interfaces/i-branding.d.ts +36 -0
  188. package/dist/interfaces/i-branding.js +8 -0
  189. package/dist/interfaces/i-calamares-displaymanager.d.ts +17 -0
  190. package/dist/interfaces/i-calamares-displaymanager.js +1 -0
  191. package/dist/interfaces/i-calamares-finished.d.ts +12 -0
  192. package/dist/interfaces/i-calamares-finished.js +1 -0
  193. package/dist/interfaces/i-calamares-packages.d.ts +28 -0
  194. package/dist/interfaces/i-calamares-packages.js +1 -0
  195. package/dist/interfaces/i-calamares-partition.d.ts +40 -0
  196. package/dist/interfaces/i-calamares-partition.js +1 -0
  197. package/dist/interfaces/i-config-tools.d.ts +15 -0
  198. package/dist/interfaces/i-config-tools.js +8 -0
  199. package/dist/interfaces/i-devices.d.ts +20 -0
  200. package/dist/interfaces/i-devices.js +8 -0
  201. package/dist/interfaces/i-distro.d.ts +23 -0
  202. package/dist/interfaces/i-distro.js +8 -0
  203. package/dist/interfaces/i-drive-list.d.ts +33 -0
  204. package/dist/interfaces/i-drive-list.js +8 -0
  205. package/dist/interfaces/i-eggs-config.d.ts +32 -0
  206. package/dist/interfaces/i-eggs-config.js +8 -0
  207. package/dist/interfaces/i-excludes.d.ts +14 -0
  208. package/dist/interfaces/i-excludes.js +8 -0
  209. package/dist/interfaces/i-exec.d.ts +11 -0
  210. package/dist/interfaces/i-exec.js +8 -0
  211. package/dist/interfaces/i-initrd.d.ts +13 -0
  212. package/dist/interfaces/i-initrd.js +8 -0
  213. package/dist/interfaces/i-install.d.ts +16 -0
  214. package/dist/interfaces/i-install.js +8 -0
  215. package/dist/interfaces/i-installer.d.ts +17 -0
  216. package/dist/interfaces/i-installer.js +8 -0
  217. package/dist/interfaces/i-krill-config.d.ts +33 -0
  218. package/dist/interfaces/i-krill-config.js +8 -0
  219. package/dist/interfaces/i-krill.d.ts +42 -0
  220. package/dist/interfaces/i-krill.js +8 -0
  221. package/dist/interfaces/i-materia.d.ts +36 -0
  222. package/dist/interfaces/i-materia.js +8 -0
  223. package/dist/interfaces/i-net.d.ts +16 -0
  224. package/dist/interfaces/i-net.js +8 -0
  225. package/dist/interfaces/i-packages.d.ts +16 -0
  226. package/dist/interfaces/i-packages.js +8 -0
  227. package/dist/interfaces/i-partitions.d.ts +16 -0
  228. package/dist/interfaces/i-partitions.js +8 -0
  229. package/dist/interfaces/i-pxe.d.ts +45 -0
  230. package/dist/interfaces/i-pxe.js +1 -0
  231. package/dist/interfaces/i-remix.d.ts +21 -0
  232. package/dist/interfaces/i-remix.js +8 -0
  233. package/dist/interfaces/i-settings.d.ts +33 -0
  234. package/dist/interfaces/i-settings.js +8 -0
  235. package/dist/interfaces/i-user.d.ts +14 -0
  236. package/dist/interfaces/i-user.js +8 -0
  237. package/dist/interfaces/i-workdir.d.ts +14 -0
  238. package/dist/interfaces/i-workdir.js +8 -0
  239. package/dist/interfaces/i-xkb-model.d.ts +24 -0
  240. package/dist/interfaces/i-xkb-model.js +8 -0
  241. package/dist/interfaces/index.d.ts +25 -0
  242. package/dist/interfaces/index.js +8 -0
  243. package/dist/krill/modules/add-user.d.ts +20 -0
  244. package/dist/krill/modules/add-user.js +48 -0
  245. package/dist/krill/modules/bootloader-config.d.ts +14 -0
  246. package/dist/krill/modules/bootloader-config.js +165 -0
  247. package/dist/krill/modules/bootloader.d.ts +14 -0
  248. package/dist/krill/modules/bootloader.js +157 -0
  249. package/dist/krill/modules/change-password.d.ts +15 -0
  250. package/dist/krill/modules/change-password.js +18 -0
  251. package/dist/krill/modules/del-live-user.d.ts +14 -0
  252. package/dist/krill/modules/del-live-user.js +39 -0
  253. package/dist/krill/modules/fstab.d.ts +14 -0
  254. package/dist/krill/modules/fstab.js +123 -0
  255. package/dist/krill/modules/grubcfg.d.ts +17 -0
  256. package/dist/krill/modules/grubcfg.js +29 -0
  257. package/dist/krill/modules/hostname.d.ts +13 -0
  258. package/dist/krill/modules/hostname.js +50 -0
  259. package/dist/krill/modules/initramfs-cfg.d.ts +14 -0
  260. package/dist/krill/modules/initramfs-cfg.js +22 -0
  261. package/dist/krill/modules/initramfs.d.ts +13 -0
  262. package/dist/krill/modules/initramfs.js +54 -0
  263. package/dist/krill/modules/locale-cfg.d.ts +10 -0
  264. package/dist/krill/modules/locale-cfg.js +58 -0
  265. package/dist/krill/modules/locale.d.ts +13 -0
  266. package/dist/krill/modules/locale.js +91 -0
  267. package/dist/krill/modules/m-keyboard.d.ts +14 -0
  268. package/dist/krill/modules/m-keyboard.js +58 -0
  269. package/dist/krill/modules/machine-id.d.ts +15 -0
  270. package/dist/krill/modules/machine-id.js +33 -0
  271. package/dist/krill/modules/mkfs.d.ts +15 -0
  272. package/dist/krill/modules/mkfs.js +50 -0
  273. package/dist/krill/modules/mount-fs.d.ts +17 -0
  274. package/dist/krill/modules/mount-fs.js +62 -0
  275. package/dist/krill/modules/mount-vfs.d.ts +17 -0
  276. package/dist/krill/modules/mount-vfs.js +40 -0
  277. package/dist/krill/modules/network-cfg.d.ts +19 -0
  278. package/dist/krill/modules/network-cfg.js +64 -0
  279. package/dist/krill/modules/packages.d.ts +14 -0
  280. package/dist/krill/modules/packages.js +111 -0
  281. package/dist/krill/modules/partition.d.ts +20 -0
  282. package/dist/krill/modules/partition.js +324 -0
  283. package/dist/krill/modules/remove-installer-link.d.ts +13 -0
  284. package/dist/krill/modules/remove-installer-link.js +35 -0
  285. package/dist/krill/modules/umount.d.ts +14 -0
  286. package/dist/krill/modules/umount.js +28 -0
  287. package/dist/krill/modules/unpackfs.d.ts +13 -0
  288. package/dist/krill/modules/unpackfs.js +20 -0
  289. package/dist/krill/prepare.d.ts +78 -0
  290. package/dist/krill/prepare.js +624 -0
  291. package/dist/krill/sequence.d.ts +154 -0
  292. package/dist/krill/sequence.js +652 -0
  293. package/dist/lib/get_address.d.ts +8 -0
  294. package/dist/lib/get_address.js +23 -0
  295. package/dist/lib/get_dns.d.ts +8 -0
  296. package/dist/lib/get_dns.js +23 -0
  297. package/dist/lib/get_domain.d.ts +8 -0
  298. package/dist/lib/get_domain.js +23 -0
  299. package/dist/lib/get_gateway.d.ts +8 -0
  300. package/dist/lib/get_gateway.js +23 -0
  301. package/dist/lib/get_hostname.d.ts +8 -0
  302. package/dist/lib/get_hostname.js +23 -0
  303. package/dist/lib/get_netmask.d.ts +8 -0
  304. package/dist/lib/get_netmask.js +23 -0
  305. package/dist/lib/get_password.d.ts +8 -0
  306. package/dist/lib/get_password.js +36 -0
  307. package/dist/lib/get_userfullname.d.ts +8 -0
  308. package/dist/lib/get_userfullname.js +23 -0
  309. package/dist/lib/get_username.d.ts +8 -0
  310. package/dist/lib/get_username.js +23 -0
  311. package/dist/lib/kill_me_softly.d.ts +11 -0
  312. package/dist/lib/kill_me_softly.js +61 -0
  313. package/dist/lib/select_address_type.d.ts +8 -0
  314. package/dist/lib/select_address_type.js +24 -0
  315. package/dist/lib/select_filesystem_type.d.ts +8 -0
  316. package/dist/lib/select_filesystem_type.js +46 -0
  317. package/dist/lib/select_installation_device.d.ts +8 -0
  318. package/dist/lib/select_installation_device.js +30 -0
  319. package/dist/lib/select_installation_mode.d.ts +8 -0
  320. package/dist/lib/select_installation_mode.js +24 -0
  321. package/dist/lib/select_interface.d.ts +8 -0
  322. package/dist/lib/select_interface.js +24 -0
  323. package/dist/lib/select_keyboard_layout.d.ts +11 -0
  324. package/dist/lib/select_keyboard_layout.js +36 -0
  325. package/dist/lib/select_keyboard_model.d.ts +11 -0
  326. package/dist/lib/select_keyboard_model.js +34 -0
  327. package/dist/lib/select_keyboard_option.d.ts +11 -0
  328. package/dist/lib/select_keyboard_option.js +34 -0
  329. package/dist/lib/select_keyboard_variant.d.ts +11 -0
  330. package/dist/lib/select_keyboard_variant.js +35 -0
  331. package/dist/lib/select_languages.d.ts +8 -0
  332. package/dist/lib/select_languages.js +28 -0
  333. package/dist/lib/select_regions.d.ts +8 -0
  334. package/dist/lib/select_regions.js +24 -0
  335. package/dist/lib/select_user_swap_choice.d.ts +8 -0
  336. package/dist/lib/select_user_swap_choice.js +34 -0
  337. package/dist/lib/select_zones.d.ts +8 -0
  338. package/dist/lib/select_zones.js +518 -0
  339. package/dist/lib/utils.d.ts +34 -0
  340. package/dist/lib/utils.js +79 -0
  341. package/manpages/doc/man/eggs.1.gz +0 -0
  342. package/manpages/doc/man/eggs.html +635 -4
  343. package/package.json +11 -7
  344. package/scripts/_eggs +10 -1
  345. package/scripts/eggs.bash +1 -0
  346. /package/addons/eggs/theme/livecd/{grub.main.cfg → grub.main.full.cfg} +0 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * ./src/krill/modules/network-cfg.ts
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
+ import fs from 'node:fs';
10
+ import Pacman from '../../classes/pacman.js';
11
+ import Systemctl from '../../classes/systemctl.js';
12
+ import Utils from '../../classes/utils.js';
13
+ import { exec } from '../../lib/utils.js';
14
+ /**
15
+ * networkcfg
16
+ *
17
+ * - debian: /etc/network/interface
18
+ * - ubuntu: netplan
19
+ * - arch:
20
+ *
21
+ * - all: /etc/resolv.conf
22
+ */
23
+ export default async function networkCfg() {
24
+ const systemdCtl = new Systemctl();
25
+ /**
26
+ * debian: /etc/network/interfaces
27
+ */
28
+ if (this.distro.familyId === 'debian' && !Pacman.packageIsInstalled('netplan.io')) {
29
+ const file = this.installTarget + '/etc/network/interfaces';
30
+ let content = '# created by eggs\n\n';
31
+ content += 'auto lo\n';
32
+ content += 'iface lo inet loopback\n\n';
33
+ content += 'auto ' + this.network.iface + '\n';
34
+ content += 'iface ' + this.network.iface + ' inet ' + this.network.addressType + '\n';
35
+ if (this.network.addressType !== 'dhcp') {
36
+ content += ' address ' + this.network.address + '\n';
37
+ content += ' netmask ' + this.network.netmask + '\n';
38
+ content += ' gateway ' + this.network.gateway + '\n';
39
+ }
40
+ Utils.write(file, content);
41
+ }
42
+ else if (this.distro.familyId === 'debian' && Pacman.packageIsInstalled('netplan.io')) {
43
+ // netplan: to do
44
+ }
45
+ else if (this.distro.familyId === 'arch') {
46
+ // arch: seem to work
47
+ }
48
+ /**
49
+ * resolv.conf
50
+ */
51
+ const resolvFile = this.installTarget + '/etc/resolv.conf';
52
+ await exec(`rm -f ${resolvFile}`);
53
+ if (fs.existsSync('/run/systemd/resolve/resolv.conf')) {
54
+ await exec(`ln -s /run/systemd/resolve/resolv.conf ${resolvFile}`);
55
+ }
56
+ else {
57
+ let content = '# created by eggs\n\n';
58
+ content += 'domain ' + this.network.domain + '\n';
59
+ for (const element of this.network.dns) {
60
+ content += 'nameserver ' + element + '\n';
61
+ }
62
+ Utils.write(resolvFile, content);
63
+ }
64
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ./src/krill/modules/packages.ts
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
+ import Sequence from '../sequence.js';
10
+ /**
11
+ *
12
+ * @param this
13
+ */
14
+ export default function packages(this: Sequence): Promise<void>;
@@ -0,0 +1,111 @@
1
+ /**
2
+ * ./src/krill/modules/packages.ts
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
+ import yaml from 'js-yaml';
10
+ import fs from 'node:fs';
11
+ import Pacman from '../../classes/pacman.js';
12
+ import Utils from '../../classes/utils.js';
13
+ import { exec } from '../../lib/utils.js';
14
+ /**
15
+ *
16
+ * @param this
17
+ */
18
+ export default async function packages() {
19
+ const echoYes = Utils.setEcho(true);
20
+ let modulePath = '/etc/penguins-eggs.d/krill/';
21
+ if (Pacman.packageIsInstalled('calamares')) {
22
+ modulePath = '/etc/calamares/';
23
+ }
24
+ const config_file = `${modulePath}modules/packages.conf`;
25
+ if (fs.existsSync(config_file)) {
26
+ const packages = yaml.load(fs.readFileSync(config_file, 'utf8'));
27
+ let packagesToInstall = [];
28
+ let packagesToRemove = [];
29
+ if (packages.operations !== undefined) {
30
+ for (const operation of packages.operations) {
31
+ if ('try_remove' in operation) {
32
+ packagesToRemove = operation.try_remove;
33
+ }
34
+ if ('try_install' in operation) {
35
+ packagesToInstall = operation.try_install;
36
+ }
37
+ }
38
+ }
39
+ // Alpine
40
+ if (this.distro.familyId === 'alpine') {
41
+ packages.backend = 'apk';
42
+ }
43
+ switch (packages.backend) {
44
+ case 'apt': {
45
+ /**
46
+ * apt
47
+ */
48
+ if (packagesToRemove != undefined && packagesToRemove.length > 0) {
49
+ let cmd = `chroot ${this.installTarget} apt-get purge -y `;
50
+ for (const elem of packagesToRemove) {
51
+ if (Pacman.packageIsInstalled(elem)) {
52
+ cmd += elem + ' ';
53
+ }
54
+ }
55
+ await exec(`${cmd} ${this.toNull}`, this.echo);
56
+ const autoremove = `chroot ${this.installTarget} apt-get autoremove -y ${this.toNull}`;
57
+ await exec(autoremove, this.echo);
58
+ }
59
+ if (packagesToInstall != undefined && packagesToInstall.length > 0) {
60
+ let cmd = `chroot ${this.installTarget} apt-get install -y `;
61
+ for (const elem of packagesToInstall) {
62
+ cmd += elem + ' ';
63
+ }
64
+ const update = `chroot ${this.installTarget} apt-get update ${this.toNull}`;
65
+ await exec(update, this.echo);
66
+ await exec(`${cmd} ${this.toNull}`, this.echo);
67
+ }
68
+ break;
69
+ }
70
+ case 'pacman': {
71
+ /**
72
+ * pacman
73
+ */
74
+ if (packagesToRemove != undefined && packagesToRemove.length > 0) {
75
+ let cmd = `chroot ${this.installTarget} pacman -R\n`;
76
+ for (const elem of packagesToRemove) {
77
+ cmd += elem + ' ';
78
+ }
79
+ await exec(`${cmd} ${echoYes}`, this.echo);
80
+ }
81
+ if (packagesToInstall != undefined && packagesToInstall.length > 0) {
82
+ for (const elem of packagesToInstall) {
83
+ await exec(`chroot ${this.installTarget} pacman -S ${elem}`, echoYes);
84
+ }
85
+ }
86
+ break;
87
+ }
88
+ case 'apk': {
89
+ /**
90
+ * apk
91
+ */
92
+ if (packagesToRemove != undefined && packagesToRemove.length > 0) {
93
+ let cmd = `chroot ${this.installTarget} apk del `;
94
+ for (const elem of packagesToRemove) {
95
+ cmd += elem + ' ';
96
+ }
97
+ await exec(`${cmd} ${this.toNull}`, this.echo);
98
+ }
99
+ if (packagesToInstall != undefined && packagesToInstall.length > 0) {
100
+ let cmd = `chroot ${this.installTarget} apk add `;
101
+ for (const elem of packagesToInstall) {
102
+ cmd += elem + ' ';
103
+ }
104
+ await exec(`${cmd} ${this.toNull}`, this.echo);
105
+ }
106
+ break;
107
+ }
108
+ // No default
109
+ }
110
+ }
111
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ./src/krill/modules/partition.ts
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
+ import Sequence from '../sequence.js';
10
+ /**
11
+ *
12
+ * @param this
13
+ */
14
+ export default function partition(this: Sequence): Promise<boolean>;
15
+ /**
16
+ *
17
+ * @param installDevice
18
+ * @returns
19
+ */
20
+ export declare function lvmPartInfo(installDevice?: string): Promise<[string, number, number, number]>;
@@ -0,0 +1,324 @@
1
+ /**
2
+ * ./src/krill/modules/partition.ts
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
+ import os from 'node:os';
10
+ import shx from 'shelljs';
11
+ import Utils from '../../classes/utils.js';
12
+ import { exec } from '../../lib/utils.js';
13
+ /**
14
+ *
15
+ * @param this
16
+ */
17
+ export default async function partition() {
18
+ const echoYes = Utils.setEcho(true);
19
+ let retVal = false;
20
+ const installDevice = this.partitions.installationDevice;
21
+ /**
22
+ * Support for NVMe
23
+ *
24
+ * /dev/sda1 = /dev/nvme0n1p1
25
+ */
26
+ let p = '';
27
+ if (installDevice.includes('nvme')) {
28
+ p = 'p';
29
+ }
30
+ const installMode = this.partitions.installationMode;
31
+ let swapSize = Math.round(os.totalmem() / 1_073_741_824) * 1024;
32
+ switch (this.partitions.userSwapChoice) {
33
+ case 'none': {
34
+ swapSize = 256;
35
+ break;
36
+ }
37
+ case 'small': {
38
+ break;
39
+ }
40
+ case 'suspend': {
41
+ swapSize *= 2;
42
+ break;
43
+ }
44
+ case 'file': {
45
+ swapSize = 0;
46
+ break;
47
+ }
48
+ // No default
49
+ }
50
+ if (installMode === 'standard' && !this.efi) {
51
+ /**
52
+ * ===========================================================================================
53
+ * BIOS: working
54
+ * ===========================================================================================
55
+ */
56
+ await exec(`parted --script ${installDevice} mklabel msdos`, this.echo);
57
+ await exec(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 1MiB ${swapSize + 1}MiB`, this.echo); // dev/sda1 swap
58
+ await exec(`parted --script --align optimal ${installDevice} mkpart primary ext4 ${swapSize + 1}MiB 100%`, this.echo); // dev/sda2 root
59
+ await exec(`parted ${installDevice} set 1 boot on`, this.echo);
60
+ await exec(`parted ${installDevice} set 1 esp on`, this.echo);
61
+ // SWAP
62
+ this.devices.swap.name = `${installDevice}${p}1`;
63
+ this.devices.swap.fsType = 'swap';
64
+ this.devices.swap.mountPoint = 'none';
65
+ // ROOT
66
+ this.devices.root.name = `${installDevice}${p}2`;
67
+ this.devices.root.fsType = 'ext4';
68
+ this.devices.root.mountPoint = '/';
69
+ // BOOT/DATA/EFI
70
+ this.devices.boot.name = 'none';
71
+ this.devices.data.name = 'none';
72
+ this.devices.efi.name = 'none';
73
+ retVal = true;
74
+ }
75
+ else if (installMode === 'full-encrypted' && !this.efi) {
76
+ /**
77
+ * ===========================================================================================
78
+ * BIOS: full-encrypt:
79
+ * ===========================================================================================
80
+ */
81
+ await exec(`parted --script ${installDevice} mklabel msdos`, this.echo);
82
+ await exec(`parted --script --align optimal ${installDevice} mkpart primary ext4 1MiB 512MiB`, this.echo); // sda1
83
+ await exec(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 512MiB ${swapSize + 512}MiB`, this.echo); // sda2
84
+ await exec(`parted --script --align optimal ${installDevice} mkpart primary ext4 ${swapSize + 512}MiB 100%`, this.echo); // sda3
85
+ await exec(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
86
+ await exec(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
87
+ // BOOT 512M
88
+ this.devices.boot.name = `${installDevice}${p}1`; // 'boot'
89
+ this.devices.boot.fsType = 'ext4';
90
+ this.devices.boot.mountPoint = '/boot';
91
+ // SWAP 8G
92
+ // this.redraw(<Install message={`Formatting LUKS ${installDevice}2`} percent={0} />)
93
+ const crytoSwap = await exec(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}2`, echoYes);
94
+ if (crytoSwap.code !== 0) {
95
+ Utils.warning(`Error: ${crytoSwap.code} ${crytoSwap.data}`);
96
+ process.exit(1);
97
+ }
98
+ // this.redraw(<Install message={`Opening ${installDevice}${p}2 as swap_crypted`} percent={0} />)
99
+ const crytoSwapOpen = await exec(`cryptsetup luksOpen --type luks2 ${installDevice}${p}2 swap_crypted`, echoYes);
100
+ if (crytoSwapOpen.code !== 0) {
101
+ Utils.warning(`Error: ${crytoSwapOpen.code} ${crytoSwapOpen.data}`);
102
+ process.exit(1);
103
+ }
104
+ this.devices.swap.name = '/dev/mapper/swap_crypted';
105
+ this.devices.swap.cryptedFrom = `${installDevice}${p}2`;
106
+ this.devices.swap.fsType = 'swap';
107
+ this.devices.swap.mountPoint = 'none';
108
+ // ROOT
109
+ // this.redraw(<Install message={`Formatting LUKS ${installDevice}${p}3`} percent={0} />)
110
+ const crytoRoot = await exec(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}3`, echoYes);
111
+ if (crytoRoot.code !== 0) {
112
+ Utils.warning(`Error: ${crytoRoot.code} ${crytoRoot.data}`);
113
+ process.exit(1);
114
+ }
115
+ // this.redraw(<Install message={`Opening ${installDevice}${p}3 as root_crypted`} percent={0} />)
116
+ const crytoRootOpen = await exec(`cryptsetup luksOpen --type luks2 ${installDevice}${p}3 root_crypted`, echoYes);
117
+ if (crytoRootOpen.code !== 0) {
118
+ Utils.warning(`Error: ${crytoRootOpen.code} ${crytoRootOpen.data}`);
119
+ process.exit(1);
120
+ }
121
+ this.devices.root.name = '/dev/mapper/root_crypted';
122
+ this.devices.root.cryptedFrom = `${installDevice}${p}3`;
123
+ this.devices.root.fsType = 'ext4';
124
+ this.devices.root.mountPoint = '/';
125
+ // BOOT/DATA/EFI
126
+ this.devices.data.name = 'none';
127
+ this.devices.efi.name = 'none';
128
+ retVal = true;
129
+ }
130
+ else if (installMode === 'standard' && this.efi) {
131
+ /**
132
+ * ===========================================================================================
133
+ * UEFI: working
134
+ * ===========================================================================================
135
+ */
136
+ await exec(`parted --script ${installDevice} mklabel gpt`, this.echo);
137
+ await exec(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
138
+ await exec(`parted --script ${installDevice} mkpart swap linux-swap 256MiB ${swapSize + 256}Mib`, this.echo); // sda2 swap
139
+ await exec(`parted --script ${installDevice} mkpart root ext4 ${swapSize + 256}MiB 100%`, this.echo); // sda3 root
140
+ await exec(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
141
+ await exec(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
142
+ this.devices.efi.name = `${installDevice}${p}1`;
143
+ this.devices.efi.fsType = 'F 32 -I';
144
+ this.devices.efi.mountPoint = '/boot/efi';
145
+ this.devices.boot.name = 'none';
146
+ this.devices.swap.name = `${installDevice}${p}2`;
147
+ this.devices.swap.fsType = 'swap';
148
+ this.devices.root.name = `${installDevice}${p}3`;
149
+ this.devices.root.fsType = 'ext4';
150
+ this.devices.root.mountPoint = '/';
151
+ // BOOT/DATA/EFI
152
+ this.devices.boot.name = 'none';
153
+ this.devices.data.name = 'none';
154
+ // this.devices.efi.name = `none`
155
+ retVal = true;
156
+ }
157
+ else if (installMode === 'full-encrypted' && this.efi) {
158
+ /**
159
+ * ===========================================================================================
160
+ * UEFI, full-encrypt
161
+ * ===========================================================================================
162
+ */
163
+ await exec(`parted --script ${installDevice} mklabel gpt`, this.echo);
164
+ await exec(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
165
+ await exec(`parted --script ${installDevice} mkpart boot ext4 256MiB 768MiB`, this.echo); // sda2 boot
166
+ await exec(`parted --script ${installDevice} mkpart swap linux-swap 768MiB ${swapSize + 768}MiB`, this.echo); // sda3 swap
167
+ await exec(`parted --script ${installDevice} mkpart root ext4 ${swapSize + 768}MiB 100%`, this.echo); // sda4 root
168
+ await exec(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
169
+ await exec(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
170
+ // EFI 256M
171
+ this.devices.efi.name = `${installDevice}${p}1`; // 'efi'
172
+ this.devices.efi.fsType = 'F 32 -I';
173
+ this.devices.efi.mountPoint = '/boot/efi';
174
+ // BOOT 512M
175
+ this.devices.boot.name = `${installDevice}${p}2`; // 'boot'
176
+ this.devices.boot.fsType = 'ext4';
177
+ this.devices.boot.mountPoint = '/boot';
178
+ /**
179
+ * cryptsetup return codes are:
180
+ *
181
+ * 1 wrong parameters,
182
+ * 2 no permission (bad passphrase),
183
+ * 3 out of memory,
184
+ * 4 wrong device specified,
185
+ * 5 device already exists or device is busy.
186
+ *
187
+ * sometime due scarce memory 2GB, we can have the process killed
188
+ */
189
+ // SWAP 8G
190
+ // redraw(<Install message={`Formatting LUKS ${installDevice}${p}3`} percent={0} />)
191
+ const crytoSwap = await exec(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}3`, echoYes);
192
+ if (crytoSwap.code !== 0) {
193
+ Utils.warning(`Error: ${crytoSwap.code} ${crytoSwap.data}`);
194
+ process.exit(1);
195
+ }
196
+ // this.redraw(<Install message={`Opening ${installDevice}${p}3 as swap_crypted`} percent={0} />)
197
+ const crytoSwapOpen = await exec(`cryptsetup luksOpen --type luks2 ${installDevice}${p}3 swap_crypted`, echoYes);
198
+ if (crytoSwapOpen.code !== 0) {
199
+ Utils.warning(`Error: ${crytoSwapOpen.code} ${crytoSwapOpen.data}`);
200
+ process.exit(1);
201
+ }
202
+ this.devices.swap.name = '/dev/mapper/swap_crypted';
203
+ this.devices.swap.cryptedFrom = `${installDevice}${p}3`;
204
+ this.devices.swap.fsType = 'swap';
205
+ this.devices.swap.mountPoint = 'none';
206
+ // ROOT
207
+ // this.redraw(<Install message={`Formatting LUKS ${installDevice}${p}4`} percent={0} />)
208
+ const crytoRoot = await exec(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}${p}4`, echoYes);
209
+ if (crytoRoot.code !== 0) {
210
+ Utils.warning(`Error: ${crytoRoot.code} ${crytoRoot.data}`);
211
+ process.exit(1);
212
+ }
213
+ // this.redraw(<Install message={`Opening ${installDevice}${p}4 as root_crypted`} percent={0} />)
214
+ const crytoRootOpen = await exec(`cryptsetup luksOpen --type luks2 ${installDevice}${p}4 root_crypted`, echoYes);
215
+ if (crytoRootOpen.code !== 0) {
216
+ Utils.warning(`Error: ${crytoRootOpen.code} ${crytoRootOpen.data}`);
217
+ process.exit(1);
218
+ }
219
+ this.devices.root.name = '/dev/mapper/root_crypted';
220
+ this.devices.root.cryptedFrom = `${installDevice}${p}4`;
221
+ this.devices.root.fsType = 'ext4';
222
+ this.devices.root.mountPoint = '/';
223
+ // BOOT/DATA/EFI
224
+ // this.devices.boot.name = `none`
225
+ this.devices.data.name = 'none';
226
+ // this.devices.efi.name = `none`
227
+ retVal = true;
228
+ }
229
+ else if (installMode === 'lvm2' && !this.efi) {
230
+ /**
231
+ * ===========================================================================================
232
+ * PROXMOX VE: BIOS and lvm2
233
+ * ===========================================================================================
234
+ */
235
+ // Creo partizioni
236
+ await exec(`parted --script ${installDevice} mklabel msdos`, this.echo);
237
+ await exec(`parted --script ${installDevice} mkpart primary ext2 1 512`, this.echo); // sda1
238
+ await exec(`parted --script --align optimal ${installDevice} mkpart primary ext2 512 100%`, this.echo); // sda2
239
+ await exec(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
240
+ await exec(`parted --script ${installDevice} set 2 lvm on`, this.echo); // sda2
241
+ const partInfo = await lvmPartInfo(installDevice);
242
+ const lvmPartname = partInfo[0];
243
+ const lvmSwapSize = partInfo[1];
244
+ const lvmRootSize = partInfo[2];
245
+ await exec(`pvcreate /dev/${lvmPartname}`, this.echo);
246
+ await exec(`vgcreate pve /dev/${lvmPartname}`, this.echo);
247
+ await exec('vgchange -an', this.echo);
248
+ await exec(`lvcreate -L ${lvmSwapSize} -nswap pve`, this.echo);
249
+ await exec(`lvcreate -L ${lvmRootSize} -nroot pve`, this.echo);
250
+ await exec('lvcreate -l 100%FREE -ndata pve', this.echo);
251
+ await exec('vgchange -a y pve', this.echo);
252
+ this.devices.efi.name = 'none';
253
+ this.devices.boot.name = `${installDevice}${p}1`;
254
+ this.devices.root.fsType = 'ext2';
255
+ this.devices.root.mountPoint = '/boot';
256
+ this.devices.root.name = '/dev/pve/root';
257
+ this.devices.root.fsType = 'ext4';
258
+ this.devices.root.mountPoint = '/';
259
+ this.devices.data.name = '/dev/pve/data';
260
+ this.devices.data.fsType = 'ext4';
261
+ this.devices.data.mountPoint = '/var/lib/vz';
262
+ this.devices.swap.name = '/dev/pve/swap';
263
+ retVal = true;
264
+ }
265
+ else if (this.partitions.installationMode === 'lvm2' && this.efi) {
266
+ /**
267
+ * ===========================================================================================
268
+ * PROXMOX VE: lvm2 and UEFI
269
+ * ===========================================================================================
270
+ */
271
+ await exec(`parted --script ${installDevice} mklabel gpt`, this.echo);
272
+ await exec(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
273
+ await exec(`parted --script ${installDevice} mkpart boot ext2 256MiB 768MiB`, this.echo); // sda2 boot
274
+ await exec(`parted --script ${installDevice} mkpart lvm ext4 768MiB 100%`, this.echo); // sda3 lmv2
275
+ await exec(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
276
+ await exec(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
277
+ await exec(`parted --script ${installDevice} set 3 lvm on`, this.echo); // sda3
278
+ const partInfo = await lvmPartInfo(installDevice);
279
+ const lvmPartname = partInfo[0];
280
+ const lvmSwapSize = partInfo[1];
281
+ const lvmRootSize = partInfo[2];
282
+ await exec(`pvcreate /dev/${lvmPartname}`, this.echo);
283
+ await exec(`vgcreate pve /dev/${lvmPartname}`, this.echo);
284
+ await exec('vgchange -an', this.echo);
285
+ await exec(`lvcreate -L ${lvmSwapSize} -nswap pve`, this.echo);
286
+ await exec(`lvcreate -L ${lvmRootSize} -nroot pve`, this.echo);
287
+ await exec('lvcreate -l 100%FREE -ndata pve', this.echo);
288
+ await exec('vgchange -a y pve', this.echo);
289
+ this.devices.efi.name = `${installDevice}${p}1`;
290
+ this.devices.efi.fsType = 'F 32 -I';
291
+ this.devices.efi.mountPoint = '/boot/efi';
292
+ this.devices.boot.name = `${installDevice}${p}2`;
293
+ this.devices.boot.fsType = 'ext4';
294
+ this.devices.boot.mountPoint = '/boot';
295
+ this.devices.root.name = '/dev/pve/root';
296
+ this.devices.root.fsType = 'ext4';
297
+ this.devices.root.mountPoint = '/';
298
+ this.devices.data.name = '/dev/pve/data';
299
+ this.devices.data.fsType = 'ext4';
300
+ this.devices.data.mountPoint = '/var/lib/vz';
301
+ this.devices.swap.name = '/dev/pve/swap';
302
+ retVal = true;
303
+ }
304
+ return retVal;
305
+ }
306
+ /**
307
+ *
308
+ * @param installDevice
309
+ * @returns
310
+ */
311
+ export async function lvmPartInfo(installDevice = '/dev/sda') {
312
+ // Partizione LVM
313
+ const lvmPartname = shx.exec(`fdisk ${installDevice} -l | grep LVM | awk '{print $1}' | cut -d "/" -f3`).stdout.trim();
314
+ const lvmByteSize = Number(shx.exec(`cat /proc/partitions | grep ${lvmPartname}| awk '{print $3}' | grep "[0-9]"`).stdout.trim());
315
+ const lvmSize = lvmByteSize / 1024;
316
+ // La partizione di root viene posta ad 1/4 della partizione LVM, limite max 100 GB
317
+ const lvmSwapSize = 8192;
318
+ let lvmRootSize = lvmSize / 8;
319
+ if (lvmRootSize < 20_480) {
320
+ lvmRootSize = 20_480;
321
+ }
322
+ const lvmDataSize = lvmSize - lvmRootSize - lvmSwapSize;
323
+ return [lvmPartname, lvmSwapSize, lvmRootSize, lvmDataSize];
324
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ./src/krill/modules/remove-installer-link.ts
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
+ import Sequence from '../sequence.js';
10
+ /**
11
+ * removeInstallerLink
12
+ */
13
+ export default function removeInstallerLink(this: Sequence): Promise<void>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * ./src/krill/modules/remove-installer-link.ts
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
+ import fs from 'node:fs';
10
+ /**
11
+ * removeInstallerLink
12
+ */
13
+ export default async function removeInstallerLink() {
14
+ const file = `${this.installTarget}/usr/bin/penguins-links-add.sh`;
15
+ let lines = [];
16
+ let content = '';
17
+ if (fs.existsSync(file)) {
18
+ lines = fs.readFileSync(file, { encoding: 'utf8', flag: 'r' }).split('\n');
19
+ for (let i = 0; i < lines.length; i++) {
20
+ if (lines[i]) {
21
+ if (lines[i].search('penguins-krill.desktop') !== -1) {
22
+ lines[i] = '#' + lines[i];
23
+ }
24
+ if (lines[i].search('penguins-clinstaller.desktop') !== -1) {
25
+ lines[i] = '#' + lines[i];
26
+ }
27
+ if (lines[i].search('install-system.desktop') !== -1) {
28
+ lines[i] = '#' + lines[i];
29
+ }
30
+ content += lines[i] + '\n';
31
+ }
32
+ }
33
+ }
34
+ fs.writeFileSync(file, content);
35
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ./src/krill/modules/umount.ts
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
+ import Sequence from '../sequence.js';
10
+ /**
11
+ *
12
+ * @param mountpoint
13
+ */
14
+ export default function umount(this: Sequence, mountPoint?: string): Promise<void>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * ./src/krill/modules/umount.ts
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
+ import Utils from '../../classes/utils.js';
10
+ import { exec } from '../../lib/utils.js';
11
+ /**
12
+ *
13
+ * @param mountpoint
14
+ */
15
+ export default async function umount(mountPoint = '') {
16
+ let message = 'umount: ' + mountPoint;
17
+ if (Utils.isMountpoint(mountPoint)) {
18
+ let cmd = `umount ${mountPoint} ${this.toNull}`;
19
+ try {
20
+ await exec(cmd, this.echo);
21
+ await exec('sleep 1', this.echo);
22
+ }
23
+ catch (error) {
24
+ message += cmd + JSON.stringify(error);
25
+ await Utils.pressKeyToExit(message, true);
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ./src/krill/modules/unpackfs.ts
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
+ import Sequence from '../sequence.js';
10
+ /**
11
+ * unpackfs
12
+ */
13
+ export default function unpackfs(this: Sequence): Promise<void>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ./src/krill/modules/unpackfs.ts
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
+ import Utils from '../../classes/utils.js';
10
+ import { exec } from '../../lib/utils.js';
11
+ /**
12
+ * unpackfs
13
+ */
14
+ export default async function unpackfs() {
15
+ // const cmd = `unsquashfs -d ${this.installTarget} -f ${this.distro.liveMediumPath}`
16
+ const cmd = `unsquashfs -d ${this.installTarget} -f ${this.distro.liveMediumPath}${this.distro.squashfs} ${this.toNull}`;
17
+ const echoYes = Utils.setEcho(true);
18
+ const echoNo = Utils.setEcho(false);
19
+ await exec(cmd, echoNo);
20
+ }