penguins-eggs 9.8.1 → 10.0.1

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