penguins-eggs 9.6.34 → 10.0.0

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 (351) hide show
  1. package/.oclif.manifest.json +1458 -1
  2. package/README.md +823 -8
  3. package/addons/eggs/theme/livecd/grub.main.cfg +4 -4
  4. package/addons/eggs/theme/livecd/isolinux.main.cfg +5 -5
  5. package/bin/dev.cmd +1 -1
  6. package/bin/dev.js +6 -0
  7. package/bin/run.js +5 -0
  8. package/conf/derivatives.yaml +2 -0
  9. package/conf/distros/buster/calamares/calamares-modules/bootloader-config/bootloader-config.sh +3 -3
  10. package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +1 -1
  11. package/conf/distros/buster/calamares/modules/fstab.yml +1 -1
  12. package/conf/distros/focal/calamares/modules/fstab.yml +1 -1
  13. package/conf/{exclude.list.homes → exclude.list.d/home.list} +6 -1
  14. package/conf/{exclude.list.template → exclude.list.d/master.list} +15 -24
  15. package/conf/exclude.list.d/var.list +21 -0
  16. package/conf/tools.yaml +1 -3
  17. package/dist/classes/bleach.d.ts +37 -0
  18. package/dist/classes/bleach.js +43 -91
  19. package/dist/classes/cfs.d.ts +17 -0
  20. package/dist/classes/cfs.js +15 -12
  21. package/dist/classes/compressors.d.ts +53 -0
  22. package/dist/classes/compressors.js +51 -58
  23. package/dist/classes/daddy.d.ts +18 -0
  24. package/dist/classes/daddy.js +93 -101
  25. package/dist/classes/distro.d.ts +26 -0
  26. package/dist/classes/distro.js +45 -27
  27. package/dist/classes/families/archlinux.d.ts +61 -0
  28. package/dist/classes/families/archlinux.js +56 -113
  29. package/dist/classes/families/debian.d.ts +65 -0
  30. package/dist/classes/families/debian.js +68 -143
  31. package/dist/classes/families/fedora.d.ts +52 -0
  32. package/dist/classes/families/fedora.js +43 -99
  33. package/dist/classes/families/mockup.d.ts +60 -0
  34. package/dist/classes/families/mockup.js +27 -46
  35. package/dist/classes/families/suse.d.ts +52 -0
  36. package/dist/classes/families/suse.js +45 -97
  37. package/dist/classes/incubation/branding.d.ts +17 -0
  38. package/dist/classes/incubation/branding.js +33 -32
  39. package/dist/classes/incubation/distros/bionic.d.ts +32 -0
  40. package/dist/classes/incubation/distros/bionic.js +15 -15
  41. package/dist/classes/incubation/distros/buster.d.ts +32 -0
  42. package/dist/classes/incubation/distros/buster.js +15 -15
  43. package/dist/classes/incubation/distros/focal.d.ts +32 -0
  44. package/dist/classes/incubation/distros/focal.js +15 -15
  45. package/dist/classes/incubation/distros/jessie.d.ts +31 -0
  46. package/dist/classes/incubation/distros/jessie.js +11 -13
  47. package/dist/classes/incubation/distros/rolling.d.ts +32 -0
  48. package/dist/classes/incubation/distros/rolling.js +15 -16
  49. package/dist/classes/incubation/fisherman-helper/displaymanager.d.ts +11 -0
  50. package/dist/classes/incubation/fisherman-helper/displaymanager.js +8 -9
  51. package/dist/classes/incubation/fisherman-helper/packages.d.ts +20 -0
  52. package/dist/classes/incubation/fisherman-helper/packages.js +17 -17
  53. package/dist/classes/incubation/fisherman-helper/settings.d.ts +15 -0
  54. package/dist/classes/incubation/fisherman-helper/settings.js +30 -28
  55. package/dist/classes/incubation/fisherman.d.ts +77 -0
  56. package/dist/classes/incubation/fisherman.js +137 -132
  57. package/dist/classes/incubation/incubator.d.ts +40 -0
  58. package/dist/classes/incubation/incubator.js +93 -87
  59. package/dist/classes/incubation/installer.d.ts +13 -0
  60. package/dist/classes/incubation/installer.js +27 -12
  61. package/dist/classes/initrd.d.ts +41 -0
  62. package/dist/classes/initrd.js +42 -44
  63. package/dist/classes/keyboards.d.ts +50 -0
  64. package/dist/classes/keyboards.js +110 -107
  65. package/dist/classes/locales.d.ts +21 -0
  66. package/dist/classes/locales.js +30 -34
  67. package/dist/classes/n8.d.ts +17 -0
  68. package/dist/classes/n8.js +16 -22
  69. package/dist/classes/network.d.ts +37 -0
  70. package/dist/classes/network.js +21 -25
  71. package/dist/classes/ovary.d.ts +205 -0
  72. package/dist/classes/ovary.js +1262 -1334
  73. package/dist/classes/pacman.d.ts +149 -0
  74. package/dist/classes/pacman.js +347 -426
  75. package/dist/classes/pve-live.d.ts +17 -0
  76. package/dist/classes/pve-live.js +23 -25
  77. package/dist/classes/pxe.d.ts +65 -0
  78. package/dist/classes/pxe.js +206 -210
  79. package/dist/classes/settings.d.ts +53 -0
  80. package/dist/classes/settings.js +99 -102
  81. package/dist/classes/sources_list.d.ts +28 -0
  82. package/dist/classes/sources_list.js +35 -39
  83. package/dist/classes/systemctl.d.ts +47 -0
  84. package/dist/classes/systemctl.js +35 -39
  85. package/dist/classes/tailor.d.ts +46 -0
  86. package/dist/classes/tailor.js +225 -241
  87. package/dist/classes/tools.d.ts +30 -0
  88. package/dist/classes/tools.js +20 -26
  89. package/dist/classes/users.d.ts +28 -0
  90. package/dist/classes/users.js +22 -16
  91. package/dist/classes/utils.d.ts +318 -0
  92. package/dist/classes/utils.js +91 -76
  93. package/dist/classes/xdg.d.ts +45 -0
  94. package/dist/classes/xdg.js +129 -133
  95. package/dist/classes/yolk.d.ts +33 -0
  96. package/dist/classes/yolk.js +54 -60
  97. package/dist/commands/adapt.d.ts +17 -0
  98. package/dist/commands/adapt.js +21 -25
  99. package/dist/commands/analyze.d.ts +26 -0
  100. package/dist/commands/analyze.js +60 -74
  101. package/dist/commands/calamares.d.ts +29 -0
  102. package/dist/commands/calamares.js +53 -60
  103. package/dist/commands/config.d.ts +36 -0
  104. package/dist/commands/config.js +120 -142
  105. package/dist/commands/cuckoo.d.ts +16 -0
  106. package/dist/commands/cuckoo.js +24 -28
  107. package/dist/commands/dad.d.ts +19 -0
  108. package/dist/commands/dad.js +26 -30
  109. package/dist/commands/export/deb.d.ts +19 -0
  110. package/dist/commands/export/deb.js +33 -42
  111. package/dist/commands/export/iso.d.ts +19 -0
  112. package/dist/commands/export/iso.js +24 -28
  113. package/dist/commands/install.d.ts +37 -0
  114. package/dist/commands/install.js +68 -68
  115. package/dist/commands/kill.d.ts +24 -0
  116. package/dist/commands/kill.js +31 -38
  117. package/dist/commands/mom.d.ts +16 -0
  118. package/dist/commands/mom.js +20 -22
  119. package/dist/commands/produce.d.ts +33 -0
  120. package/dist/commands/produce.js +100 -92
  121. package/dist/commands/status.d.ts +23 -0
  122. package/dist/commands/status.js +14 -20
  123. package/dist/commands/syncfrom.d.ts +45 -0
  124. package/dist/commands/syncfrom.js +99 -109
  125. package/dist/commands/syncto.d.ts +40 -0
  126. package/dist/commands/syncto.js +152 -216
  127. package/dist/commands/tools/clean.d.ts +18 -0
  128. package/dist/commands/tools/clean.js +21 -25
  129. package/dist/commands/tools/ppa.d.ts +26 -0
  130. package/dist/commands/tools/ppa.js +46 -50
  131. package/dist/commands/tools/skel.d.ts +18 -0
  132. package/dist/commands/tools/skel.js +27 -31
  133. package/dist/commands/tools/stat.d.ts +31 -0
  134. package/dist/commands/tools/stat.js +21 -25
  135. package/dist/commands/tools/yolk.d.ts +24 -0
  136. package/dist/commands/tools/yolk.js +23 -27
  137. package/dist/commands/update.d.ts +47 -0
  138. package/dist/commands/update.js +66 -70
  139. package/dist/commands/wardrobe/get.d.ts +23 -0
  140. package/dist/commands/wardrobe/get.js +26 -28
  141. package/dist/commands/wardrobe/list.d.ts +24 -0
  142. package/dist/commands/wardrobe/list.js +69 -67
  143. package/dist/commands/wardrobe/show.d.ts +25 -0
  144. package/dist/commands/wardrobe/show.js +57 -52
  145. package/dist/commands/wardrobe/wear.d.ts +26 -0
  146. package/dist/commands/wardrobe/wear.js +39 -41
  147. package/dist/components/finished.d.ts +15 -0
  148. package/dist/components/finished.js +37 -42
  149. package/dist/components/information.d.ts +8 -0
  150. package/dist/components/information.js +155 -0
  151. package/dist/components/install.d.ts +15 -0
  152. package/dist/components/install.js +31 -35
  153. package/dist/components/keyboard.d.ts +16 -0
  154. package/dist/components/keyboard.js +37 -40
  155. package/dist/components/location.d.ts +16 -0
  156. package/dist/components/location.js +38 -38
  157. package/dist/components/network.d.ts +19 -0
  158. package/dist/components/network.js +47 -48
  159. package/dist/components/partitions.d.ts +16 -0
  160. package/dist/components/partitions.js +47 -51
  161. package/dist/components/steps.d.ts +13 -0
  162. package/dist/components/steps.js +148 -0
  163. package/dist/components/summary.d.ts +24 -0
  164. package/dist/components/summary.js +53 -54
  165. package/dist/components/title.d.ts +12 -0
  166. package/dist/components/title.js +35 -0
  167. package/dist/components/users.d.ts +24 -0
  168. package/dist/components/users.js +43 -43
  169. package/dist/components/welcome.d.ts +13 -0
  170. package/dist/components/welcome.js +37 -38
  171. package/dist/index.d.ts +8 -0
  172. package/dist/index.js +8 -5
  173. package/dist/interfaces/i-addons.d.ts +13 -0
  174. package/dist/interfaces/i-addons.js +8 -3
  175. package/dist/interfaces/i-analyze.d.ts +17 -0
  176. package/dist/interfaces/i-analyze.js +11 -16
  177. package/dist/interfaces/i-app.d.ts +14 -0
  178. package/dist/interfaces/i-app.js +8 -2
  179. package/dist/interfaces/i-branding.d.ts +36 -0
  180. package/dist/interfaces/i-branding.js +8 -2
  181. package/dist/interfaces/i-calamares-partition.d.ts +18 -0
  182. package/dist/interfaces/i-calamares-partition.js +3 -4
  183. package/dist/interfaces/i-config-tools.d.ts +18 -0
  184. package/dist/interfaces/i-config-tools.js +8 -2
  185. package/dist/interfaces/i-devices.d.ts +20 -0
  186. package/dist/interfaces/i-devices.js +8 -2
  187. package/dist/interfaces/i-distro.d.ts +27 -0
  188. package/dist/interfaces/i-distro.js +3 -4
  189. package/dist/interfaces/i-drive-list.d.ts +33 -0
  190. package/dist/interfaces/i-drive-list.js +3 -4
  191. package/dist/interfaces/i-eggs-config.d.ts +32 -0
  192. package/dist/interfaces/i-eggs-config.js +3 -4
  193. package/dist/interfaces/i-excludes.d.ts +14 -0
  194. package/dist/interfaces/i-excludes.js +8 -0
  195. package/dist/interfaces/i-exec.d.ts +11 -0
  196. package/dist/interfaces/i-exec.js +3 -4
  197. package/dist/interfaces/i-initrd.d.ts +13 -0
  198. package/dist/interfaces/i-initrd.js +8 -2
  199. package/dist/interfaces/i-install.d.ts +16 -0
  200. package/dist/interfaces/i-install.js +8 -2
  201. package/dist/interfaces/i-installer.d.ts +17 -0
  202. package/dist/interfaces/i-installer.js +8 -2
  203. package/dist/interfaces/i-krill-config.d.ts +33 -0
  204. package/dist/interfaces/i-krill-config.js +3 -4
  205. package/dist/interfaces/i-krill.d.ts +42 -0
  206. package/dist/interfaces/i-krill.js +8 -2
  207. package/dist/interfaces/i-materia.d.ts +41 -0
  208. package/dist/interfaces/i-materia.js +8 -2
  209. package/dist/interfaces/i-net.d.ts +16 -0
  210. package/dist/interfaces/i-net.js +8 -2
  211. package/dist/interfaces/i-packages.d.ts +29 -0
  212. package/dist/interfaces/i-packages.js +3 -4
  213. package/dist/interfaces/i-partitions.d.ts +16 -0
  214. package/dist/interfaces/i-partitions.js +8 -2
  215. package/dist/interfaces/i-pxe.d.ts +21 -0
  216. package/dist/interfaces/i-pxe.js +8 -39
  217. package/dist/interfaces/i-remix.d.ts +21 -0
  218. package/dist/interfaces/i-remix.js +3 -4
  219. package/dist/interfaces/i-settings.d.ts +39 -0
  220. package/dist/interfaces/i-settings.js +8 -2
  221. package/dist/interfaces/i-user.d.ts +14 -0
  222. package/dist/interfaces/i-user.js +8 -2
  223. package/dist/interfaces/i-workdir.d.ts +14 -0
  224. package/dist/interfaces/i-workdir.js +8 -2
  225. package/dist/interfaces/i-xkb-model.d.ts +24 -0
  226. package/dist/interfaces/i-xkb-model.js +8 -2
  227. package/dist/interfaces/index.d.ts +25 -0
  228. package/dist/interfaces/index.js +3 -4
  229. package/dist/krill/modules/add-user.d.ts +20 -0
  230. package/dist/krill/modules/add-user.js +11 -15
  231. package/dist/krill/modules/bootloader-config-arch.d.ts +14 -0
  232. package/dist/krill/modules/bootloader-config-arch.js +15 -11
  233. package/dist/krill/modules/bootloader-config-debian.d.ts +10 -0
  234. package/dist/krill/modules/bootloader-config-debian.js +20 -16
  235. package/dist/krill/modules/bootloader-config.d.ts +10 -0
  236. package/dist/krill/modules/bootloader-config.js +3 -6
  237. package/dist/krill/modules/bootloader.d.ts +14 -0
  238. package/dist/krill/modules/bootloader.js +9 -13
  239. package/dist/krill/modules/change-password.d.ts +15 -0
  240. package/dist/krill/modules/change-password.js +5 -8
  241. package/dist/krill/modules/del-live-user.d.ts +14 -0
  242. package/dist/krill/modules/del-live-user.js +8 -12
  243. package/dist/krill/modules/fstab.d.ts +14 -0
  244. package/dist/krill/modules/fstab.js +69 -46
  245. package/dist/krill/modules/grubcfg.d.ts +17 -0
  246. package/dist/krill/modules/grubcfg.js +8 -17
  247. package/dist/krill/modules/hostname.d.ts +13 -0
  248. package/dist/krill/modules/hostname.js +11 -17
  249. package/dist/krill/modules/initramfs-cfg.d.ts +14 -0
  250. package/dist/krill/modules/initramfs-cfg.js +6 -15
  251. package/dist/krill/modules/initramfs.d.ts +13 -0
  252. package/dist/krill/modules/initramfs.js +17 -19
  253. package/dist/krill/modules/locale-cfg.d.ts +10 -0
  254. package/dist/krill/modules/locale-cfg.js +8 -12
  255. package/dist/krill/modules/locale.d.ts +13 -0
  256. package/dist/krill/modules/locale.js +7 -11
  257. package/dist/krill/modules/m-keyboard.d.ts +14 -0
  258. package/dist/krill/modules/m-keyboard.js +14 -18
  259. package/dist/krill/modules/m-timezone.d.ts +14 -0
  260. package/dist/krill/modules/m-timezone.js +8 -12
  261. package/dist/krill/modules/machine-id.d.ts +15 -0
  262. package/dist/krill/modules/machine-id.js +6 -10
  263. package/dist/krill/modules/mkfs.d.ts +13 -0
  264. package/dist/krill/modules/mkfs.js +33 -23
  265. package/dist/krill/modules/mount-fs.d.ts +17 -0
  266. package/dist/krill/modules/mount-fs.js +20 -26
  267. package/dist/krill/modules/mount-vfs.d.ts +17 -0
  268. package/dist/krill/modules/mount-vfs.js +16 -21
  269. package/dist/krill/modules/network-cfg.d.ts +19 -0
  270. package/dist/krill/modules/network-cfg.js +28 -31
  271. package/dist/krill/modules/packages.d.ts +14 -0
  272. package/dist/krill/modules/packages.js +17 -21
  273. package/dist/krill/modules/partition.d.ts +20 -0
  274. package/dist/krill/modules/partition.js +80 -86
  275. package/dist/krill/modules/remove-installer-link.d.ts +13 -0
  276. package/dist/krill/modules/remove-installer-link.js +7 -11
  277. package/dist/krill/modules/umount.d.ts +14 -0
  278. package/dist/krill/modules/umount.js +9 -13
  279. package/dist/krill/modules/unpackfs.d.ts +13 -0
  280. package/dist/krill/modules/unpackfs.js +7 -11
  281. package/dist/krill/prepare.d.ts +77 -0
  282. package/dist/krill/{krill-prepare.js → prepare.js} +136 -130
  283. package/dist/krill/sequence.d.ts +156 -0
  284. package/dist/krill/sequence.js +640 -0
  285. package/dist/lib/cli-autologin.d.ts +43 -0
  286. package/dist/lib/cli-autologin.js +88 -92
  287. package/dist/lib/get_address.d.ts +8 -0
  288. package/dist/lib/get_address.js +9 -11
  289. package/dist/lib/get_dns.d.ts +8 -0
  290. package/dist/lib/get_dns.js +9 -11
  291. package/dist/lib/get_domain.d.ts +8 -0
  292. package/dist/lib/get_domain.js +9 -11
  293. package/dist/lib/get_gateway.d.ts +8 -0
  294. package/dist/lib/get_gateway.js +9 -11
  295. package/dist/lib/get_hostname.d.ts +8 -0
  296. package/dist/lib/get_hostname.js +9 -11
  297. package/dist/lib/get_netmask.d.ts +8 -0
  298. package/dist/lib/get_netmask.js +9 -11
  299. package/dist/lib/get_password.d.ts +8 -0
  300. package/dist/lib/get_password.js +10 -13
  301. package/dist/lib/get_userfullname.d.ts +8 -0
  302. package/dist/lib/get_userfullname.js +9 -11
  303. package/dist/lib/get_username.d.ts +8 -0
  304. package/dist/lib/get_username.js +9 -12
  305. package/dist/lib/kill_me_softly.d.ts +11 -0
  306. package/dist/lib/kill_me_softly.js +19 -24
  307. package/dist/lib/select_address_type.d.ts +8 -0
  308. package/dist/lib/select_address_type.js +9 -12
  309. package/dist/lib/select_filesystem_type.d.ts +8 -0
  310. package/dist/lib/select_filesystem_type.js +19 -17
  311. package/dist/lib/select_installation_device.d.ts +8 -0
  312. package/dist/lib/select_installation_device.js +11 -15
  313. package/dist/lib/select_installation_mode.d.ts +8 -0
  314. package/dist/lib/select_installation_mode.js +9 -11
  315. package/dist/lib/select_interface.d.ts +8 -0
  316. package/dist/lib/select_interface.js +9 -12
  317. package/dist/lib/select_keyboard_layout.d.ts +11 -0
  318. package/dist/lib/select_keyboard_layout.js +11 -15
  319. package/dist/lib/select_keyboard_model.d.ts +11 -0
  320. package/dist/lib/select_keyboard_model.js +11 -15
  321. package/dist/lib/select_keyboard_option.d.ts +11 -0
  322. package/dist/lib/select_keyboard_option.js +11 -15
  323. package/dist/lib/select_keyboard_variant.d.ts +11 -0
  324. package/dist/lib/select_keyboard_variant.js +11 -15
  325. package/dist/lib/select_languages.d.ts +8 -0
  326. package/dist/lib/select_languages.js +11 -15
  327. package/dist/lib/select_regions.d.ts +8 -0
  328. package/dist/lib/select_regions.js +9 -11
  329. package/dist/lib/select_user_swap_choice.d.ts +8 -0
  330. package/dist/lib/select_user_swap_choice.js +13 -17
  331. package/dist/lib/select_zones.d.ts +8 -0
  332. package/dist/lib/select_zones.js +9 -11
  333. package/dist/lib/utils.d.ts +34 -0
  334. package/dist/lib/utils.js +24 -14
  335. package/manpages/doc/man/eggs.1.gz +0 -0
  336. package/manpages/doc/man/eggs.html +130 -76
  337. package/package.json +55 -74
  338. package/scripts/_eggs +9 -7
  339. package/scripts/eggs.bash +4 -4
  340. package/LICENSE +0 -339
  341. package/bin/dev +0 -17
  342. package/bin/run +0 -5
  343. package/conf/exclude.list.custom +0 -3
  344. package/dist/components/elements/information.js +0 -194
  345. package/dist/components/elements/steps.js +0 -152
  346. package/dist/components/elements/title.js +0 -36
  347. package/dist/interfaces/i-filters.js +0 -3
  348. package/dist/krill/krill-sequence.js +0 -645
  349. package/dist/lib/dependencies.js +0 -120
  350. package/manpages/doc/man/README.md +0 -0
  351. /package/conf/{exclude.list.usr → exclude.list.d/usr.list} +0 -0
