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