penguins-eggs 8.1.3 → 9.0.16
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/README.md +332 -168
- package/addons/README.md +78 -84
- package/addons/{pve → blissos}/theme/applications/install-debian.desktop +0 -0
- package/addons/{deblinux → blissos}/theme/artwork/install-debian.png +0 -0
- package/addons/blissos/theme/calamares/branding/blissos-logo.png +0 -0
- package/addons/{guadalinex → blissos}/theme/calamares/branding/branding.desc +0 -0
- package/addons/blissos/theme/calamares/branding/languages.png +0 -0
- package/addons/blissos/theme/calamares/branding/show.qml +75 -0
- package/addons/blissos/theme/calamares/branding/slide1.png +0 -0
- package/addons/blissos/theme/calamares/branding/slide2.png +0 -0
- package/addons/blissos/theme/calamares/branding/slide3.png +0 -0
- package/addons/blissos/theme/calamares/branding/welcome.png +0 -0
- package/addons/{guadalinex → blissos}/theme/calamares/modules/partition.yml +1 -1
- package/{conf/distros/buster/grub/theme.cfg → addons/blissos/theme/livecd/grub.theme.cfg} +10 -9
- package/{conf/distros/buster/isolinux/stdmenu.template.cfg → addons/blissos/theme/livecd/isolinux.theme.cfg} +4 -0
- package/addons/blissos/theme/livecd/splash.png +0 -0
- package/addons/eggs/adapt/applications/eggs-adapt.desktop +1 -1
- package/addons/eggs/theme/calamares/branding/show.qml +1 -1
- package/addons/eggs/theme/livecd/README.md +19 -6
- package/addons/eggs/theme/livecd/{theme.cfg → grub.theme.cfg} +13 -12
- package/addons/eggs/theme/livecd/isolinux.theme.cfg +46 -0
- package/addons/eggs/theme/livecd/splash.png +0 -0
- package/addons/{ufficiozero/theme/livecd/theme.cfg → neon/theme/livecd/grub.theme.cfg} +13 -12
- package/addons/neon/theme/livecd/isolinux.theme.cfg +46 -0
- package/addons/neon/theme/livecd/splash.png +0 -0
- package/addons/templates/grub.template +28 -0
- package/addons/templates/isolinux.template +29 -0
- package/addons/ufficiozero/theme/applications/install-debian.desktop +17 -2
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +2 -4
- package/conf/distros/bionic/calamares/settings.yml +5 -5
- package/conf/distros/bookworm/README.md +9 -0
- package/conf/distros/bullseye/README.md +6 -8
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +1 -1
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.working.sh +1 -1
- package/conf/distros/buster/calamares/modules/shellprocess_eggs-cleanup.yml +6 -0
- package/conf/distros/buster/calamares/settings.yml +14 -3
- package/conf/distros/chimaera/README.md +3 -0
- package/conf/distros/daedalus/README.md +3 -0
- package/conf/distros/focal/calamares/settings.yml +2 -2
- package/conf/distros/hirsute/README.md +1 -1
- package/conf/distros/impish/README.md +9 -0
- package/conf/distros/jammy/README.md +9 -0
- package/conf/distros/jessie/krill/krill-modules/sources-yolk/sources-yolk.sh +1 -1
- package/conf/distros/rolling/README.md +3 -0
- package/conf/distros/rolling/calamares/calamares-modules/remove-link/module.yml +9 -0
- package/conf/distros/rolling/calamares/calamares-modules/remove-link/remove-link.sh +3 -0
- package/conf/distros/rolling/calamares/modules/displaymanager.yml +22 -0
- package/conf/distros/rolling/calamares/modules/finished.yml +6 -0
- package/conf/distros/rolling/calamares/modules/fstab.yml +13 -0
- package/conf/distros/rolling/calamares/modules/locale.yml +97 -0
- package/conf/distros/rolling/calamares/modules/luksopenswaphookcfg.yml +6 -0
- package/conf/distros/rolling/calamares/modules/mount.yml +38 -0
- package/conf/distros/rolling/calamares/modules/packages.yml +8 -0
- package/conf/distros/rolling/calamares/modules/removeuser.yml +15 -0
- package/conf/distros/rolling/calamares/modules/unpackfs.yml +7 -0
- package/conf/distros/rolling/calamares/modules/users.yml +20 -0
- package/conf/distros/rolling/calamares/modules/welcome.yml +19 -0
- package/conf/distros/{bullseye → rolling}/calamares/settings.yml +17 -12
- package/conf/distros/thirtyfive/README.md +3 -0
- package/conf/distros/tumbleweed/README.md +3 -0
- package/conf/eggs.yaml +3 -3
- package/conf/exclude.list +12 -7
- package/conf/tools.yaml +1 -1
- package/lib/classes/basket.js +24 -20
- package/lib/classes/bleach.js +19 -19
- package/lib/classes/compressors.js +15 -14
- package/lib/classes/daddy.js +44 -31
- package/lib/classes/distro.d.ts +3 -2
- package/lib/classes/distro.js +314 -175
- package/lib/classes/family/archlinux.d.ts +69 -0
- package/lib/classes/family/archlinux.js +182 -0
- package/lib/classes/family/debian.d.ts +64 -0
- package/lib/classes/family/debian.js +227 -0
- package/lib/classes/family/fedora.d.ts +63 -0
- package/lib/classes/family/fedora.js +169 -0
- package/lib/classes/family/suse.d.ts +63 -0
- package/lib/classes/family/suse.js +169 -0
- package/lib/classes/i18n.js +16 -16
- package/lib/classes/incubation/branding.js +5 -4
- package/lib/classes/incubation/distros/bionic.js +1 -2
- package/lib/classes/incubation/distros/buster.js +2 -2
- package/lib/classes/incubation/distros/focal.js +3 -2
- package/lib/classes/incubation/distros/jessie.js +1 -25
- package/lib/classes/incubation/distros/{bullseye.d.ts → rolling.d.ts} +3 -3
- package/lib/classes/incubation/distros/{bullseye.js → rolling.js} +15 -16
- package/lib/classes/incubation/fisherman-helper/displaymanager.js +2 -7
- package/lib/classes/incubation/fisherman-helper/packages.js +31 -32
- package/lib/classes/incubation/fisherman.d.ts +17 -17
- package/lib/classes/incubation/fisherman.js +84 -71
- package/lib/classes/incubation/incubator.js +116 -74
- package/lib/classes/incubation/installer.d.ts +2 -2
- package/lib/classes/incubation/installer.js +6 -20
- package/lib/classes/initrd.d.ts +1 -1
- package/lib/classes/initrd.js +37 -30
- package/lib/classes/krill_install.d.ts +4 -4
- package/lib/classes/krill_install.js +166 -162
- package/lib/classes/krill_prepare.d.ts +6 -2
- package/lib/classes/krill_prepare.js +73 -60
- package/lib/classes/n8.js +6 -11
- package/lib/classes/ovary.d.ts +34 -25
- package/lib/classes/ovary.js +771 -688
- package/lib/classes/pacman.d.ts +55 -56
- package/lib/classes/pacman.js +524 -436
- package/lib/classes/pve-live.js +6 -6
- package/lib/classes/settings.js +47 -56
- package/lib/classes/systemctl.d.ts +6 -6
- package/lib/classes/systemctl.js +7 -7
- package/lib/classes/tools.d.ts +1 -1
- package/lib/classes/tools.js +10 -10
- package/lib/classes/users.d.ts +21 -0
- package/lib/classes/users.js +129 -0
- package/lib/classes/utils.d.ts +10 -13
- package/lib/classes/utils.js +128 -107
- package/lib/classes/xdg.js +112 -91
- package/lib/classes/yolk.js +38 -31
- package/lib/commands/adapt.d.ts +3 -3
- package/lib/commands/adapt.js +12 -12
- package/lib/commands/analyze.d.ts +25 -0
- package/lib/commands/analyze.js +74 -0
- package/lib/commands/bro.d.ts +14 -0
- package/lib/commands/bro.js +31 -0
- package/lib/commands/calamares.d.ts +7 -7
- package/lib/commands/calamares.js +22 -54
- package/lib/commands/config.d.ts +5 -5
- package/lib/commands/config.js +69 -79
- package/lib/commands/dad.d.ts +5 -5
- package/lib/commands/dad.js +11 -11
- package/lib/commands/export/deb.d.ts +8 -8
- package/lib/commands/export/deb.js +16 -16
- package/lib/commands/export/docs.d.ts +2 -2
- package/lib/commands/export/docs.js +9 -9
- package/lib/commands/export/iso.d.ts +4 -4
- package/lib/commands/export/iso.js +12 -17
- package/lib/commands/info.d.ts +9 -3
- package/lib/commands/info.js +14 -164
- package/lib/commands/install.d.ts +5 -5
- package/lib/commands/install.js +28 -42
- package/lib/commands/kill.d.ts +3 -3
- package/lib/commands/kill.js +11 -13
- package/lib/commands/mom.d.ts +2 -2
- package/lib/commands/mom.js +8 -8
- package/lib/commands/produce.d.ts +14 -14
- package/lib/commands/produce.js +48 -46
- package/lib/commands/remove.d.ts +5 -5
- package/lib/commands/remove.js +46 -57
- package/lib/commands/syncfrom.d.ts +37 -0
- package/lib/commands/syncfrom.js +156 -0
- package/lib/commands/syncto.d.ts +48 -0
- package/lib/commands/syncto.js +219 -0
- package/lib/commands/tools/clean.d.ts +3 -3
- package/lib/commands/tools/clean.js +10 -12
- package/lib/commands/tools/locales.d.ts +4 -4
- package/lib/commands/tools/locales.js +8 -8
- package/lib/commands/tools/skel.d.ts +4 -4
- package/lib/commands/tools/skel.js +10 -15
- package/lib/commands/tools/stat.d.ts +7 -4
- package/lib/commands/tools/stat.js +20 -13
- package/lib/commands/tools/yolk.d.ts +3 -3
- package/lib/commands/tools/yolk.js +13 -13
- package/lib/commands/update.d.ts +5 -10
- package/lib/commands/update.js +56 -72
- package/lib/components/elements/information.d.ts +4 -0
- package/lib/components/elements/information.js +166 -0
- package/lib/components/elements/steps.js +1 -1
- package/lib/components/elements/title.js +7 -10
- package/lib/components/finished.js +5 -5
- package/lib/components/install.js +5 -5
- package/lib/components/keyboard.js +5 -5
- package/lib/components/location.js +5 -5
- package/lib/components/network.js +5 -5
- package/lib/components/partitions.d.ts +2 -1
- package/lib/components/partitions.js +9 -7
- package/lib/components/summary.js +5 -5
- package/lib/components/users.js +6 -6
- package/lib/components/welcome.js +6 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/interfaces/i-analyze.d.ts +13 -0
- package/lib/interfaces/i-analyze.js +18 -0
- package/lib/interfaces/i-distro.d.ts +3 -2
- package/lib/interfaces/i-krill.d.ts +1 -0
- package/lib/interfaces/i-settings.d.ts +2 -2
- package/lib/lib/cli-autologin.d.ts +19 -2
- package/lib/lib/cli-autologin.js +114 -39
- package/lib/lib/dependencies.d.ts +9 -6
- package/lib/lib/dependencies.js +22 -13
- package/lib/lib/get_address.js +2 -2
- package/lib/lib/get_dns.js +2 -2
- package/lib/lib/get_domain.js +2 -2
- package/lib/lib/get_gateway.js +2 -2
- package/lib/lib/get_hostname.js +2 -2
- package/lib/lib/get_netmask.js +2 -2
- package/lib/lib/get_password.js +3 -2
- package/lib/lib/get_root_password.js +2 -2
- package/lib/lib/get_userfullname.js +2 -2
- package/lib/lib/get_username.js +2 -2
- package/lib/lib/select_address_type.js +2 -5
- package/lib/lib/select_filesystem_type.js +5 -14
- package/lib/lib/select_installation_device.js +3 -3
- package/lib/lib/select_interface.js +1 -1
- package/lib/lib/select_keyboard_layout.js +2 -10
- package/lib/lib/select_languages.js +2 -2
- package/lib/lib/select_regions.js +1 -12
- package/lib/lib/select_user_swap_choice.js +4 -4
- package/lib/lib/select_zones.js +483 -62
- package/manpages/doc/man/eggs.html +508 -0
- package/manpages/doc/man/eggs.roll.gz +0 -0
- package/oclif.manifest.json +1 -1
- package/package.json +115 -107
- package/scripts/_eggs +275 -0
- package/scripts/bros/waydroid-helper.sh +92 -0
- package/scripts/eggs.bash +68 -19
- package/scripts/mom-cli.sh +6 -5
- package/scripts/not-used/eggs-cleanup.sh +7 -0
- package/scripts/not-used/install-eggs-ppa.sh +2 -0
- package/scripts/{mkinitramfs → not-used/mkinitramfs} +0 -0
- package/scripts/{pve-live.sh → not-used/pve-live.sh} +0 -0
- package/addons/debian/theme/applications/install-debian.desktop +0 -13
- package/addons/debian/theme/artwork/install-debian.png +0 -0
- package/addons/debian/theme/branding/branding.desc +0 -27
- package/addons/debian/theme/branding/debian-logo.png +0 -0
- package/addons/debian/theme/branding/show.qml +0 -51
- package/addons/debian/theme/branding/slide1.png +0 -0
- package/addons/debian/theme/branding/welcome.png +0 -0
- package/addons/deblinux/theme/README.md +0 -16
- package/addons/deblinux/theme/applications/install-debian.desktop +0 -13
- package/addons/deblinux/theme/calamares/branding/branding.desc +0 -23
- package/addons/deblinux/theme/calamares/branding/deblinux-logo.png +0 -0
- package/addons/deblinux/theme/calamares/branding/show.qml +0 -46
- package/addons/deblinux/theme/calamares/branding/slide1.png +0 -0
- package/addons/deblinux/theme/calamares/branding/welcome.png +0 -0
- package/addons/deblinux/theme/calamares/modules/partition.yml +0 -233
- package/addons/eggs/theme/calamares/branding/4tation.png +0 -0
- package/addons/eggs/theme/livecd/grub.template.cfg +0 -60
- package/addons/eggs/theme/livecd/menu.template.cfg +0 -54
- package/addons/guadalinex/theme/README.md +0 -9
- package/addons/guadalinex/theme/applications/install-debian.desktop +0 -28
- package/addons/guadalinex/theme/artwork/install-debian.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/guadalinex-logo.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/show.qml +0 -85
- package/addons/guadalinex/theme/calamares/branding/slide1.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide2.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide3.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide4.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide5.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide6.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide7.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/welcome.png +0 -0
- package/addons/guadalinex/theme/livecd/menu.template.cfg +0 -54
- package/addons/guadalinex/theme/livecd/splash.png +0 -0
- package/addons/guadalinex/theme/livecd/theme.cfg +0 -42
- package/addons/openos/theme/applications/Install-OpenOS-Neon_RLTS-Desktop.png +0 -0
- package/addons/openos/theme/applications/install-debian.desktop +0 -24
- package/addons/openos/theme/artwork/install-debian.png +0 -0
- package/addons/openos/theme/calamares/branding/branding.desc +0 -28
- package/addons/openos/theme/calamares/branding/openos-logo.png +0 -0
- package/addons/openos/theme/calamares/branding/show.qml +0 -203
- package/addons/openos/theme/calamares/branding/slide1.png +0 -0
- package/addons/openos/theme/calamares/branding/slide10.png +0 -0
- package/addons/openos/theme/calamares/branding/slide11.png +0 -0
- package/addons/openos/theme/calamares/branding/slide12.png +0 -0
- package/addons/openos/theme/calamares/branding/slide13.png +0 -0
- package/addons/openos/theme/calamares/branding/slide14.png +0 -0
- package/addons/openos/theme/calamares/branding/slide15.png +0 -0
- package/addons/openos/theme/calamares/branding/slide16.png +0 -0
- package/addons/openos/theme/calamares/branding/slide2.png +0 -0
- package/addons/openos/theme/calamares/branding/slide3.png +0 -0
- package/addons/openos/theme/calamares/branding/slide4.png +0 -0
- package/addons/openos/theme/calamares/branding/slide5.png +0 -0
- package/addons/openos/theme/calamares/branding/slide6.png +0 -0
- package/addons/openos/theme/calamares/branding/slide7.png +0 -0
- package/addons/openos/theme/calamares/branding/slide8.png +0 -0
- package/addons/openos/theme/calamares/branding/slide9.png +0 -0
- package/addons/openos/theme/calamares/branding/welcome.png +0 -0
- package/addons/openos/theme/calamares/branding.desc +0 -24
- package/addons/openos/theme/calamares/lang/calamares-default_ar.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_en.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_eo.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_fr.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_nl.qm +0 -0
- package/addons/openos/theme/calamares/modules/partition.yml +0 -233
- package/addons/openos/theme/livecd/grub.template.cfg +0 -60
- package/addons/openos/theme/livecd/menu.template.cfg +0 -54
- package/addons/openos/theme/livecd/splash.png +0 -0
- package/addons/openos/theme/livecd/theme.cfg +0 -42
- package/addons/pve/theme/applications/penguins-pve.desktop +0 -24
- package/addons/pve/theme/artwork/install-debian.png +0 -0
- package/addons/pve/theme/calamares/branding/branding.desc +0 -1
- package/addons/pve/theme/calamares/branding/pve-logo.png +0 -0
- package/addons/pve/theme/calamares/branding/show.qml +0 -227
- package/addons/pve/theme/calamares/branding/slide1.png +0 -0
- package/addons/pve/theme/calamares/branding/slide2.png +0 -0
- package/addons/pve/theme/calamares/branding/slide3.png +0 -0
- package/addons/pve/theme/calamares/branding/slide4.png +0 -0
- package/addons/pve/theme/calamares/branding/slide5.png +0 -0
- package/addons/pve/theme/calamares/branding/slide6.png +0 -0
- package/addons/pve/theme/calamares/branding/slide7.png +0 -0
- package/addons/pve/theme/calamares/branding/slide8.png +0 -0
- package/addons/pve/theme/calamares/branding/slide9.png +0 -0
- package/addons/pve/theme/calamares/branding/welcome.png +0 -0
- package/addons/pve/theme/calamares/modules/partition.yml +0 -233
- package/addons/pve/theme/livecd/README.md +0 -8
- package/addons/pve/theme/livecd/grub.template.cfg +0 -60
- package/addons/pve/theme/livecd/menu.template.cfg +0 -54
- package/addons/pve/theme/livecd/splash.png +0 -0
- package/addons/pve/theme/livecd/theme.cfg +0 -42
- package/addons/ufficiozero/theme/artwork/install-debian.png +0 -0
- package/addons/ufficiozero/theme/livecd/README.md +0 -8
- package/addons/ufficiozero/theme/livecd/grub.template.cfg +0 -60
- package/addons/ufficiozero/theme/livecd/menu.template.cfg +0 -54
- package/conf/distros/bullseye/calamares/calamares-modules/bootloader-config/bootloader-config.sh +0 -28
- package/conf/distros/bullseye/calamares/calamares-modules/bootloader-config/module.yml +0 -8
- package/conf/distros/buster/grub/grub.template.cfg +0 -58
- package/conf/distros/buster/grub/loopback.cfg +0 -1
- package/conf/distros/buster/isolinux/isolinux.template.cfg +0 -8
- package/conf/distros/buster/isolinux/menu.template.cfg +0 -56
- package/conf/distros/focal/grub/grub.template.cfg +0 -67
- package/conf/distros/focal/isolinux/menu.template.cfg +0 -54
- package/lib/classes/incubation/distros/beowulf.d.ts +0 -30
- package/lib/classes/incubation/distros/beowulf.js +0 -69
- package/manpages/doc/man/eggs.1.gz +0 -0
package/lib/classes/ovary.js
CHANGED
|
@@ -11,26 +11,30 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
*/
|
|
12
12
|
// packages
|
|
13
13
|
const fs = require("fs");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
18
|
-
const mustache_1 = tslib_1.__importDefault(require("mustache"));
|
|
19
|
-
const pve_live_1 = tslib_1.__importDefault(require("./pve-live"));
|
|
14
|
+
const node_path_1 = (0, tslib_1.__importDefault)(require("node:path"));
|
|
15
|
+
const node_os_1 = (0, tslib_1.__importDefault)(require("node:os"));
|
|
16
|
+
const shelljs_1 = (0, tslib_1.__importDefault)(require("shelljs"));
|
|
17
|
+
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
18
|
+
const mustache_1 = (0, tslib_1.__importDefault)(require("mustache"));
|
|
19
|
+
const pve_live_1 = (0, tslib_1.__importDefault)(require("./pve-live"));
|
|
20
20
|
// libraries
|
|
21
|
-
const
|
|
21
|
+
const utils_1 = require("../lib/utils");
|
|
22
22
|
// classes
|
|
23
|
-
const
|
|
24
|
-
const n8_1 = tslib_1.__importDefault(require("./n8"));
|
|
25
|
-
const incubator_1 = tslib_1.__importDefault(require("./incubation/incubator"));
|
|
26
|
-
const xdg_1 = tslib_1.__importDefault(require("./xdg"));
|
|
27
|
-
const pacman_1 = tslib_1.__importDefault(require("./pacman"));
|
|
28
|
-
const settings_1 = tslib_1.__importDefault(require("./settings"));
|
|
29
|
-
const systemctl_1 = tslib_1.__importDefault(require("./systemctl"));
|
|
30
|
-
const bleach_1 = tslib_1.__importDefault(require("./bleach"));
|
|
31
|
-
const yolk_1 = tslib_1.__importDefault(require("./yolk"));
|
|
23
|
+
const utils_2 = (0, tslib_1.__importDefault)(require("./utils"));
|
|
24
|
+
const n8_1 = (0, tslib_1.__importDefault)(require("./n8"));
|
|
25
|
+
const incubator_1 = (0, tslib_1.__importDefault)(require("./incubation/incubator"));
|
|
26
|
+
const xdg_1 = (0, tslib_1.__importDefault)(require("./xdg"));
|
|
27
|
+
const pacman_1 = (0, tslib_1.__importDefault)(require("./pacman"));
|
|
28
|
+
const settings_1 = (0, tslib_1.__importDefault)(require("./settings"));
|
|
29
|
+
const systemctl_1 = (0, tslib_1.__importDefault)(require("./systemctl"));
|
|
30
|
+
const bleach_1 = (0, tslib_1.__importDefault)(require("./bleach"));
|
|
31
|
+
const yolk_1 = (0, tslib_1.__importDefault)(require("./yolk"));
|
|
32
32
|
const cliAutologin = require("../lib/cli-autologin");
|
|
33
|
-
const
|
|
33
|
+
const displaymanager_1 = require("./incubation/fisherman-helper/displaymanager");
|
|
34
|
+
// backup
|
|
35
|
+
const promises_1 = require("fs/promises");
|
|
36
|
+
const fs_1 = require("fs");
|
|
37
|
+
const users_1 = (0, tslib_1.__importDefault)(require("./users"));
|
|
34
38
|
/**
|
|
35
39
|
* Ovary:
|
|
36
40
|
*/
|
|
@@ -43,6 +47,7 @@ class Ovary {
|
|
|
43
47
|
this.toNull = ' > /dev/null 2>&1';
|
|
44
48
|
this.incubator = {};
|
|
45
49
|
this.settings = {};
|
|
50
|
+
this.familyId = '';
|
|
46
51
|
this.snapshot_prefix = '';
|
|
47
52
|
this.snapshot_basename = '';
|
|
48
53
|
this.theme = '';
|
|
@@ -67,6 +72,7 @@ class Ovary {
|
|
|
67
72
|
*/
|
|
68
73
|
async fertilization() {
|
|
69
74
|
if (await this.settings.load()) {
|
|
75
|
+
this.familyId = this.settings.distro.familyId;
|
|
70
76
|
if (this.snapshot_prefix !== '') {
|
|
71
77
|
this.settings.config.snapshot_prefix = this.snapshot_prefix;
|
|
72
78
|
}
|
|
@@ -79,10 +85,9 @@ class Ovary {
|
|
|
79
85
|
if (this.compression !== '') {
|
|
80
86
|
this.settings.config.compression = this.compression;
|
|
81
87
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
88
|
+
this.settings.listFreeSpace();
|
|
89
|
+
if (await utils_2.default.customConfirm('Select yes to continue...'))
|
|
90
|
+
return true;
|
|
86
91
|
}
|
|
87
92
|
return false;
|
|
88
93
|
}
|
|
@@ -91,113 +96,126 @@ class Ovary {
|
|
|
91
96
|
* @param basename
|
|
92
97
|
*/
|
|
93
98
|
async produce(backup = false, scriptOnly = false, yolkRenew = false, release = false, myAddons, verbose = false) {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
100
|
+
const echoYes = utils_2.default.setEcho(true);
|
|
101
|
+
let luksName = 'luks-eggs-backup';
|
|
102
|
+
let luksFile = `/tmp/${luksName}`;
|
|
103
|
+
let luksDevice = `/dev/mapper/${luksName}`;
|
|
104
|
+
let luksMountpoint = `/mnt`;
|
|
105
|
+
if (this.familyId === 'debian') {
|
|
106
|
+
const yolk = new yolk_1.default();
|
|
107
|
+
if (!yolk.exists()) {
|
|
108
|
+
utils_2.default.warning('local repo yolk creation...');
|
|
109
|
+
await yolk.create(verbose);
|
|
110
|
+
}
|
|
111
|
+
else if (yolkRenew) {
|
|
112
|
+
utils_2.default.warning('force renew local repository yolk...');
|
|
102
113
|
yolk.clean();
|
|
103
114
|
await yolk.create(verbose);
|
|
104
115
|
}
|
|
105
116
|
else {
|
|
106
|
-
|
|
117
|
+
utils_2.default.warning('Using preesixent yolk...');
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
if (!fs.existsSync(this.settings.config.snapshot_dir)) {
|
|
110
|
-
|
|
121
|
+
shelljs_1.default.mkdir('-p', this.settings.config.snapshot_dir);
|
|
111
122
|
}
|
|
112
123
|
await this.settings.loadRemix(this.snapshot_basename, this.theme);
|
|
113
|
-
if (
|
|
124
|
+
if (utils_2.default.isLive()) {
|
|
114
125
|
console.log(chalk_1.default.red('>>> eggs: This is a live system! An egg cannot be produced from an egg!'));
|
|
115
126
|
}
|
|
116
127
|
else {
|
|
117
|
-
if (verbose) {
|
|
118
|
-
console.log(`egg ${this.settings.remix.name}`);
|
|
119
|
-
}
|
|
120
128
|
await this.liveCreateStructure(verbose);
|
|
121
|
-
if (pacman_1.default.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
await bleach.clean(verbose);
|
|
127
|
-
}
|
|
129
|
+
if (this.settings.distro.isCalamaresAvailable && (pacman_1.default.isInstalledGui()) && this.settings.config.force_installer && !(await pacman_1.default.calamaresCheck())) {
|
|
130
|
+
console.log('Installing ' + chalk_1.default.bgGray('calamares') + ' due force_installer=yes.');
|
|
131
|
+
await pacman_1.default.calamaresInstall(verbose);
|
|
132
|
+
const bleach = new bleach_1.default();
|
|
133
|
+
await bleach.clean(verbose);
|
|
128
134
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
await this.cleanUsersAccounts();
|
|
144
|
-
await this.createUserLive(verbose);
|
|
145
|
-
if (await pacman_1.default.isGui()) {
|
|
146
|
-
await this.createAutostart(this.theme, myAddons);
|
|
135
|
+
if (backup) {
|
|
136
|
+
/**
|
|
137
|
+
* We will remove users and servers homes from ISO
|
|
138
|
+
*/
|
|
139
|
+
console.log(`The following private data will removed from your ISO:`);
|
|
140
|
+
const users = await this.usersFill();
|
|
141
|
+
for (let i = 0; i < users.length; i++) {
|
|
142
|
+
if (users[i].saveIt) {
|
|
143
|
+
console.log(`- user: ${users[i].login.padEnd(16)} \thome: ${users[i].home}`);
|
|
144
|
+
if (users[i].login !== 'root') {
|
|
145
|
+
this.addRemoveExclusion(true, users[i].home);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
147
149
|
}
|
|
148
150
|
else {
|
|
149
|
-
|
|
151
|
+
/**
|
|
152
|
+
* We will remove all the users from ISO, but servers and data will be included uncrypted
|
|
153
|
+
*/
|
|
154
|
+
utils_2.default.warning('eggs will remove all the users from ISO, but servers and data will be included uncrypted');
|
|
150
155
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
156
|
+
/**
|
|
157
|
+
* NOTE: reCreate = false
|
|
158
|
+
*
|
|
159
|
+
* reCreate = false is just for develop
|
|
160
|
+
* put reCreate = true in release
|
|
161
|
+
*/
|
|
162
|
+
let reCreate = true;
|
|
163
|
+
if (reCreate) { // start pre-backup
|
|
164
|
+
/**
|
|
165
|
+
* Anche non accettando l'installazione di calamares
|
|
166
|
+
* viene creata la configurazione dell'installer: krill/calamares
|
|
167
|
+
* L'installer prende il tema da settings.remix.branding
|
|
168
|
+
*/
|
|
169
|
+
this.incubator = new incubator_1.default(this.settings.remix, this.settings.distro, this.settings.config.user_opt, verbose);
|
|
170
|
+
await this.incubator.config(release);
|
|
171
|
+
await this.syslinux(verbose);
|
|
172
|
+
await this.isolinux(this.theme, verbose);
|
|
173
|
+
await this.kernelCopy(verbose);
|
|
174
|
+
/**
|
|
175
|
+
* we need different behaviour on
|
|
176
|
+
* initrd for different familis
|
|
177
|
+
*/
|
|
178
|
+
if (this.familyId === 'debian') {
|
|
179
|
+
await this.initrdCopy(verbose);
|
|
167
180
|
}
|
|
168
|
-
if (
|
|
169
|
-
|
|
181
|
+
else if (this.familyId === 'archlinux') {
|
|
182
|
+
await this.initrdCreate(verbose);
|
|
170
183
|
}
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
if (this.settings.config.make_efi) {
|
|
185
|
+
await this.makeEfi(this.theme, verbose);
|
|
173
186
|
}
|
|
174
|
-
|
|
175
|
-
|
|
187
|
+
await this.bindLiveFs(verbose);
|
|
188
|
+
await this.cleanUsersAccounts();
|
|
189
|
+
await this.createUserLive(verbose);
|
|
190
|
+
if (pacman_1.default.isInstalledGui()) {
|
|
191
|
+
await this.createXdgAutostart(this.theme, myAddons);
|
|
192
|
+
if ((0, displaymanager_1.displaymanager)() === '') {
|
|
193
|
+
// If GUI is installed and not Desktop manager
|
|
194
|
+
cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.versionId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
195
|
+
cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.versionId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
cliAutologin.addAutologin(this.settings.distro.distroId, this.settings.distro.versionId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
176
200
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
child_process_1.execSync('cryptsetup luksFormat /tmp/luks-users-data', { stdio: 'inherit' });
|
|
181
|
-
utils_1.default.warning('Opening volume luks-users-data and map it in /dev/mapper/eggs-users-data');
|
|
182
|
-
utils_1.default.warning('You will insert the same passphrase you choose before');
|
|
183
|
-
child_process_1.execSync('cryptsetup luksOpen /tmp/luks-users-data eggs-users-data', { stdio: 'inherit' });
|
|
184
|
-
utils_1.default.warning('Formatting volume eggs-users-data with ext4');
|
|
185
|
-
child_process_1.execSync('mkfs.ext2 /dev/mapper/eggs-users-data' + this.toNull, { stdio: 'inherit' });
|
|
186
|
-
utils_1.default.warning('mounting volume eggs-users-data in /mnt');
|
|
187
|
-
child_process_1.execSync('mount /dev/mapper/eggs-users-data /mnt', { stdio: 'inherit' });
|
|
188
|
-
utils_1.default.warning('Saving users datas in eggs-users-data');
|
|
189
|
-
await this.copyUsersDatas(verbose);
|
|
190
|
-
const bytesUsed = parseInt(shx.exec(`du -b --summarize /mnt |awk '{ print $1 }'`, { silent: true }).stdout.trim());
|
|
191
|
-
utils_1.default.warning('We used ' + utils_1.default.formatBytes(bytesUsed, 0) + ' on ' + utils_1.default.formatBytes(volumeSize, 0) + ' in volume luks-users-data');
|
|
192
|
-
utils_1.default.warning('Unmount /mnt');
|
|
193
|
-
child_process_1.execSync('umount /mnt', { stdio: 'inherit' });
|
|
194
|
-
utils_1.default.warning('closing eggs-users-data');
|
|
195
|
-
child_process_1.execSync('cryptsetup luksClose eggs-users-data', { stdio: 'inherit' });
|
|
196
|
-
utils_1.default.warning('moving luks-users-data in ' + this.settings.config.snapshot_dir + 'ovarium/iso/live');
|
|
197
|
-
child_process_1.execSync('mv /tmp/luks-users-data ' + this.settings.config.snapshot_dir + 'ovarium/iso/live', { stdio: 'inherit' });
|
|
201
|
+
await this.editLiveFs(verbose);
|
|
202
|
+
await this.makeSquashfs(scriptOnly, verbose);
|
|
203
|
+
await this.uBindLiveFs(verbose); // Lo smonto prima della fase di backup
|
|
198
204
|
}
|
|
199
|
-
|
|
200
|
-
|
|
205
|
+
if (backup) {
|
|
206
|
+
await (0, utils_1.exec)('eggs syncto');
|
|
207
|
+
utils_2.default.warning(`moving ${luksFile} in ${this.settings.config.snapshot_dir}ovarium/iso/live`);
|
|
208
|
+
await (0, utils_1.exec)(`mv ${luksFile} ${this.settings.config.snapshot_dir}ovarium/iso/live`, echo);
|
|
209
|
+
}
|
|
210
|
+
const xorrisoCommand = this.makeDotDisk(backup, verbose);
|
|
211
|
+
/**
|
|
212
|
+
* patch to emulate miso archilinux
|
|
213
|
+
*/
|
|
214
|
+
if (this.familyId === 'archlinux') {
|
|
215
|
+
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.pathIso}/live/x86_64`, echo);
|
|
216
|
+
await (0, utils_1.exec)(`ln ${this.settings.work_dir.pathIso}/live/filesystem.squashfs ${this.settings.work_dir.pathIso}/live/x86_64/livefs.sfs`, echo);
|
|
217
|
+
}
|
|
218
|
+
await this.makeIso(xorrisoCommand, scriptOnly, verbose);
|
|
201
219
|
}
|
|
202
220
|
}
|
|
203
221
|
/**
|
|
@@ -207,10 +225,10 @@ class Ovary {
|
|
|
207
225
|
if (verbose) {
|
|
208
226
|
console.log('Overy: liveCreateStructure');
|
|
209
227
|
}
|
|
210
|
-
|
|
228
|
+
utils_2.default.warning(`Creating egg in ${this.settings.work_dir.path}`);
|
|
211
229
|
if (!fs.existsSync(this.settings.work_dir.path)) {
|
|
212
230
|
try {
|
|
213
|
-
|
|
231
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.path);
|
|
214
232
|
}
|
|
215
233
|
catch (error) {
|
|
216
234
|
console.log('error: ' + error + ' creating ' + this.settings.work_dir.path);
|
|
@@ -218,15 +236,15 @@ class Ovary {
|
|
|
218
236
|
}
|
|
219
237
|
if (!fs.existsSync(this.settings.work_dir.path + '/README.md')) {
|
|
220
238
|
try {
|
|
221
|
-
|
|
239
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../conf/README.md'), this.settings.work_dir.path + 'README.md');
|
|
222
240
|
}
|
|
223
241
|
catch (error) {
|
|
224
|
-
console.log('error: ' + error + ' creating ' +
|
|
242
|
+
console.log('error: ' + error + ' creating ' + node_path_1.default.resolve(__dirname, '../../conf/README.md'), this.settings.work_dir.path + 'README.md');
|
|
225
243
|
}
|
|
226
244
|
}
|
|
227
245
|
if (!fs.existsSync(this.settings.work_dir.lowerdir)) {
|
|
228
246
|
try {
|
|
229
|
-
|
|
247
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.lowerdir);
|
|
230
248
|
}
|
|
231
249
|
catch (error) {
|
|
232
250
|
console.log('error: ' + error + ' creating ' + this.settings.work_dir.lowerdir);
|
|
@@ -234,7 +252,7 @@ class Ovary {
|
|
|
234
252
|
}
|
|
235
253
|
if (!fs.existsSync(this.settings.work_dir.upperdir)) {
|
|
236
254
|
try {
|
|
237
|
-
|
|
255
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.upperdir);
|
|
238
256
|
}
|
|
239
257
|
catch (error) {
|
|
240
258
|
console.log('error: ' + error + ' creating ' + this.settings.work_dir.upperdir);
|
|
@@ -242,7 +260,7 @@ class Ovary {
|
|
|
242
260
|
}
|
|
243
261
|
if (!fs.existsSync(this.settings.work_dir.workdir)) {
|
|
244
262
|
try {
|
|
245
|
-
|
|
263
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.workdir);
|
|
246
264
|
}
|
|
247
265
|
catch (error) {
|
|
248
266
|
console.log('error: ' + error + ' creating ' + this.settings.work_dir.workdir);
|
|
@@ -250,7 +268,7 @@ class Ovary {
|
|
|
250
268
|
}
|
|
251
269
|
if (!fs.existsSync(this.settings.work_dir.merged)) {
|
|
252
270
|
try {
|
|
253
|
-
|
|
271
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.merged);
|
|
254
272
|
}
|
|
255
273
|
catch (error) {
|
|
256
274
|
console.log('error: ' + error + ' creating ' + this.settings.work_dir.merged);
|
|
@@ -262,28 +280,28 @@ class Ovary {
|
|
|
262
280
|
*/
|
|
263
281
|
if (!fs.existsSync(this.settings.work_dir.pathIso)) {
|
|
264
282
|
try {
|
|
265
|
-
|
|
283
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.pathIso + '/boot/grub/' + utils_2.default.machineUEFI());
|
|
266
284
|
}
|
|
267
285
|
catch (error) {
|
|
268
|
-
console.log('error: ' + error + ' creating ' + this.settings.work_dir.pathIso + '/boot/grub/' +
|
|
286
|
+
console.log('error: ' + error + ' creating ' + this.settings.work_dir.pathIso + '/boot/grub/' + utils_2.default.machineUEFI());
|
|
269
287
|
}
|
|
270
288
|
try {
|
|
271
|
-
|
|
289
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.pathIso + '/efi/boot');
|
|
272
290
|
}
|
|
273
291
|
catch (error) {
|
|
274
292
|
console.log('error: ' + error + ' creating ' + this.settings.work_dir.pathIso + '/efi/boot');
|
|
275
293
|
}
|
|
276
294
|
try {
|
|
277
|
-
|
|
295
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.pathIso + '/isolinux');
|
|
278
296
|
}
|
|
279
|
-
catch
|
|
280
|
-
|
|
297
|
+
catch {
|
|
298
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.pathIso + '/isolinux');
|
|
281
299
|
}
|
|
282
300
|
try {
|
|
283
|
-
|
|
301
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.pathIso + '/live');
|
|
284
302
|
}
|
|
285
|
-
catch
|
|
286
|
-
|
|
303
|
+
catch {
|
|
304
|
+
shelljs_1.default.mkdir('-p', this.settings.work_dir.pathIso + '/live');
|
|
287
305
|
}
|
|
288
306
|
}
|
|
289
307
|
}
|
|
@@ -298,91 +316,88 @@ class Ovary {
|
|
|
298
316
|
* - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
|
|
299
317
|
*/
|
|
300
318
|
async editLiveFs(verbose = false) {
|
|
301
|
-
const echo =
|
|
319
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
302
320
|
if (verbose) {
|
|
303
321
|
console.log('ovary: editLiveFs');
|
|
304
322
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
323
|
+
if (this.familyId === 'debian') {
|
|
324
|
+
// Aggiungo UMASK=0077 in /etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf
|
|
325
|
+
const text = 'UMASK=0077\n';
|
|
326
|
+
const file = '/etc/initramfs-tools/conf.d/eggs-safe-initramfs.conf';
|
|
327
|
+
utils_2.default.write(file, text);
|
|
328
|
+
}
|
|
309
329
|
// sudo systemctl disable wpa_supplicant
|
|
310
330
|
// Truncate logs, remove archived logs.
|
|
311
331
|
let cmd = `find ${this.settings.work_dir.merged}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
|
|
312
|
-
await exec(cmd, echo);
|
|
332
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
313
333
|
cmd = `find ${this.settings.work_dir.merged}/var/log/ -type f -exec truncate -s 0 {} \\;`;
|
|
314
|
-
await exec(cmd, echo);
|
|
334
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
315
335
|
// Allow all fixed drives to be mounted with pmount
|
|
316
|
-
if (this.settings.config.pmount_fixed) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
await exec(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${this.settings.work_dir.merged}/etc/pmount.allow`, echo);
|
|
320
|
-
}
|
|
336
|
+
if (this.settings.config.pmount_fixed && fs.existsSync(`${this.settings.work_dir.merged}/etc/pmount.allow`)) {
|
|
337
|
+
// MX aggiunto /etc
|
|
338
|
+
await (0, utils_1.exec)(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${this.settings.work_dir.merged}/etc/pmount.allow`, echo);
|
|
321
339
|
}
|
|
322
340
|
// Enable or disable password login through ssh for users (not root)
|
|
323
341
|
// Remove obsolete live-config file
|
|
324
342
|
if (fs.existsSync(`${this.settings.work_dir.merged}lib/live/config/1161-openssh-server`)) {
|
|
325
|
-
await exec('rm -f "$work_dir"/myfs/lib/live/config/1161-openssh-server', echo);
|
|
343
|
+
await (0, utils_1.exec)('rm -f "$work_dir"/myfs/lib/live/config/1161-openssh-server', echo);
|
|
326
344
|
}
|
|
327
345
|
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/ssh/sshd_config`)) {
|
|
328
|
-
await exec(`sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo);
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
else {
|
|
333
|
-
await exec(`sed -i 's|.*PasswordAuthentication.*yes|PasswordAuthentication no|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo);
|
|
334
|
-
}
|
|
346
|
+
await (0, utils_1.exec)(`sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo);
|
|
347
|
+
await (this.settings.config.ssh_pass
|
|
348
|
+
? (0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*no|PasswordAuthentication yes|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo)
|
|
349
|
+
: (0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*yes|PasswordAuthentication no|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo));
|
|
335
350
|
}
|
|
336
351
|
/**
|
|
337
352
|
* /etc/fstab should exist, even if it's empty,
|
|
338
353
|
* to prevent error messages at boot
|
|
339
354
|
*/
|
|
340
|
-
await exec(`rm ${this.settings.work_dir.merged}/etc/fstab`, echo);
|
|
341
|
-
await exec(`touch ${this.settings.work_dir.merged}/etc/fstab`, echo);
|
|
355
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/fstab`, echo);
|
|
356
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/fstab`, echo);
|
|
342
357
|
/**
|
|
343
358
|
* Blank out systemd machine id. If it does not exist, systemd-journald
|
|
344
359
|
* will fail, but if it exists and is empty, systemd will automatically
|
|
345
360
|
* set up a new unique ID.
|
|
346
361
|
*/
|
|
347
362
|
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/machine-id`)) {
|
|
348
|
-
await exec(`rm ${this.settings.work_dir.merged}/etc/machine-id`, echo);
|
|
349
|
-
await exec(`touch ${this.settings.work_dir.merged}/etc/machine-id`, echo);
|
|
350
|
-
|
|
363
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/machine-id`, echo);
|
|
364
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/machine-id`, echo);
|
|
365
|
+
utils_2.default.write(`${this.settings.work_dir.merged}/etc/machine-id`, ':');
|
|
351
366
|
}
|
|
352
367
|
/**
|
|
353
368
|
* LMDE4: utilizza UbuntuMono16.pf2
|
|
354
369
|
* aggiungo un link a /boot/grub/fonts/UbuntuMono16.pf2
|
|
355
370
|
*/
|
|
356
|
-
|
|
371
|
+
shelljs_1.default.cp(`${this.settings.work_dir.merged}/boot/grub/fonts/unicode.pf2`, `${this.settings.work_dir.merged}/boot/grub/fonts/UbuntuMono16.pf2`);
|
|
357
372
|
/**
|
|
358
373
|
* Per tutte le distro systemd
|
|
359
374
|
*/
|
|
360
|
-
if (
|
|
375
|
+
if (utils_2.default.isSystemd()) {
|
|
361
376
|
/**
|
|
362
377
|
* SU UBUNTU E DERIVATE NON DISABILITARE systemd-resolved.service
|
|
363
378
|
*/
|
|
364
379
|
if (this.settings.distro.distroLike !== 'Ubuntu') {
|
|
365
|
-
await exec(`chroot ${this.settings.work_dir.merged} systemctl disable systemd-resolved.service`);
|
|
380
|
+
await (0, utils_1.exec)(`chroot ${this.settings.work_dir.merged} systemctl disable systemd-resolved.service`);
|
|
366
381
|
}
|
|
367
382
|
// systemctl is-enabled
|
|
368
383
|
const systemdctl = new systemctl_1.default();
|
|
369
384
|
if (await systemdctl.isEnabled('systemd-networkd.service')) {
|
|
370
|
-
await exec(`chroot ${this.settings.work_dir.merged} systemctl disable systemd-networkd.service`);
|
|
385
|
+
await (0, utils_1.exec)(`chroot ${this.settings.work_dir.merged} systemctl disable systemd-networkd.service`);
|
|
371
386
|
}
|
|
372
387
|
if (await systemdctl.isEnabled('remote-cryptsetup.target')) {
|
|
373
|
-
await exec(`chroot ${this.settings.work_dir.merged} systemctl disable remote-cryptsetup.target`);
|
|
388
|
+
await (0, utils_1.exec)(`chroot ${this.settings.work_dir.merged} systemctl disable remote-cryptsetup.target`);
|
|
374
389
|
}
|
|
375
390
|
if (await systemdctl.isEnabled('speech-dispatcherd.service')) {
|
|
376
|
-
await exec(`chroot ${this.settings.work_dir.merged} systemctl disable speech-dispatcherd.service`);
|
|
391
|
+
await (0, utils_1.exec)(`chroot ${this.settings.work_dir.merged} systemctl disable speech-dispatcherd.service`);
|
|
377
392
|
}
|
|
378
393
|
if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service')) {
|
|
379
|
-
await exec(`chroot ${this.settings.work_dir.merged} systemctl disable wpa_supplicant-nl80211@.service`);
|
|
394
|
+
await (0, utils_1.exec)(`chroot ${this.settings.work_dir.merged} systemctl disable wpa_supplicant-nl80211@.service`);
|
|
380
395
|
}
|
|
381
396
|
if (await systemdctl.isEnabled('wpa_supplicant@.service')) {
|
|
382
|
-
await exec(`chroot ${this.settings.work_dir.merged} systemctl disable wpa_supplicant@.service`);
|
|
397
|
+
await (0, utils_1.exec)(`chroot ${this.settings.work_dir.merged} systemctl disable wpa_supplicant@.service`);
|
|
383
398
|
}
|
|
384
399
|
if (await systemdctl.isEnabled('wpa_supplicant-wired@.service')) {
|
|
385
|
-
await exec(`chroot ${this.settings.work_dir.merged} systemctl disable wpa_supplicant-wired@.service`);
|
|
400
|
+
await (0, utils_1.exec)(`chroot ${this.settings.work_dir.merged} systemctl disable wpa_supplicant-wired@.service`);
|
|
386
401
|
}
|
|
387
402
|
}
|
|
388
403
|
// Probabilmente non necessario
|
|
@@ -391,19 +406,21 @@ class Ovary {
|
|
|
391
406
|
* Clear configs from /etc/network/interfaces, wicd and NetworkManager
|
|
392
407
|
* and netman, so they aren't stealthily included in the snapshot.
|
|
393
408
|
*/
|
|
394
|
-
if (
|
|
395
|
-
|
|
409
|
+
if (this.familyId === 'debian') {
|
|
410
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/network/interfaces`)) {
|
|
411
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/network/interfaces`, echo);
|
|
412
|
+
}
|
|
413
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/network/interfaces`, echo);
|
|
414
|
+
utils_2.default.write(`${this.settings.work_dir.merged}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
396
415
|
}
|
|
397
|
-
await exec(`touch ${this.settings.work_dir.merged}/etc/network/interfaces`, echo);
|
|
398
|
-
utils_1.default.write(`${this.settings.work_dir.merged}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
399
416
|
/**
|
|
400
417
|
* Per tutte le distro systemd
|
|
401
418
|
*/
|
|
402
|
-
if (
|
|
403
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/var/lib/wicd/configurations/*`, echo);
|
|
404
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/wicd/wireless-settings.conf`, echo);
|
|
405
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/NetworkManager/system-connections/*`, echo);
|
|
406
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/wifi/*`, echo);
|
|
419
|
+
if (utils_2.default.isSystemd()) {
|
|
420
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/var/lib/wicd/configurations/*`, echo);
|
|
421
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/wicd/wireless-settings.conf`, echo);
|
|
422
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/NetworkManager/system-connections/*`, echo);
|
|
423
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/wifi/*`, echo);
|
|
407
424
|
/**
|
|
408
425
|
* Andiamo a fare pulizia in /etc/network/:
|
|
409
426
|
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
@@ -411,149 +428,203 @@ class Ovary {
|
|
|
411
428
|
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
412
429
|
let cleanDir = '';
|
|
413
430
|
for (cleanDir of cleanDirs) {
|
|
414
|
-
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/${cleanDir}/wpasupplicant`, echo);
|
|
431
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/${cleanDir}/wpasupplicant`, echo);
|
|
415
432
|
}
|
|
416
433
|
}
|
|
417
434
|
/**
|
|
418
435
|
* add some basic files to /dev
|
|
419
436
|
*/
|
|
420
437
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/console`)) {
|
|
421
|
-
await exec(`mknod -m 622 ${this.settings.work_dir.merged}/dev/console c 5 1`, echo);
|
|
438
|
+
await (0, utils_1.exec)(`mknod -m 622 ${this.settings.work_dir.merged}/dev/console c 5 1`, echo);
|
|
422
439
|
}
|
|
423
440
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/null`)) {
|
|
424
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/null c 1 3`, echo);
|
|
441
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/null c 1 3`, echo);
|
|
425
442
|
}
|
|
426
443
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/zero`)) {
|
|
427
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/zero c 1 5`, echo);
|
|
444
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/zero c 1 5`, echo);
|
|
428
445
|
}
|
|
429
446
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/ptmx`)) {
|
|
430
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/ptmx c 5 2`, echo);
|
|
447
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/ptmx c 5 2`, echo);
|
|
431
448
|
}
|
|
432
449
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/tty`)) {
|
|
433
|
-
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/tty c 5 0`, echo);
|
|
450
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/tty c 5 0`, echo);
|
|
434
451
|
}
|
|
435
452
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/random`)) {
|
|
436
|
-
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, echo);
|
|
453
|
+
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, echo);
|
|
437
454
|
}
|
|
438
455
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/urandom`)) {
|
|
439
|
-
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, echo);
|
|
456
|
+
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, echo);
|
|
440
457
|
}
|
|
441
458
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`)) {
|
|
442
|
-
await exec(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, echo);
|
|
459
|
+
await (0, utils_1.exec)(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, echo);
|
|
443
460
|
}
|
|
444
461
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/fd`)) {
|
|
445
|
-
await exec(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, echo);
|
|
462
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, echo);
|
|
446
463
|
}
|
|
447
464
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdin`)) {
|
|
448
|
-
await exec(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, echo);
|
|
465
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, echo);
|
|
449
466
|
}
|
|
450
467
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdout`)) {
|
|
451
|
-
await exec(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, echo);
|
|
468
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, echo);
|
|
452
469
|
}
|
|
453
470
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stderr`)) {
|
|
454
|
-
await exec(`ln -sv /proc/self/fd/2 ${this.settings.work_dir.merged}/dev/stderr`, echo);
|
|
471
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/2 ${this.settings.work_dir.merged}/dev/stderr`, echo);
|
|
455
472
|
}
|
|
456
473
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/core`)) {
|
|
457
|
-
await exec(`ln -sv /proc/kcore ${this.settings.work_dir.merged}/dev/core`, echo);
|
|
474
|
+
await (0, utils_1.exec)(`ln -sv /proc/kcore ${this.settings.work_dir.merged}/dev/core`, echo);
|
|
458
475
|
}
|
|
459
476
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
460
|
-
await exec(`mkdir -v ${this.settings.work_dir.merged}/dev/shm`, echo);
|
|
477
|
+
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/shm`, echo);
|
|
461
478
|
}
|
|
462
479
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/pts`)) {
|
|
463
|
-
await exec(`mkdir -v ${this.settings.work_dir.merged}/dev/pts`, echo);
|
|
480
|
+
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/pts`, echo);
|
|
464
481
|
}
|
|
465
482
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
466
|
-
await exec(`chmod 1777 ${this.settings.work_dir.merged}/dev/shm`, echo);
|
|
483
|
+
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/dev/shm`, echo);
|
|
467
484
|
}
|
|
468
485
|
/**
|
|
469
486
|
* Assegno 1777 a /tmp
|
|
470
487
|
* creava problemi con MXLINUX
|
|
471
488
|
*/
|
|
472
489
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/tmp`)) {
|
|
473
|
-
await exec(`mkdir ${this.settings.work_dir.merged}/tmp`, echo);
|
|
490
|
+
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.merged}/tmp`, echo);
|
|
474
491
|
}
|
|
475
|
-
await exec(`chmod 1777 ${this.settings.work_dir.merged}/tmp`, echo);
|
|
492
|
+
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/tmp`, echo);
|
|
476
493
|
}
|
|
477
494
|
/**
|
|
478
|
-
|
|
479
|
-
|
|
495
|
+
* syslinux
|
|
496
|
+
*/
|
|
480
497
|
async syslinux(verbose = false) {
|
|
481
|
-
const echo =
|
|
498
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
482
499
|
if (verbose) {
|
|
483
500
|
console.log('ovary: syslinux');
|
|
501
|
+
console.log('syslinux path: ' + this.settings.distro.syslinuxPath);
|
|
502
|
+
}
|
|
503
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/vesamenu.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
504
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/chain.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
505
|
+
/**
|
|
506
|
+
* per openSuse non sono riusciuto a determinare
|
|
507
|
+
* quale pacchetto installi:
|
|
508
|
+
* ldllinux.c43, libcom32 e libutil.c32
|
|
509
|
+
*/
|
|
510
|
+
if (this.familyId !== 'suse') {
|
|
511
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/ldlinux.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
512
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libcom32.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
513
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libutil.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
484
514
|
}
|
|
485
|
-
await exec('rsync -a ' + this.settings.distro.syslinuxPath + 'vesamenu.c32' + ' ' + this.settings.work_dir.pathIso + 'isolinux/', echo);
|
|
486
|
-
await exec('rsync -a ' + this.settings.distro.syslinuxPath + 'chain.c32' + ' ' + this.settings.work_dir.pathIso + 'isolinux/', echo);
|
|
487
|
-
await exec('rsync -a ' + this.settings.distro.syslinuxPath + 'ldlinux.c32' + ' ' + this.settings.work_dir.pathIso + 'isolinux/', echo);
|
|
488
|
-
await exec('rsync -a ' + this.settings.distro.syslinuxPath + 'libcom32.c32' + ' ' + this.settings.work_dir.pathIso + 'isolinux/', echo);
|
|
489
|
-
await exec('rsync -a ' + this.settings.distro.syslinuxPath + 'libutil.c32' + ' ' + this.settings.work_dir.pathIso + 'isolinux/', echo);
|
|
490
515
|
}
|
|
491
516
|
/**
|
|
492
517
|
* async isolinux
|
|
493
518
|
*/
|
|
494
519
|
async isolinux(theme = 'eggs', verbose = false) {
|
|
495
|
-
const echo =
|
|
520
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
496
521
|
if (verbose) {
|
|
497
522
|
console.log('ovary: isolinux');
|
|
498
523
|
}
|
|
499
|
-
await exec('rsync -a ' + this.settings.distro.isolinuxPath + 'isolinux.bin' + ' ' + this.settings.work_dir.pathIso + 'isolinux/', echo);
|
|
500
|
-
fs.copyFileSync(path.resolve(__dirname, '../../conf/distros/' + this.settings.distro.versionLike + '/' + 'isolinux/isolinux.template.cfg'), this.settings.work_dir.pathIso + 'isolinux/isolinux.cfg');
|
|
501
|
-
fs.copyFileSync(path.resolve(__dirname, '../../conf/distros/' + this.settings.distro.versionLike + '/' + 'isolinux/stdmenu.template.cfg'), this.settings.work_dir.pathIso + 'isolinux/stdmenu.cfg');
|
|
502
|
-
const menuDest = this.settings.work_dir.pathIso + 'isolinux/menu.cfg';
|
|
503
|
-
const splashDest = this.settings.work_dir.pathIso + 'isolinux/splash.png';
|
|
504
524
|
/**
|
|
505
|
-
*
|
|
525
|
+
* isolinux.bin
|
|
506
526
|
*/
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
527
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.isolinuxPath}/isolinux.bin ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
528
|
+
/**
|
|
529
|
+
* isolinux.theme.cfg
|
|
530
|
+
*/
|
|
531
|
+
const isolinuxThemeDest = this.settings.work_dir.pathIso + 'isolinux/isolinux.theme.cfg';
|
|
532
|
+
const isolinuxThemeSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/isolinux.theme.cfg`);
|
|
533
|
+
if (!fs.existsSync(isolinuxThemeSrc)) {
|
|
534
|
+
utils_2.default.warning('Cannot find: ' + isolinuxThemeSrc);
|
|
535
|
+
process.exit();
|
|
516
536
|
}
|
|
517
|
-
fs.copyFileSync(
|
|
518
|
-
|
|
537
|
+
fs.copyFileSync(isolinuxThemeSrc, isolinuxThemeDest);
|
|
538
|
+
/**
|
|
539
|
+
* isolinux.cfg from isolinux.template.cfg
|
|
540
|
+
*/
|
|
541
|
+
const isolinuxDest = this.settings.work_dir.pathIso + 'isolinux/isolinux.cfg';
|
|
542
|
+
let isolinuxTemplate = node_path_1.default.resolve(__dirname, `../../addons/templates/isolinux.template`);
|
|
543
|
+
if (!fs.existsSync(isolinuxTemplate)) {
|
|
544
|
+
utils_2.default.warning('Cannot find: ' + isolinuxTemplate);
|
|
545
|
+
process.exit();
|
|
546
|
+
}
|
|
547
|
+
let kernel_parameters = `boot=live components locales=${process.env.LANG}`;
|
|
548
|
+
let volid = utils_2.default.getVolid(this.settings.remix.name);
|
|
549
|
+
if (this.familyId === "archlinux") {
|
|
550
|
+
kernel_parameters = `misobasedir=live misolabel=${volid} boot=live locales=${process.env.LANG}`;
|
|
551
|
+
}
|
|
552
|
+
const template = fs.readFileSync(isolinuxTemplate, 'utf8');
|
|
519
553
|
const view = {
|
|
520
554
|
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
521
|
-
kernel:
|
|
555
|
+
kernel: utils_2.default.kernelVersion(),
|
|
522
556
|
vmlinuz: `/live${this.settings.vmlinuz}`,
|
|
523
557
|
initrdImg: `/live${this.settings.initrdImg}`,
|
|
524
|
-
|
|
525
|
-
netconfigOpt: this.settings.config.netconfig_opt,
|
|
526
|
-
timezoneOpt: this.settings.config.timezone,
|
|
527
|
-
lang: process.env.LANG,
|
|
528
|
-
locales: process.env.LANG,
|
|
558
|
+
kernel_parameters: kernel_parameters,
|
|
529
559
|
};
|
|
530
|
-
fs.writeFileSync(
|
|
560
|
+
fs.writeFileSync(isolinuxDest, mustache_1.default.render(template, view));
|
|
561
|
+
/**
|
|
562
|
+
* splash
|
|
563
|
+
*/
|
|
564
|
+
const splashDest = `${this.settings.work_dir.pathIso}/isolinux/splash.png`;
|
|
565
|
+
const splashSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/splash.png`);
|
|
566
|
+
if (!fs.existsSync(splashSrc)) {
|
|
567
|
+
utils_2.default.warning('Cannot find: ' + splashSrc);
|
|
568
|
+
process.exit();
|
|
569
|
+
}
|
|
570
|
+
fs.copyFileSync(splashSrc, splashDest);
|
|
531
571
|
}
|
|
532
572
|
/**
|
|
533
573
|
* copy kernel
|
|
534
574
|
*/
|
|
535
|
-
async
|
|
575
|
+
async kernelCopy(verbose = false) {
|
|
576
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
536
577
|
if (verbose) {
|
|
537
|
-
console.log('ovary:
|
|
578
|
+
console.log('ovary: kernelCopy');
|
|
538
579
|
}
|
|
539
|
-
let
|
|
580
|
+
let lackVmlinuzImage = false;
|
|
540
581
|
if (fs.existsSync(this.settings.kernel_image)) {
|
|
541
|
-
|
|
582
|
+
await (0, utils_1.exec)(`cp ${this.settings.kernel_image} ${this.settings.work_dir.pathIso}/live/`, echo);
|
|
542
583
|
}
|
|
543
584
|
else {
|
|
544
|
-
|
|
585
|
+
utils_2.default.error(`Cannot find ${this.settings.kernel_image}`);
|
|
586
|
+
lackVmlinuzImage = true;
|
|
545
587
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
588
|
+
if (lackVmlinuzImage) {
|
|
589
|
+
utils_2.default.warning('Try to edit /etc/penguins-eggs.d/eggs.yaml and check for');
|
|
590
|
+
utils_2.default.warning(`vmlinuz: ${this.settings.kernel_image}`);
|
|
591
|
+
process.exit(1);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* necessita di verbose
|
|
596
|
+
*/
|
|
597
|
+
async initrdCreate(verbose = false) {
|
|
598
|
+
verbose = true;
|
|
599
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
600
|
+
let initrdImg = utils_2.default.initrdImg();
|
|
601
|
+
initrdImg = initrdImg.substring(initrdImg.lastIndexOf('/') + 1);
|
|
602
|
+
utils_2.default.warning(`Creating ${initrdImg} in ${this.settings.work_dir.pathIso}/live/`);
|
|
603
|
+
// shx.cp(path.resolve(__dirname, '../../conf/README.md'), this.settings.work_dir.path + 'README.md')
|
|
604
|
+
await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/manjaro/mkinitcpio.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, echo);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
*
|
|
608
|
+
* @param verbose
|
|
609
|
+
* @returns
|
|
610
|
+
*/
|
|
611
|
+
async initrdCopy(verbose = false) {
|
|
612
|
+
utils_2.default.warning(`initrdCopy`);
|
|
613
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
614
|
+
if (verbose) {
|
|
615
|
+
console.log('ovary: initrdCopy');
|
|
616
|
+
}
|
|
617
|
+
let lackInitrdImage = false;
|
|
618
|
+
if (fs.existsSync(this.settings.initrd_image)) {
|
|
619
|
+
await (0, utils_1.exec)(`cp ${this.settings.initrd_image} ${this.settings.work_dir.pathIso}/live/`, echo);
|
|
549
620
|
}
|
|
550
621
|
else {
|
|
551
|
-
|
|
622
|
+
utils_2.default.error(`Cannot find ${this.settings.initrdImg}`);
|
|
623
|
+
lackInitrdImage = true;
|
|
552
624
|
}
|
|
553
|
-
if (
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
utils_1.default.warning('and initrd_img: vmlinuz: /path/to/initrd_img');
|
|
625
|
+
if (lackInitrdImage) {
|
|
626
|
+
utils_2.default.warning('Try to edit /etc/penguins-eggs.d/eggs.yaml and check for');
|
|
627
|
+
utils_2.default.warning(`initrd_img: ${this.settings.initrd_image}`);
|
|
557
628
|
process.exit(1);
|
|
558
629
|
}
|
|
559
630
|
}
|
|
@@ -575,31 +646,36 @@ class Ovary {
|
|
|
575
646
|
// for (let i in fexcludes) {
|
|
576
647
|
// this.addRemoveExclusion(true, fexcludes[i])
|
|
577
648
|
// }
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
649
|
+
/**
|
|
650
|
+
* Non sò che fa, ma sicuro non serve per archlinux
|
|
651
|
+
*/
|
|
652
|
+
if (this.familyId === 'debian') {
|
|
653
|
+
const rcd = ['rc0.d', 'rc1.d', 'rc2.d', 'rc3.d', 'rc4.d', 'rc5.d', 'rc6.d', 'rcS.d'];
|
|
654
|
+
let files;
|
|
655
|
+
for (const i in rcd) {
|
|
656
|
+
files = fs.readdirSync(`${this.settings.work_dir.merged}/etc/${rcd[i]}`);
|
|
657
|
+
for (const n in files) {
|
|
658
|
+
if (files[n].includes('cryptdisks')) {
|
|
659
|
+
this.addRemoveExclusion(true, `/etc/${rcd[i]}${files[n]}`);
|
|
660
|
+
}
|
|
585
661
|
}
|
|
586
662
|
}
|
|
587
663
|
}
|
|
588
|
-
if (
|
|
589
|
-
this.addRemoveExclusion(true, '/etc/localtime')
|
|
664
|
+
if (shelljs_1.default.exec('/usr/bin/test -L /etc/localtime', { silent: true }) && shelljs_1.default.exec('cat /etc/timezone', { silent: true }) !== 'Europe/Rome') {
|
|
665
|
+
//this.addRemoveExclusion(true, '/etc/localtime')
|
|
590
666
|
}
|
|
591
667
|
this.addRemoveExclusion(true, this.settings.config.snapshot_dir /* .absolutePath() */);
|
|
592
668
|
const compression = `-comp ${this.settings.config.compression}`;
|
|
593
669
|
if (fs.existsSync(`${this.settings.work_dir.pathIso}/live/filesystem.squashfs`)) {
|
|
594
670
|
fs.unlinkSync(`${this.settings.work_dir.pathIso}/live/filesystem.squashfs`);
|
|
595
671
|
}
|
|
596
|
-
// let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}
|
|
597
|
-
let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}
|
|
672
|
+
// let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${compression} -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes} `
|
|
673
|
+
let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${compression} -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes} `;
|
|
598
674
|
cmd = cmd.replace(/\s\s+/g, ' ');
|
|
599
|
-
|
|
675
|
+
utils_2.default.writeX(`${this.settings.work_dir.path}mksquashfs`, cmd);
|
|
600
676
|
if (!scriptOnly) {
|
|
601
|
-
|
|
602
|
-
await exec(cmd, echo);
|
|
677
|
+
utils_2.default.warning('squashing filesystem: ' + compression);
|
|
678
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
603
679
|
}
|
|
604
680
|
}
|
|
605
681
|
/**
|
|
@@ -632,17 +708,12 @@ class Ovary {
|
|
|
632
708
|
* - normal solo la creazione della directory, nessun mount
|
|
633
709
|
* - merged creazione della directory e mount ro
|
|
634
710
|
* - mergedAndOverlay creazione directory, overlay e mount rw
|
|
635
|
-
*
|
|
636
|
-
* @param dir
|
|
637
|
-
*
|
|
638
|
-
* @returns merged
|
|
639
711
|
*/
|
|
640
712
|
merged(dir) {
|
|
641
|
-
const
|
|
713
|
+
const nomergedDirs = [
|
|
642
714
|
'cdrom',
|
|
643
715
|
'dev',
|
|
644
716
|
'home',
|
|
645
|
-
// 'live',
|
|
646
717
|
'media',
|
|
647
718
|
'mnt',
|
|
648
719
|
'proc',
|
|
@@ -652,11 +723,10 @@ class Ovary {
|
|
|
652
723
|
'tmp'
|
|
653
724
|
];
|
|
654
725
|
// deepin ha due directory /data e recovery
|
|
655
|
-
|
|
656
|
-
normalDirs.push('recovery');
|
|
726
|
+
nomergedDirs.push('data', 'recovery');
|
|
657
727
|
let merged = true;
|
|
658
|
-
for (const
|
|
659
|
-
if (dir ===
|
|
728
|
+
for (const nomergedDir of nomergedDirs) {
|
|
729
|
+
if (dir === nomergedDir) {
|
|
660
730
|
merged = false;
|
|
661
731
|
}
|
|
662
732
|
}
|
|
@@ -669,7 +739,8 @@ class Ovary {
|
|
|
669
739
|
* @param verbose
|
|
670
740
|
*/
|
|
671
741
|
async bindLiveFs(verbose = false) {
|
|
672
|
-
|
|
742
|
+
verbose = false;
|
|
743
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
673
744
|
if (verbose) {
|
|
674
745
|
console.log('ovary: bindLiveFs');
|
|
675
746
|
}
|
|
@@ -679,15 +750,14 @@ class Ovary {
|
|
|
679
750
|
* viene ignorato da Node8, ma da problemi da Node10 in poi
|
|
680
751
|
*/
|
|
681
752
|
const dirs = fs.readdirSync('/');
|
|
682
|
-
const startLine =
|
|
683
|
-
const titleLine =
|
|
684
|
-
const endLine =
|
|
753
|
+
const startLine = '#############################################################';
|
|
754
|
+
const titleLine = '# -----------------------------------------------------------';
|
|
755
|
+
const endLine = '# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n';
|
|
685
756
|
let lnkDest = '';
|
|
686
757
|
let cmd = '';
|
|
687
758
|
const cmds = [];
|
|
688
|
-
cmds.push(
|
|
689
|
-
cmds.push(`#
|
|
690
|
-
cmds.push(`# host: ${os.hostname()} user: ${utils_1.default.getPrimaryUser()}\n`);
|
|
759
|
+
cmds.push('# NOTE: cdrom, dev, live, media, mnt, proc, run, sys and tmp', `# need just a mkdir in ${this.settings.work_dir.merged}`);
|
|
760
|
+
cmds.push(`# host: ${node_os_1.default.hostname()} user: ${utils_2.default.getPrimaryUser()}\n`);
|
|
691
761
|
for (const dir of dirs) {
|
|
692
762
|
cmds.push(startLine);
|
|
693
763
|
if (n8_1.default.isDirectory(dir)) {
|
|
@@ -697,27 +767,20 @@ class Ovary {
|
|
|
697
767
|
/**
|
|
698
768
|
* mergedAndOverlay creazione directory, overlay e mount rw
|
|
699
769
|
*/
|
|
700
|
-
cmds.push(`${cmd} need to be presente, and rw
|
|
701
|
-
cmds.push(
|
|
702
|
-
cmds.push(
|
|
703
|
-
cmds.push(await
|
|
704
|
-
cmds.push(`# first: mount /${dir} rw in ${this.settings.work_dir.lowerdir}/${dir}`);
|
|
705
|
-
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.lowerdir}/${dir}`, verbose));
|
|
706
|
-
cmds.push(`# now remount it ro`);
|
|
707
|
-
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.lowerdir}/${dir}`, verbose));
|
|
708
|
-
cmds.push(`\n# second: create mountpoint upper, work and ${this.settings.work_dir.merged} and mount ${dir}`);
|
|
770
|
+
cmds.push(`${cmd} need to be presente, and rw`, titleLine, '# create mountpoint lower');
|
|
771
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.lowerdir}/${dir}`), `# first: mount /${dir} rw in ${this.settings.work_dir.lowerdir}/${dir}`);
|
|
772
|
+
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.lowerdir}/${dir}`, verbose), '# now remount it ro');
|
|
773
|
+
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.lowerdir}/${dir}`, verbose), `\n# second: create mountpoint upper, work and ${this.settings.work_dir.merged} and mount ${dir}`);
|
|
709
774
|
cmds.push(await makeIfNotExist(`${this.settings.work_dir.upperdir}/${dir}`, verbose));
|
|
710
775
|
cmds.push(await makeIfNotExist(`${this.settings.work_dir.workdir}/${dir}`, verbose));
|
|
711
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
712
|
-
cmds.push(`\n# thirth: mount /${dir} rw in ${this.settings.work_dir.merged}`);
|
|
776
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose), `\n# thirth: mount /${dir} rw in ${this.settings.work_dir.merged}`);
|
|
713
777
|
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}`, verbose));
|
|
714
778
|
}
|
|
715
779
|
else if (this.merged(dir)) {
|
|
716
780
|
/*
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
cmds.push(`${cmd} need to be present, mount ro
|
|
720
|
-
cmds.push(titleLine);
|
|
781
|
+
* merged creazione della directory e mount ro
|
|
782
|
+
*/
|
|
783
|
+
cmds.push(`${cmd} need to be present, mount ro`, titleLine);
|
|
721
784
|
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
722
785
|
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
723
786
|
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
@@ -726,16 +789,13 @@ class Ovary {
|
|
|
726
789
|
/**
|
|
727
790
|
* normal solo la creazione della directory, nessun mount
|
|
728
791
|
*/
|
|
729
|
-
cmds.push(`${cmd} need to be present, no mount
|
|
730
|
-
cmds.push(
|
|
731
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
732
|
-
cmds.push(`# mount -o bind /${dir} ${this.settings.work_dir.merged}/${dir}`);
|
|
792
|
+
cmds.push(`${cmd} need to be present, no mount`, titleLine);
|
|
793
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose), `# mount -o bind /${dir} ${this.settings.work_dir.merged}/${dir}`);
|
|
733
794
|
}
|
|
734
795
|
}
|
|
735
796
|
}
|
|
736
797
|
else if (n8_1.default.isFile(dir)) {
|
|
737
|
-
cmds.push(`# /${dir} is just a file
|
|
738
|
-
cmds.push(titleLine);
|
|
798
|
+
cmds.push(`# /${dir} is just a file`, titleLine);
|
|
739
799
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
|
|
740
800
|
cmds.push(await rexec(`cp /${dir} ${this.settings.work_dir.merged}`, verbose));
|
|
741
801
|
}
|
|
@@ -745,11 +805,7 @@ class Ovary {
|
|
|
745
805
|
}
|
|
746
806
|
else if (n8_1.default.isSymbolicLink(dir)) {
|
|
747
807
|
lnkDest = fs.readlinkSync(`/${dir}`);
|
|
748
|
-
cmds.push(`# /${dir} is a symbolic link to /${lnkDest} in the system
|
|
749
|
-
cmds.push(`# we need just to recreate it`);
|
|
750
|
-
cmds.push(`# ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`);
|
|
751
|
-
cmds.push(`# but we don't know if the destination exist, and I'm too lazy today. So, for now: `);
|
|
752
|
-
cmds.push(titleLine);
|
|
808
|
+
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);
|
|
753
809
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
|
|
754
810
|
if (fs.existsSync(lnkDest)) {
|
|
755
811
|
cmds.push(`ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`);
|
|
@@ -764,21 +820,20 @@ class Ovary {
|
|
|
764
820
|
}
|
|
765
821
|
cmds.push(endLine);
|
|
766
822
|
}
|
|
767
|
-
|
|
823
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}bind`, cmds);
|
|
768
824
|
}
|
|
769
825
|
/**
|
|
770
826
|
* ubind del fs live
|
|
771
827
|
* @param verbose
|
|
772
828
|
*/
|
|
773
829
|
async uBindLiveFs(verbose = false) {
|
|
774
|
-
const echo =
|
|
830
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
775
831
|
if (verbose) {
|
|
776
832
|
console.log('ovary: uBindLiveFs');
|
|
777
833
|
}
|
|
778
834
|
const cmds = [];
|
|
779
|
-
cmds.push(
|
|
780
|
-
cmds.push(`#
|
|
781
|
-
cmds.push(`# host: ${os.hostname()} user: ${utils_1.default.getPrimaryUser()}\n`);
|
|
835
|
+
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}`);
|
|
836
|
+
cmds.push(`# host: ${node_os_1.default.hostname()} user: ${utils_2.default.getPrimaryUser()}\n`);
|
|
782
837
|
// await exec(`/usr/bin/pkill mksquashfs; /usr/bin/pkill md5sum`, {echo: true})
|
|
783
838
|
if (fs.existsSync(this.settings.work_dir.merged)) {
|
|
784
839
|
const bindDirs = fs.readdirSync(this.settings.work_dir.merged, {
|
|
@@ -786,24 +841,25 @@ class Ovary {
|
|
|
786
841
|
});
|
|
787
842
|
for (const dir of bindDirs) {
|
|
788
843
|
const dirname = n8_1.default.dirent2string(dir);
|
|
789
|
-
cmds.push(
|
|
844
|
+
cmds.push('#############################################################');
|
|
790
845
|
if (n8_1.default.isDirectory(dirname)) {
|
|
791
846
|
cmds.push(`\n# directory: ${dirname}`);
|
|
792
847
|
if (this.mergedAndOvelay(dirname)) {
|
|
793
|
-
cmds.push(`\n# ${dirname} has overlay`);
|
|
794
|
-
cmds.push(`\n#
|
|
795
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, verbose));
|
|
796
|
-
cmds.push(`\n# Second, umount it from ${this.settings.work_dir.lowerdir}`);
|
|
848
|
+
cmds.push(`\n# ${dirname} has overlay`, `\n# First, umount it from ${this.settings.work_dir.path}`);
|
|
849
|
+
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, verbose), `\n# Second, umount it from ${this.settings.work_dir.lowerdir}`);
|
|
797
850
|
cmds.push(await rexec(`umount ${this.settings.work_dir.lowerdir}/${dirname}`, verbose));
|
|
798
851
|
}
|
|
799
852
|
else if (this.merged(dirname)) {
|
|
800
853
|
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, verbose));
|
|
801
854
|
}
|
|
802
855
|
cmds.push(`\n# remove in ${this.settings.work_dir.merged} and ${this.settings.work_dir.lowerdir}`);
|
|
803
|
-
|
|
856
|
+
/**
|
|
857
|
+
* We can't remove the nest!!!
|
|
858
|
+
*/
|
|
859
|
+
let nest = this.settings.work_dir.path.split('/');
|
|
860
|
+
if (dirname !== nest[1]) { // We can't remove first level nest
|
|
804
861
|
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname} -rf`, verbose));
|
|
805
862
|
}
|
|
806
|
-
cmds.push(await rexec(`rm ${this.settings.work_dir.lowerdir}/${dirname} -rf`, verbose));
|
|
807
863
|
}
|
|
808
864
|
else if (n8_1.default.isFile(dirname)) {
|
|
809
865
|
cmds.push(`\n# ${dirname} = file`);
|
|
@@ -815,19 +871,15 @@ class Ovary {
|
|
|
815
871
|
}
|
|
816
872
|
}
|
|
817
873
|
}
|
|
818
|
-
|
|
874
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}ubind`, cmds);
|
|
819
875
|
}
|
|
820
876
|
/**
|
|
821
877
|
* bind dei virtual file system
|
|
822
878
|
*/
|
|
823
879
|
async bindVfs(verbose = false) {
|
|
824
880
|
const cmds = [];
|
|
825
|
-
cmds.push(`mount -o bind /dev ${this.settings.work_dir.merged}/dev`);
|
|
826
|
-
|
|
827
|
-
cmds.push(`mount -o bind /proc ${this.settings.work_dir.merged}/proc`);
|
|
828
|
-
cmds.push(`mount -o bind /sys ${this.settings.work_dir.merged}/sys`);
|
|
829
|
-
cmds.push(`mount -o bind /run ${this.settings.work_dir.merged}/run`);
|
|
830
|
-
utils_1.default.writeXs(`${this.settings.work_dir.path}bindvfs`, cmds);
|
|
881
|
+
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`);
|
|
882
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}bindvfs`, cmds);
|
|
831
883
|
}
|
|
832
884
|
/**
|
|
833
885
|
*
|
|
@@ -835,94 +887,29 @@ class Ovary {
|
|
|
835
887
|
*/
|
|
836
888
|
async ubindVfs(verbose = false) {
|
|
837
889
|
const cmds = [];
|
|
838
|
-
cmds.push(`umount ${this.settings.work_dir.merged}/dev/pts`);
|
|
839
|
-
|
|
840
|
-
cmds.push(`umount ${this.settings.work_dir.merged}/proc`);
|
|
841
|
-
cmds.push(`umount ${this.settings.work_dir.merged}/run`);
|
|
842
|
-
// cmds.push(`umount ${this.settings.work_dir.merged}/sys/fs/fuse/connections`)
|
|
843
|
-
cmds.push(`umount ${this.settings.work_dir.merged}/sys`);
|
|
844
|
-
utils_1.default.writeXs(`${this.settings.work_dir.path}ubindvfs`, cmds);
|
|
845
|
-
}
|
|
846
|
-
/**
|
|
847
|
-
*
|
|
848
|
-
* @param verbose
|
|
849
|
-
*/
|
|
850
|
-
async getUsersDatasSize(verbose = false) {
|
|
851
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
852
|
-
if (verbose) {
|
|
853
|
-
utils_1.default.warning('copyUsersDatas');
|
|
854
|
-
}
|
|
855
|
-
const cmds = [];
|
|
856
|
-
const cmd = `chroot / getent passwd {1000..60000} |awk -F: '{print $1}'`;
|
|
857
|
-
const result = await exec(cmd, {
|
|
858
|
-
echo: verbose,
|
|
859
|
-
ignore: false,
|
|
860
|
-
capture: true
|
|
861
|
-
});
|
|
862
|
-
// Filter serve a rimuovere gli elementi vuoti
|
|
863
|
-
const users = result.data.split('\n').filter(Boolean);
|
|
864
|
-
let size = 0;
|
|
865
|
-
utils_1.default.warning('We found ' + users.length + ' users');
|
|
866
|
-
for (let i = 0; i < users.length; i++) {
|
|
867
|
-
// esclude tutte le cartelle che NON sono users
|
|
868
|
-
if (users[i] !== this.settings.config.user_opt) {
|
|
869
|
-
// du restituisce size in Kbytes senza -b
|
|
870
|
-
const bytes = parseInt(shx.exec(`du -b --summarize /home/${users[i]} |awk '{ print $1 }'`, { silent: true }).stdout.trim());
|
|
871
|
-
size += bytes;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
return size;
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
*
|
|
878
|
-
* @param verbose
|
|
879
|
-
*/
|
|
880
|
-
async copyUsersDatas(verbose = false) {
|
|
881
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
882
|
-
if (verbose) {
|
|
883
|
-
utils_1.default.warning('copyUsersDatas');
|
|
884
|
-
}
|
|
885
|
-
const cmds = [];
|
|
886
|
-
// take original users in croot there is just live now
|
|
887
|
-
const cmd = `getent passwd {1000..60000} |awk -F: '{print $1}'`;
|
|
888
|
-
const result = await exec(cmd, {
|
|
889
|
-
echo: verbose,
|
|
890
|
-
ignore: false,
|
|
891
|
-
capture: true
|
|
892
|
-
});
|
|
893
|
-
const users = result.data.split('\n');
|
|
894
|
-
child_process_1.execSync('mkdir -p /mnt/home', { stdio: 'inherit' });
|
|
895
|
-
for (let i = 0; i < users.length - 1; i++) {
|
|
896
|
-
// ad esclusione dell'utente live...
|
|
897
|
-
if (users[i] !== this.settings.config.user_opt) {
|
|
898
|
-
child_process_1.execSync('mkdir -p /mnt/home/' + users[i], { stdio: 'inherit' });
|
|
899
|
-
child_process_1.execSync('rsync -a /home/' + users[i] + '/ ' + '/mnt/home/' + users[i] + '/', { stdio: 'inherit' });
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
child_process_1.execSync('mkdir -p /mnt/etc', { stdio: 'inherit' });
|
|
903
|
-
child_process_1.execSync('cp /etc/passwd /mnt/etc', { stdio: 'inherit' });
|
|
904
|
-
child_process_1.execSync('cp /etc/shadow /mnt/etc', { stdio: 'inherit' });
|
|
905
|
-
child_process_1.execSync('cp /etc/group /mnt/etc', { stdio: 'inherit' });
|
|
890
|
+
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`);
|
|
891
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}ubindvfs`, cmds);
|
|
906
892
|
}
|
|
907
893
|
/**
|
|
908
894
|
*
|
|
909
895
|
* @param verbose
|
|
910
896
|
*/
|
|
911
897
|
async cleanUsersAccounts(verbose = false) {
|
|
912
|
-
const echo =
|
|
898
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
913
899
|
/**
|
|
914
900
|
* delete all user in chroot
|
|
915
901
|
*/
|
|
916
902
|
const cmds = [];
|
|
917
903
|
const cmd = `chroot ${this.settings.work_dir.merged} getent passwd {1000..60000} |awk -F: '{print $1}'`;
|
|
918
|
-
const result = await exec(cmd, {
|
|
904
|
+
const result = await (0, utils_1.exec)(cmd, {
|
|
919
905
|
echo: verbose,
|
|
920
906
|
ignore: false,
|
|
921
907
|
capture: true
|
|
922
908
|
});
|
|
923
909
|
const users = result.data.split('\n');
|
|
924
910
|
for (let i = 0; i < users.length - 1; i++) {
|
|
925
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} deluser ${users[i]}`, verbose))
|
|
911
|
+
// cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} deluser ${users[i]}`, verbose))
|
|
912
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} userdel ${users[i]}`, verbose));
|
|
926
913
|
}
|
|
927
914
|
}
|
|
928
915
|
/**
|
|
@@ -931,80 +918,102 @@ class Ovary {
|
|
|
931
918
|
* @param verbose
|
|
932
919
|
*/
|
|
933
920
|
async createUserLive(verbose = false) {
|
|
934
|
-
const echo =
|
|
921
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
935
922
|
if (verbose) {
|
|
936
923
|
console.log('ovary: createUserLive');
|
|
937
924
|
}
|
|
938
925
|
const cmds = [];
|
|
939
|
-
cmds.push(await rexec(
|
|
940
|
-
cmds.push(await rexec(
|
|
941
|
-
cmds.push(await rexec(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
cmds.push(await rexec(
|
|
946
|
-
|
|
926
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' rm /home/' + this.settings.config.user_opt + ' -rf', verbose));
|
|
927
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' mkdir /home/' + this.settings.config.user_opt, verbose));
|
|
928
|
+
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 ', verbose));
|
|
929
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' echo ' + this.settings.config.user_opt + ':' + this.settings.config.user_opt_passwd + '| chroot ' + this.settings.work_dir.merged + ' chpasswd', verbose));
|
|
930
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', verbose));
|
|
931
|
+
// cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', verbose))
|
|
932
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' chown ' + this.settings.config.user_opt + ':users' + ' /home/' + this.settings.config.user_opt + ' -R', verbose));
|
|
933
|
+
if (this.familyId === 'debian') {
|
|
934
|
+
// add user live to sudo
|
|
935
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sudo ${this.settings.config.user_opt}`, verbose));
|
|
936
|
+
// educaandos
|
|
937
|
+
if (this.theme === 'educaandos') {
|
|
938
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG adm ${this.settings.config.user_opt}`, verbose));
|
|
939
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG cdrom ${this.settings.config.user_opt}`, verbose));
|
|
940
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG dip ${this.settings.config.user_opt}`, verbose));
|
|
941
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG plugdev ${this.settings.config.user_opt}`, verbose));
|
|
942
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG lpadmin ${this.settings.config.user_opt}`, verbose));
|
|
943
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sambashare ${this.settings.config.user_opt}`, verbose));
|
|
944
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG admin ${this.settings.config.user_opt}`, verbose));
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
else if (this.familyId === 'archlinux') {
|
|
948
|
+
// adduser live to wheel and autologin
|
|
949
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, verbose));
|
|
950
|
+
// in manjaro they use autologin group for the iso, if not exist create it
|
|
951
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} test $(grep "autologin" /etc/group) || groupadd -r autologin`, verbose));
|
|
952
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG autologin ${this.settings.config.user_opt}`, verbose));
|
|
953
|
+
}
|
|
954
|
+
if (this.familyId === 'debian' || this.familyId === 'archlinux') {
|
|
955
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' echo root:' + this.settings.config.root_passwd + '| chroot ' + this.settings.work_dir.merged + ' chpasswd', verbose));
|
|
956
|
+
}
|
|
947
957
|
}
|
|
948
958
|
/**
|
|
949
959
|
*
|
|
950
960
|
*/
|
|
951
|
-
async
|
|
952
|
-
const echo =
|
|
961
|
+
async createXdgAutostart(theme = 'eggs', myAddons, verbose = false) {
|
|
962
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
953
963
|
if (verbose) {
|
|
954
|
-
console.log('ovary:
|
|
964
|
+
console.log('ovary: createXdgAutostart()');
|
|
955
965
|
}
|
|
956
966
|
const pathHomeLive = `/home/${this.settings.config.user_opt}`;
|
|
957
967
|
// Copia icona penguins-eggs
|
|
958
|
-
|
|
959
|
-
|
|
968
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/eggs.png'), '/usr/share/icons/');
|
|
969
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/krill.svg'), '/usr/share/icons/');
|
|
960
970
|
/**
|
|
961
971
|
* creazione dei link in /usr/share/applications
|
|
962
|
-
*
|
|
963
972
|
*/
|
|
964
|
-
|
|
973
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/penguins-eggs.desktop'), '/usr/share/applications/');
|
|
965
974
|
let installerUrl = 'install-debian.desktop';
|
|
966
|
-
let installerIcon =
|
|
975
|
+
let installerIcon = 'install-debian';
|
|
967
976
|
if (pacman_1.default.packageIsInstalled('calamares')) {
|
|
968
|
-
|
|
969
|
-
}
|
|
970
|
-
else if (pacman_1.default.packageIsInstalled('mx-installer')) {
|
|
971
|
-
installerUrl = 'penguins-minstall.desktop';
|
|
972
|
-
installerIcon = '/usr/share/gazelle-installer-data/logo.png';
|
|
973
|
-
shx.cp(path.resolve(__dirname, '../../assets/penguins-minstall.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
977
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/applications/install-debian.desktop`), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
974
978
|
}
|
|
975
979
|
else {
|
|
976
980
|
installerUrl = 'penguins-krill.desktop';
|
|
977
981
|
installerIcon = 'utilities-terminal';
|
|
978
|
-
|
|
982
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/penguins-krill.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
979
983
|
}
|
|
980
|
-
|
|
984
|
+
/**
|
|
985
|
+
* flags
|
|
986
|
+
*/
|
|
987
|
+
// adapt
|
|
981
988
|
if (myAddons.adapt) {
|
|
982
|
-
//
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
}
|
|
989
|
+
// if (Pacman.packageIsInstalled('lxde-core') || Pacman.packageIsInstalled('deepin-desktop-base') || Pacman.packageIsInstalled('mate-desktop') || Pacman.packageIsInstalled('ubuntu-mate-core') || Pacman.packageIsInstalled('xfce4')) {
|
|
990
|
+
const dirAddon = node_path_1.default.resolve(__dirname, `../../addons/eggs/adapt/`);
|
|
991
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-adapt.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
992
|
+
// shx.cp(`${dirAddon}/bin/eggs-adapt.sh`, `${this.settings.work_dir.merged}/usr/local/bin/`)
|
|
993
|
+
// }
|
|
988
994
|
}
|
|
995
|
+
// ichoice
|
|
989
996
|
if (myAddons.ichoice) {
|
|
990
997
|
installerUrl = 'eggs-ichoice.desktop';
|
|
991
998
|
installerIcon = 'system-software-install';
|
|
992
|
-
const dirAddon =
|
|
993
|
-
|
|
994
|
-
|
|
999
|
+
const dirAddon = node_path_1.default.resolve(__dirname, '../../addons/eggs/ichoice/');
|
|
1000
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-ichoice.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
1001
|
+
shelljs_1.default.cp(`${dirAddon}/bin/eggs-ichoice.sh`, `${this.settings.work_dir.merged}/usr/local/bin/`);
|
|
995
1002
|
}
|
|
1003
|
+
// pve
|
|
996
1004
|
if (myAddons.pve) {
|
|
997
1005
|
// Imposto service pve-lite
|
|
998
1006
|
const pve = new pve_live_1.default();
|
|
999
1007
|
pve.create(this.settings.work_dir.merged);
|
|
1000
|
-
const dirAddon =
|
|
1001
|
-
|
|
1002
|
-
|
|
1008
|
+
const dirAddon = node_path_1.default.resolve(__dirname, '../../addons/eggs/pve');
|
|
1009
|
+
shelljs_1.default.cp(`${dirAddon}/artwork/eggs-pve.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
|
|
1010
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-pve.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
1003
1011
|
}
|
|
1012
|
+
// rsupport
|
|
1004
1013
|
if (myAddons.rsupport) {
|
|
1005
|
-
const dirAddon =
|
|
1006
|
-
|
|
1007
|
-
|
|
1014
|
+
const dirAddon = node_path_1.default.resolve(__dirname, '../../addons/eggs/rsupport');
|
|
1015
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-rsupport.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
1016
|
+
shelljs_1.default.cp(`${dirAddon}/artwork/eggs-rsupport.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
|
|
1008
1017
|
}
|
|
1009
1018
|
/**
|
|
1010
1019
|
* configuro add-penguins-desktop-icons in /etc/xdg/autostart
|
|
@@ -1013,7 +1022,7 @@ class Ovary {
|
|
|
1013
1022
|
const dirRun = '/usr/bin';
|
|
1014
1023
|
if (fs.existsSync(dirAutostart)) {
|
|
1015
1024
|
// Creo l'avviatore xdg DEVE essere add-penguins-links.desktop
|
|
1016
|
-
|
|
1025
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/penguins-links-add.desktop'), dirAutostart);
|
|
1017
1026
|
// Creo lo script add-penguins-links.sh
|
|
1018
1027
|
const script = `${dirRun}/penguins-links-add.sh`;
|
|
1019
1028
|
let text = '';
|
|
@@ -1025,7 +1034,7 @@ class Ovary {
|
|
|
1025
1034
|
// per l'installer, lo tolgo altrimenti su LXDE riappare comunque
|
|
1026
1035
|
text += `cp /usr/share/applications/${installerUrl} $DESKTOP\n`;
|
|
1027
1036
|
if (pacman_1.default.packageIsInstalled('lxde-core')) {
|
|
1028
|
-
text += this.lxdeLink('penguins-eggs.desktop',
|
|
1037
|
+
text += this.lxdeLink('penguins-eggs.desktop', "penguin's eggs", 'eggs');
|
|
1029
1038
|
if (myAddons.adapt)
|
|
1030
1039
|
text += this.lxdeLink('eggs-adapt.desktop', 'Adapt', 'video-display');
|
|
1031
1040
|
if (myAddons.pve)
|
|
@@ -1042,10 +1051,27 @@ class Ovary {
|
|
|
1042
1051
|
if (myAddons.rsupport)
|
|
1043
1052
|
text += 'cp /usr/share/applications/eggs-rsupport.desktop $DESKTOP\n';
|
|
1044
1053
|
}
|
|
1054
|
+
// enable desktop links in gnome
|
|
1055
|
+
/**
|
|
1056
|
+
* test -f /usr/share/applications/penguins-eggs.desktop && cp /usr/share/applications/penguins-eggs.desktop $DESKTOP
|
|
1057
|
+
* test -f "$DESKTOP/penguins-eggs.desktop" && chmod a+x "$DESKTOP/penguins-eggs.desktop"
|
|
1058
|
+
* test -f "$DESKTOP/penguins-eggs.desktop" && gio set "$DESKTOP/penguins-eggs.desktop" metadata::trusted true
|
|
1059
|
+
* test -f /usr/share/applications/install-debian.desktop && cp /usr/share/applications/install-debian.desktop $DESKTOP
|
|
1060
|
+
* test -f "$DESKTOP/install-debian.desktop" && chmod a+x $DESKTOP/install-debian.desktop
|
|
1061
|
+
* test -f "$DESKTOP/install-debian.desktop" && gio set "$DESKTOP/install-debian.desktop" metadata::trusted true
|
|
1062
|
+
*/
|
|
1063
|
+
if (pacman_1.default.packageIsInstalled('gdm3') || pacman_1.default.packageIsInstalled('gdm')) {
|
|
1064
|
+
text += `test -f /usr/share/applications/penguins-eggs.desktop && cp /usr/share/applications/penguins-eggs.desktop $DESKTOP\n`;
|
|
1065
|
+
text += `test -f "$DESKTOP/penguins-eggs.desktop" && chmod a+x "$DESKTOP/penguins-eggs.desktop"\n`;
|
|
1066
|
+
text += `test -f "$DESKTOP/penguins-eggs.desktop" && gio set "$DESKTOP/penguins-eggs.desktop" metadata::trusted true\n`;
|
|
1067
|
+
text += `test -f /usr/share/applications/install-debian.desktop && cp /usr/share/applications/install-debian.desktop $DESKTOP\n`;
|
|
1068
|
+
text += `test -f "$DESKTOP/install-debian.desktop" && chmod a+x $DESKTOP/install-debian.desktop\n`;
|
|
1069
|
+
text += `test -f "$DESKTOP/install-debian.desktop" && gio set "$DESKTOP/install-debian.desktop" metadata::trusted true\n`;
|
|
1070
|
+
}
|
|
1045
1071
|
fs.writeFileSync(script, text, 'utf8');
|
|
1046
|
-
await exec(`chmod a+x ${script}`, echo);
|
|
1072
|
+
await (0, utils_1.exec)(`chmod a+x ${script}`, echo);
|
|
1047
1073
|
}
|
|
1048
|
-
xdg_1.default.autologin(
|
|
1074
|
+
await xdg_1.default.autologin(utils_2.default.getPrimaryUser(), this.settings.config.user_opt, this.settings.work_dir.merged);
|
|
1049
1075
|
}
|
|
1050
1076
|
/**
|
|
1051
1077
|
* Creazione link desktop per lxde
|
|
@@ -1069,15 +1095,10 @@ class Ovary {
|
|
|
1069
1095
|
*/
|
|
1070
1096
|
addRemoveExclusion(add, exclusion) {
|
|
1071
1097
|
if (exclusion.startsWith('/')) {
|
|
1072
|
-
exclusion = exclusion.
|
|
1098
|
+
exclusion = exclusion.slice(1); // remove / initial Non compatible with
|
|
1073
1099
|
}
|
|
1074
1100
|
if (add) {
|
|
1075
|
-
|
|
1076
|
-
this.settings.session_excludes += `-e '${exclusion}' `;
|
|
1077
|
-
}
|
|
1078
|
-
else {
|
|
1079
|
-
this.settings.session_excludes += ` '${exclusion}' `;
|
|
1080
|
-
}
|
|
1101
|
+
this.settings.session_excludes += this.settings.session_excludes === '' ? `-e '${exclusion}' ` : ` '${exclusion}' `;
|
|
1081
1102
|
}
|
|
1082
1103
|
else {
|
|
1083
1104
|
this.settings.session_excludes.replace(` '${exclusion}'`, '');
|
|
@@ -1086,336 +1107,401 @@ class Ovary {
|
|
|
1086
1107
|
}
|
|
1087
1108
|
}
|
|
1088
1109
|
}
|
|
1110
|
+
// #######################################################################################
|
|
1089
1111
|
/**
|
|
1090
1112
|
* makeEfi
|
|
1091
|
-
|
|
1092
|
-
|
|
1113
|
+
*/
|
|
1114
|
+
// #######################################################################################
|
|
1093
1115
|
async makeEfi(theme = 'eggs', verbose = false) {
|
|
1094
|
-
const echo =
|
|
1116
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1095
1117
|
if (verbose) {
|
|
1096
1118
|
console.log('ovary: makeEfi');
|
|
1097
1119
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1120
|
+
const memdiskDir = this.settings.work_dir.path + 'memdiskDir';
|
|
1121
|
+
const efiWorkDir = this.settings.efi_work;
|
|
1122
|
+
const isoDir = this.settings.work_dir.pathIso;
|
|
1123
|
+
const versionLike = this.settings.distro.versionLike;
|
|
1124
|
+
/**
|
|
1125
|
+
* il pachetto grub/grub2 DEVE essere presente
|
|
1126
|
+
*/
|
|
1127
|
+
const grubName = pacman_1.default.whichGrubIsInstalled();
|
|
1128
|
+
if (grubName === '') {
|
|
1129
|
+
utils_2.default.error('Something went wrong! Cannot find grub');
|
|
1102
1130
|
process.exit(1);
|
|
1103
1131
|
}
|
|
1104
1132
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1133
|
+
* Creo o cancello e creo: memdiskDir
|
|
1134
|
+
*/
|
|
1135
|
+
if (fs.existsSync(memdiskDir)) {
|
|
1136
|
+
await (0, utils_1.exec)(`rm ${memdiskDir} -rf`, echo);
|
|
1137
|
+
}
|
|
1138
|
+
utils_2.default.warning('creating memdiskDir: ' + memdiskDir);
|
|
1139
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}`);
|
|
1140
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot`, echo);
|
|
1141
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot/grub`, echo);
|
|
1142
|
+
/**
|
|
1143
|
+
* for initial grub.cfg in memdisk
|
|
1109
1144
|
*/
|
|
1110
|
-
const
|
|
1111
|
-
// for initial grub.cfg
|
|
1112
|
-
shx.mkdir('-p', `${tempDir}/boot/grub`);
|
|
1113
|
-
const grubCfg = `${tempDir}/boot/grub/grub.cfg`;
|
|
1114
|
-
shx.touch(grubCfg);
|
|
1145
|
+
const grubCfg = `${memdiskDir}/boot/grub/grub.cfg`;
|
|
1115
1146
|
let text = '';
|
|
1116
|
-
text += 'search --file --set=root /
|
|
1147
|
+
text += 'search --file --set=root /.disk/info\n';
|
|
1117
1148
|
text += 'set prefix=($root)/boot/grub\n';
|
|
1118
|
-
text += `source $prefix/${
|
|
1119
|
-
|
|
1149
|
+
text += `source $prefix/${utils_2.default.machineUEFI()}/grub.cfg\n`;
|
|
1150
|
+
utils_2.default.write(grubCfg, text);
|
|
1151
|
+
// #################################
|
|
1120
1152
|
/**
|
|
1121
|
-
*
|
|
1153
|
+
* start with empty efiWorkDir
|
|
1122
1154
|
*/
|
|
1123
|
-
if (
|
|
1124
|
-
|
|
1155
|
+
if (fs.existsSync(efiWorkDir)) {
|
|
1156
|
+
await (0, utils_1.exec)(`rm ${efiWorkDir} -rf`, echo);
|
|
1157
|
+
}
|
|
1158
|
+
utils_2.default.warning('creating efiWordDir: ' + efiWorkDir);
|
|
1159
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}`, echo);
|
|
1160
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot`, echo);
|
|
1161
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub`, echo);
|
|
1162
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}`, echo);
|
|
1163
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi`, echo);
|
|
1164
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi/boot`, echo);
|
|
1165
|
+
/**
|
|
1166
|
+
* copy splash to efiWorkDir
|
|
1167
|
+
*/
|
|
1168
|
+
const splashDest = `${efiWorkDir}/boot/grub/splash.png`;
|
|
1169
|
+
const splashSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/splash.png`);
|
|
1170
|
+
if (!fs.existsSync(splashSrc)) {
|
|
1171
|
+
utils_2.default.warning('Cannot find: ' + splashSrc);
|
|
1172
|
+
process.exit();
|
|
1173
|
+
}
|
|
1174
|
+
await (0, utils_1.exec)(`cp ${splashSrc} ${splashDest}`);
|
|
1175
|
+
/**
|
|
1176
|
+
* copy theme
|
|
1177
|
+
*/
|
|
1178
|
+
const themeDest = `${efiWorkDir}/boot/grub/theme.cfg`;
|
|
1179
|
+
const themeSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.theme.cfg`);
|
|
1180
|
+
if (!fs.existsSync(themeSrc)) {
|
|
1181
|
+
utils_2.default.warning('Cannot find: ' + themeSrc);
|
|
1182
|
+
process.exit();
|
|
1125
1183
|
}
|
|
1126
|
-
|
|
1127
|
-
const currentDir = process.cwd();
|
|
1184
|
+
await (0, utils_1.exec)(`cp ${themeSrc} ${themeDest}`);
|
|
1128
1185
|
/**
|
|
1129
|
-
*
|
|
1186
|
+
* second grub.cfg file in efiWork
|
|
1130
1187
|
*/
|
|
1131
|
-
|
|
1188
|
+
// 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
|
|
1189
|
+
let cmd = `for i in $(ls /usr/lib/grub/${utils_2.default.machineUEFI()}|grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> ${efiWorkDir}boot/grub/${utils_2.default.machineUEFI()}/grub.cfg; done`;
|
|
1190
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1191
|
+
// for i in efi_gop efi_uga ieee1275_fb vbe vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg ; done
|
|
1192
|
+
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_2.default.machineUEFI()}/grub.cfg ; done`;
|
|
1193
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1194
|
+
await (0, utils_1.exec)(`echo "source /boot/grub/grub.cfg" >> ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/grub.cfg`, echo);
|
|
1132
1195
|
/**
|
|
1133
|
-
*
|
|
1196
|
+
* andiamo in memdiskDir
|
|
1134
1197
|
*/
|
|
1135
|
-
const files = fs.readdirSync('.');
|
|
1136
|
-
for (var i in files) {
|
|
1137
|
-
if (files[i] === './boot') {
|
|
1138
|
-
await exec(`rm ./boot -rf`, echo);
|
|
1139
|
-
}
|
|
1140
|
-
if (files[i] === './efi') {
|
|
1141
|
-
await exec(`rm ./efi -rf`, echo);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
shx.mkdir('-p', `./boot/grub/${utils_1.default.machineUEFI()}`);
|
|
1145
|
-
shx.mkdir('-p', './efi/boot');
|
|
1146
|
-
// second grub.cfg file
|
|
1147
|
-
let cmd = `for i in $(ls /usr/lib/grub/${utils_1.default.machineUEFI()}|grep part_|grep .mod|sed \'s/.mod//\'); do echo "insmod $i" >> boot/grub/${utils_1.default.machineUEFI()}/grub.cfg; done`;
|
|
1148
|
-
await exec(cmd, echo);
|
|
1149
|
-
// Additional modules so we don't boot in blind mode. I don't know which ones are really needed.
|
|
1150
|
-
// cmd = `for i in efi_gop efi_uga ieee1275_fb vbe vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg ; done`
|
|
1151
|
-
cmd = `for i in efi_gop efi_gop efi_uga gfxterm video_bochs video_cirrus jpeg png ; do echo "insmod $i" >> boot/grub/${utils_1.default.machineUEFI()}/grub.cfg ; done`;
|
|
1152
|
-
await exec(cmd, echo);
|
|
1153
|
-
await exec(`echo source /boot/grub/grub.cfg >> boot/grub/${utils_1.default.machineUEFI()}/grub.cfg`, echo);
|
|
1154
1198
|
/**
|
|
1155
|
-
*
|
|
1199
|
+
* make a tarred "memdisk" to embed in the grub image
|
|
1200
|
+
*
|
|
1201
|
+
* NOTE: it's CRUCIAL to chdir before tar!!!
|
|
1156
1202
|
*/
|
|
1157
|
-
|
|
1158
|
-
process.chdir(
|
|
1159
|
-
|
|
1160
|
-
|
|
1203
|
+
const currentDir = process.cwd();
|
|
1204
|
+
process.chdir(memdiskDir);
|
|
1205
|
+
await (0, utils_1.exec)(`tar -cvf memdisk boot`, echo);
|
|
1206
|
+
process.chdir(currentDir);
|
|
1161
1207
|
// make the grub image
|
|
1162
|
-
|
|
1163
|
-
//
|
|
1164
|
-
|
|
1208
|
+
// -O, --format=FORMAT
|
|
1209
|
+
// -m --memdisk=FILE embed FILE as a memdisk image
|
|
1210
|
+
// -o, --output=FILE embed FILE as a memdisk image
|
|
1211
|
+
// -p, --prefix=DIR set prefix directory
|
|
1212
|
+
// --format=x86_64-efi --memdisk=memdisk --output=bootx64.efi --prefix?DIR set prefix directory
|
|
1213
|
+
// 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
|
|
1214
|
+
await (0, utils_1.exec)(`${grubName}-mkimage -O "${utils_2.default.machineUEFI()}" -m "${memdiskDir}/memdisk" -o "${memdiskDir}/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`, echo);
|
|
1215
|
+
// popd torna in efiWorkDir
|
|
1165
1216
|
// copy the grub image to efi/boot (to go later in the device's root)
|
|
1166
|
-
|
|
1217
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/efi/boot`, echo);
|
|
1218
|
+
// #######################
|
|
1167
1219
|
// Do the boot image "boot/grub/efiboot.img"
|
|
1168
|
-
await exec(
|
|
1169
|
-
await exec(
|
|
1170
|
-
|
|
1171
|
-
await exec(
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
//
|
|
1220
|
+
await (0, utils_1.exec)(`dd if=/dev/zero of=${efiWorkDir}/boot/grub/efiboot.img bs=1K count=1440`, echo);
|
|
1221
|
+
await (0, utils_1.exec)(`/sbin/mkdosfs -F 12 ${efiWorkDir}/boot/grub/efiboot.img`, echo);
|
|
1222
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt`, echo);
|
|
1223
|
+
await (0, utils_1.exec)(`mount -o loop ${efiWorkDir}/boot/grub/efiboot.img ${efiWorkDir}/img-mnt`, echo);
|
|
1224
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi`, echo);
|
|
1225
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi/boot`, echo);
|
|
1226
|
+
// era cp -r
|
|
1227
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/img-mnt/efi/boot`, echo);
|
|
1228
|
+
// #######################
|
|
1175
1229
|
// copy modules and font
|
|
1176
|
-
|
|
1230
|
+
await (0, utils_1.exec)(`cp -r /usr/lib/grub/${utils_2.default.machineUEFI()}/* ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/`, echo);
|
|
1177
1231
|
// if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
|
|
1178
1232
|
// Either of these will work, and they look the same to me. Unicode seems to work with qemu. -fsr
|
|
1179
|
-
fs.
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1233
|
+
if (fs.existsSync('/usr/share/grub/unicode.pf2')) {
|
|
1234
|
+
await (0, utils_1.exec)(`cp /usr/share/grub/unicode.pf2 ${efiWorkDir}/boot/grub/font.pf2`, echo);
|
|
1235
|
+
}
|
|
1236
|
+
else if (fs.existsSync('/usr/share/grub2/ascii.pf2')) {
|
|
1237
|
+
await (0, utils_1.exec)(`cp /usr/share/grub2/ascii.pf2 ${efiWorkDir}/boot/grub/font.pf2`, echo);
|
|
1238
|
+
}
|
|
1239
|
+
// doesn't need to be root-owned
|
|
1240
|
+
// chown -R 1000:1000 $(pwd) 2>/dev/null
|
|
1185
1241
|
// Cleanup efi temps
|
|
1186
|
-
await exec(
|
|
1187
|
-
await exec(
|
|
1188
|
-
//
|
|
1189
|
-
|
|
1242
|
+
await (0, utils_1.exec)(`umount ${efiWorkDir}/img-mnt`, echo);
|
|
1243
|
+
// await exec(`rmdir ${efiWorkDir}/img-mnt`, echo)
|
|
1244
|
+
// await exec(`rm ${memdiskDir}/img-mnt -rf`, echo)
|
|
1245
|
+
// popd
|
|
1190
1246
|
// Copy efi files to iso
|
|
1191
|
-
await exec(`rsync -
|
|
1192
|
-
await exec(`rsync -
|
|
1247
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/boot ${isoDir}/`, echo);
|
|
1248
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/efi ${isoDir}/`, echo);
|
|
1249
|
+
// Do the main grub.cfg (which gets loaded last):
|
|
1250
|
+
// grub.theme.cfg
|
|
1251
|
+
const grubThemeSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.theme.cfg`);
|
|
1252
|
+
const grubThemeDest = `${isoDir}/boot/grub/theme.cfg`;
|
|
1253
|
+
if (!fs.existsSync(grubThemeSrc)) {
|
|
1254
|
+
utils_2.default.warning('Cannot find: ' + grubThemeSrc);
|
|
1255
|
+
process.exit();
|
|
1256
|
+
}
|
|
1257
|
+
fs.copyFileSync(grubThemeSrc, grubThemeDest);
|
|
1193
1258
|
/**
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
let
|
|
1202
|
-
let
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
const
|
|
1208
|
-
if (fs.existsSync(splashCandidate)) {
|
|
1209
|
-
splashSrc = splashCandidate;
|
|
1210
|
-
}
|
|
1211
|
-
// if a theme exist, change theme.cfg with theme.cfg of the theme
|
|
1212
|
-
const themeCandidate = path.resolve(__dirname, `../../addons/${theme}/theme/livecd/theme.cfg`);
|
|
1213
|
-
if (fs.existsSync(themeCandidate)) {
|
|
1214
|
-
themeSrc = themeCandidate;
|
|
1215
|
-
}
|
|
1216
|
-
fs.copyFileSync(themeSrc, themeDest);
|
|
1217
|
-
fs.copyFileSync(splashSrc, splashDest);
|
|
1218
|
-
// Utilizzo mustache
|
|
1219
|
-
const template = fs.readFileSync(grubSrc, 'utf8');
|
|
1259
|
+
* prepare grub.cfg from grub.template.cfg
|
|
1260
|
+
*/
|
|
1261
|
+
const grubTemplate = node_path_1.default.resolve(__dirname, `../../addons/templates/grub.template`);
|
|
1262
|
+
if (!fs.existsSync(grubTemplate)) {
|
|
1263
|
+
utils_2.default.warning('Cannot find: ' + grubTemplate);
|
|
1264
|
+
process.exit();
|
|
1265
|
+
}
|
|
1266
|
+
let kernel_parameters = `boot=live locales=${process.env.LANG}`;
|
|
1267
|
+
let volid = utils_2.default.getVolid(this.settings.remix.name);
|
|
1268
|
+
if (this.familyId === "archlinux") {
|
|
1269
|
+
kernel_parameters = `misobasedir=live misolabel=${volid} boot=live locales=${process.env.LANG}`;
|
|
1270
|
+
}
|
|
1271
|
+
const grubDest = `${isoDir}/boot/grub/grub.cfg`;
|
|
1272
|
+
const template = fs.readFileSync(grubTemplate, 'utf8');
|
|
1220
1273
|
const view = {
|
|
1221
1274
|
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
1222
|
-
kernel:
|
|
1275
|
+
kernel: utils_2.default.kernelVersion(),
|
|
1223
1276
|
vmlinuz: `/live${this.settings.vmlinuz}`,
|
|
1224
1277
|
initrdImg: `/live${this.settings.initrdImg}`,
|
|
1225
|
-
|
|
1226
|
-
netconfigOpt: this.settings.config.netconfig_opt,
|
|
1227
|
-
timezoneOpt: this.settings.config.timezone,
|
|
1228
|
-
lang: process.env.LANG,
|
|
1229
|
-
locales: process.env.LANG,
|
|
1278
|
+
kernel_parameters: kernel_parameters,
|
|
1230
1279
|
};
|
|
1231
1280
|
fs.writeFileSync(grubDest, mustache_1.default.render(template, view));
|
|
1281
|
+
/**
|
|
1282
|
+
* loopback.cfg
|
|
1283
|
+
*/
|
|
1284
|
+
fs.writeFileSync(`${isoDir}/boot/grub/loopback.cfg`, 'source /boot/grub/grub.cfg\n');
|
|
1232
1285
|
}
|
|
1286
|
+
// #######################################################################################
|
|
1233
1287
|
/**
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1288
|
+
* makeDotDisk
|
|
1289
|
+
* create .disk/info, .disk/mksquashfs, .disk/mkiso
|
|
1290
|
+
* return mkiso
|
|
1236
1291
|
*/
|
|
1237
|
-
|
|
1292
|
+
makeDotDisk(backup = false, verbose = false) {
|
|
1238
1293
|
const dotDisk = this.settings.work_dir.pathIso + '/.disk';
|
|
1239
1294
|
if (fs.existsSync(dotDisk)) {
|
|
1240
|
-
|
|
1295
|
+
shelljs_1.default.rm('-rf', dotDisk);
|
|
1241
1296
|
}
|
|
1242
|
-
|
|
1243
|
-
// info
|
|
1297
|
+
shelljs_1.default.mkdir('-p', dotDisk);
|
|
1298
|
+
// .disk/info
|
|
1244
1299
|
let file = dotDisk + '/info';
|
|
1245
|
-
let content =
|
|
1300
|
+
let content = utils_2.default.getVolid(this.settings.remix.name);
|
|
1246
1301
|
fs.writeFileSync(file, content, 'utf-8');
|
|
1247
|
-
//
|
|
1302
|
+
// .disk/mksquashfs
|
|
1303
|
+
const scripts = this.settings.work_dir.path;
|
|
1304
|
+
shelljs_1.default.cp(scripts + '/mksquashfs', dotDisk + '/mksquashfs');
|
|
1305
|
+
// .disk/mkisofs
|
|
1306
|
+
content = this.xorrisoCommand(backup).replace(/\s\s+/g, ' ');
|
|
1248
1307
|
file = dotDisk + '/mkisofs';
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1308
|
+
fs.writeFileSync(file, content, 'utf-8');
|
|
1309
|
+
return content;
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
*
|
|
1313
|
+
* @param backup
|
|
1314
|
+
* @returns cmd 4 mkiso
|
|
1315
|
+
*/
|
|
1316
|
+
xorrisoCommand(backup = false) {
|
|
1317
|
+
const volid = utils_2.default.getVolid(this.settings.remix.name);
|
|
1318
|
+
let prefix = this.settings.config.snapshot_prefix;
|
|
1319
|
+
if (backup) {
|
|
1320
|
+
prefix = prefix.slice(0, 7) === 'egg-of-' ? 'egg-eb-' + prefix.slice(7) : 'egg-eb-' + prefix;
|
|
1252
1321
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1322
|
+
const postfix = utils_2.default.getPostfix();
|
|
1323
|
+
this.settings.isoFilename = prefix + volid + postfix;
|
|
1324
|
+
const output = this.settings.config.snapshot_dir + this.settings.isoFilename;
|
|
1325
|
+
let command = '';
|
|
1326
|
+
const appid = `-appid "${this.settings.distro.distroId}" `;
|
|
1327
|
+
const publisher = `-publisher "${this.settings.distro.distroId}/${this.settings.distro.versionId}" `;
|
|
1328
|
+
const preparer = '-preparer "prepared by eggs <https://penguins-eggs.net>" ';
|
|
1329
|
+
let isoHybridMbr = ``;
|
|
1259
1330
|
if (this.settings.config.make_isohybrid) {
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
else if (fs.existsSync('/usr/lib/syslinux/isohdpfx.bin')) {
|
|
1264
|
-
isoHybridOption = '-isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin';
|
|
1265
|
-
}
|
|
1266
|
-
else if (fs.existsSync('/usr/lib/ISOLINUX/isohdpfx.bin')) {
|
|
1267
|
-
isoHybridOption = '-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin';
|
|
1331
|
+
const isolinuxFile = this.settings.distro.isolinuxPath + 'isohdpfx.bin';
|
|
1332
|
+
if (fs.existsSync(isolinuxFile)) {
|
|
1333
|
+
isoHybridMbr = `-isohybrid-mbr ${isolinuxFile}`;
|
|
1268
1334
|
}
|
|
1269
1335
|
else {
|
|
1270
|
-
|
|
1336
|
+
utils_2.default.warning(`Can't create isohybrid image. File: ${isolinuxFile} not found. \nThe resulting image will be a standard iso file`);
|
|
1271
1337
|
}
|
|
1272
1338
|
}
|
|
1273
|
-
|
|
1274
|
-
let
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1339
|
+
// uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
|
|
1340
|
+
let uefi_elToritoAltBoot = '';
|
|
1341
|
+
let uefi_e = '';
|
|
1342
|
+
let uefi_isohybridGptBasdat = '';
|
|
1343
|
+
let uefi_noEmulBoot = '';
|
|
1344
|
+
if (this.settings.config.make_efi) {
|
|
1345
|
+
uefi_elToritoAltBoot = '-eltorito-alt-boot';
|
|
1346
|
+
uefi_e = '-e boot/grub/efiboot.img';
|
|
1347
|
+
uefi_isohybridGptBasdat = '-isohybrid-gpt-basdat';
|
|
1348
|
+
uefi_noEmulBoot = '-no-emul-boot';
|
|
1282
1349
|
}
|
|
1283
|
-
let output = this.settings.config.snapshot_dir + prefix + volid;
|
|
1284
|
-
content = `xorriso -as mkisofs \
|
|
1285
|
-
-volid ${volid} \
|
|
1286
|
-
-joliet-long \
|
|
1287
|
-
-l \
|
|
1288
|
-
-iso-level 3 \
|
|
1289
|
-
-b isolinux/isolinux.bin \
|
|
1290
|
-
${isoHybridOption} \
|
|
1291
|
-
-partition_offset 16 \
|
|
1292
|
-
-c isolinux/boot.cat \
|
|
1293
|
-
-no-emul-boot \
|
|
1294
|
-
-boot-load-size 4 \
|
|
1295
|
-
-boot-info-table \
|
|
1296
|
-
${uefi_opt} \
|
|
1297
|
-
-output ${output} \
|
|
1298
|
-
${this.settings.work_dir.pathIso}`;
|
|
1299
1350
|
/**
|
|
1300
|
-
|
|
1351
|
+
* info Debian GNU/Linux 10.8.0 "Buster" - Official i386 NETINST 20210206-10:54
|
|
1352
|
+
* mkisofs xorriso -as mkisofs
|
|
1353
|
+
* -r
|
|
1354
|
+
* -checksum_algorithm_iso md5,sha1,sha256,sha512
|
|
1355
|
+
* -V 'Debian 10.8.0 i386 n'
|
|
1356
|
+
* -o /srv/cdbuilder.debian.org/dst/deb-cd/out/2busteri386/debian-10.8.0-i386-NETINST-1.iso
|
|
1357
|
+
* -jigdo-jigdo /srv/cdbuilder.debian.org/dst/deb-cd/out/2busteri386/debian-10.8.0-i386-NETINST-1.jigdo
|
|
1358
|
+
* -jigdo-template /srv/cdbuilder.debian.org/dst/deb-cd/out/2busteri386/debian-10.8.0-i386-NETINST-1.template
|
|
1359
|
+
* -jigdo-map Debian=/srv/cdbuilder.debian.org/src/ftp/debian/
|
|
1360
|
+
* -jigdo-exclude boot1
|
|
1361
|
+
* -md5-list /srv/cdbuilder.debian.org/src/deb-cd/tmp/2busteri386/buster/md5-check
|
|
1362
|
+
* -jigdo-min-file-size 1024
|
|
1363
|
+
* -jigdo-exclude 'README*'
|
|
1364
|
+
* -jigdo-exclude /doc/
|
|
1365
|
+
* -jigdo-exclude /md5sum.txt
|
|
1366
|
+
* -jigdo-exclude /.disk/
|
|
1367
|
+
* -jigdo-exclude /pics/
|
|
1368
|
+
* -jigdo-exclude 'Release*'
|
|
1369
|
+
* -jigdo-exclude 'Packages*'
|
|
1370
|
+
* -jigdo-exclude 'Sources*'
|
|
1371
|
+
* -J
|
|
1372
|
+
* -joliet-long
|
|
1373
|
+
* -cache-inodes
|
|
1374
|
+
* -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin
|
|
1375
|
+
* -b isolinux/isolinux.bin
|
|
1376
|
+
* -c isolinux/boot.cat
|
|
1377
|
+
* -boot-load-size 4
|
|
1378
|
+
* -boot-info-table
|
|
1379
|
+
* -no-emul-boot
|
|
1380
|
+
* -eltorito-alt-boot
|
|
1381
|
+
* -e boot/grub/efi.img
|
|
1382
|
+
* -no-emul-boot
|
|
1383
|
+
* -isohybrid-gpt-basdat
|
|
1384
|
+
* isohybrid-apm-hfsplus
|
|
1385
|
+
* boot1 CD1
|
|
1386
|
+
*/
|
|
1387
|
+
command = `xorriso -as mkisofs \
|
|
1388
|
+
-r \
|
|
1389
|
+
-checksum_algorithm_iso md5,sha1,sha256,sha512 \
|
|
1390
|
+
-V ${volid} \
|
|
1391
|
+
-o ${output} \
|
|
1392
|
+
-J \
|
|
1393
|
+
-joliet-long \
|
|
1394
|
+
-cache-inodes \
|
|
1395
|
+
${isoHybridMbr} \
|
|
1396
|
+
-b isolinux/isolinux.bin \
|
|
1397
|
+
-c isolinux/boot.cat \
|
|
1398
|
+
-boot-load-size 4 \
|
|
1399
|
+
-boot-info-table \
|
|
1400
|
+
-no-emul-boot \
|
|
1401
|
+
${uefi_elToritoAltBoot} \
|
|
1402
|
+
${uefi_e} \
|
|
1403
|
+
${uefi_noEmulBoot} \
|
|
1404
|
+
${uefi_isohybridGptBasdat}
|
|
1405
|
+
${this.settings.work_dir.pathIso}`;
|
|
1406
|
+
/**
|
|
1407
|
+
* how is made in refracta
|
|
1408
|
+
*
|
|
1409
|
+
* -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
|
|
1410
|
+
* uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
|
|
1411
|
+
*
|
|
1412
|
+
* xorriso -as mkisofs -r \
|
|
1413
|
+
* -J \
|
|
1414
|
+
* -joliet-long \
|
|
1415
|
+
* -l \
|
|
1416
|
+
* -iso-level 3 \
|
|
1417
|
+
* ${isohybrid_opt} \
|
|
1418
|
+
* -partition_offset 16 \
|
|
1419
|
+
* -V "$volid" \
|
|
1420
|
+
* -b isolinux/isolinux.bin \
|
|
1421
|
+
* -c isolinux/boot.cat \
|
|
1422
|
+
* -no-emul-boot \
|
|
1423
|
+
* -boot-load-size 4 \
|
|
1424
|
+
* -boot-info-table \
|
|
1425
|
+
* ${uefi_opt} \
|
|
1426
|
+
* -o "$snapshot_dir"/"$filename" iso/
|
|
1301
1427
|
*/
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1428
|
+
command = `xorriso -as mkisofs \
|
|
1429
|
+
-J \
|
|
1430
|
+
-joliet-long \
|
|
1431
|
+
-l \
|
|
1432
|
+
-iso-level 3 \
|
|
1433
|
+
${isoHybridMbr} \
|
|
1434
|
+
-partition_offset 16 \
|
|
1435
|
+
-V ${volid} \
|
|
1436
|
+
-b isolinux/isolinux.bin \
|
|
1437
|
+
-c isolinux/boot.cat \
|
|
1438
|
+
-no-emul-boot \
|
|
1439
|
+
-boot-load-size 4 \
|
|
1440
|
+
-boot-info-table \
|
|
1441
|
+
${uefi_elToritoAltBoot} \
|
|
1442
|
+
${uefi_e} \
|
|
1443
|
+
${uefi_isohybridGptBasdat} \
|
|
1444
|
+
${uefi_noEmulBoot} \
|
|
1445
|
+
-o ${output} ${this.settings.work_dir.pathIso}`;
|
|
1446
|
+
return command;
|
|
1306
1447
|
}
|
|
1307
1448
|
/**
|
|
1308
|
-
*
|
|
1449
|
+
* makeIso
|
|
1450
|
+
* cmd: cmd 4 xorirriso
|
|
1309
1451
|
*/
|
|
1310
|
-
async makeIso(
|
|
1452
|
+
async makeIso(cmd, scriptOnly = false, verbose = false) {
|
|
1311
1453
|
let echo = { echo: false, ignore: false };
|
|
1312
1454
|
if (verbose) {
|
|
1313
1455
|
echo = { echo: true, ignore: false };
|
|
1314
|
-
}
|
|
1315
|
-
if (verbose) {
|
|
1316
1456
|
console.log('ovary: makeIso');
|
|
1317
1457
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
uefi_opt = '-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot';
|
|
1321
|
-
}
|
|
1322
|
-
let isoHybridOption = `-isohybrid-mbr ${this.settings.distro.isolinuxPath}isohdpfx.bin `;
|
|
1323
|
-
if (this.settings.config.make_isohybrid) {
|
|
1324
|
-
if (fs.existsSync('/usr/lib/syslinux/mbr/isohdpfx.bin')) {
|
|
1325
|
-
isoHybridOption = '-isohybrid-mbr /usr/lib/syslinux/mbr/isohdpfx.bin';
|
|
1326
|
-
}
|
|
1327
|
-
else if (fs.existsSync('/usr/lib/syslinux/isohdpfx.bin')) {
|
|
1328
|
-
isoHybridOption = '-isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin';
|
|
1329
|
-
}
|
|
1330
|
-
else if (fs.existsSync('/usr/lib/ISOLINUX/isohdpfx.bin')) {
|
|
1331
|
-
isoHybridOption = '-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin';
|
|
1332
|
-
}
|
|
1333
|
-
else {
|
|
1334
|
-
utils_1.default.warning("Can't create isohybrid. File: isohdpfx.bin not found. The resulting image will be a standard iso file");
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
const prefix = utils_1.default.getPrefix(this.settings.config.snapshot_prefix, backup);
|
|
1338
|
-
const volid = utils_1.default.getVolid(this.settings.remix.name);
|
|
1339
|
-
const postfix = utils_1.default.getPostfix();
|
|
1340
|
-
// salvo in isoFile per mostrare alla fine
|
|
1341
|
-
this.settings.isoFilename = prefix + volid + postfix;
|
|
1342
|
-
const output = this.settings.config.snapshot_dir + this.settings.isoFilename;
|
|
1343
|
-
let cmd = `xorriso -as mkisofs \
|
|
1344
|
-
-volid ${volid} \
|
|
1345
|
-
-joliet-long \
|
|
1346
|
-
-l \
|
|
1347
|
-
-iso-level 3 \
|
|
1348
|
-
-b isolinux/isolinux.bin \
|
|
1349
|
-
${isoHybridOption} \
|
|
1350
|
-
-partition_offset 16 \
|
|
1351
|
-
-c isolinux/boot.cat \
|
|
1352
|
-
-no-emul-boot \
|
|
1353
|
-
-boot-load-size 4 \
|
|
1354
|
-
-boot-info-table \
|
|
1355
|
-
${uefi_opt} \
|
|
1356
|
-
-output ${output} \
|
|
1357
|
-
${this.settings.work_dir.pathIso}`;
|
|
1358
|
-
// /usr/lib/ISOLINUX/isohdpfx.bin
|
|
1359
|
-
cmd = cmd.replace(/\s\s+/g, ' ');
|
|
1360
|
-
utils_1.default.writeX(`${this.settings.work_dir.path}mkisofs`, cmd);
|
|
1458
|
+
console.log(cmd);
|
|
1459
|
+
utils_2.default.writeX(`${this.settings.work_dir.path}mkisofs`, cmd);
|
|
1361
1460
|
if (!scriptOnly) {
|
|
1362
|
-
await exec(cmd, echo);
|
|
1461
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1363
1462
|
}
|
|
1364
|
-
/**
|
|
1365
|
-
* Ultima versione
|
|
1366
|
-
* Tolto -cache-inodes (veniva ignorato)
|
|
1367
|
-
*
|
|
1368
|
-
* Non solo supportati, almeno da xorriso 1.5.0, i flag:
|
|
1369
|
-
* -h 256
|
|
1370
|
-
* -s 63
|
|
1371
|
-
*
|
|
1372
|
-
* Sarebbero da sostituire i flag brevi con quelli estesi, rimangono:
|
|
1373
|
-
* -l
|
|
1374
|
-
* -b
|
|
1375
|
-
* -c
|
|
1376
|
-
*
|
|
1377
|
-
* Il seguente è un esempio corrente funzionante:
|
|
1378
|
-
*
|
|
1379
|
-
* xorriso -as makeIsofs
|
|
1380
|
-
* volid incubator-x64_2020-06-05_100.iso
|
|
1381
|
-
* -joliet-long
|
|
1382
|
-
* -l
|
|
1383
|
-
* -iso-level 3
|
|
1384
|
-
* -b isolinux/isolinux.bin
|
|
1385
|
-
* -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
|
|
1386
|
-
* -partition_offset 16
|
|
1387
|
-
* -c isolinux/boot.cat
|
|
1388
|
-
* -no-emul-boot
|
|
1389
|
-
* -boot-load-size 4
|
|
1390
|
-
* -boot-info-table
|
|
1391
|
-
* -output /home/eggs/incubator-x64_2020-06-05_100.iso
|
|
1392
|
-
* /home/eggs/ovarium/iso
|
|
1393
|
-
*/
|
|
1394
1463
|
}
|
|
1395
1464
|
/**
|
|
1396
1465
|
* finished = show the results
|
|
1397
1466
|
* @param scriptOnly
|
|
1398
1467
|
*/
|
|
1399
1468
|
finished(scriptOnly = false) {
|
|
1400
|
-
|
|
1469
|
+
utils_2.default.titles('produce');
|
|
1401
1470
|
if (!scriptOnly) {
|
|
1402
1471
|
console.log('eggs is finished!\n\nYou can find the file iso: ' + chalk_1.default.cyanBright(this.settings.isoFilename) + '\nin the nest: ' + chalk_1.default.cyanBright(this.settings.config.snapshot_dir) + '.');
|
|
1403
1472
|
}
|
|
1404
1473
|
else {
|
|
1405
1474
|
console.log('eggs is finished!\n\nYou can find the scripts to build iso: ' + chalk_1.default.cyanBright(this.settings.isoFilename) + '\nin the ovarium: ' + chalk_1.default.cyanBright(this.settings.work_dir.path) + '.');
|
|
1406
|
-
console.log(
|
|
1475
|
+
console.log('usage');
|
|
1407
1476
|
console.log(chalk_1.default.cyanBright(`cd ${this.settings.work_dir.path}`));
|
|
1408
|
-
console.log(chalk_1.default.cyanBright(
|
|
1409
|
-
console.log(
|
|
1410
|
-
console.log(
|
|
1411
|
-
console.log(chalk_1.default.cyanBright(
|
|
1412
|
-
console.log(chalk_1.default.cyanBright(
|
|
1413
|
-
console.log(chalk_1.default.cyanBright(
|
|
1414
|
-
console.log(
|
|
1477
|
+
console.log(chalk_1.default.cyanBright('sudo ./bind'));
|
|
1478
|
+
console.log('Make all yours modifications in the directories filesystem.squashfs and iso.');
|
|
1479
|
+
console.log('After when you are ready:');
|
|
1480
|
+
console.log(chalk_1.default.cyanBright('sudo ./mksquashfs'));
|
|
1481
|
+
console.log(chalk_1.default.cyanBright('sudo ./mkisofs'));
|
|
1482
|
+
console.log(chalk_1.default.cyanBright('sudo ./ubind'));
|
|
1483
|
+
console.log('happy hacking!');
|
|
1415
1484
|
}
|
|
1416
1485
|
console.log();
|
|
1417
|
-
console.log('Remember, on liveCD user =' + chalk_1.default.cyanBright(this.settings.config.user_opt) + '/' + chalk_1.default.cyanBright(this.settings.config.user_opt_passwd));
|
|
1418
|
-
console.log(' root =' + chalk_1.default.cyanBright('root') + '/' + chalk_1.default.cyanBright(this.settings.config.root_passwd));
|
|
1486
|
+
console.log('Remember, on liveCD user = ' + chalk_1.default.cyanBright(this.settings.config.user_opt) + '/' + chalk_1.default.cyanBright(this.settings.config.user_opt_passwd));
|
|
1487
|
+
console.log(' root = ' + chalk_1.default.cyanBright('root') + '/' + chalk_1.default.cyanBright(this.settings.config.root_passwd));
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* fill
|
|
1491
|
+
*/
|
|
1492
|
+
async usersFill() {
|
|
1493
|
+
const usersArray = [];
|
|
1494
|
+
await (0, promises_1.access)('/etc/passwd', fs_1.constants.R_OK | fs_1.constants.W_OK);
|
|
1495
|
+
const passwd = fs.readFileSync('/etc/passwd', 'utf-8').split('\n');
|
|
1496
|
+
for (let i = 0; i < passwd.length; i++) {
|
|
1497
|
+
var line = passwd[i].split(':');
|
|
1498
|
+
const users = new users_1.default(line[0], line[1], line[2], line[3], line[4], line[5], line[6]);
|
|
1499
|
+
await users.getValues();
|
|
1500
|
+
if (users.password !== undefined) {
|
|
1501
|
+
usersArray.push(users);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
return usersArray;
|
|
1419
1505
|
}
|
|
1420
1506
|
}
|
|
1421
1507
|
exports.default = Ovary;
|
|
@@ -1427,11 +1513,11 @@ async function makeIfNotExist(path, verbose = false) {
|
|
|
1427
1513
|
if (verbose) {
|
|
1428
1514
|
console.log(`ovary: makeIfNotExist(${path})`);
|
|
1429
1515
|
}
|
|
1430
|
-
const echo =
|
|
1516
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1431
1517
|
let cmd = `# ${path} alreasy exist`;
|
|
1432
1518
|
if (!fs.existsSync(path)) {
|
|
1433
1519
|
cmd = `mkdir ${path} -p`;
|
|
1434
|
-
await exec(cmd, echo);
|
|
1520
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1435
1521
|
}
|
|
1436
1522
|
return cmd;
|
|
1437
1523
|
}
|
|
@@ -1441,10 +1527,7 @@ async function makeIfNotExist(path, verbose = false) {
|
|
|
1441
1527
|
* @param echo
|
|
1442
1528
|
*/
|
|
1443
1529
|
async function rexec(cmd, verbose = false) {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
}
|
|
1447
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
1448
|
-
await exec(cmd, echo);
|
|
1530
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1531
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1449
1532
|
return cmd;
|
|
1450
1533
|
}
|