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.
- package/.oclif.manifest.json +62 -62
- package/README.md +43 -40
- package/bin/dev.cmd +1 -1
- package/bin/dev.js +6 -6
- package/bin/run.js +3 -5
- package/conf/tools.yaml +1 -1
- package/dist/classes/bleach.d.ts +37 -0
- package/dist/classes/bleach.js +43 -91
- package/dist/classes/cfs.d.ts +17 -0
- package/dist/classes/cfs.js +15 -12
- package/dist/classes/compressors.d.ts +53 -0
- package/dist/classes/compressors.js +42 -47
- package/dist/classes/daddy.d.ts +18 -0
- package/dist/classes/daddy.js +92 -98
- package/dist/classes/distro.d.ts +26 -0
- package/dist/classes/distro.js +36 -37
- package/dist/classes/families/archlinux.d.ts +61 -0
- package/dist/classes/families/archlinux.js +52 -107
- package/dist/classes/families/debian.d.ts +65 -0
- package/dist/classes/families/debian.js +67 -142
- package/dist/classes/families/fedora.d.ts +52 -0
- package/dist/classes/families/fedora.js +42 -98
- package/dist/classes/families/mockup.d.ts +60 -0
- package/dist/classes/families/mockup.js +27 -46
- package/dist/classes/families/suse.d.ts +52 -0
- package/dist/classes/families/suse.js +44 -96
- package/dist/classes/incubation/branding.d.ts +17 -0
- package/dist/classes/incubation/branding.js +32 -36
- package/dist/classes/incubation/distros/bionic.d.ts +32 -0
- package/dist/classes/incubation/distros/bionic.js +11 -16
- package/dist/classes/incubation/distros/buster.d.ts +32 -0
- package/dist/classes/incubation/distros/buster.js +13 -18
- package/dist/classes/incubation/distros/focal.d.ts +32 -0
- package/dist/classes/incubation/distros/focal.js +11 -16
- package/dist/classes/incubation/distros/jessie.d.ts +31 -0
- package/dist/classes/incubation/distros/jessie.js +8 -13
- package/dist/classes/incubation/distros/rolling.d.ts +32 -0
- package/dist/classes/incubation/distros/rolling.js +11 -16
- package/dist/classes/incubation/fisherman-helper/displaymanager.d.ts +11 -0
- package/dist/classes/incubation/fisherman-helper/displaymanager.js +8 -9
- package/dist/classes/incubation/fisherman-helper/packages.d.ts +20 -0
- package/dist/classes/incubation/fisherman-helper/packages.js +17 -20
- package/dist/classes/incubation/fisherman-helper/settings.d.ts +15 -0
- package/dist/classes/incubation/fisherman-helper/settings.js +30 -28
- package/dist/classes/incubation/fisherman.d.ts +77 -0
- package/dist/classes/incubation/fisherman.js +135 -131
- package/dist/classes/incubation/incubator.d.ts +40 -0
- package/dist/classes/incubation/incubator.js +90 -89
- package/dist/classes/incubation/installer.d.ts +13 -0
- package/dist/classes/incubation/installer.js +27 -12
- package/dist/classes/initrd.d.ts +41 -0
- package/dist/classes/initrd.js +40 -42
- package/dist/classes/keyboards.d.ts +50 -0
- package/dist/classes/keyboards.js +108 -105
- package/dist/classes/locales.d.ts +21 -0
- package/dist/classes/locales.js +30 -34
- package/dist/classes/n8.d.ts +17 -0
- package/dist/classes/n8.js +16 -22
- package/dist/classes/network.d.ts +37 -0
- package/dist/classes/network.js +14 -18
- package/dist/classes/ovary.d.ts +205 -0
- package/dist/classes/ovary.js +1281 -1294
- package/dist/classes/pacman.d.ts +149 -0
- package/dist/classes/pacman.js +344 -418
- package/dist/classes/pve-live.d.ts +17 -0
- package/dist/classes/pve-live.js +22 -24
- package/dist/classes/pxe.d.ts +65 -0
- package/dist/classes/pxe.js +204 -206
- package/dist/classes/settings.d.ts +53 -0
- package/dist/classes/settings.js +91 -94
- package/dist/classes/sources_list.d.ts +28 -0
- package/dist/classes/sources_list.js +35 -39
- package/dist/classes/systemctl.d.ts +47 -0
- package/dist/classes/systemctl.js +34 -38
- package/dist/classes/tailor.d.ts +46 -0
- package/dist/classes/tailor.js +223 -239
- package/dist/classes/tools.d.ts +30 -0
- package/dist/classes/tools.js +18 -22
- package/dist/classes/users.d.ts +28 -0
- package/dist/classes/users.js +18 -22
- package/dist/classes/utils.d.ts +318 -0
- package/dist/classes/utils.js +78 -78
- package/dist/classes/xdg.d.ts +45 -0
- package/dist/classes/xdg.js +129 -133
- package/dist/classes/yolk.d.ts +33 -0
- package/dist/classes/yolk.js +53 -57
- package/dist/commands/adapt.d.ts +17 -0
- package/dist/commands/adapt.js +17 -21
- package/dist/commands/analyze.d.ts +26 -0
- package/dist/commands/analyze.js +56 -67
- package/dist/commands/calamares.d.ts +29 -0
- package/dist/commands/calamares.js +44 -48
- package/dist/commands/config.d.ts +36 -0
- package/dist/commands/config.js +115 -137
- package/dist/commands/cuckoo.d.ts +16 -0
- package/dist/commands/cuckoo.js +20 -24
- package/dist/commands/dad.d.ts +19 -0
- package/dist/commands/dad.js +20 -24
- package/dist/commands/export/deb.d.ts +19 -0
- package/dist/commands/export/deb.js +19 -23
- package/dist/commands/export/iso.d.ts +19 -0
- package/dist/commands/export/iso.js +19 -23
- package/dist/commands/install.d.ts +37 -0
- package/dist/commands/install.js +46 -50
- package/dist/commands/kill.d.ts +24 -0
- package/dist/commands/kill.js +25 -29
- package/dist/commands/mom.d.ts +16 -0
- package/dist/commands/mom.js +16 -18
- package/dist/commands/produce.d.ts +33 -0
- package/dist/commands/produce.js +64 -66
- package/dist/commands/status.d.ts +23 -0
- package/dist/commands/status.js +10 -14
- package/dist/commands/syncfrom.d.ts +45 -0
- package/dist/commands/syncfrom.js +85 -89
- package/dist/commands/syncto.d.ts +40 -0
- package/dist/commands/syncto.js +91 -95
- package/dist/commands/tools/clean.d.ts +18 -0
- package/dist/commands/tools/clean.js +17 -21
- package/dist/commands/tools/ppa.d.ts +26 -0
- package/dist/commands/tools/ppa.js +41 -45
- package/dist/commands/tools/skel.d.ts +18 -0
- package/dist/commands/tools/skel.js +22 -26
- package/dist/commands/tools/stat.d.ts +31 -0
- package/dist/commands/tools/stat.js +15 -19
- package/dist/commands/tools/yolk.d.ts +24 -0
- package/dist/commands/tools/yolk.js +19 -23
- package/dist/commands/update.d.ts +47 -0
- package/dist/commands/update.js +62 -66
- package/dist/commands/wardrobe/get.d.ts +23 -0
- package/dist/commands/wardrobe/get.js +19 -23
- package/dist/commands/wardrobe/list.d.ts +24 -0
- package/dist/commands/wardrobe/list.js +61 -60
- package/dist/commands/wardrobe/show.d.ts +25 -0
- package/dist/commands/wardrobe/show.js +50 -47
- package/dist/commands/wardrobe/wear.d.ts +26 -0
- package/dist/commands/wardrobe/wear.js +32 -36
- package/dist/components/finished.d.ts +15 -0
- package/dist/components/finished.js +37 -42
- package/dist/components/information.d.ts +8 -0
- package/dist/components/information.js +155 -0
- package/dist/components/install.d.ts +15 -0
- package/dist/components/install.js +31 -35
- package/dist/components/keyboard.d.ts +16 -0
- package/dist/components/keyboard.js +37 -40
- package/dist/components/location.d.ts +16 -0
- package/dist/components/location.js +38 -38
- package/dist/components/network.d.ts +19 -0
- package/dist/components/network.js +47 -48
- package/dist/components/partitions.d.ts +16 -0
- package/dist/components/partitions.js +47 -51
- package/dist/components/steps.d.ts +13 -0
- package/dist/components/steps.js +148 -0
- package/dist/components/summary.d.ts +24 -0
- package/dist/components/summary.js +50 -54
- package/dist/components/title.d.ts +12 -0
- package/dist/components/title.js +35 -0
- package/dist/components/users.d.ts +24 -0
- package/dist/components/users.js +43 -43
- package/dist/components/welcome.d.ts +13 -0
- package/dist/components/welcome.js +37 -38
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -5
- package/dist/interfaces/i-addons.d.ts +13 -0
- package/dist/interfaces/i-addons.js +8 -3
- package/dist/interfaces/i-analyze.d.ts +17 -0
- package/dist/interfaces/i-analyze.js +7 -10
- package/dist/interfaces/i-app.d.ts +14 -0
- package/dist/interfaces/i-app.js +8 -2
- package/dist/interfaces/i-branding.d.ts +36 -0
- package/dist/interfaces/i-branding.js +8 -2
- package/dist/interfaces/i-calamares-partition.d.ts +18 -0
- package/dist/interfaces/i-calamares-partition.js +3 -4
- package/dist/interfaces/i-config-tools.d.ts +18 -0
- package/dist/interfaces/i-config-tools.js +8 -2
- package/dist/interfaces/i-devices.d.ts +20 -0
- package/dist/interfaces/i-devices.js +8 -2
- package/dist/interfaces/i-distro.d.ts +27 -0
- package/dist/interfaces/i-distro.js +3 -4
- package/dist/interfaces/i-drive-list.d.ts +33 -0
- package/dist/interfaces/i-drive-list.js +3 -4
- package/dist/interfaces/i-eggs-config.d.ts +32 -0
- package/dist/interfaces/i-eggs-config.js +3 -4
- package/dist/interfaces/i-excludes.d.ts +14 -0
- package/dist/interfaces/i-excludes.js +8 -2
- package/dist/interfaces/i-exec.d.ts +11 -0
- package/dist/interfaces/i-exec.js +3 -4
- package/dist/interfaces/i-initrd.d.ts +13 -0
- package/dist/interfaces/i-initrd.js +8 -2
- package/dist/interfaces/i-install.d.ts +16 -0
- package/dist/interfaces/i-install.js +8 -2
- package/dist/interfaces/i-installer.d.ts +17 -0
- package/dist/interfaces/i-installer.js +8 -2
- package/dist/interfaces/i-krill-config.d.ts +33 -0
- package/dist/interfaces/i-krill-config.js +3 -4
- package/dist/interfaces/i-krill.d.ts +42 -0
- package/dist/interfaces/i-krill.js +8 -2
- package/dist/interfaces/i-materia.d.ts +41 -0
- package/dist/interfaces/i-materia.js +8 -2
- package/dist/interfaces/i-net.d.ts +16 -0
- package/dist/interfaces/i-net.js +8 -2
- package/dist/interfaces/i-packages.d.ts +29 -0
- package/dist/interfaces/i-packages.js +3 -4
- package/dist/interfaces/i-partitions.d.ts +16 -0
- package/dist/interfaces/i-partitions.js +8 -2
- package/dist/interfaces/i-pxe.d.ts +21 -0
- package/dist/interfaces/i-pxe.js +8 -39
- package/dist/interfaces/i-remix.d.ts +21 -0
- package/dist/interfaces/i-remix.js +3 -4
- package/dist/interfaces/i-settings.d.ts +39 -0
- package/dist/interfaces/i-settings.js +8 -2
- package/dist/interfaces/i-user.d.ts +14 -0
- package/dist/interfaces/i-user.js +8 -2
- package/dist/interfaces/i-workdir.d.ts +14 -0
- package/dist/interfaces/i-workdir.js +8 -2
- package/dist/interfaces/i-xkb-model.d.ts +24 -0
- package/dist/interfaces/i-xkb-model.js +8 -2
- package/dist/interfaces/index.d.ts +25 -0
- package/dist/interfaces/index.js +3 -4
- package/dist/krill/modules/add-user.d.ts +20 -0
- package/dist/krill/modules/add-user.js +11 -15
- package/dist/krill/modules/bootloader-config-arch.d.ts +14 -0
- package/dist/krill/modules/bootloader-config-arch.js +15 -11
- package/dist/krill/modules/bootloader-config-debian.d.ts +10 -0
- package/dist/krill/modules/bootloader-config-debian.js +20 -16
- package/dist/krill/modules/bootloader-config.d.ts +10 -0
- package/dist/krill/modules/bootloader-config.js +3 -6
- package/dist/krill/modules/bootloader.d.ts +14 -0
- package/dist/krill/modules/bootloader.js +9 -13
- package/dist/krill/modules/change-password.d.ts +15 -0
- package/dist/krill/modules/change-password.js +5 -8
- package/dist/krill/modules/del-live-user.d.ts +14 -0
- package/dist/krill/modules/del-live-user.js +8 -12
- package/dist/krill/modules/fstab.d.ts +14 -0
- package/dist/krill/modules/fstab.js +33 -37
- package/dist/krill/modules/grubcfg.d.ts +17 -0
- package/dist/krill/modules/grubcfg.js +8 -17
- package/dist/krill/modules/hostname.d.ts +13 -0
- package/dist/krill/modules/hostname.js +11 -17
- package/dist/krill/modules/initramfs-cfg.d.ts +14 -0
- package/dist/krill/modules/initramfs-cfg.js +6 -15
- package/dist/krill/modules/initramfs.d.ts +13 -0
- package/dist/krill/modules/initramfs.js +17 -19
- package/dist/krill/modules/locale-cfg.d.ts +10 -0
- package/dist/krill/modules/locale-cfg.js +8 -12
- package/dist/krill/modules/locale.d.ts +13 -0
- package/dist/krill/modules/locale.js +7 -11
- package/dist/krill/modules/m-keyboard.d.ts +14 -0
- package/dist/krill/modules/m-keyboard.js +14 -18
- package/dist/krill/modules/m-timezone.d.ts +14 -0
- package/dist/krill/modules/m-timezone.js +8 -12
- package/dist/krill/modules/machine-id.d.ts +15 -0
- package/dist/krill/modules/machine-id.js +6 -10
- package/dist/krill/modules/mkfs.d.ts +13 -0
- package/dist/krill/modules/mkfs.js +10 -13
- package/dist/krill/modules/mount-fs.d.ts +17 -0
- package/dist/krill/modules/mount-fs.js +20 -26
- package/dist/krill/modules/mount-vfs.d.ts +17 -0
- package/dist/krill/modules/mount-vfs.js +16 -21
- package/dist/krill/modules/network-cfg.d.ts +19 -0
- package/dist/krill/modules/network-cfg.js +16 -20
- package/dist/krill/modules/packages.d.ts +14 -0
- package/dist/krill/modules/packages.js +17 -21
- package/dist/krill/modules/partition.d.ts +20 -0
- package/dist/krill/modules/partition.js +78 -84
- package/dist/krill/modules/remove-installer-link.d.ts +13 -0
- package/dist/krill/modules/remove-installer-link.js +7 -11
- package/dist/krill/modules/umount.d.ts +14 -0
- package/dist/krill/modules/umount.js +9 -13
- package/dist/krill/modules/unpackfs.d.ts +13 -0
- package/dist/krill/modules/unpackfs.js +7 -11
- package/dist/krill/prepare.d.ts +77 -0
- package/dist/krill/{krill-prepare.js → prepare.js} +118 -124
- package/dist/krill/sequence.d.ts +156 -0
- package/dist/krill/{krill-sequence.js → sequence.js} +166 -170
- package/dist/lib/cli-autologin.d.ts +43 -0
- package/dist/lib/cli-autologin.js +88 -92
- package/dist/lib/get_address.d.ts +8 -0
- package/dist/lib/get_address.js +9 -11
- package/dist/lib/get_dns.d.ts +8 -0
- package/dist/lib/get_dns.js +9 -11
- package/dist/lib/get_domain.d.ts +8 -0
- package/dist/lib/get_domain.js +9 -11
- package/dist/lib/get_gateway.d.ts +8 -0
- package/dist/lib/get_gateway.js +9 -11
- package/dist/lib/get_hostname.d.ts +8 -0
- package/dist/lib/get_hostname.js +9 -11
- package/dist/lib/get_netmask.d.ts +8 -0
- package/dist/lib/get_netmask.js +9 -11
- package/dist/lib/get_password.d.ts +8 -0
- package/dist/lib/get_password.js +10 -13
- package/dist/lib/get_userfullname.d.ts +8 -0
- package/dist/lib/get_userfullname.js +9 -11
- package/dist/lib/get_username.d.ts +8 -0
- package/dist/lib/get_username.js +9 -12
- package/dist/lib/kill_me_softly.d.ts +11 -0
- package/dist/lib/kill_me_softly.js +19 -24
- package/dist/lib/select_address_type.d.ts +8 -0
- package/dist/lib/select_address_type.js +9 -12
- package/dist/lib/select_filesystem_type.d.ts +8 -0
- package/dist/lib/select_filesystem_type.js +15 -18
- package/dist/lib/select_installation_device.d.ts +8 -0
- package/dist/lib/select_installation_device.js +11 -15
- package/dist/lib/select_installation_mode.d.ts +8 -0
- package/dist/lib/select_installation_mode.js +9 -11
- package/dist/lib/select_interface.d.ts +8 -0
- package/dist/lib/select_interface.js +9 -12
- package/dist/lib/select_keyboard_layout.d.ts +11 -0
- package/dist/lib/select_keyboard_layout.js +11 -15
- package/dist/lib/select_keyboard_model.d.ts +11 -0
- package/dist/lib/select_keyboard_model.js +11 -15
- package/dist/lib/select_keyboard_option.d.ts +11 -0
- package/dist/lib/select_keyboard_option.js +11 -15
- package/dist/lib/select_keyboard_variant.d.ts +11 -0
- package/dist/lib/select_keyboard_variant.js +11 -15
- package/dist/lib/select_languages.d.ts +8 -0
- package/dist/lib/select_languages.js +11 -15
- package/dist/lib/select_regions.d.ts +8 -0
- package/dist/lib/select_regions.js +9 -11
- package/dist/lib/select_user_swap_choice.d.ts +8 -0
- package/dist/lib/select_user_swap_choice.js +13 -17
- package/dist/lib/select_zones.d.ts +8 -0
- package/dist/lib/select_zones.js +9 -11
- package/dist/lib/utils.d.ts +34 -0
- package/dist/lib/utils.js +24 -14
- package/manpages/doc/man/eggs.1.gz +0 -0
- package/manpages/doc/man/eggs.html +10 -10
- package/package.json +48 -69
- package/LICENSE +0 -339
- package/bin/dev +0 -17
- package/bin/run +0 -5
- package/dist/components/elements/information.js +0 -194
- package/dist/components/elements/steps.js +0 -152
- package/dist/components/elements/title.js +0 -36
- package/dist/lib/dependencies.js +0 -121
package/dist/classes/pacman.js
CHANGED
|
@@ -1,231 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
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
|
-
* @
|
|
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
|
|
129
|
-
let isUefi = false;
|
|
36
|
+
static async autocompleteInstall(verbose = false) {
|
|
130
37
|
if (this.distro().familyId === 'debian') {
|
|
131
|
-
if (
|
|
132
|
-
if (
|
|
133
|
-
|
|
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 (
|
|
138
|
-
|
|
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
|
|
63
|
+
await Debian.calamaresInstall(verbose);
|
|
254
64
|
}
|
|
255
65
|
else if (this.distro().familyId === 'fedora') {
|
|
256
|
-
await
|
|
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
|
|
72
|
+
await exec(cmd, Utils.setEcho(true));
|
|
263
73
|
}
|
|
264
74
|
catch {
|
|
265
|
-
|
|
75
|
+
Utils.error(`manjaro: ${cmd}`); // + e.error)
|
|
266
76
|
}
|
|
267
77
|
}
|
|
268
78
|
else {
|
|
269
|
-
await
|
|
79
|
+
await Archlinux.calamaresInstall(verbose);
|
|
270
80
|
}
|
|
271
81
|
}
|
|
272
82
|
else if (this.distro().familyId === 'suse') {
|
|
273
|
-
await
|
|
83
|
+
await Suse.calamaresInstall(verbose);
|
|
274
84
|
}
|
|
275
85
|
// remove others calamares links
|
|
276
|
-
await
|
|
277
|
-
await
|
|
278
|
-
await
|
|
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
|
|
96
|
+
await Debian.calamaresPolicies();
|
|
287
97
|
}
|
|
288
98
|
else if (this.distro().familyId === 'fedora') {
|
|
289
|
-
await
|
|
99
|
+
await Fedora.calamaresPolicies();
|
|
290
100
|
}
|
|
291
101
|
else if (this.distro().familyId === 'archlinux') {
|
|
292
|
-
await
|
|
102
|
+
await Archlinux.calamaresPolicies();
|
|
293
103
|
}
|
|
294
104
|
else if (this.distro().familyId === 'suse') {
|
|
295
|
-
await
|
|
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
|
|
114
|
+
retVal = await Debian.calamaresRemove(verbose);
|
|
305
115
|
}
|
|
306
116
|
else if (this.distro().familyId === 'fedora') {
|
|
307
|
-
retVal = await
|
|
117
|
+
retVal = await Fedora.calamaresRemove(verbose);
|
|
308
118
|
}
|
|
309
119
|
else if (this.distro().familyId === 'archlinux') {
|
|
310
|
-
retVal = await
|
|
120
|
+
retVal = await Archlinux.calamaresRemove(verbose);
|
|
311
121
|
}
|
|
312
122
|
else if (this.distro().familyId === 'suse') {
|
|
313
|
-
retVal = await
|
|
123
|
+
retVal = await Suse.calamaresRemove(verbose);
|
|
314
124
|
}
|
|
315
125
|
return retVal;
|
|
316
126
|
}
|
|
317
127
|
/**
|
|
318
|
-
*
|
|
128
|
+
*
|
|
129
|
+
* @param cmd
|
|
319
130
|
*/
|
|
320
|
-
static
|
|
321
|
-
|
|
322
|
-
|
|
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
|
-
*
|
|
141
|
+
* Restituisce VERO se i file di configurazione SONO presenti
|
|
326
142
|
*/
|
|
327
|
-
static
|
|
328
|
-
const
|
|
329
|
-
|
|
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 =
|
|
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() &&
|
|
179
|
+
if (!Pacman.isUefi() && Utils.uefiArch() !== "i386") {
|
|
369
180
|
config.make_efi = false;
|
|
370
|
-
console.log('Due the lacks of grub-efi-' +
|
|
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 =
|
|
376
|
-
config.vmlinuz =
|
|
377
|
-
config.initrd_img =
|
|
378
|
-
const settings = new
|
|
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 (!
|
|
387
|
-
|
|
197
|
+
if (!fs.existsSync(confRoot)) {
|
|
198
|
+
execSync(`mkdir ${confRoot}`);
|
|
388
199
|
}
|
|
200
|
+
console.log('configurationInstall: ' + confRoot);
|
|
389
201
|
const addons = `${confRoot}/addons`;
|
|
390
|
-
if (
|
|
391
|
-
|
|
202
|
+
if (fs.existsSync(addons)) {
|
|
203
|
+
execSync(`rm -rf ${addons}`);
|
|
392
204
|
}
|
|
393
205
|
const distros = `${confRoot}/distros`;
|
|
394
|
-
if (
|
|
395
|
-
|
|
206
|
+
if (fs.existsSync(distros)) {
|
|
207
|
+
execSync(`rm -rf ${distros}`);
|
|
396
208
|
}
|
|
397
|
-
|
|
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 (
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
-
|
|
420
|
-
|
|
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
|
-
*
|
|
236
|
+
* Ritorna vero se machine-id è uguale
|
|
425
237
|
*/
|
|
426
|
-
static async
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
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
|
-
|
|
451
|
-
await
|
|
255
|
+
if (fs.existsSync('/etc/calamares')) {
|
|
256
|
+
await exec('rm /etc/calamares -rf', echo);
|
|
452
257
|
}
|
|
453
258
|
}
|
|
454
259
|
/**
|
|
455
|
-
*
|
|
260
|
+
*
|
|
261
|
+
* @returns
|
|
456
262
|
*/
|
|
457
|
-
static
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
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()
|
|
479
|
-
return
|
|
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 =
|
|
489
|
-
const rootPen =
|
|
490
|
-
await
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
364
|
+
await exec(`cp -r ${bionic} ${dest}`, echo);
|
|
571
365
|
// Poi da buster
|
|
572
|
-
await
|
|
573
|
-
await
|
|
574
|
-
await
|
|
575
|
-
await
|
|
576
|
-
await
|
|
577
|
-
await
|
|
578
|
-
await
|
|
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
|
|
587
|
-
await
|
|
588
|
-
await
|
|
589
|
-
await
|
|
590
|
-
await
|
|
591
|
-
await
|
|
592
|
-
await
|
|
593
|
-
await
|
|
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
|
|
602
|
-
await
|
|
603
|
-
await
|
|
604
|
-
await
|
|
605
|
-
await
|
|
606
|
-
await
|
|
607
|
-
await
|
|
608
|
-
await
|
|
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
|
|
617
|
-
await
|
|
618
|
-
await
|
|
619
|
-
await
|
|
620
|
-
await
|
|
621
|
-
await
|
|
622
|
-
await
|
|
623
|
-
await
|
|
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
|
|
633
|
-
await
|
|
634
|
-
await
|
|
635
|
-
await
|
|
636
|
-
await
|
|
637
|
-
await
|
|
638
|
-
await
|
|
639
|
-
await
|
|
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
|
|
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
|
|
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
|
|
466
|
+
await exec(`cp -r ${tumbleweed} ${dest}`, echo);
|
|
673
467
|
}
|
|
674
468
|
}
|
|
675
469
|
/**
|
|
676
|
-
*
|
|
677
|
-
* @
|
|
470
|
+
* Controlla se calamares è installabile
|
|
471
|
+
* @returns
|
|
678
472
|
*/
|
|
679
|
-
static
|
|
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
|
-
|
|
494
|
+
if (Debian.packageIsInstalled('xwayland')) {
|
|
495
|
+
installed = true;
|
|
496
|
+
}
|
|
683
497
|
}
|
|
684
498
|
else if (this.distro().familyId === 'fedora') {
|
|
685
|
-
|
|
499
|
+
if (Fedora.packageIsInstalled('xorg-x11-server-Xwayland*')) {
|
|
500
|
+
installed = true;
|
|
501
|
+
}
|
|
686
502
|
}
|
|
687
503
|
else if (this.distro().familyId === 'archlinux') {
|
|
688
|
-
|
|
504
|
+
if (Archlinux.packageIsInstalled('xwayland')) {
|
|
505
|
+
installed = true;
|
|
506
|
+
}
|
|
689
507
|
}
|
|
690
|
-
else if (this.distro().familyId === 'suse') {
|
|
691
|
-
installed =
|
|
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 =
|
|
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
|
|
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
|
|
636
|
+
retVal = await Debian.packageInstall(packageName);
|
|
743
637
|
}
|
|
744
638
|
else if (this.distro().familyId === 'archlinux') {
|
|
745
|
-
retVal = await
|
|
639
|
+
retVal = await Archlinux.packageInstall(packageName);
|
|
746
640
|
}
|
|
747
641
|
else if (this.distro().familyId === 'fedora') {
|
|
748
|
-
retVal = await
|
|
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
|
-
* @
|
|
755
|
-
*
|
|
756
|
-
* Probabilmente da rimuovere, viene usata solo da prerequisitesRemove
|
|
757
|
-
*
|
|
671
|
+
* @returns grub
|
|
758
672
|
*/
|
|
759
|
-
static
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
if (
|
|
763
|
-
|
|
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
|
-
|
|
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;
|