penguins-eggs 8.17.4 → 9.0.2

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 (264) hide show
  1. package/README.md +235 -155
  2. package/addons/README.md +78 -84
  3. package/addons/{pve → blissos}/theme/applications/install-debian.desktop +0 -0
  4. package/addons/{pve → blissos}/theme/artwork/install-debian.png +0 -0
  5. package/addons/blissos/theme/calamares/branding/blissos-logo.png +0 -0
  6. package/addons/{pve → blissos}/theme/calamares/branding/branding.desc +0 -0
  7. package/addons/blissos/theme/calamares/branding/languages.png +0 -0
  8. package/addons/blissos/theme/calamares/branding/show.qml +75 -0
  9. package/addons/blissos/theme/calamares/branding/slide1.png +0 -0
  10. package/addons/blissos/theme/calamares/branding/slide2.png +0 -0
  11. package/addons/blissos/theme/calamares/branding/slide3.png +0 -0
  12. package/addons/blissos/theme/calamares/branding/welcome.png +0 -0
  13. package/addons/{pve → blissos}/theme/calamares/modules/partition.yml +2 -2
  14. package/addons/blissos/theme/livecd/README.md +23 -0
  15. package/addons/blissos/theme/livecd/grub.template.cfg +34 -0
  16. package/addons/blissos/theme/livecd/grub.theme.cfg +46 -0
  17. package/addons/blissos/theme/livecd/isolinux.template.cfg +29 -0
  18. package/addons/blissos/theme/livecd/isolinux.theme.cfg +45 -0
  19. package/addons/blissos/theme/livecd/splash.png +0 -0
  20. package/addons/debian/theme/README.md +23 -0
  21. package/addons/debian/theme/{branding → calamares/branding}/branding.desc +0 -0
  22. package/addons/debian/theme/{branding → calamares/branding}/debian-logo.png +0 -0
  23. package/addons/debian/theme/{branding → calamares/branding}/show.qml +0 -0
  24. package/addons/debian/theme/{branding → calamares/branding}/slide1.png +0 -0
  25. package/addons/debian/theme/{branding → calamares/branding}/welcome.png +0 -0
  26. package/addons/debian/theme/calamares/modules/partition.yml +233 -0
  27. package/addons/debian/theme/livecd/README.md +23 -0
  28. package/addons/debian/theme/livecd/grub.template.cfg +34 -0
  29. package/addons/{pve/theme/livecd/theme.cfg → debian/theme/livecd/grub.theme.cfg} +4 -0
  30. package/addons/debian/theme/livecd/isolinux.template.cfg +30 -0
  31. package/{conf/distros/buster/isolinux/stdmenu.template.cfg → addons/debian/theme/livecd/isolinux.theme.cfg} +4 -0
  32. package/addons/debian/theme/livecd/splash.png +0 -0
  33. package/addons/deblinux/theme/README.md +19 -12
  34. package/addons/eggs/adapt/applications/eggs-adapt.desktop +1 -1
  35. package/addons/eggs/theme/livecd/README.md +21 -6
  36. package/addons/eggs/theme/livecd/grub.template.cfg +11 -37
  37. package/addons/eggs/theme/livecd/{theme.cfg → grub.theme.cfg} +5 -1
  38. package/addons/eggs/theme/livecd/isolinux.template.cfg +29 -0
  39. package/addons/eggs/theme/livecd/isolinux.theme.cfg +46 -0
  40. package/addons/eggs/theme/livecd/splash.png +0 -0
  41. package/addons/guadalinex/theme/livecd/README.md +23 -0
  42. package/addons/guadalinex/theme/livecd/{menu.template.cfg → isolinux.template.cfg} +12 -3
  43. package/addons/guadalinex/theme/livecd/{theme.cfg → isolinux.theme.cfg} +0 -0
  44. package/addons/neon/theme/livecd/README.md +23 -0
  45. package/addons/neon/theme/livecd/grub.template.cfg +34 -0
  46. package/addons/{ufficiozero/theme/livecd/theme.cfg → neon/theme/livecd/grub.theme.cfg} +5 -1
  47. package/addons/neon/theme/livecd/isolinux.template.cfg +29 -0
  48. package/addons/neon/theme/livecd/isolinux.theme.cfg +46 -0
  49. package/addons/neon/theme/livecd/splash.pcx +0 -0
  50. package/addons/neon/theme/livecd/splash.png +0 -0
  51. package/addons/openos/theme/livecd/README.md +23 -0
  52. package/addons/openos/theme/livecd/{theme.cfg → grub.theme.cfg} +0 -0
  53. package/addons/openos/theme/livecd/{menu.template.cfg → isolinux.template.cfg} +11 -3
  54. package/addons/openos/theme/livecd/isolinux.theme.cfg +45 -0
  55. package/addons/ufficiozero/theme/applications/install-debian.desktop +17 -2
  56. package/bin/dev +17 -0
  57. package/bin/dev.cmd +3 -0
  58. package/bin/run +2 -4
  59. package/conf/distros/bionic/calamares/settings.yml +5 -5
  60. package/conf/distros/bookworm/README.md +9 -0
  61. package/conf/distros/bullseye/README.md +6 -8
  62. package/conf/distros/buster/calamares/modules/shellprocess_eggs-cleanup.yml +6 -0
  63. package/conf/distros/buster/calamares/settings.yml +14 -3
  64. package/conf/distros/chimaera/README.md +3 -0
  65. package/conf/distros/daedalus/README.md +3 -0
  66. package/conf/distros/focal/calamares/settings.yml +2 -2
  67. package/conf/distros/jammy/README.md +9 -0
  68. package/conf/distros/rolling/README.md +3 -0
  69. package/conf/distros/rolling/calamares/calamares-modules/remove-link/module.yml +9 -0
  70. package/conf/distros/rolling/calamares/calamares-modules/remove-link/remove-link.sh +3 -0
  71. package/conf/distros/rolling/calamares/modules/displaymanager.yml +22 -0
  72. package/conf/distros/rolling/calamares/modules/finished.yml +6 -0
  73. package/conf/distros/rolling/calamares/modules/fstab.yml +13 -0
  74. package/conf/distros/rolling/calamares/modules/locale.yml +97 -0
  75. package/conf/distros/rolling/calamares/modules/luksopenswaphookcfg.yml +6 -0
  76. package/conf/distros/rolling/calamares/modules/mount.yml +38 -0
  77. package/conf/distros/rolling/calamares/modules/packages.yml +8 -0
  78. package/conf/distros/rolling/calamares/modules/removeuser.yml +15 -0
  79. package/conf/distros/rolling/calamares/modules/unpackfs.yml +7 -0
  80. package/conf/distros/rolling/calamares/modules/users.yml +20 -0
  81. package/conf/distros/rolling/calamares/modules/welcome.yml +19 -0
  82. package/conf/distros/{bullseye → rolling}/calamares/settings.yml +17 -12
  83. package/conf/distros/thirtyfive/README.md +3 -0
  84. package/conf/distros/tumbleweed/README.md +3 -0
  85. package/conf/eggs.yaml +1 -1
  86. package/conf/exclude.list +2 -4
  87. package/conf/tools.yaml +1 -1
  88. package/lib/classes/basket.js +24 -28
  89. package/lib/classes/bleach.js +17 -17
  90. package/lib/classes/compressors.js +15 -14
  91. package/lib/classes/daddy.js +38 -31
  92. package/lib/classes/distro.d.ts +3 -2
  93. package/lib/classes/distro.js +288 -179
  94. package/lib/classes/family/archlinux.d.ts +69 -0
  95. package/lib/classes/family/archlinux.js +181 -0
  96. package/lib/classes/family/debian.d.ts +64 -0
  97. package/lib/classes/family/debian.js +227 -0
  98. package/lib/classes/family/fedora.d.ts +63 -0
  99. package/lib/classes/family/fedora.js +169 -0
  100. package/lib/classes/family/suse.d.ts +63 -0
  101. package/lib/classes/family/suse.js +169 -0
  102. package/lib/classes/i18n.js +16 -16
  103. package/lib/classes/incubation/branding.js +5 -4
  104. package/lib/classes/incubation/distros/bionic.js +1 -2
  105. package/lib/classes/incubation/distros/buster.js +2 -2
  106. package/lib/classes/incubation/distros/focal.js +3 -2
  107. package/lib/classes/incubation/distros/jessie.js +1 -25
  108. package/lib/classes/incubation/distros/{bullseye.d.ts → rolling.d.ts} +3 -3
  109. package/lib/classes/incubation/distros/{bullseye.js → rolling.js} +15 -16
  110. package/lib/classes/incubation/fisherman-helper/displaymanager.js +2 -7
  111. package/lib/classes/incubation/fisherman-helper/packages.js +31 -32
  112. package/lib/classes/incubation/fisherman.d.ts +17 -17
  113. package/lib/classes/incubation/fisherman.js +84 -71
  114. package/lib/classes/incubation/incubator.js +116 -78
  115. package/lib/classes/incubation/installer.d.ts +2 -2
  116. package/lib/classes/incubation/installer.js +6 -20
  117. package/lib/classes/initrd.d.ts +1 -1
  118. package/lib/classes/initrd.js +37 -30
  119. package/lib/classes/krill_install.js +135 -132
  120. package/lib/classes/krill_prepare.js +51 -51
  121. package/lib/classes/n8.js +6 -11
  122. package/lib/classes/ovary.d.ts +29 -11
  123. package/lib/classes/ovary.js +711 -605
  124. package/lib/classes/pacman.d.ts +53 -58
  125. package/lib/classes/pacman.js +512 -431
  126. package/lib/classes/pve-live.js +6 -6
  127. package/lib/classes/settings.js +46 -55
  128. package/lib/classes/systemctl.d.ts +6 -6
  129. package/lib/classes/systemctl.js +7 -7
  130. package/lib/classes/tools.d.ts +1 -1
  131. package/lib/classes/tools.js +10 -10
  132. package/lib/classes/utils.d.ts +9 -12
  133. package/lib/classes/utils.js +127 -106
  134. package/lib/classes/xdg.js +94 -90
  135. package/lib/classes/yolk.js +36 -29
  136. package/lib/commands/adapt.d.ts +3 -3
  137. package/lib/commands/adapt.js +12 -12
  138. package/lib/commands/bro.d.ts +14 -0
  139. package/lib/commands/bro.js +31 -0
  140. package/lib/commands/calamares.d.ts +7 -7
  141. package/lib/commands/calamares.js +21 -46
  142. package/lib/commands/config.d.ts +5 -5
  143. package/lib/commands/config.js +68 -75
  144. package/lib/commands/dad.d.ts +5 -5
  145. package/lib/commands/dad.js +11 -11
  146. package/lib/commands/export/deb.d.ts +8 -8
  147. package/lib/commands/export/deb.js +16 -16
  148. package/lib/commands/export/docs.d.ts +2 -2
  149. package/lib/commands/export/docs.js +9 -9
  150. package/lib/commands/export/iso.d.ts +4 -4
  151. package/lib/commands/export/iso.js +12 -17
  152. package/lib/commands/info.d.ts +9 -3
  153. package/lib/commands/info.js +14 -164
  154. package/lib/commands/install.d.ts +4 -4
  155. package/lib/commands/install.js +19 -14
  156. package/lib/commands/kill.d.ts +3 -3
  157. package/lib/commands/kill.js +11 -13
  158. package/lib/commands/mom.d.ts +2 -2
  159. package/lib/commands/mom.js +8 -8
  160. package/lib/commands/produce.d.ts +14 -14
  161. package/lib/commands/produce.js +42 -45
  162. package/lib/commands/remove.d.ts +5 -5
  163. package/lib/commands/remove.js +46 -57
  164. package/lib/commands/tools/clean.d.ts +3 -3
  165. package/lib/commands/tools/clean.js +10 -12
  166. package/lib/commands/tools/locales.d.ts +4 -4
  167. package/lib/commands/tools/locales.js +8 -8
  168. package/lib/commands/tools/skel.d.ts +4 -4
  169. package/lib/commands/tools/skel.js +10 -15
  170. package/lib/commands/tools/stat.d.ts +7 -4
  171. package/lib/commands/tools/stat.js +20 -13
  172. package/lib/commands/tools/yolk.d.ts +3 -3
  173. package/lib/commands/tools/yolk.js +12 -12
  174. package/lib/commands/update.d.ts +5 -10
  175. package/lib/commands/update.js +56 -72
  176. package/lib/components/elements/information.d.ts +4 -0
  177. package/lib/components/elements/information.js +166 -0
  178. package/lib/components/elements/steps.js +1 -1
  179. package/lib/components/elements/title.js +7 -10
  180. package/lib/components/finished.js +5 -5
  181. package/lib/components/install.js +5 -5
  182. package/lib/components/keyboard.js +5 -5
  183. package/lib/components/location.js +5 -5
  184. package/lib/components/network.js +5 -5
  185. package/lib/components/partitions.js +5 -5
  186. package/lib/components/summary.js +5 -5
  187. package/lib/components/users.js +6 -6
  188. package/lib/components/welcome.js +6 -6
  189. package/lib/index.d.ts +1 -1
  190. package/lib/index.js +2 -2
  191. package/lib/interfaces/i-distro.d.ts +3 -2
  192. package/lib/interfaces/i-settings.d.ts +2 -2
  193. package/lib/lib/cli-autologin.d.ts +19 -2
  194. package/lib/lib/cli-autologin.js +114 -39
  195. package/lib/lib/dependencies.d.ts +9 -6
  196. package/lib/lib/dependencies.js +22 -13
  197. package/lib/lib/get_address.js +2 -2
  198. package/lib/lib/get_dns.js +2 -2
  199. package/lib/lib/get_domain.js +2 -2
  200. package/lib/lib/get_gateway.js +2 -2
  201. package/lib/lib/get_hostname.js +2 -2
  202. package/lib/lib/get_netmask.js +2 -2
  203. package/lib/lib/get_password.js +2 -2
  204. package/lib/lib/get_root_password.js +2 -2
  205. package/lib/lib/get_userfullname.js +2 -2
  206. package/lib/lib/get_username.js +2 -2
  207. package/lib/lib/select_address_type.js +2 -5
  208. package/lib/lib/select_filesystem_type.js +5 -14
  209. package/lib/lib/select_installation_device.js +3 -3
  210. package/lib/lib/select_interface.js +1 -1
  211. package/lib/lib/select_keyboard_layout.js +2 -10
  212. package/lib/lib/select_languages.js +2 -2
  213. package/lib/lib/select_regions.js +1 -12
  214. package/lib/lib/select_user_swap_choice.js +4 -4
  215. package/lib/lib/select_zones.js +483 -62
  216. package/oclif.manifest.json +1 -1
  217. package/package.json +115 -107
  218. package/scripts/bros/waydroid-helper.sh +92 -0
  219. package/scripts/eggs.bash +65 -35
  220. package/scripts/not-used/eggs-cleanup.sh +7 -0
  221. package/scripts/{install-eggs-ppa.sh → not-used/install-eggs-ppa.sh} +0 -0
  222. package/scripts/{mkinitramfs → not-used/mkinitramfs} +0 -0
  223. package/scripts/{pve-live.sh → not-used/pve-live.sh} +0 -0
  224. package/addons/eggs/theme/livecd/menu.template.cfg +0 -54
  225. package/addons/pve/theme/applications/penguins-pve.desktop +0 -24
  226. package/addons/pve/theme/calamares/branding/pve-logo.png +0 -0
  227. package/addons/pve/theme/calamares/branding/show.qml +0 -227
  228. package/addons/pve/theme/calamares/branding/slide1.png +0 -0
  229. package/addons/pve/theme/calamares/branding/slide2.png +0 -0
  230. package/addons/pve/theme/calamares/branding/slide3.png +0 -0
  231. package/addons/pve/theme/calamares/branding/slide4.png +0 -0
  232. package/addons/pve/theme/calamares/branding/slide5.png +0 -0
  233. package/addons/pve/theme/calamares/branding/slide6.png +0 -0
  234. package/addons/pve/theme/calamares/branding/slide7.png +0 -0
  235. package/addons/pve/theme/calamares/branding/slide8.png +0 -0
  236. package/addons/pve/theme/calamares/branding/slide9.png +0 -0
  237. package/addons/pve/theme/calamares/branding/welcome.png +0 -0
  238. package/addons/pve/theme/livecd/README.md +0 -8
  239. package/addons/pve/theme/livecd/grub.template.cfg +0 -60
  240. package/addons/pve/theme/livecd/menu.template.cfg +0 -54
  241. package/addons/pve/theme/livecd/splash.png +0 -0
  242. package/addons/ufficiozero/theme/artwork/install-debian.png +0 -0
  243. package/addons/ufficiozero/theme/livecd/README.md +0 -8
  244. package/addons/ufficiozero/theme/livecd/grub.template.cfg +0 -60
  245. package/addons/ufficiozero/theme/livecd/menu.template.cfg +0 -54
  246. package/changelog.md +0 -154
  247. package/conf/distros/bullseye/calamares/calamares-modules/bootloader-config/bootloader-config.sh +0 -28
  248. package/conf/distros/bullseye/calamares/calamares-modules/bootloader-config/module.yml +0 -8
  249. package/conf/distros/buster/grub/grub.template.cfg +0 -58
  250. package/conf/distros/buster/grub/loopback.cfg +0 -1
  251. package/conf/distros/buster/grub/theme.cfg +0 -42
  252. package/conf/distros/buster/isolinux/isolinux.template.cfg +0 -8
  253. package/conf/distros/buster/isolinux/menu.template.cfg +0 -56
  254. package/conf/distros/focal/grub/grub.template.cfg +0 -67
  255. package/conf/distros/focal/isolinux/menu.template.cfg +0 -54
  256. package/lib/classes/incubation/distros/beowulf.d.ts +0 -30
  257. package/lib/classes/incubation/distros/beowulf.js +0 -69
  258. package/lib/classes/krill_install_compare.d.ts +0 -200
  259. package/lib/classes/krill_install_compare.js +0 -1110
  260. package/manpages/doc/man/eggs.1.gz +0 -0
  261. package/scripts/python-minimal-deb/anti-python-minimal +0 -7
  262. package/scripts/python-minimal-deb/python-minimal_99_all.deb +0 -0
  263. package/scripts/python-minimal-deb/python-minimal_99_amd64.buildinfo +0 -168
  264. package/scripts/python-minimal-deb/python-minimal_99_amd64.changes +0 -25
