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