@@ -1,232 +1,52 @@
1
- "use strict";
2
1
  /**
3
- * penguins-eggs
4
- * class: pacman.ts
5
- * author: Piero Proietti
6
- * email: piero.proietti@gmail.com
7
- * license: MIT
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const tslib_1 = require("tslib");
11
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
12
- const node_path_1 = tslib_1.__importDefault(require("node:path"));
13
- const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
14
- const utils_1 = tslib_1.__importDefault(require("./utils"));
15
- const distro_1 = tslib_1.__importDefault(require("./distro"));
16
- const settings_1 = tslib_1.__importDefault(require("./settings"));
17
- const node_child_process_1 = require("node:child_process");
18
- const utils_2 = require("../lib/utils");
19
- const debian_1 = tslib_1.__importDefault(require("./families/debian"));
20
- const fedora_1 = tslib_1.__importDefault(require("./families/fedora"));
21
- const archlinux_1 = tslib_1.__importDefault(require("./families/archlinux"));
22
- const suse_1 = tslib_1.__importDefault(require("./families/suse"));
2
+ * ./src/classes/pacman.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import { execSync } from 'node:child_process';
9
+ import fs from 'node:fs';
10
+ // _dirname
11
+ import path from 'node:path';
12
+ import shx from 'shelljs';
13
+ import { exec } from '../lib/utils.js';
14
+ import Distro from './distro.js';
15
+ import Archlinux from './families/archlinux.js';
16
+ import Debian from './families/debian.js';
17
+ import Fedora from './families/fedora.js';
18
+ import Suse from './families/suse.js';
19
+ import Settings from './settings.js';
20
+ import Utils from './utils.js';
21
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
23
22
  const config_file = '/etc/penguins-eggs.d/eggs.yaml';
24
23
  const config_tools = '/etc/penguins-eggs.d/tools.yaml';
25
24
  /**
26
25
  * Utils: general porpouse utils
27
26
  * @remarks all the utilities
28
27
  */