@@ -7,15 +7,18 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const tslib_1 = require("tslib");
10
- const dependencies_1 = require("../lib/dependencies");
11
- const fs = require("fs");
12
- const path = require("path");
13
- const shx = 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 child_process_1 = require("child_process");
18
- const exec = require('../lib/utils').exec;
10
+ const node_fs_1 = (0, tslib_1.__importDefault)(require("node:fs"));
11
+ const node_path_1 = (0, tslib_1.__importDefault)(require("node:path"));
12
+ const shelljs_1 = (0, tslib_1.__importDefault)(require("shelljs"));
13
+ const utils_1 = (0, tslib_1.__importDefault)(require("./utils"));
14
+ const distro_1 = (0, tslib_1.__importDefault)(require("./distro"));
15
+ const settings_1 = (0, tslib_1.__importDefault)(require("./settings"));
16
+ const node_child_process_1 = require("node:child_process");
17
+ const utils_2 = require("../lib/utils");
18
+ const debian_1 = (0, tslib_1.__importDefault)(require("./family/debian"));
19
+ const fedora_1 = (0, tslib_1.__importDefault)(require("./family/fedora"));
20
+ const archlinux_1 = (0, tslib_1.__importDefault)(require("./family/archlinux"));
21
+ const suse_1 = (0, tslib_1.__importDefault)(require("./family/suse"));
19
22
  const config_file = '/etc/penguins-eggs.d/eggs.yaml';
