penguins-eggs 10.0.57 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +100 -1
- package/README.md +84 -44
- package/addons/eggs/theme/calamares/modules/{_users.yml → users.yml} +3 -3
- package/addons/eggs/theme/livecd/grub.main.full.cfg +1 -7
- package/addons/eggs/theme/livecd/grub.main.simple.cfg +1 -1
- package/assets/config.cfg +30 -0
- package/conf/derivatives.yaml +1 -3
- package/conf/derivatives_fedora.yaml +6 -0
- package/conf/distros/alpine/calamares/modules/users.yml +3 -3
- package/conf/distros/bionic/calamares/calamares-modules/grubcfg/grubcfg.yml +1 -1
- package/conf/distros/bionic/calamares/modules/users.yml +3 -3
- package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +8 -1
- package/conf/distros/buster/calamares/modules/partition.yml +159 -23
- package/conf/distros/buster/calamares/modules/removeuser.yml +1 -1
- package/conf/distros/buster/calamares/modules/users.yml +3 -3
- package/conf/distros/fedora/calamares/modules/users.yml +3 -3
- package/conf/distros/noble/calamares/modules/focal-jammy/users.yml +3 -3
- package/conf/distros/opensuse/calamares/modules/users.yml +3 -3
- package/conf/distros/rolling/calamares/modules/users.yml +3 -3
- package/conf/eggs.yaml +1 -1
- package/conf/exclude.list.d/master.list +1 -0
- package/conf/krill.yaml +8 -0
- package/conf/love.yaml +4 -4
- package/package.json +33 -29
- package/perrisbrewery/scripts/postinst +98 -0
- package/perrisbrewery/scripts/postrm +82 -0
- package/perrisbrewery/scripts/preinst +40 -0
- package/perrisbrewery/scripts/prerm +47 -0
- package/perrisbrewery/template/control.template +17 -0
- package/perrisbrewery/template/dependencies-bionic.yaml +33 -0
- package/perrisbrewery/template/dependencies.yaml +37 -0
- package/perrisbrewery/template/man.template.md +110 -0
- package/pods/README.md +14 -0
- package/pods/almalinux.sh +10 -0
- package/pods/archlinux.sh +10 -0
- package/pods/ci/README.md +5 -0
- package/pods/ci/kernel-overlay-install.sh +114 -0
- package/pods/ci/minimal/almalinux-container2host.sh +165 -0
- package/pods/ci/minimal/archlinux-container2host.sh +125 -0
- package/pods/ci/minimal/debian-container2host.sh +173 -0
- package/pods/ci/minimal/fedora-container2host.sh +170 -0
- package/pods/ci/minimal/manjaro-container2host.sh +123 -0
- package/pods/ci/minimal/opensuse-container2host.sh +143 -0
- package/pods/ci/penguins-eggs-execute.sh +22 -0
- package/pods/ci/penguins-eggs-install.sh +115 -0
- package/pods/ci/run +34 -0
- package/pods/ci/run-on-almalinux.sh +50 -0
- package/pods/ci/run-on-archlinux.sh +64 -0
- package/pods/ci/run-on-debian.sh +51 -0
- package/pods/ci/run-on-devuan.sh +48 -0
- package/pods/ci/run-on-fedora.sh +51 -0
- package/pods/ci/run-on-manjaro.sh +61 -0
- package/pods/ci/run-on-opensuse.sh +58 -0
- package/pods/ci/run-on-rockylinux.sh +51 -0
- package/pods/ci/run-on-ubuntu.sh +52 -0
- package/pods/debian.sh +23 -0
- package/pods/devuan.sh +26 -0
- package/pods/fedora.sh +12 -0
- package/pods/lmde.sh +22 -0
- package/pods/manjaro.sh +10 -0
- package/pods/opensuse.sh +12 -0
- package/pods/podman.command.sh +85 -0
- package/pods/rocky.sh +12 -0
- package/pods/run-build-packages-debs.sh +45 -0
- package/pods/run-create-debs.sh +23 -0
- package/pods/ubuntu.sh +24 -0
- package/scripts/_eggs +23 -6
- package/scripts/eggs.bash +8 -6
- package/dist/classes/bleach.d.ts +0 -32
- package/dist/classes/bleach.js +0 -135
- package/dist/classes/cfs.d.ts +0 -17
- package/dist/classes/cfs.js +0 -39
- package/dist/classes/cli-autologin.d.ts +0 -52
- package/dist/classes/cli-autologin.js +0 -247
- package/dist/classes/compressors.d.ts +0 -54
- package/dist/classes/compressors.js +0 -109
- package/dist/classes/daddy.d.ts +0 -26
- package/dist/classes/daddy.js +0 -167
- package/dist/classes/distro.d.ts +0 -32
- package/dist/classes/distro.js +0 -341
- package/dist/classes/diversions.d.ts +0 -52
- package/dist/classes/diversions.js +0 -126
- package/dist/classes/incubation/branding.d.ts +0 -17
- package/dist/classes/incubation/branding.js +0 -85
- package/dist/classes/incubation/fisherman-helper/displaymanager.d.ts +0 -11
- package/dist/classes/incubation/fisherman-helper/displaymanager.js +0 -40
- package/dist/classes/incubation/fisherman-helper/packages.d.ts +0 -20
- package/dist/classes/incubation/fisherman-helper/packages.js +0 -72
- package/dist/classes/incubation/fisherman-helper/settings.d.ts +0 -15
- package/dist/classes/incubation/fisherman-helper/settings.js +0 -83
- package/dist/classes/incubation/fisherman.d.ts +0 -70
- package/dist/classes/incubation/fisherman.js +0 -263
- package/dist/classes/incubation/incubator.d/alpine.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/alpine.js +0 -78
- package/dist/classes/incubation/incubator.d/bionic.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/bionic.js +0 -83
- package/dist/classes/incubation/incubator.d/buster.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/buster.js +0 -85
- package/dist/classes/incubation/incubator.d/jessie.d.ts +0 -31
- package/dist/classes/incubation/incubator.d/jessie.js +0 -44
- package/dist/classes/incubation/incubator.d/noble.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/noble.js +0 -85
- package/dist/classes/incubation/incubator.d/openmamba.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/openmamba.js +0 -81
- package/dist/classes/incubation/incubator.d/opensuse.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/opensuse.js +0 -81
- package/dist/classes/incubation/incubator.d/rolling.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/rolling.js +0 -80
- package/dist/classes/incubation/incubator.d.ts +0 -44
- package/dist/classes/incubation/incubator.js +0 -382
- package/dist/classes/incubation/installer.d.ts +0 -13
- package/dist/classes/incubation/installer.js +0 -52
- package/dist/classes/keyboards.d.ts +0 -50
- package/dist/classes/keyboards.js +0 -287
- package/dist/classes/locales.d.ts +0 -21
- package/dist/classes/locales.js +0 -77
- package/dist/classes/network.d.ts +0 -37
- package/dist/classes/network.js +0 -98
- package/dist/classes/ovary.d.ts +0 -198
- package/dist/classes/ovary.js +0 -1850
- package/dist/classes/pacman.d/aldos.d.ts +0 -52
- package/dist/classes/pacman.d/aldos.js +0 -100
- package/dist/classes/pacman.d/alpine.d.ts +0 -56
- package/dist/classes/pacman.d/alpine.js +0 -162
- package/dist/classes/pacman.d/archlinux.d.ts +0 -62
- package/dist/classes/pacman.d/archlinux.js +0 -139
- package/dist/classes/pacman.d/debian.d.ts +0 -65
- package/dist/classes/pacman.d/debian.js +0 -143
- package/dist/classes/pacman.d/fedora.d.ts +0 -53
- package/dist/classes/pacman.d/fedora.js +0 -101
- package/dist/classes/pacman.d/openmamba.d.ts +0 -52
- package/dist/classes/pacman.d/openmamba.js +0 -100
- package/dist/classes/pacman.d/opensuse.d.ts +0 -53
- package/dist/classes/pacman.d/opensuse.js +0 -102
- package/dist/classes/pacman.d/voidlinux.d.ts +0 -52
- package/dist/classes/pacman.d/voidlinux.js +0 -90
- package/dist/classes/pacman.d.ts +0 -139
- package/dist/classes/pacman.js +0 -775
- package/dist/classes/pve-live.d.ts +0 -17
- package/dist/classes/pve-live.js +0 -52
- package/dist/classes/pxe.d.ts +0 -74
- package/dist/classes/pxe.js +0 -410
- package/dist/classes/settings.d.ts +0 -53
- package/dist/classes/settings.js +0 -185
- package/dist/classes/sources_list.d.ts +0 -28
- package/dist/classes/sources_list.js +0 -89
- package/dist/classes/systemctl.d.ts +0 -47
- package/dist/classes/systemctl.js +0 -86
- package/dist/classes/tailor.d.ts +0 -50
- package/dist/classes/tailor.js +0 -526
- package/dist/classes/tools.d.ts +0 -26
- package/dist/classes/tools.js +0 -50
- package/dist/classes/users.d.ts +0 -28
- package/dist/classes/users.js +0 -143
- package/dist/classes/utils.d.ts +0 -326
- package/dist/classes/utils.js +0 -1025
- package/dist/classes/xdg.d.ts +0 -45
- package/dist/classes/xdg.js +0 -337
- package/dist/classes/yolk.d.ts +0 -33
- package/dist/classes/yolk.js +0 -114
- package/dist/commands/adapt.d.ts +0 -17
- package/dist/commands/adapt.js +0 -33
- package/dist/commands/analyze.d.ts +0 -26
- package/dist/commands/analyze.js +0 -95
- package/dist/commands/calamares.d.ts +0 -29
- package/dist/commands/calamares.js +0 -112
- package/dist/commands/config.d.ts +0 -35
- package/dist/commands/config.js +0 -120
- package/dist/commands/cuckoo.d.ts +0 -16
- package/dist/commands/cuckoo.js +0 -62
- package/dist/commands/dad.d.ts +0 -20
- package/dist/commands/dad.js +0 -46
- package/dist/commands/export/iso.d.ts +0 -19
- package/dist/commands/export/iso.js +0 -55
- package/dist/commands/export/pkg.d.ts +0 -29
- package/dist/commands/export/pkg.js +0 -163
- package/dist/commands/export/tarballs.d.ts +0 -27
- package/dist/commands/export/tarballs.js +0 -84
- package/dist/commands/install.d.ts +0 -37
- package/dist/commands/install.js +0 -88
- package/dist/commands/kill.d.ts +0 -24
- package/dist/commands/kill.js +0 -50
- package/dist/commands/love.d.ts +0 -20
- package/dist/commands/love.js +0 -59
- package/dist/commands/mom.d.ts +0 -16
- package/dist/commands/mom.js +0 -30
- package/dist/commands/produce.d.ts +0 -34
- package/dist/commands/produce.js +0 -201
- package/dist/commands/status.d.ts +0 -23
- package/dist/commands/status.js +0 -31
- package/dist/commands/syncfrom.d.ts +0 -45
- package/dist/commands/syncfrom.js +0 -152
- package/dist/commands/syncto.d.ts +0 -40
- package/dist/commands/syncto.js +0 -175
- package/dist/commands/tools/clean.d.ts +0 -18
- package/dist/commands/tools/clean.js +0 -37
- package/dist/commands/tools/ppa.d.ts +0 -26
- package/dist/commands/tools/ppa.js +0 -138
- package/dist/commands/tools/skel.d.ts +0 -18
- package/dist/commands/tools/skel.js +0 -44
- package/dist/commands/tools/stat.d.ts +0 -31
- package/dist/commands/tools/stat.js +0 -70
- package/dist/commands/tools/yolk.d.ts +0 -24
- package/dist/commands/tools/yolk.js +0 -45
- package/dist/commands/update.d.ts +0 -51
- package/dist/commands/update.js +0 -219
- package/dist/commands/wardrobe/get.d.ts +0 -23
- package/dist/commands/wardrobe/get.js +0 -52
- package/dist/commands/wardrobe/list.d.ts +0 -24
- package/dist/commands/wardrobe/list.js +0 -125
- package/dist/commands/wardrobe/show.d.ts +0 -25
- package/dist/commands/wardrobe/show.js +0 -97
- package/dist/commands/wardrobe/wear.d.ts +0 -26
- package/dist/commands/wardrobe/wear.js +0 -84
- package/dist/components/finished.d.ts +0 -16
- package/dist/components/finished.js +0 -56
- package/dist/components/information.d.ts +0 -8
- package/dist/components/information.js +0 -156
- package/dist/components/install.d.ts +0 -15
- package/dist/components/install.js +0 -60
- package/dist/components/keyboard.d.ts +0 -16
- package/dist/components/keyboard.js +0 -54
- package/dist/components/location.d.ts +0 -16
- package/dist/components/location.js +0 -59
- package/dist/components/network.d.ts +0 -19
- package/dist/components/network.js +0 -65
- package/dist/components/partitions.d.ts +0 -16
- package/dist/components/partitions.js +0 -73
- package/dist/components/steps.d.ts +0 -13
- package/dist/components/steps.js +0 -148
- package/dist/components/summary.d.ts +0 -24
- package/dist/components/summary.js +0 -81
- package/dist/components/title.d.ts +0 -11
- package/dist/components/title.js +0 -35
- package/dist/components/users.d.ts +0 -24
- package/dist/components/users.js +0 -80
- package/dist/components/welcome.d.ts +0 -13
- package/dist/components/welcome.js +0 -63
- package/dist/index-old.d.ts +0 -8
- package/dist/index-old.js +0 -8
- package/dist/index.d.ts +0 -54
- package/dist/index.js +0 -147
- package/dist/interfaces/i-addons.d.ts +0 -12
- package/dist/interfaces/i-addons.js +0 -8
- package/dist/interfaces/i-analyze.d.ts +0 -17
- package/dist/interfaces/i-analyze.js +0 -17
- package/dist/interfaces/i-app.d.ts +0 -14
- package/dist/interfaces/i-app.js +0 -8
- package/dist/interfaces/i-branding.d.ts +0 -36
- package/dist/interfaces/i-branding.js +0 -8
- package/dist/interfaces/i-calamares-displaymanager.d.ts +0 -17
- package/dist/interfaces/i-calamares-displaymanager.js +0 -1
- package/dist/interfaces/i-calamares-finished.d.ts +0 -12
- package/dist/interfaces/i-calamares-finished.js +0 -1
- package/dist/interfaces/i-calamares-packages.d.ts +0 -28
- package/dist/interfaces/i-calamares-packages.js +0 -1
- package/dist/interfaces/i-calamares-partition.d.ts +0 -40
- package/dist/interfaces/i-calamares-partition.js +0 -1
- package/dist/interfaces/i-config-tools.d.ts +0 -15
- package/dist/interfaces/i-config-tools.js +0 -8
- package/dist/interfaces/i-devices.d.ts +0 -20
- package/dist/interfaces/i-devices.js +0 -8
- package/dist/interfaces/i-distro.d.ts +0 -23
- package/dist/interfaces/i-distro.js +0 -8
- package/dist/interfaces/i-drive-list.d.ts +0 -33
- package/dist/interfaces/i-drive-list.js +0 -8
- package/dist/interfaces/i-eggs-config.d.ts +0 -32
- package/dist/interfaces/i-eggs-config.js +0 -8
- package/dist/interfaces/i-excludes.d.ts +0 -14
- package/dist/interfaces/i-excludes.js +0 -8
- package/dist/interfaces/i-exec.d.ts +0 -11
- package/dist/interfaces/i-exec.js +0 -8
- package/dist/interfaces/i-initrd.d.ts +0 -13
- package/dist/interfaces/i-initrd.js +0 -8
- package/dist/interfaces/i-install.d.ts +0 -16
- package/dist/interfaces/i-install.js +0 -8
- package/dist/interfaces/i-installer.d.ts +0 -17
- package/dist/interfaces/i-installer.js +0 -8
- package/dist/interfaces/i-krill-config.d.ts +0 -33
- package/dist/interfaces/i-krill-config.js +0 -8
- package/dist/interfaces/i-krill.d.ts +0 -42
- package/dist/interfaces/i-krill.js +0 -8
- package/dist/interfaces/i-materia.d.ts +0 -36
- package/dist/interfaces/i-materia.js +0 -8
- package/dist/interfaces/i-net.d.ts +0 -16
- package/dist/interfaces/i-net.js +0 -8
- package/dist/interfaces/i-os-release.d.ts +0 -5
- package/dist/interfaces/i-os-release.js +0 -1
- package/dist/interfaces/i-packages.d.ts +0 -16
- package/dist/interfaces/i-packages.js +0 -8
- package/dist/interfaces/i-partitions.d.ts +0 -16
- package/dist/interfaces/i-partitions.js +0 -8
- package/dist/interfaces/i-pxe.d.ts +0 -45
- package/dist/interfaces/i-pxe.js +0 -1
- package/dist/interfaces/i-remix.d.ts +0 -21
- package/dist/interfaces/i-remix.js +0 -8
- package/dist/interfaces/i-settings.d.ts +0 -33
- package/dist/interfaces/i-settings.js +0 -8
- package/dist/interfaces/i-user.d.ts +0 -14
- package/dist/interfaces/i-user.js +0 -8
- package/dist/interfaces/i-workdir.d.ts +0 -14
- package/dist/interfaces/i-workdir.js +0 -8
- package/dist/interfaces/i-xkb-model.d.ts +0 -24
- package/dist/interfaces/i-xkb-model.js +0 -8
- package/dist/interfaces/index.d.ts +0 -25
- package/dist/interfaces/index.js +0 -8
- package/dist/krill/modules/add-user.d.ts +0 -20
- package/dist/krill/modules/add-user.js +0 -48
- package/dist/krill/modules/bootloader-config.d.ts +0 -14
- package/dist/krill/modules/bootloader-config.js +0 -165
- package/dist/krill/modules/bootloader.d.ts +0 -14
- package/dist/krill/modules/bootloader.js +0 -95
- package/dist/krill/modules/change-password.d.ts +0 -15
- package/dist/krill/modules/change-password.js +0 -18
- package/dist/krill/modules/del-live-user.d.ts +0 -14
- package/dist/krill/modules/del-live-user.js +0 -39
- package/dist/krill/modules/fstab.d.ts +0 -14
- package/dist/krill/modules/fstab.js +0 -128
- package/dist/krill/modules/grubcfg.d.ts +0 -17
- package/dist/krill/modules/grubcfg.js +0 -29
- package/dist/krill/modules/hostname.d.ts +0 -13
- package/dist/krill/modules/hostname.js +0 -50
- package/dist/krill/modules/initramfs-cfg.d.ts +0 -14
- package/dist/krill/modules/initramfs-cfg.js +0 -22
- package/dist/krill/modules/initramfs.d.ts +0 -13
- package/dist/krill/modules/initramfs.js +0 -54
- package/dist/krill/modules/locale-cfg.d.ts +0 -10
- package/dist/krill/modules/locale-cfg.js +0 -58
- package/dist/krill/modules/locale.d.ts +0 -13
- package/dist/krill/modules/locale.js +0 -91
- package/dist/krill/modules/m-keyboard.d.ts +0 -14
- package/dist/krill/modules/m-keyboard.js +0 -58
- package/dist/krill/modules/machine-id.d.ts +0 -15
- package/dist/krill/modules/machine-id.js +0 -33
- package/dist/krill/modules/mkfs.d.ts +0 -15
- package/dist/krill/modules/mkfs.js +0 -50
- package/dist/krill/modules/mount-fs.d.ts +0 -17
- package/dist/krill/modules/mount-fs.js +0 -62
- package/dist/krill/modules/mount-vfs.d.ts +0 -17
- package/dist/krill/modules/mount-vfs.js +0 -40
- package/dist/krill/modules/network-cfg.d.ts +0 -19
- package/dist/krill/modules/network-cfg.js +0 -64
- package/dist/krill/modules/packages.d.ts +0 -14
- package/dist/krill/modules/packages.js +0 -111
- package/dist/krill/modules/partition.d.ts +0 -20
- package/dist/krill/modules/partition.js +0 -345
- package/dist/krill/modules/remove-installer-link.d.ts +0 -13
- package/dist/krill/modules/remove-installer-link.js +0 -35
- package/dist/krill/modules/umount.d.ts +0 -14
- package/dist/krill/modules/umount.js +0 -28
- package/dist/krill/modules/unpackfs.d.ts +0 -13
- package/dist/krill/modules/unpackfs.js +0 -20
- package/dist/krill/prepare.d.ts +0 -78
- package/dist/krill/prepare.js +0 -626
- package/dist/krill/sequence.d.ts +0 -154
- package/dist/krill/sequence.js +0 -652
- package/dist/lib/get_address.d.ts +0 -8
- package/dist/lib/get_address.js +0 -23
- package/dist/lib/get_dns.d.ts +0 -8
- package/dist/lib/get_dns.js +0 -23
- package/dist/lib/get_domain.d.ts +0 -8
- package/dist/lib/get_domain.js +0 -23
- package/dist/lib/get_gateway.d.ts +0 -8
- package/dist/lib/get_gateway.js +0 -23
- package/dist/lib/get_hostname.d.ts +0 -8
- package/dist/lib/get_hostname.js +0 -23
- package/dist/lib/get_netmask.d.ts +0 -8
- package/dist/lib/get_netmask.js +0 -23
- package/dist/lib/get_password.d.ts +0 -8
- package/dist/lib/get_password.js +0 -36
- package/dist/lib/get_userfullname.d.ts +0 -8
- package/dist/lib/get_userfullname.js +0 -23
- package/dist/lib/get_username.d.ts +0 -8
- package/dist/lib/get_username.js +0 -23
- package/dist/lib/kill_me_softly.d.ts +0 -11
- package/dist/lib/kill_me_softly.js +0 -61
- package/dist/lib/select_address_type.d.ts +0 -8
- package/dist/lib/select_address_type.js +0 -24
- package/dist/lib/select_filesystem_type.d.ts +0 -8
- package/dist/lib/select_filesystem_type.js +0 -46
- package/dist/lib/select_installation_device.d.ts +0 -8
- package/dist/lib/select_installation_device.js +0 -34
- package/dist/lib/select_installation_mode.d.ts +0 -8
- package/dist/lib/select_installation_mode.js +0 -24
- package/dist/lib/select_interface.d.ts +0 -8
- package/dist/lib/select_interface.js +0 -24
- package/dist/lib/select_keyboard_layout.d.ts +0 -11
- package/dist/lib/select_keyboard_layout.js +0 -36
- package/dist/lib/select_keyboard_model.d.ts +0 -11
- package/dist/lib/select_keyboard_model.js +0 -34
- package/dist/lib/select_keyboard_option.d.ts +0 -11
- package/dist/lib/select_keyboard_option.js +0 -34
- package/dist/lib/select_keyboard_variant.d.ts +0 -11
- package/dist/lib/select_keyboard_variant.js +0 -35
- package/dist/lib/select_languages.d.ts +0 -8
- package/dist/lib/select_languages.js +0 -28
- package/dist/lib/select_regions.d.ts +0 -8
- package/dist/lib/select_regions.js +0 -24
- package/dist/lib/select_user_swap_choice.d.ts +0 -8
- package/dist/lib/select_user_swap_choice.js +0 -34
- package/dist/lib/select_zones.d.ts +0 -8
- package/dist/lib/select_zones.js +0 -518
- package/dist/lib/utils.d.ts +0 -34
- package/dist/lib/utils.js +0 -79
package/dist/classes/ovary.js
DELETED
|
@@ -1,1850 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ./src/classes/ovary.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 chalk from 'chalk';
|
|
9
|
-
import yaml from 'js-yaml';
|
|
10
|
-
import mustache from 'mustache';
|
|
11
|
-
// packages
|
|
12
|
-
import fs from 'node:fs';
|
|
13
|
-
import { constants } from 'node:fs';
|
|
14
|
-
// backup
|
|
15
|
-
import { access } from 'node:fs/promises';
|
|
16
|
-
import os from 'node:os';
|
|
17
|
-
import path from 'node:path';
|
|
18
|
-
import shx from 'shelljs';
|
|
19
|
-
// libraries
|
|
20
|
-
import { exec } from '../lib/utils.js';
|
|
21
|
-
import Bleach from './bleach.js';
|
|
22
|
-
import CliAutologin from './cli-autologin.js';
|
|
23
|
-
import { displaymanager } from './incubation/fisherman-helper/displaymanager.js';
|
|
24
|
-
import Incubator from './incubation/incubator.js';
|
|
25
|
-
import Pacman from './pacman.js';
|
|
26
|
-
import PveLive from './pve-live.js';
|
|
27
|
-
import Settings from './settings.js';
|
|
28
|
-
import Systemctl from './systemctl.js';
|
|
29
|
-
import Users from './users.js';
|
|
30
|
-
import Diversions from './diversions.js';
|
|
31
|
-
// classes
|
|
32
|
-
import Utils from './utils.js';
|
|
33
|
-
import Xdg from './xdg.js';
|
|
34
|
-
import Repo from './yolk.js';
|
|
35
|
-
// _dirname
|
|
36
|
-
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
37
|
-
/**
|
|
38
|
-
* Ovary:
|
|
39
|
-
*/
|
|
40
|
-
export default class Ovary {
|
|
41
|
-
cliAutologin = new CliAutologin();
|
|
42
|
-
clone = false;
|
|
43
|
-
compression = '';
|
|
44
|
-
cryptedclone = false;
|
|
45
|
-
echo = {};
|
|
46
|
-
familyId = '';
|
|
47
|
-
genisoimage = false;
|
|
48
|
-
incubator = {};
|
|
49
|
-
nest = '';
|
|
50
|
-
settings = {};
|
|
51
|
-
snapshot_basename = '';
|
|
52
|
-
snapshot_prefix = '';
|
|
53
|
-
theme = '';
|
|
54
|
-
toNull = '';
|
|
55
|
-
verbose = false;
|
|
56
|
-
volid = '';
|
|
57
|
-
/**
|
|
58
|
-
* Add or remove exclusion
|
|
59
|
-
* @param add {boolean} true = add, false remove
|
|
60
|
-
* @param exclusion {string} path to add/remove
|
|
61
|
-
*/
|
|
62
|
-
addRemoveExclusion(add, exclusion) {
|
|
63
|
-
if (this.verbose) {
|
|
64
|
-
console.log('Ovary: addRemoveExclusion');
|
|
65
|
-
}
|
|
66
|
-
if (exclusion.startsWith('/')) {
|
|
67
|
-
exclusion = exclusion.slice(1); // remove / initial Non compatible with rsync
|
|
68
|
-
}
|
|
69
|
-
if (add) {
|
|
70
|
-
this.settings.session_excludes += this.settings.session_excludes === '' ? `-e '${exclusion}' ` : ` '${exclusion}' `;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.settings.session_excludes.replace(` '${exclusion}'`, '');
|
|
74
|
-
if (this.settings.session_excludes === '-e') {
|
|
75
|
-
this.settings.session_excludes = '';
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Esegue il bind del fs live e
|
|
81
|
-
* crea lo script bind
|
|
82
|
-
*
|
|
83
|
-
* @param verbose
|
|
84
|
-
*/
|
|
85
|
-
async bindLiveFs() {
|
|
86
|
-
if (this.verbose) {
|
|
87
|
-
console.log('Ovary: bindLiveFs');
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* dirs = readdirsync /
|
|
91
|
-
*/
|
|
92
|
-
const dirs = fs.readdirSync('/');
|
|
93
|
-
const startLine = '#############################################################';
|
|
94
|
-
const titleLine = '# ---------------------------------------------------------';
|
|
95
|
-
const endLine = '# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n';
|
|
96
|
-
let lnkDest = '';
|
|
97
|
-
let cmd = '';
|
|
98
|
-
const cmds = [];
|
|
99
|
-
cmds.push('# NOTE: cdrom, dev, live, media, mnt, proc, run, sys and tmp', `# need just a mkdir in ${this.settings.work_dir.merged}`);
|
|
100
|
-
cmds.push(`# host: ${os.hostname()} user: ${await Utils.getPrimaryUser()}\n`);
|
|
101
|
-
for (const dir of dirs) {
|
|
102
|
-
cmds.push(startLine);
|
|
103
|
-
let statDir = fs.lstatSync(`/${dir}`);
|
|
104
|
-
/**
|
|
105
|
-
* Link
|
|
106
|
-
*/
|
|
107
|
-
if (statDir.isSymbolicLink()) {
|
|
108
|
-
lnkDest = fs.readlinkSync(`/${dir}`);
|
|
109
|
-
cmds.push(`# /${dir} is a symbolic link to /${lnkDest} in the system`, '# we need just to recreate it', `# ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`, "# but we don't know if the destination exist, and I'm too lazy today. So, for now: ", titleLine);
|
|
110
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
|
|
111
|
-
cmds.push('# SymbolicLink exist... skip');
|
|
112
|
-
}
|
|
113
|
-
else if (fs.existsSync(lnkDest)) {
|
|
114
|
-
cmds.push(`ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
cmds.push(await rexec(`cp -r /${dir} ${this.settings.work_dir.merged}`, this.verbose));
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Directory
|
|
121
|
-
*/
|
|
122
|
-
}
|
|
123
|
-
else if (statDir.isDirectory()) {
|
|
124
|
-
if (dir === 'boot') {
|
|
125
|
-
cmds.push(`# /boot is copied actually`);
|
|
126
|
-
cmds.push(await rexec(`cp -r /boot ${this.settings.config.snapshot_mnt}filesystem.squashfs`, this.verbose));
|
|
127
|
-
}
|
|
128
|
-
if (dir !== 'boot' && dir !== 'lost+found') {
|
|
129
|
-
cmd = `# /${dir} is a directory`;
|
|
130
|
-
if (this.mergedAndOverlay(dir)) {
|
|
131
|
-
/**
|
|
132
|
-
* mergedAndOverlay creazione directory, overlay e mount rw
|
|
133
|
-
*/
|
|
134
|
-
cmds.push(`${cmd} need to be present, and rw`, titleLine, '# create mountpoint lower');
|
|
135
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.lowerdir}/${dir}`), `# first: mount /${dir} rw in ${this.settings.work_dir.lowerdir}/${dir}`);
|
|
136
|
-
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.lowerdir}/${dir}`, this.verbose), '# now remount it ro');
|
|
137
|
-
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.lowerdir}/${dir}`, this.verbose), `\n# second: create mountpoint upper, work and ${this.settings.work_dir.merged} and mount ${dir}`);
|
|
138
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.upperdir}/${dir}`, this.verbose));
|
|
139
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.workdir}/${dir}`, this.verbose));
|
|
140
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, this.verbose), `\n# thirth: mount /${dir} rw in ${this.settings.work_dir.merged}`);
|
|
141
|
-
cmds.push(await rexec(`mount -t overlay overlay -o lowerdir=${this.settings.work_dir.lowerdir}/${dir},upperdir=${this.settings.work_dir.upperdir}/${dir},workdir=${this.settings.work_dir.workdir}/${dir} ${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
142
|
-
}
|
|
143
|
-
else if (this.merged(dir)) {
|
|
144
|
-
/*
|
|
145
|
-
* merged creazione della directory e mount ro
|
|
146
|
-
*/
|
|
147
|
-
cmds.push(`${cmd} need to be present, mount ro`, titleLine);
|
|
148
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
149
|
-
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
150
|
-
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
/**
|
|
154
|
-
* normal solo la creazione della directory, nessun mount
|
|
155
|
-
*/
|
|
156
|
-
cmds.push(`${cmd} need to be present, no mount`, titleLine);
|
|
157
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, this.verbose), `# mount -o bind /${dir} ${this.settings.work_dir.merged}/${dir}`);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* File
|
|
162
|
-
*/
|
|
163
|
-
}
|
|
164
|
-
else if (statDir.isFile()) {
|
|
165
|
-
cmds.push(`# /${dir} is just a file`, titleLine);
|
|
166
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
|
|
167
|
-
cmds.push('# file exist... skip');
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
cmds.push(await rexec(`cp /${dir} ${this.settings.work_dir.merged}`, this.verbose));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
cmds.push(endLine);
|
|
174
|
-
}
|
|
175
|
-
// Utils.writeXs(`${this.settings.config.snapshot_dir}bind`, cmds)
|
|
176
|
-
Utils.writeXs(`${this.settings.work_dir.ovarium}bind`, cmds);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* bind dei virtual file system
|
|
180
|
-
*/
|
|
181
|
-
async bindVfs() {
|
|
182
|
-
if (this.verbose) {
|
|
183
|
-
console.log('Ovary: bindVfs');
|
|
184
|
-
}
|
|
185
|
-
const cmds = [];
|
|
186
|
-
cmds.push(`mount -o bind /dev ${this.settings.work_dir.merged}/dev`, `mount -o bind /dev/pts ${this.settings.work_dir.merged}/dev/pts`, `mount -o bind /proc ${this.settings.work_dir.merged}/proc`, `mount -o bind /sys ${this.settings.work_dir.merged}/sys`, `mount -o bind /run ${this.settings.work_dir.merged}/run`);
|
|
187
|
-
// Utils.writeXs(`${this.settings.config.snapshot_dir}bindvfs`, cmds)
|
|
188
|
-
Utils.writeXs(`${this.settings.work_dir.ovarium}bindvfs`, cmds);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
*
|
|
192
|
-
* @param verbose
|
|
193
|
-
*/
|
|
194
|
-
async cleanUsersAccounts() {
|
|
195
|
-
if (this.verbose) {
|
|
196
|
-
console.log('Ovary: cleanUsersAccounts');
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* delete all user in chroot
|
|
200
|
-
*/
|
|
201
|
-
const cmds = [];
|
|
202
|
-
const cmd = `chroot ${this.settings.work_dir.merged} getent passwd {1000..60000} |awk -F: '{print $1}'`;
|
|
203
|
-
const result = await exec(cmd, {
|
|
204
|
-
capture: true,
|
|
205
|
-
echo: this.verbose,
|
|
206
|
-
ignore: false
|
|
207
|
-
});
|
|
208
|
-
const users = result.data.split('\n');
|
|
209
|
-
let deluser = Diversions.deluser(this.familyId);
|
|
210
|
-
for (let i = 0; i < users.length - 1; i++) {
|
|
211
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} ${deluser} ${users[i]}`, this.verbose));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* list degli utenti: grep -E 1[0-9]{3} /etc/passwd | sed s/:/\ / | awk '{print $1}'
|
|
216
|
-
* create la home per user_opt
|
|
217
|
-
* @param verbose
|
|
218
|
-
*/
|
|
219
|
-
async createUserLive() {
|
|
220
|
-
if (this.verbose) {
|
|
221
|
-
console.log('Ovary: createUserLive');
|
|
222
|
-
}
|
|
223
|
-
const cmds = [];
|
|
224
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' rm /home/' + this.settings.config.user_opt + ' -rf', this.verbose));
|
|
225
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' mkdir /home/' + this.settings.config.user_opt, this.verbose));
|
|
226
|
-
// Create user using useradd
|
|
227
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' useradd ' + this.settings.config.user_opt + ' --home-dir /home/' + this.settings.config.user_opt + ' --shell /bin/bash ', this.verbose));
|
|
228
|
-
// live password
|
|
229
|
-
cmds.push(await rexec('echo ' + this.settings.config.user_opt + ':' + this.settings.config.user_opt_passwd + ' | chroot ' + this.settings.work_dir.merged + ' chpasswd', this.verbose));
|
|
230
|
-
// root password
|
|
231
|
-
cmds.push(await rexec(' echo root:' + this.settings.config.root_passwd + ' | chroot ' + this.settings.work_dir.merged + ' chpasswd', this.verbose));
|
|
232
|
-
// Alpine naked don't have /etc/skel
|
|
233
|
-
if (fs.existsSync('/etc/skel')) {
|
|
234
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', this.verbose));
|
|
235
|
-
}
|
|
236
|
-
// da problemi con il mount sshfs
|
|
237
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' chown ' + this.settings.config.user_opt + ':users' + ' /home/' + this.settings.config.user_opt + ' -R', this.verbose));
|
|
238
|
-
switch (this.familyId) {
|
|
239
|
-
case 'debian': {
|
|
240
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sudo ${this.settings.config.user_opt}`, this.verbose));
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
case 'alpine': {
|
|
244
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG cdrom ${this.settings.config.user_opt}`, this.verbose));
|
|
245
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG games ${this.settings.config.user_opt}`, this.verbose));
|
|
246
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG input ${this.settings.config.user_opt}`, this.verbose));
|
|
247
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG users ${this.settings.config.user_opt}`, this.verbose));
|
|
248
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG video ${this.settings.config.user_opt}`, this.verbose));
|
|
249
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, this.verbose));
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
case 'archlinux': {
|
|
253
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} gpasswd -a ${this.settings.config.user_opt} wheel`, this.verbose));
|
|
254
|
-
// check or create group: autologin
|
|
255
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} getent group autologin || chroot ${this.settings.work_dir.merged} groupadd autologin`, this.verbose));
|
|
256
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} gpasswd -a ${this.settings.config.user_opt} autologin`, this.verbose));
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
case 'fedora': {
|
|
260
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, this.verbose));
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
case 'openmamba': {
|
|
264
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sysadmin ${this.settings.config.user_opt}`, this.verbose));
|
|
265
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG autologin ${this.settings.config.user_opt}`, this.verbose));
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
// No default
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* educaandos and others themes
|
|
272
|
-
* users.yml
|
|
273
|
-
*/
|
|
274
|
-
let usersConf = path.resolve(__dirname, `../../addons/${this.theme}/theme/calamares/users.yml`);
|
|
275
|
-
if (this.theme.includes('/')) {
|
|
276
|
-
usersConf = `${this.theme}/theme/calamares/modules/users.yml`;
|
|
277
|
-
}
|
|
278
|
-
if (fs.existsSync(usersConf)) {
|
|
279
|
-
const o = yaml.load(fs.readFileSync(usersConf, 'utf8'));
|
|
280
|
-
for (const group of o.defaultGroups) {
|
|
281
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG ${group} ${this.settings.config.user_opt}`, this.verbose));
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
*
|
|
287
|
-
*/
|
|
288
|
-
async createXdgAutostart(theme = 'eggs', myAddons, myLinks = [], noicons = false) {
|
|
289
|
-
if (this.verbose) {
|
|
290
|
-
console.log('Ovary: createXdgAutostart');
|
|
291
|
-
}
|
|
292
|
-
const pathHomeLive = `/home/${this.settings.config.user_opt}`;
|
|
293
|
-
// VOGLIO le icone
|
|
294
|
-
// Copia icona penguins-eggs
|
|
295
|
-
shx.cp(path.resolve(__dirname, '../../assets/eggs.png'), '/usr/share/icons/');
|
|
296
|
-
shx.cp(path.resolve(__dirname, '../../assets/krill.svg'), '/usr/share/icons/');
|
|
297
|
-
shx.cp(path.resolve(__dirname, '../../assets/leaves.svg'), '/usr/share/icons/');
|
|
298
|
-
/**
|
|
299
|
-
* creazione dei link in /usr/share/applications
|
|
300
|
-
*/
|
|
301
|
-
shx.cp(path.resolve(__dirname, '../../assets/penguins-eggs.desktop'), '/usr/share/applications/');
|
|
302
|
-
/**
|
|
303
|
-
* Scrivania/install-system.desktop
|
|
304
|
-
*/
|
|
305
|
-
let installerLink = 'install-system.desktop';
|
|
306
|
-
if (Pacman.calamaresExists()) {
|
|
307
|
-
/**
|
|
308
|
-
* Replace Exec in install-system.desktop per Biglinux e Bigcommunity
|
|
309
|
-
*/
|
|
310
|
-
if (this.settings.distro.distroId === 'Biglinux' || this.settings.distro.distroId === 'Bigcommunity') {
|
|
311
|
-
let installSystemDesktop = path.resolve(__dirname, `../../addons/${theme}/theme/applications/install-system.desktop`);
|
|
312
|
-
await exec(`sed -i 's|^Exec=.*|Exec=/usr/bin/calamares_polkit %f|' ${installSystemDesktop}`);
|
|
313
|
-
}
|
|
314
|
-
shx.cp(path.resolve(__dirname, `../../addons/${theme}/theme/applications/install-system.desktop`), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
315
|
-
}
|
|
316
|
-
else if (Pacman.packageIsInstalled('live-installer')) {
|
|
317
|
-
/**
|
|
318
|
-
* LMD£ live-installer
|
|
319
|
-
*/
|
|
320
|
-
const policySource = path.resolve(__dirname, '../../assets/live-installer/com.github.pieroproietti.penguins-eggs.policy');
|
|
321
|
-
const policyDest = '/usr/share/polkit-1/actions/com.github.pieroproietti.penguins-eggs.policy';
|
|
322
|
-
shx.cp(policySource, policyDest);
|
|
323
|
-
await exec(`sed -i 's/auth_admin/yes/' ${policyDest}`);
|
|
324
|
-
// carico in filesystem.live packages-remove
|
|
325
|
-
shx.cp(path.resolve(__dirname, '../../assets/live-installer/filesystem.packages-remove'), `${this.settings.iso_work}/live/`);
|
|
326
|
-
shx.touch(`${this.settings.iso_work}/live/filesystem.packages`);
|
|
327
|
-
installerLink = 'penguins-live-installer.desktop';
|
|
328
|
-
shx.cp(path.resolve(__dirname, '../../assets/penguins-live-installer.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
329
|
-
}
|
|
330
|
-
else if (Pacman.packageIsInstalled('ubiquity')) {
|
|
331
|
-
/**
|
|
332
|
-
* UBUNTU ubiquity
|
|
333
|
-
*/
|
|
334
|
-
const policySource = path.resolve(__dirname, '../../assets/ubiquity-installer/com.github.pieroproietti.penguins-eggs.policy');
|
|
335
|
-
const policyDest = '/usr/share/polkit-1/actions/com.github.pieroproietti.penguins-eggs.policy';
|
|
336
|
-
shx.cp(policySource, policyDest);
|
|
337
|
-
await exec(`sed -i 's/auth_admin/yes/' ${policyDest}`);
|
|
338
|
-
// carico in filesystem.live packages-remove
|
|
339
|
-
shx.cp(path.resolve(__dirname, '../../assets/ubiquity-installer/filesystem.packages-remove'), `${this.settings.iso_work}/live/`);
|
|
340
|
-
shx.touch(`${this.settings.iso_work}/live/filesystem.packages`);
|
|
341
|
-
installerLink = 'penguins-ubiquity-installer.desktop';
|
|
342
|
-
shx.cp(path.resolve(__dirname, '../../assets/penguins-ubiquity-installer.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
installerLink = 'penguins-krill.desktop';
|
|
346
|
-
shx.cp(path.resolve(__dirname, '../../assets/penguins-krill.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* flags
|
|
350
|
-
*/
|
|
351
|
-
// adapt
|
|
352
|
-
if (myAddons.adapt) {
|
|
353
|
-
const dirAddon = path.resolve(__dirname, '../../addons/eggs/adapt/');
|
|
354
|
-
shx.cp(`${dirAddon}/applications/eggs-adapt.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
355
|
-
}
|
|
356
|
-
// pve
|
|
357
|
-
if (myAddons.pve) {
|
|
358
|
-
/**
|
|
359
|
-
* create service pve-live
|
|
360
|
-
*/
|
|
361
|
-
const pve = new PveLive();
|
|
362
|
-
pve.create(this.settings.work_dir.merged);
|
|
363
|
-
/**
|
|
364
|
-
* adding a desktop link for pve
|
|
365
|
-
*/
|
|
366
|
-
const dirAddon = path.resolve(__dirname, '../../addons/eggs/pve');
|
|
367
|
-
shx.cp(`${dirAddon}/artwork/eggs-pve.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
|
|
368
|
-
shx.cp(`${dirAddon}/applications/eggs-pve.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
369
|
-
}
|
|
370
|
-
// rsupport
|
|
371
|
-
if (myAddons.rsupport) {
|
|
372
|
-
const dirAddon = path.resolve(__dirname, '../../addons/eggs/rsupport');
|
|
373
|
-
shx.cp(`${dirAddon}/applications/eggs-rsupport.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
374
|
-
shx.cp(`${dirAddon}/artwork/eggs-rsupport.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* configuro add-penguins-desktop-icons in /etc/xdg/autostart
|
|
378
|
-
*/
|
|
379
|
-
const dirAutostart = `${this.settings.work_dir.merged}/etc/xdg/autostart`;
|
|
380
|
-
if (fs.existsSync(dirAutostart)) {
|
|
381
|
-
// Creo l'avviatore xdg: DEVE essere add-penguins-links.desktop
|
|
382
|
-
shx.cp(path.resolve(__dirname, '../../assets/penguins-links-add.desktop'), dirAutostart);
|
|
383
|
-
// create /usr/bin/penguins-links-add.sh
|
|
384
|
-
const script = '/usr/bin/penguins-links-add.sh';
|
|
385
|
-
let text = '';
|
|
386
|
-
text += '#!/bin/sh\n';
|
|
387
|
-
text += 'DESKTOP=$(xdg-user-dir DESKTOP)\n';
|
|
388
|
-
text += 'while [ ! -d "$DESKTOP" ]; do\n';
|
|
389
|
-
text += ' DESKTOP=$(xdg-user-dir DESKTOP)\n';
|
|
390
|
-
text += ' sleep 1\n';
|
|
391
|
-
text += 'done\n';
|
|
392
|
-
text += `cp /usr/share/applications/${installerLink} "$DESKTOP"\n`;
|
|
393
|
-
if (Pacman.packageIsInstalled('lxde-core')) {
|
|
394
|
-
if (!noicons) {
|
|
395
|
-
text += this.lxdeLink('penguins-eggs.desktop', "Penguins' eggs", 'eggs');
|
|
396
|
-
}
|
|
397
|
-
if (myAddons.adapt)
|
|
398
|
-
text += this.lxdeLink('eggs-adapt.desktop', 'Adapt', 'video-display');
|
|
399
|
-
if (myAddons.pve)
|
|
400
|
-
text += this.lxdeLink('eggs-pve.desktop', 'Proxmox VE', 'proxmox-ve');
|
|
401
|
-
if (myAddons.rsupport)
|
|
402
|
-
text += this.lxdeLink('eggs-rsupport.desktop', 'Remote assistance', 'remote-assistance');
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
if (!noicons) {
|
|
406
|
-
text += 'cp /usr/share/applications/penguins-eggs.desktop "$DESKTOP"\n';
|
|
407
|
-
}
|
|
408
|
-
if (myLinks.length > 0) {
|
|
409
|
-
for (const link of myLinks) {
|
|
410
|
-
text += `cp /usr/share/applications/${link}.desktop "$DESKTOP"\n`;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
if (myAddons.adapt)
|
|
414
|
-
text += 'cp /usr/share/applications/eggs-adapt.desktop "$DESKTOP"\n';
|
|
415
|
-
if (myAddons.pve)
|
|
416
|
-
text += 'cp /usr/share/applications/eggs-pve.desktop "$DESKTOP"\n';
|
|
417
|
-
if (myAddons.rsupport)
|
|
418
|
-
text += 'cp /usr/share/applications/eggs-rsupport.desktop "$DESKTOP"\n';
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* enable desktop links
|
|
422
|
-
*/
|
|
423
|
-
if (Pacman.packageIsInstalled('gdm3') || Pacman.packageIsInstalled('gdm')) {
|
|
424
|
-
// GNOME
|
|
425
|
-
text += 'test -f /usr/share/applications/penguins-eggs.desktop && cp /usr/share/applications/penguins-eggs.desktop "$DESKTOP"\n';
|
|
426
|
-
text += 'test -f "$DESKTOP"/op && chmod a+x "$DESKTOP"/penguins-eggs.desktop\n';
|
|
427
|
-
text += 'test -f "$DESKTOP"/penguins-eggs.desktop && gio set "$DESKTOP"/penguins-eggs.desktop metadata::trusted true\n';
|
|
428
|
-
text += `test -f /usr/share/applications/${installerLink} && cp /usr/share/applications/${installerLink} "$DESKTOP"\n`;
|
|
429
|
-
text += `test -f "$DESKTOP"/${installerLink} && chmod a+x "$DESKTOP"/${installerLink}\n`;
|
|
430
|
-
text += `test -f "$DESKTOP"/${installerLink} && gio set "$DESKTOP"/${installerLink} metadata::trusted true\n`;
|
|
431
|
-
}
|
|
432
|
-
else if (Pacman.packageIsInstalled('xfce4-session')) {
|
|
433
|
-
text += `# xfce: enable-desktop-links\n`;
|
|
434
|
-
text += `for f in "$DESKTOP"/*.desktop; do chmod +x "$f"; gio set -t string "$f" metadata::xfce-exe-checksum "$(sha256sum "$f" | awk '{print $1}')"; done\n`;
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
text += `# others: enable-desktop-links\n`;
|
|
438
|
-
text += 'chmod +x "$DESKTOP"/*.desktop\n';
|
|
439
|
-
}
|
|
440
|
-
fs.writeFileSync(script, text, 'utf8');
|
|
441
|
-
await exec(`chmod a+x ${script}`, this.echo);
|
|
442
|
-
}
|
|
443
|
-
await Xdg.autologin(await Utils.getPrimaryUser(), this.settings.config.user_opt, this.settings.work_dir.merged);
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* editLiveFs
|
|
447
|
-
* - Truncate logs, remove archived log
|
|
448
|
-
* - Allow all fixed drives to be mounted with pmount
|
|
449
|
-
* - Enable or disable password login trhough ssh for users (not root)
|
|
450
|
-
* - Create an empty /etc/fstab
|
|
451
|
-
* - Blanck /etc/machine-id
|
|
452
|
-
* - Add some basic files to /dev
|
|
453
|
-
* - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
|
|
454
|
-
*/
|
|
455
|
-
async editLiveFs(clone = false, cryptedclone = false) {
|
|
456
|
-
if (this.verbose) {
|
|
457
|
-
console.log('Ovary: editLiveFs');
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* /etc/penguins-eggs.d/is_clone file created on live
|
|
461
|
-
*/
|
|
462
|
-
if (clone) {
|
|
463
|
-
await exec(`touch ${this.settings.work_dir.merged}/etc/penguins-eggs.d/is_clone`, this.echo);
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* /etc/penguins-eggs.d/is_crypted_clone file created on live
|
|
467
|
-
*/
|
|
468
|
-
if (cryptedclone) {
|
|
469
|
-
await exec(`touch ${this.settings.work_dir.merged}/etc/penguins-eggs.d/is_crypted_clone`, this.echo);
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* /etc/default/epoptes-client created on live
|
|
473
|
-
*/
|
|
474
|
-
if (Pacman.packageIsInstalled('epoptes')) {
|
|
475
|
-
const file = `${this.settings.work_dir.merged}/etc/default/epoptes-client`;
|
|
476
|
-
const text = `SERVER=${os.hostname}.local\n`;
|
|
477
|
-
fs.writeFileSync(file, text);
|
|
478
|
-
}
|
|
479
|
-
if (this.familyId === 'debian') {
|
|
480
|
-
// Aggiungo UMASK=0077 in /etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf
|
|
481
|
-
const text = 'UMASK=0077\n';
|
|
482
|
-
const file = '/etc/initramfs-tools/conf.d/eggs-safe-initramfs.conf';
|
|
483
|
-
Utils.write(file, text);
|
|
484
|
-
}
|
|
485
|
-
// Truncate logs, remove archived logs.
|
|
486
|
-
let cmd = `find ${this.settings.work_dir.merged}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
|
|
487
|
-
await exec(cmd, this.echo);
|
|
488
|
-
cmd = `find ${this.settings.work_dir.merged}/var/log/ -type f -exec truncate -s 0 {} \\;`;
|
|
489
|
-
await exec(cmd, this.echo);
|
|
490
|
-
// Allow all fixed drives to be mounted with pmount
|
|
491
|
-
if (this.settings.config.pmount_fixed && fs.existsSync(`${this.settings.work_dir.merged}/etc/pmount.allow`)) {
|
|
492
|
-
// MX aggiunto /etc
|
|
493
|
-
await exec(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${this.settings.work_dir.merged}/etc/pmount.allow`, this.echo);
|
|
494
|
-
}
|
|
495
|
-
// Remove obsolete live-config file
|
|
496
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}lib/live/config/1161-openssh-server`)) {
|
|
497
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/lib/live/config/1161-openssh-server`, this.echo);
|
|
498
|
-
}
|
|
499
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/ssh/sshd_config`)) {
|
|
500
|
-
/**
|
|
501
|
-
* enable/disable SSH root/users password login
|
|
502
|
-
*/
|
|
503
|
-
await exec(`sed -i '/PermitRootLogin/d' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`);
|
|
504
|
-
await exec(`sed -i '/PasswordAuthentication/d' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`);
|
|
505
|
-
if (this.settings.config.ssh_pass) {
|
|
506
|
-
await exec(`echo 'PasswordAuthentication yes' | tee -a ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
await exec(`echo 'PermitRootLogin prohibit-password' | tee -a ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
510
|
-
await exec(`echo 'PasswordAuthentication no' | tee -a ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* ufw --force reset
|
|
515
|
-
*/
|
|
516
|
-
// if (Pacman.packageIsInstalled('ufw')) {
|
|
517
|
-
// await exec('ufw --force reset')
|
|
518
|
-
// }
|
|
519
|
-
/**
|
|
520
|
-
* /etc/fstab should exist, even if it's empty,
|
|
521
|
-
* to prevent error messages at boot
|
|
522
|
-
*/
|
|
523
|
-
await exec(`rm ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
524
|
-
await exec(`touch ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
525
|
-
/**
|
|
526
|
-
* Remove crypttab if exists
|
|
527
|
-
* this is crucial for tpm systems.
|
|
528
|
-
*/
|
|
529
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/crypttab`)) {
|
|
530
|
-
await exec(`rm ${this.settings.work_dir.merged}/etc/crypttab`, this.echo);
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Blank out systemd machine id.
|
|
534
|
-
* If it does not exist, systemd-journald will fail,
|
|
535
|
-
* but if it exists and is empty, systemd will automatically
|
|
536
|
-
* set up a new unique ID.
|
|
537
|
-
*/
|
|
538
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/machine-id`)) {
|
|
539
|
-
await exec(`rm ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
540
|
-
await exec(`touch ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
541
|
-
Utils.write(`${this.settings.work_dir.merged}/etc/machine-id`, ':');
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* LMDE4: utilizza UbuntuMono16.pf2
|
|
545
|
-
* aggiungo un link a /boot/grub/fonts/UbuntuMono16.pf2
|
|
546
|
-
*/
|
|
547
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}/boot/grub/fonts/unicode.pf2`)) {
|
|
548
|
-
shx.cp(`${this.settings.work_dir.merged}/boot/grub/fonts/unicode.pf2`, `${this.settings.work_dir.merged}/boot/grub/fonts/UbuntuMono16.pf2`);
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* cleaning /etc/resolv.conf
|
|
552
|
-
*/
|
|
553
|
-
const resolvFile = `${this.settings.work_dir.merged}/etc/resolv.conf`;
|
|
554
|
-
shx.rm(resolvFile);
|
|
555
|
-
/**
|
|
556
|
-
* Per tutte le distro systemd
|
|
557
|
-
*/
|
|
558
|
-
if (Utils.isSystemd()) {
|
|
559
|
-
const systemdctl = new Systemctl(this.verbose);
|
|
560
|
-
/**
|
|
561
|
-
* systemd-systemd-resolved
|
|
562
|
-
*/
|
|
563
|
-
let resolvContent = '';
|
|
564
|
-
if (await systemdctl.isActive('systemd-resolved.service')) {
|
|
565
|
-
await systemdctl.stop('systemd-resolved.service');
|
|
566
|
-
resolvContent = 'nameserver 127.0.0.53\noptions edns0 trust-ad\nsearch .\n';
|
|
567
|
-
}
|
|
568
|
-
fs.writeFileSync(resolvFile, resolvContent);
|
|
569
|
-
if (await systemdctl.isEnabled('systemd-networkd.service')) {
|
|
570
|
-
await systemdctl.disable('systemd-networkd.service', this.settings.work_dir.merged, true);
|
|
571
|
-
}
|
|
572
|
-
if (await systemdctl.isEnabled('remote-cryptsetup.target')) {
|
|
573
|
-
await systemdctl.disable('remote-cryptsetup.target', this.settings.work_dir.merged, true);
|
|
574
|
-
}
|
|
575
|
-
if (await systemdctl.isEnabled('speech-dispatcherd.service')) {
|
|
576
|
-
await systemdctl.disable('speech-dispatcherd.service', this.settings.work_dir.merged, true);
|
|
577
|
-
}
|
|
578
|
-
if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service')) {
|
|
579
|
-
await systemdctl.disable('wpa_supplicant-nl80211@.service', this.settings.work_dir.merged, true);
|
|
580
|
-
}
|
|
581
|
-
if (await systemdctl.isEnabled('wpa_supplicant@.service')) {
|
|
582
|
-
await systemdctl.disable('wpa_supplicant@.service', this.settings.work_dir.merged, true);
|
|
583
|
-
}
|
|
584
|
-
if (await systemdctl.isEnabled('wpa_supplicant-wired@.service')) {
|
|
585
|
-
await systemdctl.disable('wpa_supplicant-wired@.service', this.settings.work_dir.merged, true);
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* All systemd distros rm
|
|
589
|
-
*/
|
|
590
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/var/lib/wicd/configurations/*`, this.echo);
|
|
591
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/wicd/wireless-settings.conf`, this.echo);
|
|
592
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/NetworkManager/system-connections/*`, this.echo);
|
|
593
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/wifi/*`, this.echo);
|
|
594
|
-
/**
|
|
595
|
-
* removing from /etc/network/:
|
|
596
|
-
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
597
|
-
*/
|
|
598
|
-
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
599
|
-
let cleanDir = '';
|
|
600
|
-
for (cleanDir of cleanDirs) {
|
|
601
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/${cleanDir}/wpasupplicant`, this.echo);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Clear configs from /etc/network/interfaces, wicd and NetworkManager
|
|
606
|
-
* and netman, so they aren't stealthily included in the snapshot.
|
|
607
|
-
*/
|
|
608
|
-
if (this.familyId === 'debian') {
|
|
609
|
-
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/network/interfaces`)) {
|
|
610
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/interfaces`, this.echo);
|
|
611
|
-
Utils.write(`${this.settings.work_dir.merged}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* add some basic files to /dev
|
|
615
|
-
*/
|
|
616
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/console`)) {
|
|
617
|
-
await exec(`mknod -m 622 ${this.settings.work_dir.merged}/dev/console c 5 1`, this.echo);
|
|
618
|
-
}
|
|
619
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/null`)) {
|
|
620
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/null c 1 3`, this.echo);
|
|
621
|
-
}
|
|
622
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/zero`)) {
|
|
623
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/zero c 1 5`, this.echo);
|
|
624
|
-
}
|
|
625
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/ptmx`)) {
|
|
626
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/ptmx c 5 2`, this.echo);
|
|
627
|
-
}
|
|
628
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/tty`)) {
|
|
629
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/tty c 5 0`, this.echo);
|
|
630
|
-
}
|
|
631
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/random`)) {
|
|
632
|
-
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, this.echo);
|
|
633
|
-
}
|
|
634
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/urandom`)) {
|
|
635
|
-
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, this.echo);
|
|
636
|
-
}
|
|
637
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`)) {
|
|
638
|
-
await exec(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, this.echo);
|
|
639
|
-
}
|
|
640
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/fd`)) {
|
|
641
|
-
await exec(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, this.echo);
|
|
642
|
-
}
|
|
643
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdin`)) {
|
|
644
|
-
await exec(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, this.echo);
|
|
645
|
-
}
|
|
646
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdout`)) {
|
|
647
|
-
await exec(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, this.echo);
|
|
648
|
-
}
|
|
649
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stderr`)) {
|
|
650
|
-
await exec(`ln -sv /proc/self/fd/2 ${this.settings.work_dir.merged}/dev/stderr`, this.echo);
|
|
651
|
-
}
|
|
652
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/core`)) {
|
|
653
|
-
await exec(`ln -sv /proc/kcore ${this.settings.work_dir.merged}/dev/core`, this.echo);
|
|
654
|
-
}
|
|
655
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
656
|
-
await exec(`mkdir -v ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
657
|
-
}
|
|
658
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/pts`)) {
|
|
659
|
-
await exec(`mkdir -v ${this.settings.work_dir.merged}/dev/pts`, this.echo);
|
|
660
|
-
}
|
|
661
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
662
|
-
await exec(`chmod 1777 ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
663
|
-
}
|
|
664
|
-
/**
|
|
665
|
-
* creo /tmp
|
|
666
|
-
*/
|
|
667
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/tmp`)) {
|
|
668
|
-
await exec(`mkdir ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Assegno 1777 a /tmp creava problemi con MXLINUX
|
|
672
|
-
*/
|
|
673
|
-
await exec(`chmod 1777 ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* @returns {boolean} success
|
|
678
|
-
*/
|
|
679
|
-
async fertilization(snapshot_prefix = '', snapshot_basename = '', theme = '', compression = '', nointeratctive = false) {
|
|
680
|
-
this.settings = new Settings();
|
|
681
|
-
if (await this.settings.load()) {
|
|
682
|
-
await this.settings.loadRemix(this.theme);
|
|
683
|
-
this.volid = Utils.getVolid(this.settings.remix.name);
|
|
684
|
-
this.familyId = this.settings.distro.familyId;
|
|
685
|
-
this.nest = this.settings.config.snapshot_mnt;
|
|
686
|
-
if (snapshot_prefix !== '') {
|
|
687
|
-
this.settings.config.snapshot_prefix = snapshot_prefix;
|
|
688
|
-
}
|
|
689
|
-
if (snapshot_basename !== '') {
|
|
690
|
-
this.settings.config.snapshot_basename = snapshot_basename;
|
|
691
|
-
}
|
|
692
|
-
if (theme !== '') {
|
|
693
|
-
this.theme = theme;
|
|
694
|
-
}
|
|
695
|
-
if (compression !== '') {
|
|
696
|
-
this.settings.config.compression = compression;
|
|
697
|
-
}
|
|
698
|
-
if (!nointeratctive) {
|
|
699
|
-
return true;
|
|
700
|
-
}
|
|
701
|
-
this.settings.listFreeSpace();
|
|
702
|
-
if (await Utils.customConfirm('Select yes to continue...')) {
|
|
703
|
-
return true;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return false;
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* finished = show the results
|
|
710
|
-
* @param scriptOnly
|
|
711
|
-
*/
|
|
712
|
-
finished(scriptOnly = false) {
|
|
713
|
-
Utils.titles('produce');
|
|
714
|
-
if (scriptOnly) {
|
|
715
|
-
console.log('eggs is finished!\n\nYou can find the scripts to build iso: ' + chalk.cyanBright(this.settings.isoFilename) + '\nin the ovarium: ' + chalk.cyanBright(this.settings.config.snapshot_dir) + '.');
|
|
716
|
-
console.log('usage');
|
|
717
|
-
console.log(chalk.cyanBright(`cd ${this.settings.config.snapshot_dir}`));
|
|
718
|
-
console.log(chalk.cyanBright('sudo ./bind'));
|
|
719
|
-
console.log('Make all yours modifications in the directories filesystem.squashfs and iso.');
|
|
720
|
-
console.log('After when you are ready:');
|
|
721
|
-
console.log(chalk.cyanBright('sudo ./mksquashfs'));
|
|
722
|
-
console.log(chalk.cyanBright('sudo ./mkisofs'));
|
|
723
|
-
console.log(chalk.cyanBright('sudo ./ubind'));
|
|
724
|
-
console.log('happy hacking!');
|
|
725
|
-
}
|
|
726
|
-
else {
|
|
727
|
-
console.log('eggs is finished!\n\nYou can find the file iso: ' + chalk.cyanBright(this.settings.isoFilename) + '\nin the nest: ' + chalk.cyanBright(this.settings.config.snapshot_dir) + '.');
|
|
728
|
-
}
|
|
729
|
-
console.log();
|
|
730
|
-
console.log('Remember, on liveCD user = ' + chalk.cyanBright(this.settings.config.user_opt) + '/' + chalk.cyanBright(this.settings.config.user_opt_passwd));
|
|
731
|
-
console.log(' root = ' + chalk.cyanBright('root') + '/' + chalk.cyanBright(this.settings.config.root_passwd));
|
|
732
|
-
if (this.genisoimage) {
|
|
733
|
-
console.log(`Note: format UDF, generated by ${chalk.cyanBright('genisoimage')}`);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* mkinitfs()
|
|
738
|
-
*/
|
|
739
|
-
async initrdAlpine() {
|
|
740
|
-
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} Alpine on ISO/live`);
|
|
741
|
-
const sidecar = path.resolve(__dirname, `../../mkinitfs/initramfs-init.in`);
|
|
742
|
-
Utils.warning(`Adding ${sidecar} to /usr/share/mkinitfs/initramfs-init`);
|
|
743
|
-
await exec(`cp ${sidecar} /usr/share/mkinitfs/initramfs-init`);
|
|
744
|
-
let initrdImg = Utils.initrdImg();
|
|
745
|
-
initrdImg = initrdImg.slice(Math.max(0, initrdImg.lastIndexOf('/') + 1));
|
|
746
|
-
const pathConf = path.resolve(__dirname, `../../mkinitfs/live.conf`);
|
|
747
|
-
await exec(`mkinitfs -c ${pathConf} -o ${this.settings.iso_work}live/${initrdImg}`, Utils.setEcho(true));
|
|
748
|
-
}
|
|
749
|
-
/**
|
|
750
|
-
* mkinitcpio()
|
|
751
|
-
*/
|
|
752
|
-
async initrdArch() {
|
|
753
|
-
let initrdImg = Utils.initrdImg();
|
|
754
|
-
initrdImg = initrdImg.slice(Math.max(0, initrdImg.lastIndexOf('/') + 1));
|
|
755
|
-
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} using mkinitcpio on ISO/live`);
|
|
756
|
-
const { distroId } = this.settings.distro;
|
|
757
|
-
let dirConf = 'arch';
|
|
758
|
-
if (Diversions.isManjaroBased(distroId)) {
|
|
759
|
-
dirConf = 'manjaro';
|
|
760
|
-
if (distroId === "Biglinux" || distroId === "Bigcommunity") {
|
|
761
|
-
dirConf = 'biglinux';
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
const pathConf = path.resolve(__dirname, `../../mkinitcpio/${dirConf}/live.conf`);
|
|
765
|
-
await exec(`mkinitcpio -c ${pathConf} -g ${this.settings.iso_work}live/${initrdImg}`, this.echo);
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* mkinitramfs() Debian
|
|
769
|
-
*/
|
|
770
|
-
async initrdDebian(verbose = false) {
|
|
771
|
-
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} using mkinitramfs on ISO/live`);
|
|
772
|
-
let isCrypted = false;
|
|
773
|
-
if (fs.existsSync('/etc/crypttab')) {
|
|
774
|
-
isCrypted = true;
|
|
775
|
-
await exec('mv /etc/crypttab /etc/crypttab.saved', this.echo);
|
|
776
|
-
}
|
|
777
|
-
await exec(`mkinitramfs -o ${this.settings.iso_work}/live/initrd.img-$(uname -r) ${this.toNull}`, this.echo);
|
|
778
|
-
if (isCrypted) {
|
|
779
|
-
await exec('mv /etc/crypttab.saved /etc/crypttab', this.echo);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* dracut() Fedora/Openmamba/Opensuse/Voidlinux
|
|
784
|
-
*/
|
|
785
|
-
async initrdDracut() {
|
|
786
|
-
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} using dracut on ISO/live`);
|
|
787
|
-
const kernelVersion = shx.exec('uname -r', { silent: true }).stdout.trim();
|
|
788
|
-
const confdir = path.resolve(__dirname, `../../dracut/dracut.conf.d`);
|
|
789
|
-
await exec(`dracut --confdir ${confdir} ${this.settings.iso_work}live/${this.settings.initrdImg}`, this.echo);
|
|
790
|
-
}
|
|
791
|
-
/**
|
|
792
|
-
* syslinux: da syspath
|
|
793
|
-
*/
|
|
794
|
-
async syslinux(theme = 'eggs') {
|
|
795
|
-
let syspath = path.resolve(__dirname, `../../syslinux`);
|
|
796
|
-
await exec(`cp ${syspath}/chain.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
|
|
797
|
-
await exec(`cp ${syspath}/isohdpfx.bin ${this.settings.iso_work}/isolinux/`, this.echo);
|
|
798
|
-
// just fo x64 arch
|
|
799
|
-
await exec(`cp ${syspath}/isolinux.bin ${this.settings.iso_work}/isolinux/`, this.echo);
|
|
800
|
-
await exec(`cp ${syspath}/ldlinux.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
|
|
801
|
-
await exec(`cp ${syspath}/libcom32.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
|
|
802
|
-
await exec(`cp ${syspath}/libutil.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
|
|
803
|
-
await exec(`cp ${syspath}/vesamenu.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
|
|
804
|
-
const isolinuxThemeDest = this.settings.iso_work + 'isolinux/isolinux.theme.cfg';
|
|
805
|
-
let isolinuxThemeSrc = path.resolve(__dirname, `../../addons/${theme}/theme/livecd/isolinux.theme.cfg`);
|
|
806
|
-
if (this.theme.includes('/')) {
|
|
807
|
-
isolinuxThemeSrc = `${theme}/theme/livecd/isolinux.theme.cfg`;
|
|
808
|
-
}
|
|
809
|
-
if (!fs.existsSync(isolinuxThemeSrc)) {
|
|
810
|
-
Utils.warning('Cannot find: ' + isolinuxThemeSrc);
|
|
811
|
-
process.exit();
|
|
812
|
-
}
|
|
813
|
-
fs.copyFileSync(isolinuxThemeSrc, isolinuxThemeDest);
|
|
814
|
-
/**
|
|
815
|
-
* isolinux.cfg from isolinux.main.cfg
|
|
816
|
-
*/
|
|
817
|
-
const isolinuxDest = `${this.settings.iso_work}/isolinux/isolinux.cfg`;
|
|
818
|
-
this.settings.iso_work + 'isolinux/isolinux.cfg';
|
|
819
|
-
let isolinuxTemplate = `${theme}/theme/livecd/isolinux.main.cfg`;
|
|
820
|
-
if (!fs.existsSync(isolinuxTemplate)) {
|
|
821
|
-
isolinuxTemplate = path.resolve(__dirname, '../../addons/eggs/theme/livecd/isolinux.main.cfg');
|
|
822
|
-
}
|
|
823
|
-
if (!fs.existsSync(isolinuxTemplate)) {
|
|
824
|
-
Utils.warning('Cannot find: ' + isolinuxTemplate);
|
|
825
|
-
process.exit();
|
|
826
|
-
}
|
|
827
|
-
const kernel_parameters = Diversions.kernelParameters(this.familyId, this.volid); // this.kernelParameters()
|
|
828
|
-
const template = fs.readFileSync(isolinuxTemplate, 'utf8');
|
|
829
|
-
const view = {
|
|
830
|
-
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
831
|
-
initrdImg: `/live${this.settings.initrdImg}`,
|
|
832
|
-
kernel: Utils.kernelVersion(),
|
|
833
|
-
kernel_parameters,
|
|
834
|
-
vmlinuz: `/live${this.settings.vmlinuz}`
|
|
835
|
-
};
|
|
836
|
-
fs.writeFileSync(isolinuxDest, mustache.render(template, view));
|
|
837
|
-
/**
|
|
838
|
-
* splash
|
|
839
|
-
*/
|
|
840
|
-
const splashDest = `${this.settings.iso_work}/isolinux/splash.png`;
|
|
841
|
-
let splashSrc = path.resolve(__dirname, `../../addons/${theme}/theme/livecd/splash.png`);
|
|
842
|
-
if (this.theme.includes('/')) {
|
|
843
|
-
splashSrc = path.resolve(`${theme}/theme/livecd/splash.png`);
|
|
844
|
-
}
|
|
845
|
-
if (!fs.existsSync(splashSrc)) {
|
|
846
|
-
Utils.warning('Cannot find: ' + splashSrc);
|
|
847
|
-
process.exit();
|
|
848
|
-
}
|
|
849
|
-
fs.copyFileSync(splashSrc, splashDest);
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* kernelCopy
|
|
853
|
-
*/
|
|
854
|
-
async kernelCopy() {
|
|
855
|
-
Utils.warning(`copying ${path.basename(this.settings.kernel_image)} on ISO/live`);
|
|
856
|
-
let lackVmlinuzImage = false;
|
|
857
|
-
if (fs.existsSync(this.settings.kernel_image)) {
|
|
858
|
-
await exec(`cp ${this.settings.kernel_image} ${this.settings.iso_work}live/`, this.echo);
|
|
859
|
-
}
|
|
860
|
-
else {
|
|
861
|
-
Utils.error(`Cannot find ${this.settings.kernel_image}`);
|
|
862
|
-
lackVmlinuzImage = true;
|
|
863
|
-
}
|
|
864
|
-
if (lackVmlinuzImage) {
|
|
865
|
-
Utils.warning('Try to edit /etc/penguins-eggs.d/eggs.yaml and check for');
|
|
866
|
-
Utils.warning(`vmlinuz: ${this.settings.kernel_image}`);
|
|
867
|
-
process.exit(1);
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
* Crea la struttura della workdir
|
|
872
|
-
*/
|
|
873
|
-
async liveCreateStructure() {
|
|
874
|
-
if (this.verbose) {
|
|
875
|
-
console.log('Ovary: liveCreateStructure');
|
|
876
|
-
}
|
|
877
|
-
Utils.warning(`creating egg in ${this.settings.config.snapshot_dir}`);
|
|
878
|
-
let cmd;
|
|
879
|
-
if (!fs.existsSync(this.settings.config.snapshot_dir)) {
|
|
880
|
-
cmd = `mkdir -p ${this.settings.config.snapshot_dir}`;
|
|
881
|
-
this.tryCatch(cmd);
|
|
882
|
-
}
|
|
883
|
-
if (!fs.existsSync(this.settings.config.snapshot_dir + '/README.md')) {
|
|
884
|
-
cmd = `cp ${path.resolve(__dirname, '../../conf/README.md')} ${this.settings.config.snapshot_dir}README.md`;
|
|
885
|
-
this.tryCatch(cmd);
|
|
886
|
-
}
|
|
887
|
-
// Ovarium
|
|
888
|
-
if (!fs.existsSync(this.settings.work_dir.ovarium)) {
|
|
889
|
-
cmd = `mkdir -p ${this.settings.work_dir.ovarium}`;
|
|
890
|
-
this.tryCatch(cmd);
|
|
891
|
-
}
|
|
892
|
-
if (!fs.existsSync(this.settings.work_dir.lowerdir)) {
|
|
893
|
-
cmd = `mkdir -p ${this.settings.work_dir.lowerdir}`;
|
|
894
|
-
this.tryCatch(cmd);
|
|
895
|
-
}
|
|
896
|
-
if (!fs.existsSync(this.settings.work_dir.upperdir)) {
|
|
897
|
-
cmd = `mkdir -p ${this.settings.work_dir.upperdir}`;
|
|
898
|
-
this.tryCatch(cmd);
|
|
899
|
-
}
|
|
900
|
-
if (!fs.existsSync(this.settings.work_dir.workdir)) {
|
|
901
|
-
cmd = `mkdir -p ${this.settings.work_dir.workdir}`;
|
|
902
|
-
this.tryCatch(cmd);
|
|
903
|
-
}
|
|
904
|
-
if (!fs.existsSync(this.settings.work_dir.merged)) {
|
|
905
|
-
cmd = `mkdir -p ${this.settings.work_dir.merged}`;
|
|
906
|
-
this.tryCatch(cmd);
|
|
907
|
-
}
|
|
908
|
-
/**
|
|
909
|
-
* Creo le directory di destinazione per boot, efi, isolinux e live
|
|
910
|
-
*/
|
|
911
|
-
if (!fs.existsSync(this.settings.iso_work)) {
|
|
912
|
-
cmd = `mkdir -p ${this.settings.iso_work}boot/grub/${Utils.uefiFormat()}`;
|
|
913
|
-
this.tryCatch(cmd);
|
|
914
|
-
cmd = `mkdir -p ${this.settings.iso_work}isolinux`;
|
|
915
|
-
this.tryCatch(cmd);
|
|
916
|
-
cmd = `mkdir -p ${this.settings.iso_work}live`;
|
|
917
|
-
this.tryCatch(cmd);
|
|
918
|
-
}
|
|
919
|
-
// ln iso
|
|
920
|
-
cmd = `ln -s ${this.settings.iso_work} ${this.settings.config.snapshot_dir}/iso`;
|
|
921
|
-
this.tryCatch(cmd);
|
|
922
|
-
// ln livefs
|
|
923
|
-
cmd = `ln -s ${this.settings.work_dir.merged} ${this.settings.config.snapshot_dir}/livefs`;
|
|
924
|
-
this.tryCatch(cmd);
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* makeDotDisk
|
|
928
|
-
*/
|
|
929
|
-
makeDotDisk(info = '', mksquashfs = '', mkisofs = '') {
|
|
930
|
-
if (this.verbose) {
|
|
931
|
-
console.log('Ovary: makeDotDisk');
|
|
932
|
-
}
|
|
933
|
-
const dotDisk = this.settings.iso_work + '.disk';
|
|
934
|
-
if (fs.existsSync(dotDisk)) {
|
|
935
|
-
shx.rm('-rf', dotDisk);
|
|
936
|
-
}
|
|
937
|
-
shx.mkdir('-p', dotDisk);
|
|
938
|
-
let text = `# Created at: ${Utils.formatDate(new Date())}\n`;
|
|
939
|
-
text += `# penguins_eggs v. ${Utils.getPackageVersion()}\n`;
|
|
940
|
-
// .disk/info
|
|
941
|
-
fs.writeFileSync(dotDisk + '/info', text, 'utf-8');
|
|
942
|
-
// .disk/mksquashfs
|
|
943
|
-
fs.writeFileSync(dotDisk + '/mksquashfs', text + mksquashfs, 'utf-8');
|
|
944
|
-
// .disk/mkisofs
|
|
945
|
-
fs.writeFileSync(dotDisk + '/mkisofs', text + mkisofs, 'utf-8');
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* makeEFI
|
|
949
|
-
*/
|
|
950
|
-
async makeEfi(theme = 'eggs') {
|
|
951
|
-
if (this.verbose) {
|
|
952
|
-
console.log('Ovary: makeEfi');
|
|
953
|
-
}
|
|
954
|
-
const memdiskDir = this.settings.config.snapshot_mnt + 'memdiskDir';
|
|
955
|
-
const efiWorkDir = this.settings.efi_work;
|
|
956
|
-
const isoDir = this.settings.iso_work;
|
|
957
|
-
/**
|
|
958
|
-
* il pachetto grub/grub2 DEVE essere presente
|
|
959
|
-
*/
|
|
960
|
-
const grubName = Diversions.grubName(this.familyId);
|
|
961
|
-
if (grubName === '') {
|
|
962
|
-
Utils.error('Something went wrong! Cannot find grub.');
|
|
963
|
-
process.exit(1);
|
|
964
|
-
}
|
|
965
|
-
/**
|
|
966
|
-
* Creo o cancello e creo: memdiskDir
|
|
967
|
-
*/
|
|
968
|
-
if (fs.existsSync(memdiskDir)) {
|
|
969
|
-
await exec(`rm ${memdiskDir} -rf`, this.echo);
|
|
970
|
-
}
|
|
971
|
-
Utils.warning('creating temporary memdiskDir on ' + memdiskDir);
|
|
972
|
-
await exec(`mkdir ${memdiskDir}`);
|
|
973
|
-
await exec(`mkdir ${memdiskDir}/boot`, this.echo);
|
|
974
|
-
await exec(`mkdir ${memdiskDir}/boot/grub`, this.echo);
|
|
975
|
-
/**
|
|
976
|
-
* for initial grub.cfg in memdisk
|
|
977
|
-
*/
|
|
978
|
-
const grubCfg = `${memdiskDir}/boot/grub/grub.cfg`;
|
|
979
|
-
let text = '';
|
|
980
|
-
text += 'search --file --set=root /.disk/info\n';
|
|
981
|
-
text += 'set prefix=($root)/boot/grub\n';
|
|
982
|
-
text += `source $prefix/${Utils.uefiFormat()}/grub.cfg\n`;
|
|
983
|
-
Utils.write(grubCfg, text);
|
|
984
|
-
// #################################
|
|
985
|
-
/**
|
|
986
|
-
* start with empty efiWorkDir
|
|
987
|
-
*/
|
|
988
|
-
if (fs.existsSync(efiWorkDir)) {
|
|
989
|
-
await exec(`rm ${efiWorkDir} -rf`, this.echo);
|
|
990
|
-
}
|
|
991
|
-
Utils.warning('creating temporary efiWordDir on ' + efiWorkDir);
|
|
992
|
-
await exec(`mkdir ${efiWorkDir}`, this.echo);
|
|
993
|
-
await exec(`mkdir ${efiWorkDir}boot`, this.echo);
|
|
994
|
-
await exec(`mkdir ${efiWorkDir}boot/grub`, this.echo);
|
|
995
|
-
await exec(`mkdir ${efiWorkDir}boot/grub/${Utils.uefiFormat()}`, this.echo);
|
|
996
|
-
await exec(`mkdir ${efiWorkDir}EFI`, this.echo);
|
|
997
|
-
await exec(`mkdir ${efiWorkDir}EFI/BOOT`, this.echo);
|
|
998
|
-
/**
|
|
999
|
-
* copy splash to efiWorkDir
|
|
1000
|
-
*/
|
|
1001
|
-
const splashDest = `${efiWorkDir}boot/grub/splash.png`;
|
|
1002
|
-
let splashSrc = path.resolve(__dirname, `../../addons/${theme}/theme/livecd/splash.png`);
|
|
1003
|
-
if (this.theme.includes('/')) {
|
|
1004
|
-
splashSrc = `${theme}/theme/livecd/splash.png`;
|
|
1005
|
-
}
|
|
1006
|
-
if (!fs.existsSync(splashSrc)) {
|
|
1007
|
-
Utils.warning('Cannot find: ' + splashSrc);
|
|
1008
|
-
process.exit();
|
|
1009
|
-
}
|
|
1010
|
-
await exec(`cp ${splashSrc} ${splashDest}`, this.echo);
|
|
1011
|
-
/**
|
|
1012
|
-
* copy theme
|
|
1013
|
-
*/
|
|
1014
|
-
const themeDest = `${efiWorkDir}boot/grub/theme.cfg`;
|
|
1015
|
-
let themeSrc = path.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.theme.cfg`);
|
|
1016
|
-
if (this.theme.includes('/')) {
|
|
1017
|
-
themeSrc = `${theme}/theme/livecd/grub.theme.cfg`;
|
|
1018
|
-
}
|
|
1019
|
-
if (!fs.existsSync(themeSrc)) {
|
|
1020
|
-
Utils.warning('Cannot find: ' + themeSrc);
|
|
1021
|
-
process.exit();
|
|
1022
|
-
}
|
|
1023
|
-
await exec(`cp ${themeSrc} ${themeDest}`, this.echo);
|
|
1024
|
-
/**
|
|
1025
|
-
* second grub.cfg file in efiWork
|
|
1026
|
-
*/
|
|
1027
|
-
// for i in $(ls /usr/lib/grub/x86_64-efi |grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg; done
|
|
1028
|
-
//let cmd = `for i in $(ls /usr/lib/grub/${Utils.uefiFormat()}|grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> ${efiWorkDir}boot/grub/${Utils.uefiFormat()}/grub.cfg; done`
|
|
1029
|
-
let cmd = `for i in $(ls /usr/lib/grub/${Utils.uefiFormat()}|grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> ${efiWorkDir}boot/grub/${Utils.uefiFormat()}/grub.cfg; done`;
|
|
1030
|
-
await exec(cmd, this.echo);
|
|
1031
|
-
// cmd = `for i in efi_gop efi_uga ieee1275_fb vbe vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> ${efiWorkDir}boot/grub/${Utils.uefiFormat()}/grub.cfg ; done`
|
|
1032
|
-
// not find: ieee1275_fb.mod vbe.mod vga.mod
|
|
1033
|
-
cmd = `for i in efi_gop efi_uga vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> ${efiWorkDir}boot/grub/${Utils.uefiFormat()}/grub.cfg ; done`;
|
|
1034
|
-
await exec(cmd, this.echo);
|
|
1035
|
-
await exec(`echo "source /boot/grub/grub.cfg" >> ${efiWorkDir}boot/grub/${Utils.uefiFormat()}/grub.cfg`, this.echo);
|
|
1036
|
-
/**
|
|
1037
|
-
* andiamo in memdiskDir
|
|
1038
|
-
*/
|
|
1039
|
-
/**
|
|
1040
|
-
* make a tarred "memdisk" to embed in the grub image
|
|
1041
|
-
*
|
|
1042
|
-
* NOTE: it's CRUCIAL to chdir before tar!!!
|
|
1043
|
-
*/
|
|
1044
|
-
const currentDir = process.cwd();
|
|
1045
|
-
process.chdir(memdiskDir);
|
|
1046
|
-
await exec('tar -cvf memdisk boot', this.echo);
|
|
1047
|
-
process.chdir(currentDir);
|
|
1048
|
-
// -O, --format=FORMAT
|
|
1049
|
-
// -m --memdisk=FILE embed FILE as a memdisk image
|
|
1050
|
-
// -o, --output=FILE embed FILE as a memdisk image
|
|
1051
|
-
// -p, --prefix=DIR set prefix directory
|
|
1052
|
-
// --format=x86_64-efi --memdisk=memdisk --output=bootx64.efi --prefix?DIR set prefix directory
|
|
1053
|
-
// grub-mkimage -O "x86_64-efi" -m "memdisk" -o "bootx64.efi" -p '(memdisk)/boot/grub' search iso9660 configfile normal memdisk tar cat part_msdos part_gpt fat ext2 ntfs ntfscomp hfsplus chain boot linux
|
|
1054
|
-
// arm64-efi
|
|
1055
|
-
await exec(`${grubName}-mkimage -O "${Utils.uefiFormat()}" \
|
|
1056
|
-
-m "${memdiskDir}/memdisk" \
|
|
1057
|
-
-o "${memdiskDir}/${Utils.uefiBN()}" \
|
|
1058
|
-
-p '(memdisk)/boot/grub' \
|
|
1059
|
-
search iso9660 configfile normal memdisk tar cat part_msdos part_gpt fat ext2 ntfs ntfscomp hfsplus chain boot linux`, this.echo);
|
|
1060
|
-
// popd torna in efiWorkDir
|
|
1061
|
-
// copy the grub image to efi/boot (to go later in the device's root)
|
|
1062
|
-
await exec(`cp ${memdiskDir}/${Utils.uefiBN()} ${efiWorkDir}EFI/BOOT`, this.echo);
|
|
1063
|
-
// #######################
|
|
1064
|
-
// Create boot image "boot/grub/efiboot.img"
|
|
1065
|
-
await exec(`dd if=/dev/zero of=${efiWorkDir}boot/grub/efiboot.img bs=1K count=1440`, this.echo);
|
|
1066
|
-
await exec(`/sbin/mkdosfs -F 12 ${efiWorkDir}boot/grub/efiboot.img`, this.echo);
|
|
1067
|
-
await exec(`mkdir ${efiWorkDir}img-mnt`, this.echo);
|
|
1068
|
-
await exec(`mount -o loop ${efiWorkDir}boot/grub/efiboot.img ${efiWorkDir}img-mnt`, this.echo);
|
|
1069
|
-
await exec(`mkdir ${efiWorkDir}img-mnt/EFI`, this.echo);
|
|
1070
|
-
await exec(`mkdir ${efiWorkDir}img-mnt/EFI/BOOT`, this.echo);
|
|
1071
|
-
await exec(`cp ${memdiskDir}/${Utils.uefiBN()} ${efiWorkDir}img-mnt/EFI/BOOT`, this.echo);
|
|
1072
|
-
// #######################
|
|
1073
|
-
// copy modules and font
|
|
1074
|
-
await exec(`cp -r /usr/lib/grub/${Utils.uefiFormat()}/* ${efiWorkDir}boot/grub/${Utils.uefiFormat()}/`, this.echo);
|
|
1075
|
-
// if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
|
|
1076
|
-
// Either of these will work, and they look the same to me. Unicode seems to work with qemu. -fsr
|
|
1077
|
-
if (fs.existsSync('/usr/share/grub/font.pf2')) {
|
|
1078
|
-
await exec(`cp /usr/share/grub/font.pf2 ${efiWorkDir}boot/grub/font.pf2`, this.echo);
|
|
1079
|
-
}
|
|
1080
|
-
else if (fs.existsSync('/usr/share/grub/unicode.pf2')) {
|
|
1081
|
-
await exec(`cp /usr/share/grub/unicode.pf2 ${efiWorkDir}boot/grub/font.pf2`, this.echo);
|
|
1082
|
-
}
|
|
1083
|
-
else if (fs.existsSync('/usr/share/grub/ascii.pf2')) {
|
|
1084
|
-
await exec(`cp /usr/share/grub/ascii.pf2 ${efiWorkDir}boot/grub/font.pf2`, this.echo);
|
|
1085
|
-
}
|
|
1086
|
-
// Doesn't need to be root-owned
|
|
1087
|
-
// chown -R 1000:1000 $(pwd) 2>/dev/null
|
|
1088
|
-
// Cleanup efi temps
|
|
1089
|
-
await exec(`umount ${efiWorkDir}img-mnt`, this.echo);
|
|
1090
|
-
await exec(`rmdir ${efiWorkDir}img-mnt`, this.echo);
|
|
1091
|
-
await exec(`rm ${memdiskDir}/img-mnt -rf`, this.echo);
|
|
1092
|
-
// popd
|
|
1093
|
-
// Copy efi files to ISO
|
|
1094
|
-
await exec(`rsync -avx ${efiWorkDir}boot ${isoDir}/`, this.echo);
|
|
1095
|
-
await exec(`rsync -avx ${efiWorkDir}EFI ${isoDir}/`, this.echo);
|
|
1096
|
-
// Do the main grub.cfg (which gets loaded last):
|
|
1097
|
-
// grub.theme.cfg
|
|
1098
|
-
let grubThemeSrc = path.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.theme.cfg`);
|
|
1099
|
-
if (this.theme.includes('/')) {
|
|
1100
|
-
grubThemeSrc = `${theme}/theme/livecd/grub.theme.cfg`;
|
|
1101
|
-
}
|
|
1102
|
-
const grubThemeDest = `${isoDir}/boot/grub/theme.cfg`;
|
|
1103
|
-
if (!fs.existsSync(grubThemeSrc)) {
|
|
1104
|
-
Utils.warning('Cannot find: ' + grubThemeSrc);
|
|
1105
|
-
process.exit();
|
|
1106
|
-
}
|
|
1107
|
-
fs.copyFileSync(grubThemeSrc, grubThemeDest);
|
|
1108
|
-
/**
|
|
1109
|
-
* prepare grub.cfg from grub.main.cfg
|
|
1110
|
-
*/
|
|
1111
|
-
let grubTemplate = `${theme}/theme/livecd/grub.main.cfg`;
|
|
1112
|
-
if (!fs.existsSync(grubTemplate)) {
|
|
1113
|
-
grubTemplate = path.resolve(__dirname, '../../addons/eggs/theme/livecd/grub.main.cfg');
|
|
1114
|
-
}
|
|
1115
|
-
if (!fs.existsSync(grubTemplate)) {
|
|
1116
|
-
Utils.warning('Cannot find: ' + grubTemplate);
|
|
1117
|
-
process.exit();
|
|
1118
|
-
}
|
|
1119
|
-
const kernel_parameters = Diversions.kernelParameters(this.familyId, this.volid); // this.kernelParameters()
|
|
1120
|
-
const grubDest = `${isoDir}/boot/grub/grub.cfg`;
|
|
1121
|
-
const template = fs.readFileSync(grubTemplate, 'utf8');
|
|
1122
|
-
const view = {
|
|
1123
|
-
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
1124
|
-
initrdImg: `/live${this.settings.initrdImg}`,
|
|
1125
|
-
kernel: Utils.kernelVersion(),
|
|
1126
|
-
kernel_parameters,
|
|
1127
|
-
vmlinuz: `/live${this.settings.vmlinuz}`
|
|
1128
|
-
};
|
|
1129
|
-
fs.writeFileSync(grubDest, mustache.render(template, view));
|
|
1130
|
-
/**
|
|
1131
|
-
* loopback.cfg
|
|
1132
|
-
*/
|
|
1133
|
-
fs.writeFileSync(`${isoDir}/boot/grub/loopback.cfg`, 'source /boot/grub/grub.cfg\n');
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* makeIso
|
|
1137
|
-
* cmd: cmd 4 xorriso
|
|
1138
|
-
*/
|
|
1139
|
-
async makeIso(cmd, scriptOnly = false) {
|
|
1140
|
-
// echo = { echo: true, ignore: false }
|
|
1141
|
-
if (this.verbose) {
|
|
1142
|
-
console.log('Ovary: makeIso');
|
|
1143
|
-
}
|
|
1144
|
-
Utils.writeX(`${this.settings.work_dir.ovarium}mkisofs`, cmd);
|
|
1145
|
-
// Create link to iso ALLWAYES
|
|
1146
|
-
const src = this.settings.config.snapshot_mnt + this.settings.isoFilename;
|
|
1147
|
-
const dest = this.settings.config.snapshot_dir + this.settings.isoFilename;
|
|
1148
|
-
await exec(`ln -s ${src} ${dest}`);
|
|
1149
|
-
if (!scriptOnly) {
|
|
1150
|
-
const test = (await exec(cmd, Utils.setEcho(true))).code;
|
|
1151
|
-
if (test !== 0) {
|
|
1152
|
-
process.exit();
|
|
1153
|
-
}
|
|
1154
|
-
// Create link to iso
|
|
1155
|
-
const src = this.settings.config.snapshot_mnt + this.settings.isoFilename;
|
|
1156
|
-
const dest = this.settings.config.snapshot_dir + this.settings.isoFilename;
|
|
1157
|
-
await exec(`ln -s ${src} ${dest}`);
|
|
1158
|
-
// Create md5sum, sha256sum
|
|
1159
|
-
if (this.settings.config.make_md5sum) {
|
|
1160
|
-
Utils.warning('creating md5, sha256');
|
|
1161
|
-
await exec(`md5sum ${src} > ${dest.replace('.iso', '.md5')}`);
|
|
1162
|
-
await exec(`sha256sum ${src} > ${dest.replace('.iso', '.sha256')}`);
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
* squashFs: crea in live filesystem.squashfs
|
|
1168
|
-
*/
|
|
1169
|
-
async makeSquashfs(scriptOnly = false, unsecure = false) {
|
|
1170
|
-
if (this.verbose) {
|
|
1171
|
-
console.log('Ovary: makeSquashfs');
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* exclude all the accurence of cryptdisks in rc0.d, etc
|
|
1175
|
-
*/
|
|
1176
|
-
const fexcludes = [
|
|
1177
|
-
'/boot/efi/EFI',
|
|
1178
|
-
'/boot/loader/entries/',
|
|
1179
|
-
'/etc/fstab',
|
|
1180
|
-
'/etc/mtab',
|
|
1181
|
-
'/etc/udev/rules.d/70-persistent-cd.rules',
|
|
1182
|
-
'/etc/udev/rules.d/70-persistent-net.rules',
|
|
1183
|
-
];
|
|
1184
|
-
for (const i in fexcludes) {
|
|
1185
|
-
this.addRemoveExclusion(true, fexcludes[i]);
|
|
1186
|
-
}
|
|
1187
|
-
/**
|
|
1188
|
-
* Non sò che fa, ma sicuro non serve per archlinux
|
|
1189
|
-
*/
|
|
1190
|
-
if (this.familyId === 'debian') {
|
|
1191
|
-
const rcd = ['rc0.d', 'rc1.d', 'rc2.d', 'rc3.d', 'rc4.d', 'rc5.d', 'rc6.d', 'rcS.d'];
|
|
1192
|
-
let files;
|
|
1193
|
-
for (const i in rcd) {
|
|
1194
|
-
files = fs.readdirSync(`${this.settings.work_dir.merged}/etc/${rcd[i]}`);
|
|
1195
|
-
for (const n in files) {
|
|
1196
|
-
if (files[n].includes('cryptdisks')) {
|
|
1197
|
-
this.addRemoveExclusion(true, `/etc/${rcd[i]}${files[n]}`);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
/**
|
|
1203
|
-
* secure
|
|
1204
|
-
*/
|
|
1205
|
-
if (!unsecure) {
|
|
1206
|
-
this.addRemoveExclusion(true, `root/*`);
|
|
1207
|
-
this.addRemoveExclusion(true, `root/.*`);
|
|
1208
|
-
}
|
|
1209
|
-
if (shx.exec('/usr/bin/test -L /etc/localtime', { silent: true }) && shx.exec('cat /etc/timezone', { silent: true }) !== 'Europe/Rome') {
|
|
1210
|
-
// this.addRemoveExclusion(true, '/etc/localtime')
|
|
1211
|
-
}
|
|
1212
|
-
this.addRemoveExclusion(true, this.settings.config.snapshot_dir /* .absolutePath() */);
|
|
1213
|
-
if (fs.existsSync(`${this.settings.iso_work}/live/filesystem.squashfs`)) {
|
|
1214
|
-
fs.unlinkSync(`${this.settings.iso_work}/live/filesystem.squashfs`);
|
|
1215
|
-
}
|
|
1216
|
-
const compression = `-comp ${this.settings.config.compression}`;
|
|
1217
|
-
/**
|
|
1218
|
-
* limit: patch per Raspberry
|
|
1219
|
-
*/
|
|
1220
|
-
const limit = '';
|
|
1221
|
-
if (Utils.uefiArch() === 'arm64') {
|
|
1222
|
-
// limit = ' -processors 2 -mem 1024M'
|
|
1223
|
-
}
|
|
1224
|
-
/**
|
|
1225
|
-
* mksquashfs
|
|
1226
|
-
*
|
|
1227
|
-
* SYNTAX: mksquashfs source1 source2 ...
|
|
1228
|
-
* FILESYSTEM [OPTIONS]
|
|
1229
|
-
* [-ef exclude.list]
|
|
1230
|
-
* [-e list of exclude dirs/files]
|
|
1231
|
-
*/
|
|
1232
|
-
let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.iso_work}live/filesystem.squashfs ${compression} ${limit} -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes}`;
|
|
1233
|
-
cmd = cmd.replaceAll(/\s\s+/g, ' ');
|
|
1234
|
-
Utils.writeX(`${this.settings.work_dir.ovarium}mksquashfs`, cmd);
|
|
1235
|
-
if (!scriptOnly) {
|
|
1236
|
-
Utils.warning('creating filesystem.squashfs on ISO/live');
|
|
1237
|
-
// Utils.warning(`compression: ` + compression)
|
|
1238
|
-
const test = (await exec(cmd, Utils.setEcho(true))).code;
|
|
1239
|
-
if (test !== 0) {
|
|
1240
|
-
process.exit();
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
return cmd;
|
|
1244
|
-
}
|
|
1245
|
-
/**
|
|
1246
|
-
* Ritorna true se c'è bisogno del mount --bind
|
|
1247
|
-
*
|
|
1248
|
-
* Ci sono tre tipologie:
|
|
1249
|
-
*
|
|
1250
|
-
* - normal solo la creazione della directory, nessun mount
|
|
1251
|
-
* - merged creazione della directory e mount ro
|
|
1252
|
-
* - mergedAndOverlay creazione directory, overlay e mount rw
|
|
1253
|
-
* - copied: creazione directory e copia
|
|
1254
|
-
*/
|
|
1255
|
-
merged(dir) {
|
|
1256
|
-
if (this.verbose) {
|
|
1257
|
-
console.log('Ovary: merged');
|
|
1258
|
-
}
|
|
1259
|
-
let merged = true;
|
|
1260
|
-
if (dir === 'home') {
|
|
1261
|
-
merged = this.clone;
|
|
1262
|
-
}
|
|
1263
|
-
else {
|
|
1264
|
-
const noMergeDirs = [
|
|
1265
|
-
'boot', // will be copied now
|
|
1266
|
-
'cdrom',
|
|
1267
|
-
'dev',
|
|
1268
|
-
'media',
|
|
1269
|
-
'mnt',
|
|
1270
|
-
'proc',
|
|
1271
|
-
'run',
|
|
1272
|
-
'swapfile',
|
|
1273
|
-
'sys',
|
|
1274
|
-
'tmp'
|
|
1275
|
-
];
|
|
1276
|
-
// deepin
|
|
1277
|
-
noMergeDirs.push('data', 'recovery');
|
|
1278
|
-
for (const noMergeDir of noMergeDirs) {
|
|
1279
|
-
if (dir === noMergeDir) {
|
|
1280
|
-
merged = false;
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
return merged;
|
|
1285
|
-
}
|
|
1286
|
-
/**
|
|
1287
|
-
* Restituisce true per le direcory da montare con overlay
|
|
1288
|
-
*
|
|
1289
|
-
* Ci sono tre tipologie:
|
|
1290
|
-
*
|
|
1291
|
-
* - normal solo la creazione della directory, nessun mount
|
|
1292
|
-
* - merged creazione della directory e mount ro
|
|
1293
|
-
* - mergedAndOverlay creazione directory, overlay e mount rw
|
|
1294
|
-
*
|
|
1295
|
-
* @param dir
|
|
1296
|
-
*/
|
|
1297
|
-
mergedAndOverlay(dir) {
|
|
1298
|
-
if (this.verbose) {
|
|
1299
|
-
console.log('Ovary: mergedAndOverlay');
|
|
1300
|
-
}
|
|
1301
|
-
/**
|
|
1302
|
-
* Debian: usrmerged
|
|
1303
|
-
* bin -> usr/bin
|
|
1304
|
-
* lib -> usr/lib
|
|
1305
|
-
* lib64 -> usr/lib64
|
|
1306
|
-
* sbin -> usr/sbin
|
|
1307
|
-
*
|
|
1308
|
-
* 'bin' rimossa da overlay
|
|
1309
|
-
*/
|
|
1310
|
-
// aggiunto bin per autologin su Alpine
|
|
1311
|
-
const mountDirs = ['etc', 'usr', 'var'];
|
|
1312
|
-
let mountDir = '';
|
|
1313
|
-
let overlay = false;
|
|
1314
|
-
for (mountDir of mountDirs) {
|
|
1315
|
-
if (mountDir === dir) {
|
|
1316
|
-
overlay = true;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
return overlay;
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* produce
|
|
1323
|
-
* @param clone
|
|
1324
|
-
* @param cryptedclone
|
|
1325
|
-
* @param scriptOnly
|
|
1326
|
-
* @param yolkRenew
|
|
1327
|
-
* @param release
|
|
1328
|
-
* @param myAddons
|
|
1329
|
-
* @param nointeractive
|
|
1330
|
-
* @param noicons
|
|
1331
|
-
* @param unsecure
|
|
1332
|
-
* @param verbose
|
|
1333
|
-
*/
|
|
1334
|
-
async produce(clone = false, cryptedclone = false, scriptOnly = false, yolkRenew = false, release = false, myAddons, myLinks, excludes, nointeractive = false, noicons = false, unsecure = false, verbose = false) {
|
|
1335
|
-
this.verbose = verbose;
|
|
1336
|
-
this.echo = Utils.setEcho(verbose);
|
|
1337
|
-
if (this.verbose) {
|
|
1338
|
-
this.toNull = ' > /dev/null 2>&1';
|
|
1339
|
-
}
|
|
1340
|
-
this.clone = clone;
|
|
1341
|
-
this.cryptedclone = cryptedclone;
|
|
1342
|
-
const luksName = 'luks-volume';
|
|
1343
|
-
const luksFile = `/tmp/${luksName}`;
|
|
1344
|
-
if (this.familyId === 'debian' && Utils.uefiArch() === 'amd64') {
|
|
1345
|
-
const yolk = new Repo();
|
|
1346
|
-
if (!yolk.exists()) {
|
|
1347
|
-
Utils.warning('creating yolk');
|
|
1348
|
-
await yolk.create(verbose);
|
|
1349
|
-
}
|
|
1350
|
-
else if (yolkRenew) {
|
|
1351
|
-
Utils.warning('refreshing yolk');
|
|
1352
|
-
await yolk.erase();
|
|
1353
|
-
await yolk.create(verbose);
|
|
1354
|
-
}
|
|
1355
|
-
else {
|
|
1356
|
-
Utils.warning('using preesixent yolk');
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
if (!fs.existsSync(this.settings.config.snapshot_dir)) {
|
|
1360
|
-
shx.mkdir('-p', this.settings.config.snapshot_dir);
|
|
1361
|
-
}
|
|
1362
|
-
if (Utils.isLive()) {
|
|
1363
|
-
console.log(chalk.red('>>> eggs: This is a live system! An egg cannot be produced from an egg!'));
|
|
1364
|
-
}
|
|
1365
|
-
else {
|
|
1366
|
-
await this.liveCreateStructure();
|
|
1367
|
-
// Carica calamares sono se le icone sono accettate
|
|
1368
|
-
if (!noicons && // se VOGLIO le icone
|
|
1369
|
-
!nointeractive &&
|
|
1370
|
-
this.settings.distro.isCalamaresAvailable &&
|
|
1371
|
-
Pacman.isInstalledGui() &&
|
|
1372
|
-
this.settings.config.force_installer &&
|
|
1373
|
-
!Pacman.calamaresExists()) {
|
|
1374
|
-
console.log('Installing ' + chalk.bgGray('calamares') + ' due force_installer=yes.');
|
|
1375
|
-
await Pacman.calamaresInstall(verbose);
|
|
1376
|
-
const bleach = new Bleach();
|
|
1377
|
-
await bleach.clean(verbose);
|
|
1378
|
-
}
|
|
1379
|
-
if (cryptedclone) {
|
|
1380
|
-
/**
|
|
1381
|
-
* cryptedclone
|
|
1382
|
-
*/
|
|
1383
|
-
console.log("eggs will SAVE users and users' data ENCRYPTED");
|
|
1384
|
-
/*
|
|
1385
|
-
const users = await this.usersFill()
|
|
1386
|
-
for (const user of users) {
|
|
1387
|
-
if (user.saveIt) {
|
|
1388
|
-
let utype = 'user '
|
|
1389
|
-
if (Number.parseInt(user.uid) < 1000) {
|
|
1390
|
-
utype = 'service'
|
|
1391
|
-
}
|
|
1392
|
-
//console.log(`- ${utype}: ${user.login.padEnd(16)} \thome: ${user.home}`)
|
|
1393
|
-
if (user.login !== 'root') {
|
|
1394
|
-
this.addRemoveExclusion(true, user.home)
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
*/
|
|
1399
|
-
}
|
|
1400
|
-
else if (this.clone) {
|
|
1401
|
-
/**
|
|
1402
|
-
* clone
|
|
1403
|
-
*
|
|
1404
|
-
* users tend to set user_opt as
|
|
1405
|
-
* real user when create a clone,
|
|
1406
|
-
* this is WRONG here we correct
|
|
1407
|
-
*/
|
|
1408
|
-
this.settings.config.user_opt = 'live'; // patch for humans
|
|
1409
|
-
this.settings.config.user_opt_passwd = 'evolution';
|
|
1410
|
-
this.settings.config.root_passwd = 'evolution';
|
|
1411
|
-
Utils.warning("eggs will SAVE users and users' data UNCRYPTED on the live");
|
|
1412
|
-
}
|
|
1413
|
-
else {
|
|
1414
|
-
/**
|
|
1415
|
-
* normal
|
|
1416
|
-
*/
|
|
1417
|
-
Utils.warning("eggs will REMOVE users and users' data from live");
|
|
1418
|
-
}
|
|
1419
|
-
/**
|
|
1420
|
-
* exclude.list
|
|
1421
|
-
*/
|
|
1422
|
-
if (!excludes.static /**
|
|
1423
|
-
* create exclude.list if not exists
|
|
1424
|
-
*/
|
|
1425
|
-
&&
|
|
1426
|
-
!fs.existsSync('/etc/penguins-eggs/exclude.list')) {
|
|
1427
|
-
const excludeListTemplateDir = '/etc/penguins-eggs.d/exclude.list.d/';
|
|
1428
|
-
const excludeListTemplate = excludeListTemplateDir + 'master.list';
|
|
1429
|
-
if (!fs.existsSync(excludeListTemplate)) {
|
|
1430
|
-
Utils.warning('Cannot find: ' + excludeListTemplate);
|
|
1431
|
-
process.exit(1);
|
|
1432
|
-
}
|
|
1433
|
-
let excludeUsr = '';
|
|
1434
|
-
let excludeVar = '';
|
|
1435
|
-
let excludeHomes = '';
|
|
1436
|
-
let excludeHome = '';
|
|
1437
|
-
if (excludes.usr) {
|
|
1438
|
-
excludeUsr = fs.readFileSync(`${excludeListTemplateDir}usr.list`, 'utf8');
|
|
1439
|
-
}
|
|
1440
|
-
if (excludes.var) {
|
|
1441
|
-
excludeVar = fs.readFileSync(`${excludeListTemplateDir}var.list`, 'utf8');
|
|
1442
|
-
}
|
|
1443
|
-
if (excludes.homes) {
|
|
1444
|
-
excludeHomes = fs.readFileSync(`${excludeListTemplateDir}homes.list`, 'utf8');
|
|
1445
|
-
}
|
|
1446
|
-
if (excludes.home) {
|
|
1447
|
-
excludeHome = `home/${await Utils.getPrimaryUser()}/*`;
|
|
1448
|
-
}
|
|
1449
|
-
const view = {
|
|
1450
|
-
home_list: excludeHome,
|
|
1451
|
-
homes_list: excludeHomes,
|
|
1452
|
-
usr_list: excludeUsr,
|
|
1453
|
-
var_list: excludeVar
|
|
1454
|
-
};
|
|
1455
|
-
const template = fs.readFileSync(excludeListTemplate, 'utf8');
|
|
1456
|
-
fs.writeFileSync(this.settings.config.snapshot_excludes, mustache.render(template, view));
|
|
1457
|
-
}
|
|
1458
|
-
/**
|
|
1459
|
-
* NOTE: reCreate = false
|
|
1460
|
-
*
|
|
1461
|
-
* reCreate = false is just for develop
|
|
1462
|
-
* put reCreate = true in release
|
|
1463
|
-
*/
|
|
1464
|
-
const reCreate = true;
|
|
1465
|
-
let mksquashfsCmd = '';
|
|
1466
|
-
if (reCreate) {
|
|
1467
|
-
// start pre-clone
|
|
1468
|
-
/**
|
|
1469
|
-
* installer
|
|
1470
|
-
*/
|
|
1471
|
-
this.incubator = new Incubator(this.settings.remix, this.settings.distro, this.settings.config.user_opt, this.theme, this.clone, verbose);
|
|
1472
|
-
await this.incubator.config(release);
|
|
1473
|
-
await this.syslinux(this.theme);
|
|
1474
|
-
//await this.isolinux(this.theme)
|
|
1475
|
-
await this.kernelCopy();
|
|
1476
|
-
/**
|
|
1477
|
-
* differents initfs for different families
|
|
1478
|
-
*/
|
|
1479
|
-
if (this.familyId === 'alpine') {
|
|
1480
|
-
await this.initrdAlpine();
|
|
1481
|
-
}
|
|
1482
|
-
else if (this.familyId === 'archlinux') {
|
|
1483
|
-
await this.initrdArch();
|
|
1484
|
-
}
|
|
1485
|
-
else if (this.familyId === 'debian') {
|
|
1486
|
-
await this.initrdDebian();
|
|
1487
|
-
}
|
|
1488
|
-
else if (this.familyId === 'aldos' ||
|
|
1489
|
-
this.familyId === 'fedora' ||
|
|
1490
|
-
this.familyId === 'openmamba' ||
|
|
1491
|
-
this.familyId === 'opensuse' ||
|
|
1492
|
-
this.familyId === 'voidlinux') {
|
|
1493
|
-
await this.initrdDracut();
|
|
1494
|
-
}
|
|
1495
|
-
if (this.settings.config.make_efi) {
|
|
1496
|
-
await this.makeEfi(this.theme);
|
|
1497
|
-
}
|
|
1498
|
-
await this.bindLiveFs();
|
|
1499
|
-
if (!this.clone) {
|
|
1500
|
-
/**
|
|
1501
|
-
* ANCHE per cryptedclone
|
|
1502
|
-
*/
|
|
1503
|
-
await this.cleanUsersAccounts();
|
|
1504
|
-
await this.createUserLive();
|
|
1505
|
-
if (Pacman.isInstalledGui()) {
|
|
1506
|
-
await this.createXdgAutostart(this.settings.config.theme, myAddons, myLinks, noicons);
|
|
1507
|
-
/**
|
|
1508
|
-
* GUI installed but NOT Desktop Manager: just create motd and issue
|
|
1509
|
-
*/
|
|
1510
|
-
if (displaymanager().length > 0) {
|
|
1511
|
-
this.cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
1512
|
-
this.cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
else {
|
|
1516
|
-
this.cliAutologin.add(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
await this.editLiveFs(clone, cryptedclone);
|
|
1520
|
-
mksquashfsCmd = await this.makeSquashfs(scriptOnly, unsecure);
|
|
1521
|
-
await this.uBindLiveFs(); // Lo smonto prima della fase di backup
|
|
1522
|
-
}
|
|
1523
|
-
if (cryptedclone) {
|
|
1524
|
-
let synctoCmd = `eggs syncto -f ${luksFile}`;
|
|
1525
|
-
if (excludes.home) {
|
|
1526
|
-
synctoCmd += ' --excludes'; // from Marco, usa home.list
|
|
1527
|
-
}
|
|
1528
|
-
await exec(synctoCmd, Utils.setEcho(true));
|
|
1529
|
-
Utils.warning(`moving ${luksFile} in ${this.nest}iso/live`);
|
|
1530
|
-
await exec(`mv ${luksFile} ${this.nest}iso/live`, this.echo);
|
|
1531
|
-
}
|
|
1532
|
-
const mkIsofsCmd = (await this.xorrisoCommand(clone, cryptedclone)).replaceAll(/\s\s+/g, ' ');
|
|
1533
|
-
this.makeDotDisk(this.volid, mksquashfsCmd, mkIsofsCmd);
|
|
1534
|
-
/**
|
|
1535
|
-
* AntiX/MX LINUX
|
|
1536
|
-
*/
|
|
1537
|
-
if (fs.existsSync('/etc/antix-version')) {
|
|
1538
|
-
let uname = (await exec('uname -r', { capture: true })).data;
|
|
1539
|
-
uname = uname.replaceAll('\n', '');
|
|
1540
|
-
let content = '';
|
|
1541
|
-
content = '#!/usr/bin/env bash';
|
|
1542
|
-
content += 'mkdir /live/bin -p\n';
|
|
1543
|
-
content += '## \n';
|
|
1544
|
-
content += '# cp /usr/lib/penguins-eggs/scripts/non-live-cmdline /live/bin -p\n';
|
|
1545
|
-
content += '# chmod +x /live/bin/non-live-cmdline\n';
|
|
1546
|
-
content += '## \n';
|
|
1547
|
-
content += 'mkdir /live/boot-dev/antiX -p\n';
|
|
1548
|
-
content += 'ln -s /run/live/medium/live/filesystem.squashfs /live/boot-dev/antiX/linuxfs\n';
|
|
1549
|
-
content += `ln -s /run/live/medium/live/initrd.img-${uname} /live/boot-dev/antiX/initrd.gz\n`;
|
|
1550
|
-
content += `ln -s /run/live/medium/live/vmlinuz-${uname} /live/boot-dev/antiX/vmlinuz\n`;
|
|
1551
|
-
content += `# md5sum /live/boot-dev/antiX/linuxfs > /live/boot-dev/antiX/linuxfs.md5\n`;
|
|
1552
|
-
content += `# md5sum /live/boot-dev/antiX/initrd.gz > /live/boot-dev/antiX/initrd.gz.md5\n`;
|
|
1553
|
-
content += `# md5sum /live/boot-dev/antiX/vmlinuz > /live/boot-dev/antiX/vmlinuz.md5\n`;
|
|
1554
|
-
content += `# /live/aufs -> /run/live/rootfs/filesystem.squashfs\n`;
|
|
1555
|
-
content += 'ln -s /run/live/rootfs/filesystem.squashfs /live/aufs\n';
|
|
1556
|
-
content += `# use: minstall -no-media-check\n`;
|
|
1557
|
-
content += 'minstall --no-media-check\n';
|
|
1558
|
-
const file = `${this.settings.iso_work}antix-mx-installer`;
|
|
1559
|
-
fs.writeFileSync(file, content);
|
|
1560
|
-
await exec(`chmod +x ${file}`);
|
|
1561
|
-
}
|
|
1562
|
-
/**
|
|
1563
|
-
* patch to emulate miso/archiso on archilinux family
|
|
1564
|
-
*/
|
|
1565
|
-
if (this.familyId === 'archlinux') {
|
|
1566
|
-
let pathName = `arch/x86_64/airootfs`;
|
|
1567
|
-
let hashCmd = 'sha512sum';
|
|
1568
|
-
let hashExt = '.sha512';
|
|
1569
|
-
if (Diversions.isManjaroBased(this.settings.distro.distroId)) {
|
|
1570
|
-
pathName = `manjaro/x86_64/livefs`;
|
|
1571
|
-
hashCmd = `md5sum`;
|
|
1572
|
-
hashExt = '.md5';
|
|
1573
|
-
}
|
|
1574
|
-
await exec(`mkdir ${this.settings.iso_work}${pathName}/x86_64 -p`, this.echo);
|
|
1575
|
-
fs.linkSync(`${this.settings.iso_work}live/filesystem.squashfs`, `${this.settings.iso_work}${pathName}.sfs`);
|
|
1576
|
-
}
|
|
1577
|
-
/**
|
|
1578
|
-
* patch per aldos
|
|
1579
|
-
if (this.familyId === 'aldos') {
|
|
1580
|
-
await exec(`mkdir ${this.settings.iso_work}LiveOS -p`, this.echo)
|
|
1581
|
-
fs.linkSync(`${this.settings.iso_work}live/filesystem.squashfs`, `${this.settings.iso_work}LiveOS/squashfs.img`)
|
|
1582
|
-
}
|
|
1583
|
-
*/
|
|
1584
|
-
await this.makeIso(mkIsofsCmd, scriptOnly);
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
/**
|
|
1588
|
-
*
|
|
1589
|
-
* @param cmd
|
|
1590
|
-
*/
|
|
1591
|
-
async tryCatch(cmd = '') {
|
|
1592
|
-
if (this.verbose) {
|
|
1593
|
-
console.log('Ovary: tryCatch');
|
|
1594
|
-
}
|
|
1595
|
-
try {
|
|
1596
|
-
await exec(cmd, this.echo);
|
|
1597
|
-
}
|
|
1598
|
-
catch (error) {
|
|
1599
|
-
console.log(`Error: ${error}`);
|
|
1600
|
-
await Utils.pressKeyToExit(cmd);
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
/**
|
|
1604
|
-
* ubind del fs live
|
|
1605
|
-
* @param verbose
|
|
1606
|
-
*/
|
|
1607
|
-
async uBindLiveFs() {
|
|
1608
|
-
if (this.verbose) {
|
|
1609
|
-
console.log('Ovary: uBindLiveFs');
|
|
1610
|
-
}
|
|
1611
|
-
const cmds = [];
|
|
1612
|
-
cmds.push('# NOTE: home, cdrom, dev, live, media, mnt, proc, run, sys and tmp', `# need just to be removed in ${this.settings.work_dir.merged}`);
|
|
1613
|
-
cmds.push(`# host: ${os.hostname()} user: ${await Utils.getPrimaryUser()}\n`);
|
|
1614
|
-
if (fs.existsSync(this.settings.work_dir.merged)) {
|
|
1615
|
-
const bindDirs = fs.readdirSync(this.settings.work_dir.merged, {
|
|
1616
|
-
withFileTypes: true
|
|
1617
|
-
});
|
|
1618
|
-
for (const dir of bindDirs) {
|
|
1619
|
-
const dirname = dir.name;
|
|
1620
|
-
cmds.push('#############################################################');
|
|
1621
|
-
if (fs.statSync(`/${dirname}`).isDirectory()) {
|
|
1622
|
-
cmds.push(`\n# directory: ${dirname}`);
|
|
1623
|
-
if (this.mergedAndOverlay(dirname)) {
|
|
1624
|
-
cmds.push(`\n# ${dirname} has overlay`, `\n# First, umount it from ${this.settings.config.snapshot_dir}`);
|
|
1625
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, this.verbose), `\n# Second, umount it from ${this.settings.work_dir.lowerdir}`);
|
|
1626
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.lowerdir}/${dirname}`, this.verbose));
|
|
1627
|
-
}
|
|
1628
|
-
else if (this.merged(dirname)) {
|
|
1629
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
1630
|
-
}
|
|
1631
|
-
cmds.push(`\n# remove in ${this.settings.work_dir.merged} and ${this.settings.work_dir.lowerdir}`);
|
|
1632
|
-
/**
|
|
1633
|
-
* We can't remove the nest!!!
|
|
1634
|
-
*/
|
|
1635
|
-
const nest = this.settings.config.snapshot_dir.split('/');
|
|
1636
|
-
if (dirname !== nest[1]) {
|
|
1637
|
-
// We can't remove first level nest
|
|
1638
|
-
cmds.push(await rexec(`rm -rf ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
else if (fs.statSync(`/${dirname}`).isFile()) {
|
|
1642
|
-
cmds.push(`\n# ${dirname} = file`);
|
|
1643
|
-
cmds.push(await rexec(`rm -f ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
1644
|
-
}
|
|
1645
|
-
else if (fs.statSync(`/${dirname}`).isSymbolicLink()) {
|
|
1646
|
-
cmds.push(`\n# ${dirname} = symbolicLink`);
|
|
1647
|
-
cmds.push(await rexec(`rm -f ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
if (this.clone) {
|
|
1652
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/home`, this.verbose));
|
|
1653
|
-
}
|
|
1654
|
-
// Utils.writeXs(`${this.settings.config.snapshot_dir}ubind`, cmds)
|
|
1655
|
-
Utils.writeXs(`${this.settings.work_dir.ovarium}ubind`, cmds);
|
|
1656
|
-
}
|
|
1657
|
-
/**
|
|
1658
|
-
*
|
|
1659
|
-
* @param verbose
|
|
1660
|
-
*/
|
|
1661
|
-
async ubindVfs() {
|
|
1662
|
-
if (this.verbose) {
|
|
1663
|
-
console.log('Ovary: ubindVfs');
|
|
1664
|
-
}
|
|
1665
|
-
const cmds = [];
|
|
1666
|
-
cmds.push(`umount ${this.settings.work_dir.merged}/dev/pts`, `umount ${this.settings.work_dir.merged}/dev`, `umount ${this.settings.work_dir.merged}/proc`, `umount ${this.settings.work_dir.merged}/run`, `umount ${this.settings.work_dir.merged}/sys`);
|
|
1667
|
-
// Utils.writeXs(`${this.settings.config.snapshot_dir}ubindvfs`, cmds)
|
|
1668
|
-
Utils.writeXs(`${this.settings.work_dir.ovarium}ubindvfs`, cmds);
|
|
1669
|
-
}
|
|
1670
|
-
/**
|
|
1671
|
-
* fill
|
|
1672
|
-
*/
|
|
1673
|
-
async usersFill() {
|
|
1674
|
-
if (this.verbose) {
|
|
1675
|
-
console.log('Ovary: usersFill');
|
|
1676
|
-
}
|
|
1677
|
-
const usersArray = [];
|
|
1678
|
-
await access('/etc/passwd', constants.R_OK | constants.W_OK);
|
|
1679
|
-
const passwd = fs.readFileSync('/etc/passwd', 'utf8').split('\n');
|
|
1680
|
-
for (const element of passwd) {
|
|
1681
|
-
const line = element.split(':');
|
|
1682
|
-
const users = new Users(line[0], line[1], line[2], line[3], line[4], line[5], line[6]);
|
|
1683
|
-
await users.getValues();
|
|
1684
|
-
if (users.password !== undefined) {
|
|
1685
|
-
usersArray.push(users);
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
return usersArray;
|
|
1689
|
-
}
|
|
1690
|
-
/**
|
|
1691
|
-
*
|
|
1692
|
-
* @param cryptedclone
|
|
1693
|
-
* @returns cmd 4 mkiso
|
|
1694
|
-
*/
|
|
1695
|
-
async xorrisoCommand(clone = false, cryptedclone = false) {
|
|
1696
|
-
if (this.verbose) {
|
|
1697
|
-
console.log('Ovary: xorrisoCommand');
|
|
1698
|
-
}
|
|
1699
|
-
const prefix = this.settings.config.snapshot_prefix;
|
|
1700
|
-
let typology = '';
|
|
1701
|
-
// typology is applied only with standard egg-of
|
|
1702
|
-
if (prefix.slice(0, 7) === 'egg-of_') {
|
|
1703
|
-
if (clone) {
|
|
1704
|
-
typology = '_clone';
|
|
1705
|
-
}
|
|
1706
|
-
else if (cryptedclone) {
|
|
1707
|
-
typology = '_crypted';
|
|
1708
|
-
}
|
|
1709
|
-
if (fs.existsSync('/usr/bin/eui-start.sh')) {
|
|
1710
|
-
typology += '_EUI';
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
const postfix = Utils.getPostfix();
|
|
1714
|
-
this.settings.isoFilename = prefix + this.volid + '_' + Utils.uefiArch() + typology + postfix;
|
|
1715
|
-
//
|
|
1716
|
-
const output = this.settings.config.snapshot_mnt + this.settings.isoFilename;
|
|
1717
|
-
let command = '';
|
|
1718
|
-
// const appid = `-appid "${this.settings.distro.distroId}" `
|
|
1719
|
-
// const publisher = `-publisher "${this.settings.distro.distroId}/${this.settings.distro.codenameId}" `
|
|
1720
|
-
// const preparer = '-preparer "prepared by eggs <https://penguins-eggs.net>" '
|
|
1721
|
-
let isoHybridMbr = '';
|
|
1722
|
-
if (this.settings.config.make_isohybrid) {
|
|
1723
|
-
const isolinuxFile = this.settings.distro.syslinuxPath + '/isohdpfx.bin';
|
|
1724
|
-
if (fs.existsSync(isolinuxFile)) {
|
|
1725
|
-
isoHybridMbr = `-isohybrid-mbr ${isolinuxFile}`;
|
|
1726
|
-
}
|
|
1727
|
-
else {
|
|
1728
|
-
Utils.warning(`Can't create isohybrid image. File: ${isolinuxFile} not found. \nThe resulting image will be a standard iso file`);
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
if (Pacman.packageIsInstalled('genisoimage')) {
|
|
1732
|
-
this.genisoimage = true;
|
|
1733
|
-
command = `genisoimage \
|
|
1734
|
-
-iso-level 3 \
|
|
1735
|
-
-allow-limited-size \
|
|
1736
|
-
-joliet-long \
|
|
1737
|
-
-r \
|
|
1738
|
-
-V ${this.volid} \
|
|
1739
|
-
-cache-inodes \
|
|
1740
|
-
-J \
|
|
1741
|
-
-l \
|
|
1742
|
-
-b isolinux/isolinux.bin \
|
|
1743
|
-
-c isolinux/boot.cat \
|
|
1744
|
-
-no-emul-boot \
|
|
1745
|
-
-boot-load-size 4 \
|
|
1746
|
-
-boot-info-table \
|
|
1747
|
-
-eltorito-alt-boot \
|
|
1748
|
-
-e boot/grub/efiboot.img \
|
|
1749
|
-
-o ${output} ${this.settings.iso_work}`;
|
|
1750
|
-
return command;
|
|
1751
|
-
}
|
|
1752
|
-
/**
|
|
1753
|
-
* xorriso
|
|
1754
|
-
*/
|
|
1755
|
-
// uefi_opt="-uefi_elToritoAltBoot-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
|
|
1756
|
-
let uefi_elToritoAltBoot = '';
|
|
1757
|
-
let uefi_e = '';
|
|
1758
|
-
let uefi_isohybridGptBasdat = '';
|
|
1759
|
-
let uefi_noEmulBoot = '';
|
|
1760
|
-
if (this.settings.config.make_efi) {
|
|
1761
|
-
uefi_elToritoAltBoot = '-eltorito-alt-boot';
|
|
1762
|
-
uefi_e = '-e boot/grub/efiboot.img';
|
|
1763
|
-
uefi_isohybridGptBasdat = '-isohybrid-gpt-basdat';
|
|
1764
|
-
uefi_noEmulBoot = '-no-emul-boot';
|
|
1765
|
-
}
|
|
1766
|
-
/**
|
|
1767
|
-
* L'immagine efi è efiboot.img ed è
|
|
1768
|
-
* presente in boot/grub/efiboot.img
|
|
1769
|
-
* per cui:
|
|
1770
|
-
* -append_partition 2 0xef efiboot.img
|
|
1771
|
-
* --efi-boot efiboot.img
|
|
1772
|
-
* non sono necessari
|
|
1773
|
-
*/
|
|
1774
|
-
command = `xorriso -as mkisofs \
|
|
1775
|
-
-J \
|
|
1776
|
-
-joliet-long \
|
|
1777
|
-
-l \
|
|
1778
|
-
-iso-level 3 \
|
|
1779
|
-
${isoHybridMbr} \
|
|
1780
|
-
-partition_offset 16 \
|
|
1781
|
-
-V ${this.volid} \
|
|
1782
|
-
-b isolinux/isolinux.bin \
|
|
1783
|
-
-c isolinux/boot.cat \
|
|
1784
|
-
-no-emul-boot \
|
|
1785
|
-
-boot-load-size 4 \
|
|
1786
|
-
-boot-info-table \
|
|
1787
|
-
${uefi_elToritoAltBoot} \
|
|
1788
|
-
${uefi_e} \
|
|
1789
|
-
${uefi_isohybridGptBasdat} \
|
|
1790
|
-
${uefi_noEmulBoot} \
|
|
1791
|
-
-o ${output} ${this.settings.iso_work}`;
|
|
1792
|
-
return command;
|
|
1793
|
-
}
|
|
1794
|
-
/**
|
|
1795
|
-
* Creazione link desktop per lxde
|
|
1796
|
-
* @param name
|
|
1797
|
-
* @param icon
|
|
1798
|
-
*/
|
|
1799
|
-
lxdeLink(file, name, icon) {
|
|
1800
|
-
if (this.verbose) {
|
|
1801
|
-
console.log('Ovary: lxdeLink');
|
|
1802
|
-
}
|
|
1803
|
-
const lnk = `lnk-${file}`;
|
|
1804
|
-
let text = '';
|
|
1805
|
-
text += `echo "[Desktop Entry]" >$DESKTOP/${lnk}\n`;
|
|
1806
|
-
text += `echo "Type=Link" >> $DESKTOP/${lnk}\n`;
|
|
1807
|
-
text += `echo "Name=${name}" >> $DESKTOP/${lnk}\n`;
|
|
1808
|
-
text += `echo "Icon=${icon}" >> $DESKTOP/${lnk}\n`;
|
|
1809
|
-
text += `echo "URL=/usr/share/applications/${file}" >> $DESKTOP/${lnk}\n\n`;
|
|
1810
|
-
return text;
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
/**
|
|
1814
|
-
* FUNCTIONS
|
|
1815
|
-
*/
|
|
1816
|
-
/**
|
|
1817
|
-
* Crea il path se non esiste
|
|
1818
|
-
* @param path
|
|
1819
|
-
*/
|
|
1820
|
-
async function makeIfNotExist(path, verbose = false) {
|
|
1821
|
-
if (verbose) {
|
|
1822
|
-
console.log(`Ovary: makeIfNotExist(${path})`);
|
|
1823
|
-
}
|
|
1824
|
-
const echo = Utils.setEcho(verbose);
|
|
1825
|
-
let cmd = `# ${path} alreasy exist`;
|
|
1826
|
-
if (!fs.existsSync(path)) {
|
|
1827
|
-
cmd = `mkdir ${path} -p`;
|
|
1828
|
-
await exec(cmd, echo);
|
|
1829
|
-
}
|
|
1830
|
-
return cmd;
|
|
1831
|
-
}
|
|
1832
|
-
/**
|
|
1833
|
-
*
|
|
1834
|
-
* @param cmd
|
|
1835
|
-
* @param echo
|
|
1836
|
-
*/
|
|
1837
|
-
async function rexec(cmd, verbose = false) {
|
|
1838
|
-
if (verbose) {
|
|
1839
|
-
console.log(`Ovary: rexec(${cmd})`);
|
|
1840
|
-
}
|
|
1841
|
-
const echo = Utils.setEcho(verbose);
|
|
1842
|
-
/**
|
|
1843
|
-
* skip umount errors
|
|
1844
|
-
*/
|
|
1845
|
-
const check = await exec(cmd, echo);
|
|
1846
|
-
if (!cmd.startsWith('umount') && check.code !== 0) {
|
|
1847
|
-
console.log(`eggs >>> error on command: ` + chalk.cyan(cmd) + ', code: ' + chalk.cyan(check.code));
|
|
1848
|
-
}
|
|
1849
|
-
return cmd;
|
|
1850
|
-
}
|