29
- class Pacman {
30
- constructor() {
31
- this.distro = {};
32
- this.remix = {};
33
- }
28
+ export default class Pacman {
29
+ static debs4calamares = ['calamares', 'qml-module-qtquick2', 'qml-module-qtquick-controls'];
30
+ distro = {};
31
+ remix = {};
34
32
  /**
35
33
  *
36
- * @returns
37
- */
38
- static distro() {
39
- const remix = {};
40
- const distro = new distro_1.default(remix);
41
- return distro;
42
- }
43
- /**
44
- *
45
- * @returns grub
46
- */
47
- static whichGrubIsInstalled() {
48
- let grubInstalled = '';
49
- if (this.distro().familyId === 'debian') {
50
- if (this.packageIsInstalled('grub-common')) {
51
- grubInstalled = 'grub';
52
- }
53
- }
54
- else if (this.distro().familyId === 'fedora') {
55
- if (this.packageIsInstalled('grub2-common.noarch')) {
56
- grubInstalled = 'grub2';
57
- }
58
- }
59
- else if (this.distro().familyId === 'archlinux') {
60
- if (this.packageIsInstalled('grub')) {
61
- grubInstalled = 'grub';
62
- }
63
- }
64
- else if (this.distro().familyId === 'suse' && this.packageIsInstalled('grub2')) {
65
- grubInstalled = 'grub2';
66
- }
67
- return grubInstalled;
68
- }
69
- /**
70
- * check if it's installed xorg
71
- * @returns
72
- */
73
- static isInstalledXorg() {
74
- let installed = false;
75
- if (this.distro().familyId === 'debian') {
76
- if (debian_1.default.packageIsInstalled('xserver-xorg-core')) {
77
- installed = true;
78
- }
79
- }
80
- else if (this.distro().familyId === 'fedora') {
81
- if (fedora_1.default.packageIsInstalled('xorg-x11-server-Xorg.x86_64')) {
82
- installed = true;
83
- }
84
- }
85
- else if (this.distro().familyId === 'archlinux') {
86
- if (archlinux_1.default.packageIsInstalled('xorg-server-common')) {
87
- installed = true;
88
- }
89
- }
90
- else if (this.distro().familyId === 'suse') {
91
- if (suse_1.default.packageIsInstalled('xorg-x11-server')) {
92
- installed = true;
93
- }
94
- }
95
- return installed;
96
- }
97
- /**
98
- * check if it's installed wayland
99
- * @returns true if wayland
100
- */
101
- static isInstalledWayland() {
102
- let installed = false;
103
- if (this.distro().familyId === 'debian') {
104
- if (debian_1.default.packageIsInstalled('xwayland')) {
105
- installed = true;
106
- }
107
- }
108
- else if (this.distro().familyId === 'fedora') {
109
- if (fedora_1.default.packageIsInstalled('xorg-x11-server-Xwayland*')) {
110
- installed = true;
111
- }
112
- }
113
- else if (this.distro().familyId === 'archlinux') {
114
- if (archlinux_1.default.packageIsInstalled('xwayland')) {
115
- installed = true;
116
- }
117
- }
118
- else if (this.distro().familyId === 'suse') {
119
- if (suse_1.default.packageIsInstalled('xwayland*')) {
120
- installed = true;
121
- }
122
- }
123
- return installed;
124
- }
125
- /**
126
- * Check se la macchina ha grub adatto ad efi
127
- * Forse conviene spostarlo in pacman
34
+ * @param verbose
128
35
  */
129
- static isUefi() {
130
- let isUefi = false;
36
+ static async autocompleteInstall(verbose = false) {
131
37
  if (this.distro().familyId === 'debian') {
132
- if (utils_1.default.uefiArch() !== 'i386') {
133
- if (this.packageIsInstalled('grub-efi-' + utils_1.default.uefiArch() + '-bin')) {
134
- isUefi = true;
38
+ if (Pacman.packageIsInstalled('bash-completion')) {
39
+ if (fs.existsSync('/usr/share/bash-completion/completions/')) {
40
+ await exec(`cp ${__dirname}/../../scripts/eggs.bash /usr/share/bash-completion/completions/`);
41
+ }
42
+ else if (fs.existsSync('/etc/bash_completion.d/')) {
43
+ await exec(`cp ${__dirname}/../../scripts/eggs.bash /etc/bash_completion.d/`);
135
44
  }
136
45
  }
137
46
  }
138
- else if (Pacman.distro().familyId === 'fedora') {
139
- isUefi = true;
140
- }
141
- else if (Pacman.distro().familyId === 'archlinux') {
142
- isUefi = true;
143
- }
144
- else if (Pacman.distro().familyId === 'suse') {
145
- isUefi = true;
146
- }
147
- return isUefi;
148
- }
149
- /**
150
- *
151
- * @returns true se GUI
152
- */
153
- static isInstalledGui() {
154
- return this.isInstalledXorg() || this.isInstalledWayland();
155
- }
156
- /**
157
- * controlla se è operante xserver-xorg-core
158
- */
159
- static isRunningXorg() {
160
- return process.env.XDG_SESSION_TYPE === 'x11';
161
- }
162
- /**
163
- * Constrolla se è operante wayland
164
- */
165
- static isRunningWayland() {
166
- return process.env.XDG_SESSION_TYPE === 'wayland';
167
- }
168
- /**
169
- * Check if the system is GUI able
170
- */
171
- static isRunningGui() {
172
- return this.isRunningXorg() || this.isRunningWayland();
173
- }
174
- /**
175
- * Check if the system is just CLI
176
- */
177
- static isRunningCli() {
178
- return !this.isRunningGui();
179
- }
180
- /**
181
- * Crea array packages dei pacchetti da installare
182
- *
183
- * probabilmente non usata
184
- *
185
- */
186
- static packages(remove = false, verbose = false) {
187
- let packages = [];
188
- /*
189
- if (this.distro().familyId === 'debian') {
190
- packages = Debian.packages(remove, verbose)
191
- } else if (this.distro().familyId === 'fedora') {
192
- packages = Fedora.packages(remove, verbose)
193
- } else if (this.distro().familyId === 'archlinux') {
194
- packages = Archlinux.packages(remove, verbose)
195
- } else if (this.distro().familyId === 'suse') {
196
- packages = Suse.packages(remove, verbose)
197
- }
198
- */
199
- return packages;
200
- }
201
- /**
202
- * Restituisce VERO se i prerequisiti sono installati
203
- */
204
- static async prerequisitesCheck(verbose = false) {
205
- let installed = true;
206
- const packages = this.packages(false, verbose);
207
- if (packages.length > 0) {
208
- installed = false;
209
- }
210
- return installed;
211
- }
212
- /**
213
- *
214
- */
215
- static async prerequisitesInstall(verbose = true) {
216
- let retVal = false;
217
- if (this.distro().familyId === 'debian') {
218
- retVal = await debian_1.default.prerequisitesInstall(verbose);
219
- }
220
- else if (this.distro().familyId === 'fedora') {
221
- retVal = await fedora_1.default.prerequisitesInstall(verbose);
222
- }
223
- else if (this.distro().familyId === 'archlinux') {
224
- retVal = await archlinux_1.default.prerequisitesInstall(verbose);
225
- }
226
- else if (this.distro().familyId === 'suse') {
227
- retVal = await suse_1.default.prerequisitesInstall(verbose);
47
+ else if (this.distro().familyId === 'archlinux' && Pacman.packageIsInstalled('bash-completion')) {
48
+ await exec(`cp ${__dirname}/../../scripts/eggs.bash /usr/share/bash-completion/completions/`);
228
49
  }
229
- return retVal;
230
50
  }
231
51
  /**
232
52
  * return true if calamares is installed
@@ -234,49 +54,38 @@ class Pacman {
234
54
  static calamaresExists() {
235
55
  return this.commandIsInstalled('calamares');
236
56
  }
237
- /**
238
- * Controlla se calamares è installabile
239
- * @returns
240
- */
241
- static isCalamaresAvailable() {
242
- let result = this.distro().isCalamaresAvailable;
243
- if (process.arch === 'arm' || process.arch === 'arm64') {
244
- result = false;
245
- }
246
- return result;
247
- }
248
57
  /**
249
58
  *
250
59
  */
251
60
  static async calamaresInstall(verbose = false) {
252
61
  if (this.isInstalledGui()) {
253
62
  if (this.distro().familyId === 'debian') {
254
- await debian_1.default.calamaresInstall(verbose);
63
+ await Debian.calamaresInstall(verbose);
255
64
  }
256
65
  else if (this.distro().familyId === 'fedora') {
257
- await fedora_1.default.calamaresInstall(verbose);
66
+ await Fedora.calamaresInstall(verbose);
258
67
  }
259
68
  else if (this.distro().familyId === 'archlinux') {
260
69
  if (this.distro().distroId === 'ManjaroLinux') {
261
70
  const cmd = `pacman -Sy --noconfirm calamares`;
262
71
  try {
263
- await (0, utils_2.exec)(cmd, utils_1.default.setEcho(true));
72
+ await exec(cmd, Utils.setEcho(true));
264
73
  }
265
74
  catch {
266
- utils_1.default.error(`manjaro: ${cmd}`); // + e.error)
75
+ Utils.error(`manjaro: ${cmd}`); // + e.error)
267
76
  }
268
77
  }
269
78
  else {
270
- await archlinux_1.default.calamaresInstall(verbose);
79
+ await Archlinux.calamaresInstall(verbose);
271
80
  }
272
81
  }
273
82
  else if (this.distro().familyId === 'suse') {
274
- await suse_1.default.calamaresInstall(verbose);
83
+ await Suse.calamaresInstall(verbose);
275
84
  }
276
85
  // remove others calamares links
277
- await (0, utils_2.exec)('rm -f /usr/share/applications/calamares-eggs-debugging.desktop');
278
- await (0, utils_2.exec)('rm -f /usr/share/applications/calamares-eggs.desktop');
279
- await (0, utils_2.exec)('rm -f /usr/share/applications/calamares.desktop');
86
+ await exec('rm -f /usr/share/applications/calamares-eggs-debugging.desktop');
87
+ await exec('rm -f /usr/share/applications/calamares-eggs.desktop');
88
+ await exec('rm -f /usr/share/applications/calamares.desktop');
280
89
  }
281
90
  }
282
91
  /**
@@ -284,16 +93,16 @@ class Pacman {
284
93
  */
285
94
  static async calamaresPolicies() {
286
95
  if (this.distro().familyId === 'debian') {
287
- await debian_1.default.calamaresPolicies();
96
+ await Debian.calamaresPolicies();
288
97
  }
289
98
  else if (this.distro().familyId === 'fedora') {
290
- await fedora_1.default.calamaresPolicies();
99
+ await Fedora.calamaresPolicies();
291
100
  }
292
101
  else if (this.distro().familyId === 'archlinux') {
293
- await archlinux_1.default.calamaresPolicies();
102
+ await Archlinux.calamaresPolicies();
294
103
  }
295
104
  else if (this.distro().familyId === 'suse') {
296
- await suse_1.default.calamaresPolicies();
105
+ await Suse.calamaresPolicies();
297
106
  }
298
107
  }
299
108
  /**
@@ -302,44 +111,45 @@ class Pacman {
302
111
  static async calamaresRemove(verbose = true) {
303
112
  let retVal = false;
304
113
  if (this.distro().familyId === 'debian') {
305
- retVal = await debian_1.default.calamaresRemove(verbose);
114
+ retVal = await Debian.calamaresRemove(verbose);
306
115
  }
307
116
  else if (this.distro().familyId === 'fedora') {
308
- retVal = await fedora_1.default.calamaresRemove(verbose);
117
+ retVal = await Fedora.calamaresRemove(verbose);
309
118
  }
310
119
  else if (this.distro().familyId === 'archlinux') {
311
- retVal = await archlinux_1.default.calamaresRemove(verbose);
120
+ retVal = await Archlinux.calamaresRemove(verbose);
312
121
  }
313
122
  else if (this.distro().familyId === 'suse') {
314
- retVal = await suse_1.default.calamaresRemove(verbose);
123
+ retVal = await Suse.calamaresRemove(verbose);
315
124
  }
316
125
  return retVal;
317
126
  }
318
127
  /**
319
- * Restituisce VERO se i file di configurazione SONO presenti
128
+ *
129
+ * @param cmd
320
130
  */
321
- static configurationCheck() {
322
- const confExists = node_fs_1.default.existsSync(config_file);
323
- return confExists;
131
+ static commandIsInstalled(cmd) {
132
+ let installed = false;
133
+ // if (shx.exec(`command -V ${cmd} &>/dev/null`).code == 0) {
134
+ // remove output
135
+ if (shx.exec(`command -V ${cmd} >/dev/null 2>&1`).code == 0) {
136
+ installed = true;
137
+ }
138
+ return installed;
324
139
  }
325
140
  /**
326
- * Ritorna vero se machine-id è uguale
141
+ * Restituisce VERO se i file di configurazione SONO presenti
327
142
  */
328
- static async configurationMachineNew(verbose = false) {
329
- const settings = new settings_1.default();
330
- await settings.load();
331
- const result = utils_1.default.machineId() !== settings.config.machine_id;
332
- if (verbose && result) {
333
- console.log('configurationMachineNew: True');
334
- }
335
- return result;
143
+ static configurationCheck() {
144
+ const confExists = fs.existsSync(config_file);
145
+ return confExists;
336
146
  }
337
147
  /**
338
148
  *
339
149
  */
340
150
  static async configurationFresh() {
341
151
  const config = {};
342
- config.version = utils_1.default.getPackageVersion();
152
+ config.version = Utils.getPackageVersion();
343
153
  config.snapshot_dir = '/home/eggs';
344
154
  config.snapshot_prefix = '';
345
155
  config.snapshot_excludes = '/etc/penguins-eggs.d/exclude.list';
@@ -355,8 +165,8 @@ class Pacman {
355
165
  config.compression = 'xz';
356
166
  config.ssh_pass = false;
357
167
  config.timezone = 'Europe/Rome';
358
- //config.locales_default = '__NOT_USED_MORE'
359
- //config.locales = ['__NOT_USED_MORE']
168
+ // config.locales_default = '__NOT_USED_MORE'
169
+ // config.locales = ['__NOT_USED_MORE']
360
170
  // config.timezone = 'America/New_York'
361
171
  // const env = process.env
362
172
  // config.locales_default = env.LANG !== undefined ? env.LANG : 'en_US.UTF-8'
@@ -366,17 +176,17 @@ class Pacman {
366
176
  config.force_installer = false;
367
177
  console.log('Due the lacks of calamares package set force_installer = false');
368
178
  }
369
- if (!Pacman.isUefi() && utils_1.default.uefiArch() !== "i386") {
179
+ if (!Pacman.isUefi() && Utils.uefiArch() !== "i386") {
370
180
  config.make_efi = false;
371
- console.log('Due the lacks of grub-efi-' + utils_1.default.uefiArch() + '-bin package set make_efi = false');
181
+ console.log('Due the lacks of grub-efi-' + Utils.uefiArch() + '-bin package set make_efi = false');
372
182
  }
373
183
  /**
374
184
  * Salvo la configurazione di eggs.yaml
375
185
  */
376
- config.machine_id = utils_1.default.machineId();
377
- config.vmlinuz = utils_1.default.vmlinuz();
378
- config.initrd_img = utils_1.default.initrdImg();
379
- const settings = new settings_1.default();
186
+ config.machine_id = Utils.machineId();
187
+ config.vmlinuz = Utils.vmlinuz();
188
+ config.initrd_img = Utils.initrdImg();
189
+ const settings = new Settings();
380
190
  await settings.save(config);
381
191
  }
382
192
  /**
@@ -384,103 +194,83 @@ class Pacman {
384
194
  */
385
195
  static async configurationInstall(links = true, verbose = true) {
386
196
  const confRoot = '/etc/penguins-eggs.d';
387
- if (!node_fs_1.default.existsSync(confRoot)) {
388
- (0, node_child_process_1.execSync)(`mkdir ${confRoot}`);
197
+ if (!fs.existsSync(confRoot)) {
198
+ execSync(`mkdir ${confRoot}`);
389
199
  }
200
+ console.log('configurationInstall: ' + confRoot);
390
201
  const addons = `${confRoot}/addons`;
391
- if (node_fs_1.default.existsSync(addons)) {
392
- (0, node_child_process_1.execSync)(`rm -rf ${addons}`);
202
+ if (fs.existsSync(addons)) {
203
+ execSync(`rm -rf ${addons}`);
393
204
  }
394
205
  const distros = `${confRoot}/distros`;
395
- if (node_fs_1.default.existsSync(distros)) {
396
- (0, node_child_process_1.execSync)(`rm -rf ${distros}`);
206
+ if (fs.existsSync(distros)) {
207
+ execSync(`rm -rf ${distros}`);
397
208
  }
398
- (0, node_child_process_1.execSync)(`mkdir -p ${distros}`);
209
+ execSync(`mkdir -p ${distros}`);
399
210
  /**
400
211
  * We use /etc/penguins-eggs.d/init for our init scripts:
401
212
  * # unattended.sh -> eggs install --unattended
402
213
  * # cuckoo -> eggs cuckoo
403
214
  */
404
215
  const init = `${confRoot}/init`;
405
- if (node_fs_1.default.existsSync(init)) {
406
- (0, node_child_process_1.execSync)(`rm -rf ${init}`);
407
- }
408
- (0, node_child_process_1.execSync)(`mkdir -p ${init}`);
409
- shelljs_1.default.ln('-s', node_path_1.default.resolve(__dirname, '../../addons'), addons);
410
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/README.md'), confRoot);
411
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/tools.yaml'), config_tools);
412
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/krill.yaml'), confRoot);
413
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/derivatives.yaml'), confRoot);
216
+ if (fs.existsSync(init)) {
217
+ execSync(`rm -rf ${init}`);
218
+ }
219
+ execSync(`mkdir -p ${init}`);
220
+ shx.ln('-s', path.resolve(__dirname, '../../addons'), addons);
221
+ shx.cp(path.resolve(__dirname, '../../conf/README.md'), confRoot);
222
+ shx.cp(path.resolve(__dirname, '../../conf/tools.yaml'), config_tools);
223
+ shx.cp(path.resolve(__dirname, '../../conf/krill.yaml'), confRoot);
224
+ shx.cp(path.resolve(__dirname, '../../conf/derivatives.yaml'), confRoot);
414
225
  // init
415
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/init/unattended.sh'), '/etc/penguins-eggs.d/init');
416
- shelljs_1.default.chmod('+x', '/etc/penguins-eggs.d/init/unattended.sh');
417
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/init/cuckoo.sh'), '/etc/penguins-eggs.d/init');
418
- shelljs_1.default.chmod('+x', '/etc/penguins-eggs.d/init/cuckoo.sh');
226
+ shx.cp(path.resolve(__dirname, '../../conf/init/unattended.sh'), '/etc/penguins-eggs.d/init');
227
+ shx.chmod('+x', '/etc/penguins-eggs.d/init/unattended.sh');
228
+ shx.cp(path.resolve(__dirname, '../../conf/init/cuckoo.sh'), '/etc/penguins-eggs.d/init');
229
+ shx.chmod('+x', '/etc/penguins-eggs.d/init/cuckoo.sh');
419
230
  // creazione cartella exclude.list.d
420
- (0, node_child_process_1.execSync)(`mkdir -p /etc/penguins-eggs.d/exclude.list.d`);
421
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/exclude.list.template'), '/etc/penguins-eggs.d/exclude.list.d');
422
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/exclude.list.custom'), '/etc/penguins-eggs.d/exclude.list.d');
423
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/exclude.list.homes'), '/etc/penguins-eggs.d/exclude.list.d');
424
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/exclude.list.usr'), '/etc/penguins-eggs.d/exclude.list.d');
231
+ execSync(`mkdir -p /etc/penguins-eggs.d/exclude.list.d`);
232
+ shx.cp(path.resolve(__dirname, '../../conf/exclude.list.d/*'), '/etc/penguins-eggs.d/exclude.list.d');
425
233
  await this.configurationFresh();
426
234
  }
427
235
  /**
428
- * Rimozione dei file di configurazione
236
+ * Ritorna vero se machine-id è uguale
429
237
  */
430
- static async configurationRemove(verbose = true) {
431
- const echo = utils_1.default.setEcho(verbose);
432
- if (node_fs_1.default.existsSync('/etc/penguins-eggs.d')) {
433
- await (0, utils_2.exec)('rm /etc/penguins-eggs.d -rf', echo);
434
- }
435
- if (node_fs_1.default.existsSync('/etc/calamares')) {
436
- await (0, utils_2.exec)('rm /etc/calamares -rf', echo);
238
+ static async configurationMachineNew(verbose = false) {
239
+ const settings = new Settings();
240
+ await settings.load();
241
+ const result = Utils.machineId() !== settings.config.machine_id;
242
+ if (verbose && result) {
243
+ console.log('configurationMachineNew: True');
437
244
  }
245
+ return result;
438
246
  }
439
247
  /**
440
- *
441
- * @param verbose
248
+ * Rimozione dei file di configurazione
442
249
  */
443
- static async autocompleteInstall(verbose = false) {
444
- if (this.distro().familyId === 'debian') {
445
- if (Pacman.packageIsInstalled('bash-completion')) {
446
- if (node_fs_1.default.existsSync('/usr/share/bash-completion/completions/')) {
447
- await (0, utils_2.exec)(`cp ${__dirname}/../../scripts/eggs.bash /usr/share/bash-completion/completions/`);
448
- }
449
- else if (node_fs_1.default.existsSync('/etc/bash_completion.d/')) {
450
- await (0, utils_2.exec)(`cp ${__dirname}/../../scripts/eggs.bash /etc/bash_completion.d/`);
451
- }
452
- }
250
+ static async configurationRemove(verbose = true) {
251
+ const echo = Utils.setEcho(verbose);
252
+ if (fs.existsSync('/etc/penguins-eggs.d')) {
253
+ await exec('rm /etc/penguins-eggs.d -rf', echo);
453
254
  }
454
- else if (this.distro().familyId === 'archlinux' && Pacman.packageIsInstalled('bash-completion')) {
455
- await (0, utils_2.exec)(`cp ${__dirname}/../../scripts/eggs.bash /usr/share/bash-completion/completions/`);
255
+ if (fs.existsSync('/etc/calamares')) {
256
+ await exec('rm /etc/calamares -rf', echo);
456
257
  }
457
258
  }
458
259
  /**
459
- * Installa manPage
260
+ *
261
+ * @returns
460
262
  */
461
- static async manPageInstall(verbose = false) {
462
- const manPageSrc = node_path_1.default.resolve(__dirname, '../../manpages/doc/man/eggs.roll.gz');
463
- if (node_fs_1.default.existsSync(manPageSrc)) {
464
- const man1Dir = '/usr/share/man/man1/';
465
- if (!node_fs_1.default.existsSync(man1Dir)) {
466
- (0, utils_2.exec)(`mkdir ${man1Dir} -p`);
467
- }
468
- const manPageDest = man1Dir + 'eggs.1.gz';
469
- (0, utils_2.exec)(`cp ${manPageSrc} ${manPageDest}`);
470
- if (shelljs_1.default.exec('which mandb', { silent: true }).stdout.trim() !== '') {
471
- await (0, utils_2.exec)('mandb > /dev/null');
472
- if (verbose) {
473
- console.log('manPage eggs installed...');
474
- }
475
- }
476
- }
263
+ static distro() {
264
+ const remix = {};
265
+ const distro = new Distro(remix);
266
+ return distro;
477
267
  }
478
268
  /**
479
269
  * distroTemplateCheck
480
270
  */
481
271
  static distroTemplateCheck() {
482
- const codenameLikeId = this.distro().codenameLikeId;
483
- return node_fs_1.default.existsSync(`/etc/penguins-eggs.d/distros/${codenameLikeId}`);
272
+ const { codenameLikeId } = this.distro();
273
+ return fs.existsSync(`/etc/penguins-eggs.d/distros/${codenameLikeId}`);
484
274
  }
485
275
  /**
486
276
  *
@@ -489,9 +279,9 @@ class Pacman {
489
279
  if (verbose) {
490
280
  console.log('distroTemplateInstall');
491
281
  }
492
- const echo = utils_1.default.setEcho(verbose);
493
- const rootPen = utils_1.default.rootPenguin();
494
- await (0, utils_2.exec)(`mkdir /etc/penguins-eggs.d/distros/${this.distro().codenameLikeId}`);
282
+ const echo = Utils.setEcho(verbose);
283
+ const rootPen = Utils.rootPenguin();
284
+ await exec(`mkdir /etc/penguins-eggs.d/distros/${this.distro().codenameLikeId}`);
495
285
  /**
496
286
  * Debian 10 - Buster: è il master per tutte le distro
497
287
  */
@@ -501,42 +291,42 @@ class Pacman {
501
291
  */
502
292
  if (this.distro().codenameLikeId === 'jessie') {
503
293
  const dest = '/etc/penguins-eggs.d/distros/jessie';
504
- await (0, utils_2.exec)(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
294
+ await exec(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
505
295
  /**
506
296
  * Debian 9 stretch: eredita grub, isolinux e locales da buster, contiene krill al posto di calamares
507
297
  */
508
298
  }
509
299
  else if (this.distro().codenameLikeId === 'stretch') {
510
300
  const dest = '/etc/penguins-eggs.d/distros/stretch';
511
- await (0, utils_2.exec)(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
301
+ await exec(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
512
302
  /**
513
303
  * Debian 10 buster: eredita tutto da buster
514
304
  */
515
305
  }
516
306
  else if (this.distro().codenameLikeId === 'buster') {
517
307
  const dest = '/etc/penguins-eggs.d/distros/buster';
518
- await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
308
+ await exec(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
519
309
  /**
520
310
  * Debian 11 bullseye: eredita tutto da buster
521
311
  */
522
312
  }
523
313
  else if (this.distro().codenameLikeId === 'bullseye') {
524
314
  const dest = '/etc/penguins-eggs.d/distros/bullseye';
525
- await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
315
+ await exec(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
526
316
  /**
527
317
  * Debian 12 bookworm: eredita tutto da buster
528
318
  */
529
319
  }
530
320
  else if (this.distro().codenameLikeId === 'bookworm') {
531
321
  const dest = '/etc/penguins-eggs.d/distros/bookworm';
532
- await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
322
+ await exec(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
533
323
  /**
534
324
  * Debian 13 trixie: eredita tutto da buster
535
325
  */
536
326
  }
537
327
  else if (this.distro().codenameLikeId === 'trixie') {
538
328
  const dest = '/etc/penguins-eggs.d/distros/trixie';
539
- await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
329
+ await exec(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
540
330
  /***********************************************************************************
541
331
  * Devuan
542
332
  **********************************************************************************/
@@ -546,21 +336,21 @@ class Pacman {
546
336
  }
547
337
  else if (this.distro().codenameLikeId === 'beowulf') {
548
338
  const dest = '/etc/penguins-eggs.d/distros/beowulf';
549
- await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
339
+ await exec(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
550
340
  /**
551
341
  * Devuan chimaera: eredita tutto da buster
552
342
  */
553
343
  }
554
344
  else if (this.distro().codenameLikeId === 'chimaera') {
555
345
  const dest = '/etc/penguins-eggs.d/distros/chimaera';
556
- await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
346
+ await exec(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
557
347
  /**
558
348
  * Devuan daedalus: eredita tutto da buster
559
349
  */
560
350
  }
561
351
  else if (this.distro().codenameLikeId === 'daedalus') {
562
352
  const dest = '/etc/penguins-eggs.d/distros/daedalus';
563
- await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
353
+ await exec(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
564
354
  /***********************************************************************************
565
355
  * Ubuntu
566
356
  **********************************************************************************/
@@ -571,15 +361,15 @@ class Pacman {
571
361
  else if (this.distro().codenameLikeId === 'bionic') {
572
362
  const dest = '/etc/penguins-eggs.d/distros/bionic';
573
363
  const bionic = `${rootPen}/conf/distros/bionic/*`;
574
- await (0, utils_2.exec)(`cp -r ${bionic} ${dest}`, echo);
364
+ await exec(`cp -r ${bionic} ${dest}`, echo);
575
365
  // Poi da buster
576
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
577
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
578
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
579
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
580
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
581
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
582
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
366
+ await exec(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
367
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
368
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
369
+ await exec(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
370
+ await exec(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
371
+ await exec(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
372
+ await exec(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
583
373
  /**
584
374
  * Ubuntu focal: eredita da focal e buster
585
375
  */
@@ -587,14 +377,14 @@ class Pacman {
587
377
  else if (this.distro().codenameLikeId === 'focal') {
588
378
  const dest = '/etc/penguins-eggs.d/distros/focal';
589
379
  const focal = `${rootPen}/conf/distros/focal/*`;
590
- await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
591
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
592
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
593
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
594
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
595
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
596
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
597
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
380
+ await exec(`cp -r ${focal} ${dest}`, echo);
381
+ await exec(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
382
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
383
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
384
+ await exec(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
385
+ await exec(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
386
+ await exec(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
387
+ await exec(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
598
388
  /**
599
389
  * Ubuntu 21.10 impish: eredita da focal e buster
600
390
  */
@@ -602,14 +392,14 @@ class Pacman {
602
392
  else if (this.distro().codenameLikeId === 'impish') {
603
393
  const dest = '/etc/penguins-eggs.d/distros/impish';
604
394
  const focal = `${rootPen}/conf/distros/focal/*`;
605
- await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
606
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
607
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
608
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
609
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
610
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
611
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
612
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
395
+ await exec(`cp -r ${focal} ${dest}`, echo);
396
+ await exec(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
397
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
398
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
399
+ await exec(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
400
+ await exec(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
401
+ await exec(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
402
+ await exec(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
613
403
  /**
614
404
  * Ubuntu 22.04 jammy: eredita da focal e buster
615
405
  */
@@ -617,14 +407,14 @@ class Pacman {
617
407
  else if (this.distro().codenameLikeId === 'jammy') {
618
408
  const dest = '/etc/penguins-eggs.d/distros/jammy';
619
409
  const focal = `${rootPen}/conf/distros/focal/*`;
620
- await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
621
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
622
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
623
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
624
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
625
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
626
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
627
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
410
+ await exec(`cp -r ${focal} ${dest}`, echo);
411
+ await exec(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
412
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
413
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
414
+ await exec(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
415
+ await exec(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
416
+ await exec(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
417
+ await exec(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
628
418
  /**
629
419
  * Ubuntu lunar/rhino: eredita da devel e buster
630
420
  *
@@ -633,14 +423,14 @@ class Pacman {
633
423
  else if (this.distro().codenameLikeId === 'devel') {
634
424
  const dest = '/etc/penguins-eggs.d/distros/devel';
635
425
  const focal = `${rootPen}/conf/distros/devel/*`;
636
- await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
637
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
638
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
639
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
640
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
641
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
642
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
643
- await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
426
+ await exec(`cp -r ${focal} ${dest}`, echo);
427
+ await exec(`cp -r ${buster}/calamares/calamares-modules/cleanup ${dest}/calamares/calamares-modules/cleanup`, echo);
428
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
429
+ await exec(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-undo ${dest}/calamares/calamares-modules/sources-yolk-undo`, echo);
430
+ await exec(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
431
+ await exec(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
432
+ await exec(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
433
+ await exec(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
644
434
  /***********************************************************************************
645
435
  * Fedora
646
436
  **********************************************************************************/
@@ -651,7 +441,7 @@ class Pacman {
651
441
  else if (this.distro().codenameLikeId === 'thirtyfive') {
652
442
  const dest = '/etc/penguins-eggs.d/distros/thirtyfive/';
653
443
  const thirtytive = `${rootPen}/conf/distros/thirtyfive/*`;
654
- await (0, utils_2.exec)(`cp -r ${thirtytive} ${dest}`, echo);
444
+ await exec(`cp -r ${thirtytive} ${dest}`, echo);
655
445
  /***********************************************************************************
656
446
  * Arch Linux
657
447
  **********************************************************************************/
@@ -662,7 +452,7 @@ class Pacman {
662
452
  else if (this.distro().codenameLikeId === 'rolling') {
663
453
  const dest = '/etc/penguins-eggs.d/distros/rolling/';
664
454
  const rolling = `${rootPen}/conf/distros/rolling/*`;
665
- await (0, utils_2.exec)(`cp -r ${rolling} ${dest}`, echo);
455
+ await exec(`cp -r ${rolling} ${dest}`, echo);
666
456
  /***********************************************************************************
667
457
  * openSuse
668
458
  **********************************************************************************/
@@ -673,29 +463,145 @@ class Pacman {
673
463
  else if (this.distro().codenameLikeId === 'tumbleweed') {
674
464
  const dest = '/etc/penguins-eggs.d/distros/tumbleweed/';
675
465
  const tumbleweed = `${rootPen}/conf/distros/tumbleweed/*`;
676
- await (0, utils_2.exec)(`cp -r ${tumbleweed} ${dest}`, echo);
466
+ await exec(`cp -r ${tumbleweed} ${dest}`, echo);
677
467
  }
678
468
  }
679
469
  /**
680
- * restuisce VERO se il pacchetto è installato
681
- * @param debPackage
470
+ * Controlla se calamares è installabile
471
+ * @returns
682
472
  */
683
- static packageIsInstalled(packageName) {
473
+ static isCalamaresAvailable() {
474
+ let result = this.distro().isCalamaresAvailable;
475
+ if (process.arch === 'arm' || process.arch === 'arm64') {
476
+ result = false;
477
+ }
478
+ return result;
479
+ }
480
+ /**
481
+ *
482
+ * @returns true se GUI
483
+ */
484
+ static isInstalledGui() {
485
+ return this.isInstalledXorg() || this.isInstalledWayland();
486
+ }
487
+ /**
488
+ * check if it's installed wayland
489
+ * @returns true if wayland
490
+ */
491
+ static isInstalledWayland() {
684
492
  let installed = false;
685
493
  if (this.distro().familyId === 'debian') {
686
- installed = debian_1.default.packageIsInstalled(packageName);
494
+ if (Debian.packageIsInstalled('xwayland')) {
495
+ installed = true;
496
+ }
687
497
  }
688
498
  else if (this.distro().familyId === 'fedora') {
689
- installed = fedora_1.default.packageIsInstalled(packageName);
499
+ if (Fedora.packageIsInstalled('xorg-x11-server-Xwayland*')) {
500
+ installed = true;
501
+ }
690
502
  }
691
503
  else if (this.distro().familyId === 'archlinux') {
692
- installed = archlinux_1.default.packageIsInstalled(packageName);
504
+ if (Archlinux.packageIsInstalled('xwayland')) {
505
+ installed = true;
506
+ }
693
507
  }
694
- else if (this.distro().familyId === 'suse') {
695
- installed = suse_1.default.packageIsInstalled(packageName);
508
+ else if (this.distro().familyId === 'suse' && Suse.packageIsInstalled('xwayland*')) {
509
+ installed = true;
696
510
  }
697
511
  return installed;
698
512
  }
513
+ /**
514
+ * check if it's installed xorg
515
+ * @returns
516
+ */
517
+ static isInstalledXorg() {
518
+ let installed = false;
519
+ if (this.distro().familyId === 'debian') {
520
+ if (Debian.packageIsInstalled('xserver-xorg-core')) {
521
+ installed = true;
522
+ }
523
+ }
524
+ else if (this.distro().familyId === 'fedora') {
525
+ if (Fedora.packageIsInstalled('xorg-x11-server-Xorg.x86_64')) {
526
+ installed = true;
527
+ }
528
+ }
529
+ else if (this.distro().familyId === 'archlinux') {
530
+ if (Archlinux.packageIsInstalled('xorg-server-common')) {
531
+ installed = true;
532
+ }
533
+ }
534
+ else if (this.distro().familyId === 'suse' && Suse.packageIsInstalled('xorg-x11-server')) {
535
+ installed = true;
536
+ }
537
+ return installed;
538
+ }
539
+ /**
540
+ * Check if the system is just CLI
541
+ */
542
+ static isRunningCli() {
543
+ return !this.isRunningGui();
544
+ }
545
+ /**
546
+ * Check if the system is GUI able
547
+ */
548
+ static isRunningGui() {
549
+ return this.isRunningXorg() || this.isRunningWayland();
550
+ }
551
+ /**
552
+ * Constrolla se è operante wayland
553
+ */
554
+ static isRunningWayland() {
555
+ return process.env.XDG_SESSION_TYPE === 'wayland';
556
+ }
557
+ /**
558
+ * controlla se è operante xserver-xorg-core
559
+ */
560
+ static isRunningXorg() {
561
+ return process.env.XDG_SESSION_TYPE === 'x11';
562
+ }
563
+ /**
564
+ * Check se la macchina ha grub adatto ad efi
565
+ * Forse conviene spostarlo in pacman
566
+ */
567
+ static isUefi() {
568
+ let isUefi = false;
569
+ if (this.distro().familyId === 'debian') {
570
+ if (Utils.uefiArch() !== 'i386' && this.packageIsInstalled('grub-efi-' + Utils.uefiArch() + '-bin')) {
571
+ isUefi = true;
572
+ }
573
+ }
574
+ else if (Pacman.distro().familyId === 'fedora') {
575
+ isUefi = true;
576
+ }
577
+ else if (Pacman.distro().familyId === 'archlinux') {
578
+ isUefi = true;
579
+ }
580
+ else if (Pacman.distro().familyId === 'suse') {
581
+ isUefi = true;
582
+ }
583
+ return isUefi;
584
+ }
585
+ /**
586
+ * Installa manPage
587
+ */
588
+ static async manPageInstall(verbose = false) {
589
+ const manPageSrc = path.resolve(__dirname, '../../manpages/doc/man/eggs.roll.gz');
590
+ if (fs.existsSync(manPageSrc)) {
591
+ const man1Dir = '/usr/share/man/man1/';
592
+ if (!fs.existsSync(man1Dir)) {
593
+ exec(`mkdir ${man1Dir} -p`);
594
+ }
595
+ const manPageDest = man1Dir + 'eggs.1.gz';
596
+ exec(`cp ${manPageSrc} ${manPageDest}`);
597
+ if (shx.exec('which mandb', { silent: true }).stdout.trim() !== '') {
598
+ await exec('mandb > /dev/null');
599
+ if (verbose) {
600
+ console.log('manPage eggs installed...');
601
+ }
602
+ }
603
+ }
604
+ }
699
605
  /**
700
606
  * restuisce VERO se il pacchetto è installato
701
607
  * @param debPackage
@@ -703,7 +609,7 @@ class Pacman {
703
609
  static async packageAptAvailable(packageName) {
704
610
  let available = false;
705
611
  if (this.distro().familyId === 'debian') {
706
- available = debian_1.default.packageIsInstalled(packageName);
612
+ available = Debian.packageIsInstalled(packageName);
707
613
  }
708
614
  return available;
709
615
  }
@@ -715,26 +621,10 @@ class Pacman {
715
621
  static async packageAptLast(debPackage) {
716
622
  let version = '';
717
623
  if (this.distro().familyId === 'debian') {
718
- version = await debian_1.default.packageAptLast(debPackage);
624
+ version = await Debian.packageAptLast(debPackage);
719
625
  }
720
626
  return version;
721
627
  }
722
- static async packageNpmLast(packageNpm = 'penguins-eggs') {
723
- return shelljs_1.default.exec('npm show ' + packageNpm + ' version', { silent: true }).stdout.trim();
724
- }
725
- /**
726
- *
727
- * @param cmd
728
- */
729
- static commandIsInstalled(cmd) {
730
- let installed = false;
731
- // if (shx.exec(`command -V ${cmd} &>/dev/null`).code == 0) {
732
- // remove output
733
- if (shelljs_1.default.exec(`command -V ${cmd} >/dev/null 2>&1`).code == 0) {
734
- installed = true;
735
- }
736
- return installed;
737
- }
738
628
  /**
739
629
  * Install the package packageName
740
630
  * @param packageName {string} Pacchetto Debian da installare
@@ -743,32 +633,63 @@ class Pacman {
743
633
  static async packageInstall(packageName) {
744
634
  let retVal = false;
745
635
  if (this.distro().familyId === 'debian') {
746
- retVal = await debian_1.default.packageInstall(packageName);
636
+ retVal = await Debian.packageInstall(packageName);
747
637
  }
748
638
  else if (this.distro().familyId === 'archlinux') {
749
- retVal = await archlinux_1.default.packageInstall(packageName);
639
+ retVal = await Archlinux.packageInstall(packageName);
750
640
  }
751
641
  else if (this.distro().familyId === 'fedora') {
752
- retVal = await fedora_1.default.packageInstall(packageName);
642
+ retVal = await Fedora.packageInstall(packageName);
753
643
  }
754
644
  return retVal;
755
645
  }
646
+ /**
647
+ * restuisce VERO se il pacchetto è installato
648
+ * @param debPackage
649
+ */
650
+ static packageIsInstalled(packageName) {
651
+ let installed = false;
652
+ if (this.distro().familyId === 'debian') {
653
+ installed = Debian.packageIsInstalled(packageName);
654
+ }
655
+ else if (this.distro().familyId === 'fedora') {
656
+ installed = Fedora.packageIsInstalled(packageName);
657
+ }
658
+ else if (this.distro().familyId === 'archlinux') {
659
+ installed = Archlinux.packageIsInstalled(packageName);
660
+ }
661
+ else if (this.distro().familyId === 'suse') {
662
+ installed = Suse.packageIsInstalled(packageName);
663
+ }
664
+ return installed;
665
+ }
666
+ static async packageNpmLast(packageNpm = 'penguins-eggs') {
667
+ return shx.exec('npm show ' + packageNpm + ' version', { silent: true }).stdout.trim();
668
+ }
756
669
  /**
757
670
  *
758
- * @param packages array packages
759
- *
760
- * Probabilmente da rimuovere, viene usata solo da prerequisitesRemove
761
- *
671
+ * @returns grub
762
672
  */
763
- static filterInstalled(packages) {
764
- const installed = [];
765
- for (const i in packages) {
766
- if (Pacman.packageIsInstalled(packages[i])) {
767
- installed.push(packages[i]);
673
+ static whichGrubIsInstalled() {
674
+ let grubInstalled = '';
675
+ if (this.distro().familyId === 'debian') {
676
+ if (this.packageIsInstalled('grub-common')) {
677
+ grubInstalled = 'grub';
768
678
  }
769
679
  }
770
- return installed;
680
+ else if (this.distro().familyId === 'fedora') {
681
+ if (this.packageIsInstalled('grub2-common.noarch')) {
682
+ grubInstalled = 'grub2';
683
+ }
684
+ }
685
+ else if (this.distro().familyId === 'archlinux') {
686
+ if (this.packageIsInstalled('grub')) {
687
+ grubInstalled = 'grub';
688
+ }
689
+ }
690
+ else if (this.distro().familyId === 'suse' && this.packageIsInstalled('grub2')) {
691
+ grubInstalled = 'grub2';
692
+ }
693
+ return grubInstalled;
771
694
  }
772
695
  }
773
- Pacman.debs4calamares = ['calamares', 'qml-module-qtquick2', 'qml-module-qtquick-controls'];
774
- exports.default = Pacman;