20
23
  const config_tools = '/etc/penguins-eggs.d/tools.yaml';
21
24
  /**
@@ -23,82 +26,163 @@ const config_tools = '/etc/penguins-eggs.d/tools.yaml';
23
26
  * @remarks all the utilities
24
27
  */
25
28
  class Pacman {
26
- /**
27
- *
28
- */
29
29
  constructor() {
30
30
  this.distro = {};
31
31
  this.remix = {};
32
- this.settings = {};
33
- const versionLike = this.distro.versionLike;
34
32
  }
35
33
  /**
36
34
  *
37
35
  * @returns
38
36
  */
39
- static versionLike() {
37
+ static distro() {
40
38
  const remix = {};
41
39
  const distro = new distro_1.default(remix);
42
- return distro.versionLike;
40
+ return distro;
41
+ }
42
+ static whichGrubIsInstalled() {
43
+ let grubInstalled = '';
44
+ if (this.distro().familyId === 'debian') {
45
+ if (this.packageIsInstalled('grub-common')) {
46
+ grubInstalled = 'grub';
47
+ }
48
+ }
49
+ else if (this.distro().familyId === 'fedora') {
50
+ if (this.packageIsInstalled('grub2-common.noarch')) {
51
+ grubInstalled = 'grub2';
52
+ }
53
+ }
54
+ else if (this.distro().familyId === 'archlinux') {
55
+ if (this.packageIsInstalled('grub')) {
56
+ grubInstalled = 'grub';
57
+ }
58
+ }
59
+ else if (this.distro().familyId === 'suse' && this.packageIsInstalled('grub2')) {
60
+ grubInstalled = 'grub2';
61
+ }
62
+ return grubInstalled;
43
63
  }
44
64
  /**
45
- * controlla se è installato xserver-xorg-core
65
+ * check if it's installed xorg
66
+ * @returns true if xorg is installed
46
67
  */
47
- static async isXorg() {
48
- return Pacman.packageIsInstalled('xserver-xorg-core') || Pacman.packageIsInstalled('xserver-xorg-core-hwe-18.04');
68
+ static isInstalledXorg() {
69
+ let installed = false;
70
+ if (this.distro().familyId === 'debian') {
71
+ if (debian_1.default.isInstalledXorg()) {
72
+ installed = true;
73
+ }
74
+ }
75
+ else if (this.distro().familyId === 'fedora') {
76
+ if (fedora_1.default.isInstalledXorg()) {
77
+ installed = true;
78
+ }
79
+ }
80
+ else if (this.distro().familyId === 'archlinux') {
81
+ if (archlinux_1.default.isInstalledXorg()) {
82
+ installed = true;
83
+ }
84
+ }
85
+ else if (this.distro().familyId === 'suse' && suse_1.default.isInstalledXorg()) {
86
+ installed = true;
87
+ }
88
+ return installed;
49
89
  }
50
90
  /**
51
- * Constrolla se è installato wayland
91
+ * check if it's installed wayland
92
+ * @returns true if wayland
52
93
  */
53
- static async isWayland() {
54
- return Pacman.packageIsInstalled('wayland');
94
+ static isInstalledWayland() {
95
+ let installed = false;
96
+ if (this.distro().familyId === 'debian') {
97
+ if (debian_1.default.isInstalledWayland()) {
98
+ installed = true;
99
+ }
100
+ }
101
+ else if (this.distro().familyId === 'fedora') {
102
+ if (fedora_1.default.isInstalledWayland()) {
103
+ installed = true;
104
+ }
105
+ }
106
+ else if (this.distro().familyId === 'archlinux') {
107
+ if (archlinux_1.default.isInstalledWayland()) {
108
+ installed = true;
109
+ }
110
+ }
111
+ else if (this.distro().familyId === 'suse' && suse_1.default.isInstalledWayland()) {
112
+ installed = true;
113
+ }
114
+ return installed;
55
115
  }
56
116
  /**
57
- * Check if the system is just CLI
117
+ * Check se la macchina ha grub adatto ad efi
118
+ * Forse conviene spostarlo in pacman
119
+ */
120
+ static isUefi() {
121
+ let isUefi = false;
122
+ if (this.distro().familyId === 'debian') {
123
+ if (utils_1.default.machineArch() !== 'i386' && this.packageIsInstalled('grub-efi-' + utils_1.default.machineArch() + '-bin')) {
124
+ isUefi = true;
125
+ }
126
+ }
127
+ else if (Pacman.distro().familyId === 'fedora') {
128
+ isUefi = true;
129
+ }
130
+ else if (Pacman.distro().familyId === 'archlinux') {
131
+ isUefi = true;
132
+ }
133
+ else if (Pacman.distro().familyId === 'suse') {
134
+ isUefi = true;
135
+ }
136
+ return isUefi;
137
+ }
138
+ /**
139
+ *
140
+ * @returns true se GUI
58
141
  */
59
- static async isCli() {
60
- return !await this.isGui();
142
+ static isInstalledGui() {
143
+ return this.isInstalledXorg() || this.isInstalledWayland();
144
+ }
145
+ /**
146
+ * controlla se è operante xserver-xorg-core
147
+ */
148
+ static isRunningXorg() {
149
+ return process.env.XDG_SESSION_TYPE === 'x11';
150
+ }
151
+ /**
152
+ * Constrolla se è operante wayland
153
+ */
154
+ static isRunningWayland() {
155
+ return process.env.XDG_SESSION_TYPE === 'wayland';
61
156
  }
62
157
  /**
63
158
  * Check if the system is GUI able
64
159
  */
65
- static async isGui() {
66
- return await this.isXorg() || await this.isWayland();
160
+ static isRunningGui() {
161
+ return this.isRunningXorg() || this.isRunningWayland();
67
162
  }
68
163
  /**
69
- *
70
- * @returns
164
+ * Check if the system is just CLI
71
165
  */
72
- static guiEnabled() {
73
- let enabled = true;
74
- if (process.env.DISPLAY === '') {
75
- enabled = false;
76
- }
77
- return enabled;
166
+ static isRunningCli() {
167
+ return !this.isRunningGui();
78
168
  }
79
169
  /**
80
170
  * Crea array packages dei pacchetti da installare
81
171
  */
82
- static packages(verbose = false) {
83
- const packages = dependencies_1.depCommon;
84
- const arch = utils_1.default.machineArch();
85
- dependencies_1.depArch.forEach((dep) => {
86
- if (dep.arch.includes(arch)) {
87
- packages.push(dep.package);
88
- }
89
- });
90
- const version = Pacman.versionLike();
91
- dependencies_1.depVersions.forEach((dep) => {
92
- if (dep.versions.includes(version)) {
93
- packages.push(dep.package);
94
- }
95
- });
96
- const initType = shx.exec('ps --no-headers -o comm 1', { silent: !verbose }).trim();
97
- dependencies_1.depInit.forEach((dep) => {
98
- if (dep.init.includes(initType)) {
99
- packages.push(dep.package);
100
- }
101
- });
172
+ static packages(remove = false, verbose = false) {
173
+ let packages = [];
174
+ if (this.distro().familyId === 'debian') {
175
+ packages = debian_1.default.packages(remove, verbose);
176
+ }
177
+ else if (this.distro().familyId === 'fedora') {
178
+ packages = fedora_1.default.packages(remove, verbose);
179
+ }
180
+ else if (this.distro().familyId === 'archlinux') {
181
+ packages = archlinux_1.default.packages(remove, verbose);
182
+ }
183
+ else if (this.distro().familyId === 'suse') {
184
+ packages = suse_1.default.packages(remove, verbose);
185
+ }
102
186
  return packages;
103
187
  }
104
188
  /**
@@ -106,46 +190,9 @@ class Pacman {
106
190
  */
107
191
  static async prerequisitesCheck(verbose = false) {
108
192
  let installed = true;
109
- // Controllo depCommon e depArch SOLO se il pacchetto è npm
110
- if (utils_1.default.isNpmPackage()) {
111
- // controllo depCommon
112
- dependencies_1.depCommon.forEach(dep => {
113
- if (!this.packageIsInstalled(dep)) {
114
- installed = false;
115
- }
116
- });
117
- if (installed) {
118
- // controllo depArch
119
- const arch = utils_1.default.machineArch();
120
- dependencies_1.depArch.forEach((dep) => {
121
- if (dep.arch.includes(arch)) {
122
- if (!this.packageIsInstalled(dep.package)) {
123
- installed = false;
124
- }
125
- }
126
- });
127
- }
128
- }
129
- // Controlli da effettuare SEMPRE version e init
130
- if (installed) {
131
- const version = Pacman.versionLike();
132
- dependencies_1.depVersions.forEach((dep) => {
133
- if (dep.versions.includes(version)) {
134
- if (!this.packageIsInstalled(dep.package)) {
135
- installed = false;
136
- }
137
- }
138
- });
139
- }
140
- if (installed) {
141
- const initType = shx.exec('ps --no-headers -o comm 1', { silent: !verbose }).trim();
142
- dependencies_1.depInit.forEach((dep) => {
143
- if (dep.init.includes(initType)) {
144
- if (!this.packageIsInstalled(dep.package)) {
145
- installed = false;
146
- }
147
- }
148
- });
193
+ const packages = this.packages(false, verbose);
194
+ if (packages.length > 0) {
195
+ installed = false;
149
196
  }
150
197
  return installed;
151
198
  }
@@ -153,42 +200,19 @@ class Pacman {
153
200
  *
154
201
  */
155
202
  static async prerequisitesInstall(verbose = true) {
156
- const echo = utils_1.default.setEcho(verbose);
157
- const retVal = false;
158
- const versionLike = Pacman.versionLike();
159
- // console.log(`apt-get install --yes ${array2spaced(this.packages(verbose))}`)
160
- await exec(`apt-get install --yes ${dependencies_1.array2spaced(this.packages(verbose))}`, echo);
161
- // localization
162
- if ((versionLike === 'buster') || (versionLike === 'beowulf') || (versionLike === 'bullseye') || (versionLike === 'stretch') || (versionLike === 'jessie')) {
163
- await exec(`apt-get install --yes --no-install-recommends ${dependencies_1.array2spaced(this.packagesLocalisation(verbose))}`, echo);
164
- }
165
- if (await Pacman.isCli()) {
166
- /**
167
- * live-config-getty-generator
168
- *
169
- * Viene rimosso in naked, altrimenti non funziona il login
170
- * generando un errore getty.
171
- * Sarebbe utile individuarne le ragioni, forse rompe anche sul desktop
172
- * non permettendo di cambiare terminale e loggarsi
173
- *
174
- * A che serve?
175
- */
176
- await exec(`rm /lib/systemd/system-generators/live-config-getty-generator`);
203
+ let retVal = false;
204
+ if (this.distro().familyId === 'debian') {
205
+ retVal = await debian_1.default.prerequisitesInstall(verbose);
177
206
  }
178
- return retVal;
179
- }
180
- /**
181
- *
182
- */
183
- static async prerequisitesRemove(verbose = true) {
184
- const echo = utils_1.default.setEcho(verbose);
185
- const retVal = false;
186
- const versionLike = Pacman.versionLike();
187
- await exec(`apt-get purge --yes ${dependencies_1.array2spaced(this.filterInstalled(this.packages(verbose)))}`, echo);
188
- if ((versionLike === 'buster') || (versionLike === 'beowulf')) {
189
- await exec(`apt-get purge --yes ${dependencies_1.array2spaced(this.filterInstalled(this.packagesLocalisation(verbose)))}`, echo);
207
+ else if (this.distro().familyId === 'fedora') {
208
+ retVal = await fedora_1.default.prerequisitesInstall(verbose);
209
+ }
210
+ else if (this.distro().familyId === 'archlinux') {
211
+ retVal = await archlinux_1.default.prerequisitesInstall(verbose);
212
+ }
213
+ else if (this.distro().familyId === 'suse') {
214
+ retVal = await suse_1.default.prerequisitesInstall(verbose);
190
215
  }
191
- await exec('apt-get autoremove --yes', echo);
192
216
  return retVal;
193
217
  }
194
218
  /**
@@ -196,11 +220,17 @@ class Pacman {
196
220
  */
197
221
  static async calamaresCheck() {
198
222
  let installed = true;
199
- for (const i in this.debs4calamares) {
200
- if (!this.packageIsInstalled(this.debs4calamares[i])) {
201
- installed = false;
202
- break;
203
- }
223
+ if (this.distro().familyId === 'debian') {
224
+ installed = await debian_1.default.calamaresCheck();
225
+ }
226
+ else if (this.distro().familyId === 'fedora') {
227
+ installed = await fedora_1.default.calamaresCheck();
228
+ }
229
+ else if (this.distro().familyId === 'archlinux') {
230
+ installed = await archlinux_1.default.calamaresCheck();
231
+ }
232
+ else if (this.distro().familyId === 'suse') {
233
+ installed = await suse_1.default.calamaresCheck();
204
234
  }
205
235
  return installed;
206
236
  }
@@ -208,10 +238,8 @@ class Pacman {
208
238
  * Controlla se calamares è installabile
209
239
  * @returns
210
240
  */
211
- static calamaresAble() {
212
- const remix = {};
213
- const distro = new distro_1.default(remix);
214
- let result = distro.calamaresAble;
241
+ static isCalamaresAvailable() {
242
+ let result = this.distro().isCalamaresAvailable;
215
243
  if (process.arch === 'armel' || process.arch === 'arm64') {
216
244
  result = false;
217
245
  }
@@ -221,52 +249,64 @@ class Pacman {
221
249
  *
222
250
  */
223
251
  static async calamaresInstall(verbose = true) {
224
- const echo = utils_1.default.setEcho(verbose);
225
- if (await this.isGui()) {
226
- try {
227
- await exec('apt-get update --yes', echo);
252
+ if (this.isInstalledGui()) {
253
+ if (this.distro().familyId === 'debian') {
254
+ await debian_1.default.calamaresInstall(verbose);
228
255
  }
229
- catch (e) {
230
- utils_1.default.error('Pacman.calamaresInstall() apt-get update --yes ' + e.error);
256
+ else if (this.distro().familyId === 'fedora') {
257
+ await fedora_1.default.calamaresInstall(verbose);
231
258
  }
232
- try {
233
- await exec(`apt-get install --yes ${dependencies_1.array2spaced(this.debs4calamares)}`, echo);
259
+ else if (this.distro().familyId === 'archlinux') {
260
+ await archlinux_1.default.calamaresInstall(verbose);
234
261
  }
235
- catch (e) {
236
- utils_1.default.error(`Pacman.calamaresInstall() apt-get install --yes ${dependencies_1.array2spaced(this.debs4calamares)}` + e.error);
262
+ else if (this.distro().familyId === 'suse') {
263
+ await suse_1.default.calamaresInstall(verbose);
237
264
  }
238
265
  }
239
- else {
240
- console.log("It's not possible to use calamares in a system without GUI");
241
- }
242
266
  }
243
267
  /**
244
- * calamaresPolicies
245
- */
268
+ * calamaresPolicies
269
+ */
246
270
  static async calamaresPolicies() {
247
- const policyFile = '/usr/share/polkit-1/actions/com.github.calamares.calamares.policy';
248
- await exec(`sed -i 's/auth_admin/yes/' ${policyFile}`);
271
+ if (this.distro().familyId === 'debian') {
272
+ await debian_1.default.calamaresPolicies();
273
+ }
274
+ else if (this.distro().familyId === 'fedora') {
275
+ await fedora_1.default.calamaresPolicies();
276
+ }
277
+ else if (this.distro().familyId === 'archlinux') {
278
+ await archlinux_1.default.calamaresPolicies();
279
+ }
280
+ else if (this.distro().familyId === 'suse') {
281
+ await suse_1.default.calamaresPolicies();
282
+ }
249
283
  }
250
284
  /**
251
285
  *
252
286
  */
253
287
  static async calamaresRemove(verbose = true) {
254
- const echo = utils_1.default.setEcho(verbose);
255
- const retVal = false;
256
- if (fs.existsSync('/etc/calamares')) {
257
- await exec('rm /etc/calamares -rf', echo);
288
+ let retVal = false;
289
+ if (this.distro().familyId === 'debian') {
290
+ retVal = await debian_1.default.calamaresRemove(verbose);
291
+ }
292
+ else if (this.distro().familyId === 'fedora') {
293
+ retVal = await fedora_1.default.calamaresRemove(verbose);
294
+ }
295
+ else if (this.distro().familyId === 'archlinux') {
296
+ retVal = await archlinux_1.default.calamaresRemove(verbose);
297
+ }
298
+ else if (this.distro().familyId === 'suse') {
299
+ retVal = await suse_1.default.calamaresRemove(verbose);
258
300
  }
259
- await exec(`apt-get remove --purge --yes calamares`, echo);
260
- await exec('apt-get autoremove --yes', echo);
261
301
  return retVal;
262
302
  }
263
303
  /**
264
304
  * Restituisce VERO se i file di configurazione SONO presenti
265
305
  */
266
306
  static configurationCheck() {
267
- const confExists = fs.existsSync(config_file);
268
- const listExists = fs.existsSync('/usr/local/share/penguins-eggs/exclude.list');
269
- return (confExists && listExists);
307
+ const confExists = node_fs_1.default.existsSync(config_file);
308
+ const listExists = node_fs_1.default.existsSync('/usr/local/share/penguins-eggs/exclude.list');
309
+ return confExists && listExists;
270
310
  }
271
311
  /**
272
312
  * Ritorna vero se machine-id è uguale
@@ -275,10 +315,8 @@ class Pacman {
275
315
  const settings = new settings_1.default();
276
316
  await settings.load();
277
317
  const result = utils_1.default.machineId() !== settings.config.machine_id;
278
- if (verbose) {
279
- if (result) {
280
- console.log('configurationMachineNew: True');
281
- }
318
+ if (verbose && result) {
319
+ console.log('configurationMachineNew: True');
282
320
  }
283
321
  return result;
284
322
  }
@@ -305,23 +343,13 @@ class Pacman {
305
343
  config.timezone = 'Europe/Rome';
306
344
  config.pmount_fixed = false;
307
345
  const env = process.env;
308
- if (env.LANG !== undefined) {
309
- config.locales_default = env.LANG;
310
- }
311
- else {
312
- config.locales_default = 'en_US.UTF-8';
313
- }
314
- if (config.locales_default === 'en_US.UTF-8') {
315
- config.locales = ['en_US.UTF-8'];
316
- }
317
- else {
318
- config.locales = [config.locales_default, 'en_US.UTF-8'];
319
- }
346
+ config.locales_default = env.LANG !== undefined ? env.LANG : 'en_US.UTF-8';
347
+ config.locales = config.locales_default === 'en_US.UTF-8' ? ['en_US.UTF-8'] : [config.locales_default, 'en_US.UTF-8'];
320
348
  if (!this.packageIsInstalled('calamares')) {
321
349
  config.force_installer = false;
322
- console.log(`Due the lacks of calamares package set force_installer = false`);
350
+ console.log('Due the lacks of calamares package set force_installer = false');
323
351
  }
324
- if (!utils_1.default.isUefi()) {
352
+ if (!Pacman.isUefi()) {
325
353
  config.make_efi = false;
326
354
  console.log('Due the lacks of grub-efi-' + utils_1.default.machineArch() + '-bin package set make_efi = false');
327
355
  }
@@ -339,246 +367,340 @@ class Pacman {
339
367
  */
340
368
  static async configurationInstall(links = true, verbose = true) {
341
369
  const confRoot = '/etc/penguins-eggs.d';
342
- if (!fs.existsSync(confRoot)) {
343
- child_process_1.execSync(`mkdir ${confRoot}`);
370
+ if (!node_fs_1.default.existsSync(confRoot)) {
371
+ (0, node_child_process_1.execSync)(`mkdir ${confRoot}`);
344
372
  }
345
373
  const addons = `${confRoot}/addons`;
346
374
  const distros = `${confRoot}/distros`;
347
- if (fs.existsSync(addons)) {
348
- child_process_1.execSync(`rm -rf ${addons}`);
375
+ if (node_fs_1.default.existsSync(addons)) {
376
+ (0, node_child_process_1.execSync)(`rm -rf ${addons}`);
349
377
  }
350
- if (fs.existsSync(distros)) {
351
- child_process_1.execSync(`rm -rf ${distros}`);
378
+ if (node_fs_1.default.existsSync(distros)) {
379
+ (0, node_child_process_1.execSync)(`rm -rf ${distros}`);
352
380
  }
353
- child_process_1.execSync(`mkdir -p ${distros}`);
354
- shx.ln('-s', path.resolve(__dirname, '../../addons'), addons);
355
- shx.cp(path.resolve(__dirname, '../../conf/README.md'), '/etc/penguins-eggs.d/');
356
- shx.cp(path.resolve(__dirname, '../../conf/tools.yaml'), config_tools);
381
+ (0, node_child_process_1.execSync)(`mkdir -p ${distros}`);
382
+ shelljs_1.default.ln('-s', node_path_1.default.resolve(__dirname, '../../addons'), addons);
383
+ shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/README.md'), '/etc/penguins-eggs.d/');
384
+ shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/tools.yaml'), config_tools);
357
385
  // creazione del file delle esclusioni
358
- shx.mkdir('-p', '/usr/local/share/penguins-eggs/');
359
- shx.cp(path.resolve(__dirname, '../../conf/exclude.list'), '/usr/local/share/penguins-eggs');
360
- await Pacman.configurationFresh();
386
+ shelljs_1.default.mkdir('-p', '/usr/local/share/penguins-eggs/');
387
+ shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/exclude.list'), '/usr/local/share/penguins-eggs');
388
+ await this.configurationFresh();
361
389
  }
362
390
  /**
363
391
  * Rimozione dei file di configurazione
364
392
  */
365
393
  static async configurationRemove(verbose = true) {
366
394
  const echo = utils_1.default.setEcho(verbose);
367
- if (fs.existsSync('/etc/penguins-eggs.d')) {
368
- await exec('rm /etc/penguins-eggs.d -rf', echo);
369
- }
370
- if (fs.existsSync('/usr/local/share/penguins-eggs/exclude.list')) {
371
- await exec('rm /usr/local/share/penguins-eggs/exclude.list', echo);
372
- }
373
- if (fs.existsSync('/etc/calamares')) {
374
- await exec('rm /etc/calamares -rf', echo);
395
+ if (node_fs_1.default.existsSync('/etc/penguins-eggs.d')) {
396
+ await (0, utils_2.exec)('rm /etc/penguins-eggs.d -rf', echo);
375
397
  }
376
- }
377
- /**
378
- *
379
- */
380
- static distroTemplateCheck() {
381
- const versionLike = Pacman.versionLike();
382
- return fs.existsSync(`/etc/penguins-eggs.d/distros/${versionLike}`);
383
- }
384
- /**
385
- *
386
- */
387
- static async distroTemplateInstall(verbose = false) {
388
- if (verbose) {
389
- console.log('installDistroTemplate');
398
+ if (node_fs_1.default.existsSync('/usr/local/share/penguins-eggs/exclude.list')) {
399
+ await (0, utils_2.exec)('rm /usr/local/share/penguins-eggs/exclude.list', echo);
390
400
  }
391
- const rootPen = utils_1.default.rootPenguin();
392
- const versionLike = Pacman.versionLike();
393
- if (utils_1.default.isDebPackage()) {
394
- await Pacman.links4Debs(false, verbose);
401
+ if (node_fs_1.default.existsSync('/etc/calamares')) {
402
+ await (0, utils_2.exec)('rm /etc/calamares -rf', echo);
395
403
  }
396
- // L = follow links è OK da source, ora il problema è copiare i link da npm o rifarli
397
- const cmd = `cp -rL ${rootPen}/conf/distros/${versionLike} /etc/penguins-eggs.d/distros`;
398
- child_process_1.execSync(cmd);
399
404
  }
400
405
  /**
401
406
  *
402
407
  * @param verbose
403
408
  */
404
409
  static async autocompleteInstall(verbose = false) {
405
- await exec(`cp ${__dirname}/../../scripts/eggs.bash /etc/bash_completion.d/`);
406
- if (verbose) {
407
- console.log('autocomplete installed...');
410
+ if (this.distro().familyId === 'debian') {
411
+ if (Pacman.packageIsInstalled('bash-completion')) {
412
+ await (0, utils_2.exec)(`cp ${__dirname}/../../scripts/eggs.bash /etc/bash_completion.d/`);
413
+ }
414
+ }
415
+ else if (this.distro().familyId === 'archlinux') {
416
+ if (Pacman.packageIsInstalled('bash-completion')) {
417
+ await (0, utils_2.exec)(`cp ${__dirname}/../../scripts/eggs.bash /usr/share/bash-completion/completions/`);
418
+ }
408
419
  }
409
420
  }
410
421
  /**
411
- * Installa manPage
412
- */
422
+ * Installa manPage
423
+ */
413
424
  static async manPageInstall(verbose = false) {
414
- const man1Dir = '/usr/share/man/man1/';
415
- if (!fs.existsSync(man1Dir)) {
416
- exec(`mkdir ${man1Dir} -p`);
417
- }
418
- const manPage = path.resolve(__dirname, '../../manpages/doc/man/eggs.1.gz');
419
- if (fs.existsSync(manPage)) {
420
- exec(`cp ${manPage} ${man1Dir}`);
421
- }
422
- if (shx.exec('which mandb', { silent: true }).stdout.trim() !== '') {
423
- await exec(`mandb > /dev/null`);
424
- if (verbose) {
425
- console.log('manPage eggs installed...');
425
+ const manPage = node_path_1.default.resolve(__dirname, '../../manpages/doc/man/eggs.1.gz');
426
+ if (node_fs_1.default.existsSync(manPage)) {
427
+ const man1Dir = '/usr/share/man/man1/';
428
+ if (!node_fs_1.default.existsSync(man1Dir)) {
429
+ (0, utils_2.exec)(`mkdir ${man1Dir} -p`);
430
+ }
431
+ (0, utils_2.exec)(`cp ${manPage} ${man1Dir}`);
432
+ if (shelljs_1.default.exec('which mandb', { silent: true }).stdout.trim() !== '') {
433
+ await (0, utils_2.exec)('mandb > /dev/null');
434
+ if (verbose) {
435
+ console.log('manPage eggs installed...');
436
+ }
426
437
  }
427
438
  }
428
439
  }
429
440
  /**
430
- *
431
- * @param rootPen
432
- */
433
- static async links4Debs(remove = false, verbose = false) {
434
- if (utils_1.default.isDebPackage() || !utils_1.default.isSources()) {
435
- const rootPen = utils_1.default.rootPenguin();
436
- // Debian 10 - Buster
437
- const buster = `${rootPen}/conf/distros/buster`;
438
- // Debian 11 - bullseye
439
- const bullseye = `${rootPen}/conf/distros/bullseye`;
440
- await this.ln(`${buster}/grub`, `${bullseye}/grub`, remove, verbose);
441
- await this.ln(`${buster}/isolinux`, `${bullseye}/isolinux`, remove, verbose);
442
- await this.ln(`${buster}/locales`, `${bullseye}/locales`, remove, verbose);
443
- await this.ln(`${buster}/calamares/calamares-modules/remove-link`, `${bullseye}/calamares/calamares-modules/remove-link`, remove, verbose);
444
- await this.ln(`${buster}/calamares/calamares-modules/sources-yolk`, `${bullseye}/calamares/calamares-modules/sources-yolk`, remove, verbose);
445
- await this.ln(`${buster}/calamares/calamares-modules/sources-yolk-unmount`, `${bullseye}/calamares/calamares-modules/sources-yolk-unmount`, remove, verbose);
446
- await this.ln(`${buster}/calamares/modules`, `${bullseye}/calamares/modules`, remove, verbose);
447
- // Debian 8 - jessie
448
- const jessie = `${rootPen}/conf/distros/jessie`;
449
- await this.ln(`${buster}/grub`, `${jessie}/grub`, remove, verbose);
450
- await this.ln(`${buster}/isolinux`, `${jessie}/isolinux`, remove, verbose);
451
- await this.ln(`${buster}/locales`, `${jessie}/locales`, remove, verbose);
452
- // Debian 9 - stretch
453
- const stretch = `${rootPen}/conf/distros/stretch`;
454
- await this.ln(`${buster}/grub`, `${stretch}/grub`, remove, verbose);
455
- await this.ln(`${buster}/isolinux`, `${stretch}/isolinux`, remove, verbose);
456
- await this.ln(`${buster}/locales`, `${stretch}/locales`, remove, verbose);
457
- await this.ln(`${jessie}/krill`, `${stretch}/krill`, remove, verbose);
458
- // Devuan beowulf
459
- const beowulf = `${rootPen}/conf/distros/beowulf`;
460
- await this.ln(`${buster}/grub`, `${beowulf}/grub`, remove, verbose);
461
- await this.ln(`${buster}/isolinux`, `${beowulf}/isolinux`, remove, verbose);
462
- await this.ln(`${buster}/locales`, `${beowulf}/locales`, remove, verbose);
463
- await this.ln(`${buster}/calamares`, `${beowulf}/calamares`, remove, verbose);
464
- // Ubuntu 20.04 - focal
465
- const focal = `${rootPen}/conf/distros/focal`;
466
- await this.ln(`${buster}/grub/loopback.cfg`, `${focal}/grub/loopback.cfg`, remove, verbose);
467
- await this.ln(`${buster}/grub/theme.cfg`, `${focal}/grub/theme.cfg`, remove, verbose);
468
- await this.ln(`${buster}/isolinux/isolinux.template.cfg`, `${focal}/isolinux/isolinux.template.cfg`, remove, verbose);
469
- await this.ln(`${buster}/isolinux/stdmenu.template.cfg`, `${focal}/isolinux/stdmenu.template.cfg`, remove, verbose);
470
- await this.ln(`${buster}/calamares/calamares-modules/remove-link`, `${focal}/calamares/calamares-modules/remove-link`, remove, verbose);
471
- await this.ln(`${buster}/calamares/calamares-modules/sources-yolk`, `${focal}/calamares/calamares-modules/sources-yolk`, remove, verbose);
472
- await this.ln(`${buster}/calamares/calamares-modules/sources-yolk-unmount`, `${focal}/calamares/calamares-modules/sources-yolk-unmount`, remove, verbose);
473
- await this.ln(`${buster}/calamares/modules/packages.yml`, `${focal}/calamares/modules/packages.yml`, remove, verbose);
474
- await this.ln(`${buster}/calamares/modules/removeuser.yml`, `${focal}/calamares/modules/removeuser.yml`, remove, verbose);
475
- await this.ln(`${buster}/calamares/modules/displaymanager.yml`, `${focal}/calamares/modules/displaymanager.yml`, remove, verbose);
476
- // Patch a colori
477
- // await this.ln(`${buster}/calamares/calamares-modules/bootloader-config`, `${focal}/calamares/calamares-modules/bootloader-config`, remove, verbose)
478
- // Ubuntu 18.04 - bionic
479
- const bionic = `${rootPen}/conf/distros/bionic`;
480
- await this.ln(`${focal}/grub`, `${bionic}/grub`, remove, verbose);
481
- await this.ln(`${focal}/isolinux`, `${bionic}/isolinux`, remove, verbose);
482
- await this.ln(`${buster}/calamares/calamares-modules/remove-link`, `${bionic}/calamares/calamares-modules/remove-link`, remove, verbose);
483
- await this.ln(`${buster}/calamares/calamares-modules/sources-yolk`, `${bionic}/calamares/calamares-modules/sources-yolk`, remove, verbose);
484
- await this.ln(`${buster}/calamares/calamares-modules/sources-yolk-unmount`, `${bionic}/calamares/calamares-modules/sources-yolk-unmount`, remove, verbose);
485
- await this.ln(`${buster}/calamares/modules/packages.yml`, `${bionic}/calamares/modules/packages.yml`, remove, verbose);
486
- await this.ln(`${buster}/calamares/modules/removeuser.yml`, `${bionic}/calamares/modules/removeuser.yml`, remove, verbose);
487
- await this.ln(`${buster}/calamares/modules/unpackfs.yml`, `${bionic}/calamares/modules/unpackfs.yml`, remove, verbose);
488
- await this.ln(`${buster}/calamares/modules/displaymanager.yml`, `${bionic}/calamares/modules/displaymanager.yml`, remove, verbose);
489
- // Ubuntu 20.10 groovy
490
- const groovy = `${rootPen}/conf/distros/groovy`;
491
- await this.ln(`${focal}/calamares`, `${groovy}/calamares`, remove, verbose);
492
- await this.ln(`${focal}/grub`, `${groovy}/grub`, remove, verbose);
493
- await this.ln(`${focal}/isolinux`, `${groovy}/isolinux`, remove, verbose);
494
- await this.ln(`${focal}/locale.gen.template`, `${groovy}/locale.gen.template`, remove, verbose);
495
- await this.ln(`${buster}/calamares/modules/displaymanager.yml`, `${groovy}/calamares/modules/displaymanager.yml`, remove, verbose);
496
- // Ubuntu 21.04 hirsute
497
- const hirsute = `${rootPen}/conf/distros/hirsute`;
498
- await this.ln(`${focal}/calamares`, `${hirsute}/calamares`, remove, verbose);
499
- await this.ln(`${focal}/grub`, `${hirsute}/grub`, remove, verbose);
500
- await this.ln(`${focal}/isolinux`, `${hirsute}/isolinux`, remove, verbose);
501
- await this.ln(`${focal}/locale.gen.template`, `${hirsute}/locale.gen.template`, remove, verbose);
502
- await this.ln(`${buster}/calamares/modules/displaymanager.yml`, `${hirsute}/calamares/modules/displaymanager.yml`, remove, verbose);
503
- // Ubuntu 21.10 impish
504
- const impish = `${rootPen}/conf/distros/impish`;
505
- await this.ln(`${focal}/calamares`, `${impish}/calamares`, remove, verbose);
506
- await this.ln(`${focal}/grub`, `${impish}/grub`, remove, verbose);
507
- await this.ln(`${focal}/isolinux`, `${impish}/isolinux`, remove, verbose);
508
- await this.ln(`${focal}/locale.gen.template`, `${impish}/locale.gen.template`, remove, verbose);
509
- await this.ln(`${buster}/calamares/modules/displaymanager.yml`, `${impish}/calamares/modules/displaymanager.yml`, remove, verbose);
510
- }
441
+ * distroTemplateCheck
442
+ */
443
+ static distroTemplateCheck() {
444
+ const versionLike = this.distro().versionLike;
445
+ return node_fs_1.default.existsSync(`/etc/penguins-eggs.d/distros/${versionLike}`);
511
446
  }
512
447
  /**
513
448
  *
514
- * @param mode
515
- * @param src
516
- * @param dest
517
- * @param verbose
518
449
  */
519
- static async ln(src, dest, remove = false, verbose = false) {
520
- const rel = path.relative(dest, src).substring(3);
521
- // Cancella il symlink se esiste
522
- if (fs.existsSync(dest)) {
523
- if (verbose) {
524
- console.log(`remove ${dest}`);
525
- }
526
- fs.unlinkSync(dest);
527
- }
528
- if (!remove) {
529
- const dirname = path.dirname(dest);
530
- const basename = path.basename(dest);
531
- process.chdir(dirname);
532
- if (verbose) {
533
- console.log(`cd ${dirname}`);
534
- console.log(`ln -s ${rel} ${basename}\n`);
535
- }
536
- fs.symlinkSync(rel, basename);
450
+ static async distroTemplateInstall(verbose = false) {
451
+ if (verbose) {
452
+ console.log('distroTemplateInstall');
453
+ }
454
+ const echo = utils_1.default.setEcho(verbose);
455
+ const rootPen = utils_1.default.rootPenguin();
456
+ await (0, utils_2.exec)(`mkdir /etc/penguins-eggs.d/distros/${this.distro().versionLike}`);
457
+ /**
458
+ * Debian 10 - Buster: è il master per tutte le distro
459
+ */
460
+ const buster = `${rootPen}/conf/distros/buster`;
461
+ /**
462
+ * Debian 8 jessie: eredita grub, isolinux e locales da buster, contiene krill al posto di calamares
463
+ */
464
+ if (this.distro().versionLike === 'jessie') {
465
+ const dest = '/etc/penguins-eggs.d/distros/jessie';
466
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
467
+ await (0, utils_2.exec)(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
468
+ /**
469
+ * Debian 9 stretch: eredita grub, isolinux e locales da buster, contiene krill al posto di calamares
470
+ */
471
+ }
472
+ else if (this.distro().versionLike === 'stretch') {
473
+ const dest = '/etc/penguins-eggs.d/distros/stretch';
474
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
475
+ await (0, utils_2.exec)(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
476
+ /**
477
+ * Debian 10 buster: eredita tutto da buster
478
+ */
479
+ }
480
+ else if (this.distro().versionLike === 'buster') {
481
+ const dest = '/etc/penguins-eggs.d/distros/buster';
482
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
483
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
484
+ /**
485
+ * Debian 11 bullseye: eredita tutto da buster
486
+ */
487
+ }
488
+ else if (this.distro().versionLike === 'bullseye') {
489
+ const dest = '/etc/penguins-eggs.d/distros/bullseye';
490
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
491
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
492
+ /**
493
+ * Debian 12 bookworm: eredita tutto da buster
494
+ */
495
+ }
496
+ else if (this.distro().versionLike === 'bookworm') {
497
+ const dest = '/etc/penguins-eggs.d/distros/bookworm';
498
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
499
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
500
+ /***********************************************************************************
501
+ * Devuan
502
+ **********************************************************************************/
503
+ /**
504
+ * Devuan beowulf: eredita tutto da buster
505
+ */
506
+ }
507
+ else if (this.distro().versionLike === 'beowulf') {
508
+ const dest = '/etc/penguins-eggs.d/distros/beowulf';
509
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
510
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
511
+ /**
512
+ * Devuan chimaera: eredita tutto da buster
513
+ */
514
+ }
515
+ else if (this.distro().versionLike === 'chimaera') {
516
+ const dest = '/etc/penguins-eggs.d/distros/chimaera';
517
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
518
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
519
+ /**
520
+ * Devuan daedalus: eredita tutto da buster
521
+ */
522
+ }
523
+ else if (this.distro().versionLike === 'daedalus') {
524
+ const dest = '/etc/penguins-eggs.d/distros/daedalus';
525
+ await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
526
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
527
+ /***********************************************************************************
528
+ * Ubuntu
529
+ **********************************************************************************/
530
+ /**
531
+ * Ubuntu 10.04 bionic: eredita da bionic, focal grub ed isolinux, da buster i seguenti
532
+ */
533
+ }
534
+ else if (this.distro().versionLike === 'bionic') {
535
+ const dest = '/etc/penguins-eggs.d/distros/bionic';
536
+ const bionic = `${rootPen}/conf/distros/bionic/*`;
537
+ await (0, utils_2.exec)(`cp -r ${bionic} ${dest}`, echo);
538
+ // quindi da focal
539
+ const focal = `${rootPen}/conf/distros/focal/*`;
540
+ await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
541
+ // Poi da buster
542
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/remove-link ${dest}/calamares/calamares-modules/remove-link`, echo);
543
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
544
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-unmount ${dest}/calamares/calamares-modules/sources-yolk-unmount`, echo);
545
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
546
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
547
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
548
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
549
+ /**
550
+ * Ubuntu focal: eredita da focal e buster
551
+ */
552
+ }
553
+ else if (this.distro().versionLike === 'focal') {
554
+ const dest = '/etc/penguins-eggs.d/distros/focal';
555
+ const focal = `${rootPen}/conf/distros/focal/*`;
556
+ await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
557
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/remove-link ${dest}/calamares/calamares-modules/remove-link`, echo);
558
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk ${dest}/calamares/calamares-modules/sources-yolk`, echo);
559
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/sources-yolk-unmount ${dest}/calamares/calamares-modules/sources-yolk-unmount`, echo);
560
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/packages.yml ${dest}/calamares/modules/packages.yml`, echo);
561
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/removeuser.yml ${dest}/calamares/modules/removeuser.yml`, echo);
562
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/unpackfs.yml ${dest}/calamares/modules/unpackfs.yml`, echo);
563
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/modules/displaymanager.yml ${dest}/calamares/modules/displaymanager.yml`, echo);
564
+ /**
565
+ * Ubuntu 20.10 groovy: eredita da focal e buster
566
+ */
567
+ }
568
+ else if (this.distro().versionLike === 'groovy') {
569
+ const dest = '/etc/penguins-eggs.d/distros/groovy';
570
+ const focal = `${rootPen}/conf/distros/focal/*`;
571
+ await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
572
+ await (0, utils_2.exec)(`cp -r ${buster}/calamares/calamares-modules/remove-link ${dest}/calamares/calamares-modules/remove-link`, 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-unmount ${dest}/calamares/calamares-modules/sources-yolk-unmount`, 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);
579
+ /**
580
+ * Ubuntu 21.04 hirsute: eredita da focal e buster
581
+ */
582
+ }
583
+ else if (this.distro().versionLike === 'hirsute') {
584
+ const dest = '/etc/penguins-eggs.d/distros/hirsute';
585
+ 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/remove-link ${dest}/calamares/calamares-modules/remove-link`, 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-unmount ${dest}/calamares/calamares-modules/sources-yolk-unmount`, 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);
594
+ /**
595
+ * Ubuntu 21.10 impish: eredita da focal e buster
596
+ */
597
+ }
598
+ else if (this.distro().versionLike === 'impish') {
599
+ const dest = '/etc/penguins-eggs.d/distros/impish';
600
+ 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/remove-link ${dest}/calamares/calamares-modules/remove-link`, 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-unmount ${dest}/calamares/calamares-modules/sources-yolk-unmount`, 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);
609
+ /**
610
+ * Ubuntu 22.04 jammy: eredita da focal e buster
611
+ */
612
+ }
613
+ else if (this.distro().versionLike === 'jammy') {
614
+ const dest = '/etc/penguins-eggs.d/distros/jammy';
615
+ 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/remove-link ${dest}/calamares/calamares-modules/remove-link`, 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-unmount ${dest}/calamares/calamares-modules/sources-yolk-unmount`, 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);
624
+ /***********************************************************************************
625
+ * Fedora
626
+ **********************************************************************************/
627
+ /**
628
+ * Fedora 35 ThirtyFive: eredita da ThirtyFive
629
+ */
630
+ }
631
+ else if (this.distro().versionLike === 'thirtyfive') {
632
+ const dest = '/etc/penguins-eggs.d/distros/thirtyfive/';
633
+ const thirtytive = `${rootPen}/conf/distros/thirtyfive/*`;
634
+ await (0, utils_2.exec)(`cp -r ${thirtytive} ${dest}`, echo);
635
+ /***********************************************************************************
636
+ * Arch Linux
637
+ **********************************************************************************/
638
+ /**
639
+ * Endeavour rolling: eredita da rolling
640
+ */
641
+ }
642
+ else if (this.distro().versionLike === 'rolling') {
643
+ const dest = '/etc/penguins-eggs.d/distros/rolling/';
644
+ const rolling = `${rootPen}/conf/distros/rolling/*`;
645
+ await (0, utils_2.exec)(`cp -r ${rolling} ${dest}`, echo);
646
+ /***********************************************************************************
647
+ * openSuse
648
+ **********************************************************************************/
649
+ /**
650
+ * openSUSE tumbleweed: eredita da tumbleweed
651
+ */
652
+ }
653
+ else if (this.distro().versionLike === 'tumbleweed') {
654
+ const dest = '/etc/penguins-eggs.d/distros/tumbleweed/';
655
+ const tumbleweed = `${rootPen}/conf/distros/tumbleweed/*`;
656
+ await (0, utils_2.exec)(`cp -r ${tumbleweed} ${dest}`, echo);
537
657
  }
538
658
  }
539
659
  /**
540
- * restuisce VERO se il pacchetto è installato
541
- * @param debPackage
542
- */
543
- static packageIsInstalled(debPackage) {
660
+ * restuisce VERO se il pacchetto è installato
661
+ * @param debPackage
662
+ */
663
+ static packageIsInstalled(packageName) {
544
664
  let installed = false;
545
- const cmd = `/usr/bin/dpkg -s ${debPackage} | grep Status:`;
546
- const stdout = shx.exec(cmd, { silent: true }).stdout.trim();
547
- if (stdout === 'Status: install ok installed') {
548
- installed = true;
665
+ if (this.distro().familyId === 'debian') {
666
+ installed = debian_1.default.packageIsInstalled(packageName);
667
+ }
668
+ else if (this.distro().familyId === 'fedora') {
669
+ installed = fedora_1.default.packageIsInstalled(packageName);
670
+ }
671
+ else if (this.distro().familyId === 'archlinux') {
672
+ installed = archlinux_1.default.packageIsInstalled(packageName);
673
+ }
674
+ else if (this.distro().familyId === 'suse') {
675
+ installed = suse_1.default.packageIsInstalled(packageName);
549
676
  }
550
677
  return installed;
551
678
  }
552
679
  /**
553
- * restuisce VERO se il pacchetto è installato
554
- * @param debPackage
555
- */
556
- static async packageAptAvailable(debPackage) {
557
- let disponible = false;
558
- const cmd = `apt-cache show ${debPackage} | grep Package:`;
559
- const test = `Package: ${debPackage}`;
560
- const stdout = shx.exec(cmd, { silent: true }).stdout.trim();
561
- // console.log('===================================')
562
- // console.log('[' + stdout + ']')
563
- // console.log('[' + test + ']')
564
- // console.log('===================================')
565
- if (stdout === test) {
566
- disponible = true;
680
+ * restuisce VERO se il pacchetto è installato
681
+ * @param debPackage
682
+ */
683
+ static async packageAptAvailable(packageName) {
684
+ let available = false;
685
+ if (this.distro().familyId === 'debian') {
686
+ available = debian_1.default.packageIsInstalled(packageName);
567
687
  }
568
- return disponible;
688
+ return available;
569
689
  }
690
+ /**
691
+ *
692
+ * @param debPackage
693
+ * @returns
694
+ */
570
695
  static async packageAptLast(debPackage) {
571
696
  let version = '';
572
- const cmd = `apt-cache show ${debPackage} | grep Version:`;
573
- const stdout = shx.exec(cmd, { silent: true }).stdout.trim();
574
- version = stdout.substring(9);
575
- // console.log('===================================')
576
- // console.log('[' + version + ']')
577
- // console.log('===================================')
697
+ if (this.distro().familyId === 'debian') {
698
+ version = await debian_1.default.packageAptLast(debPackage);
699
+ }
578
700
  return version;
579
701
  }
580
702
  static async packageNpmLast(packageNpm = 'penguins-eggs') {
581
- return shx.exec('npm show ' + packageNpm + ' version', { silent: true }).stdout.trim();
703
+ return shelljs_1.default.exec('npm show ' + packageNpm + ' version', { silent: true }).stdout.trim();
582
704
  }
583
705
  /**
584
706
  *
@@ -586,7 +708,7 @@ class Pacman {
586
708
  */
587
709
  static async commandIsInstalled(cmd) {
588
710
  let installed = false;
589
- const stdout = shx.exec(`command -v ${cmd}`, { silent: true }).stdout.trim();
711
+ const stdout = shelljs_1.default.exec(`command -v ${cmd}`, { silent: true }).stdout.trim();
590
712
  if (stdout !== '') {
591
713
  installed = true;
592
714
  }
@@ -596,23 +718,32 @@ class Pacman {
596
718
  return installed;
597
719
  }
598
720
  /**
599
- * Install the package debPackage
600
- * @param debPackage {string} Pacchetto Debian da installare
721
+ * Install the package packageName
722
+ * @param packageName {string} Pacchetto Debian da installare
601
723
  * @returns {boolean} True if success
602
724
  */
603
- static async packageInstall(debPackage) {
725
+ static async packageInstall(packageName) {
604
726
  let retVal = false;
605
- if (shx.exec(`/usr/bin/apt-get install -y ${debPackage}`, { silent: true }) === '0') {
606
- retVal = true;
727
+ if (this.distro().familyId === 'debian') {
728
+ retVal = await debian_1.default.packageInstall(packageName);
729
+ }
730
+ else if (this.distro().familyId === 'archlinux') {
731
+ retVal = await archlinux_1.default.packageInstall(packageName);
732
+ }
733
+ else if (this.distro().familyId === 'fedora') {
734
+ retVal = await fedora_1.default.packageInstall(packageName);
607
735
  }
608
736
  return retVal;
609
737
  }
610
738
  /**
611
739
  *
612
740
  * @param packages array packages
741
+ *
742
+ * Probabilmente da rimuovere, viene usata solo da prerequisitesRemove
743
+ *
613
744
  */
614
745
  static filterInstalled(packages) {
615
- let installed = [];
746
+ const installed = [];
616
747
  for (const i in packages) {
617
748
  if (Pacman.packageIsInstalled(packages[i])) {
618
749
  installed.push(packages[i]);
@@ -620,56 +751,6 @@ class Pacman {
620
751
  }
621
752
  return installed;
622
753
  }
623
- /**
624
- * @param remove
625
- * @param verbose
626
- *
627
- * Va solo a runtime, l'idea era di localizzare per naked
628
- */
629
- static packagesLocalisation(remove = false, verbose = false) {
630
- const versionLike = Pacman.versionLike();
631
- const packages = [];
632
- const settings = new settings_1.default();
633
- settings.load();
634
- const locales = settings.config.locales;
635
- if ((versionLike === 'jessie') ||
636
- (versionLike === 'stretch') ||
637
- (versionLike === 'buster') ||
638
- versionLike === 'bullseye' ||
639
- (versionLike === 'beowulf')) {
640
- for (let i = 0; i < locales.length; i++) {
641
- if (locales[i] === process.env.LANG) {
642
- continue;
643
- }
644
- if (locales[i] === `it_IT.UTF-8`) {
645
- packages.push('task-italian');
646
- }
647
- else if (locales[i] === `en_US.UTF-8`) {
648
- packages.push('task-english');
649
- }
650
- else if (locales[i] === `es_PE.UTF-8`) {
651
- packages.push('task-spanish');
652
- }
653
- else if (locales[i] === `pt_BR.UTF-8`) {
654
- packages.push('task-brazilian-portuguese');
655
- }
656
- else if (locales[i] === `fr_FR.UTF-8`) {
657
- packages.push('task-french');
658
- }
659
- else if (locales[i] === `de_DE.UTF-8`) {
660
- packages.push('task-german');
661
- }
662
- else if (locales[i] === `pl_PL.UTF-8`) {
663
- packages.push('task-polish');
664
- }
665
- else if (locales[i] === `de_DE.UTF-8`) {
666
- packages.push('task-russian');
667
- }
668
- }
669
- packages.push('live-task-localisation');
670
- }
671
- return packages;
672
- }
673
754
  }
674
755
  exports.default = Pacman;
675
756
  Pacman.debs4calamares = ['calamares', 'qml-module-qtquick2', 'qml-module-qtquick-controls'];