penguins-eggs 8.17.4 → 9.0.2
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 +235 -155
- package/addons/README.md +78 -84
- package/addons/{pve → blissos}/theme/applications/install-debian.desktop +0 -0
- package/addons/{pve → blissos}/theme/artwork/install-debian.png +0 -0
- package/addons/blissos/theme/calamares/branding/blissos-logo.png +0 -0
- package/addons/{pve → 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/{pve → blissos}/theme/calamares/modules/partition.yml +2 -2
- package/addons/blissos/theme/livecd/README.md +23 -0
- package/addons/blissos/theme/livecd/grub.template.cfg +34 -0
- package/addons/blissos/theme/livecd/grub.theme.cfg +46 -0
- package/addons/blissos/theme/livecd/isolinux.template.cfg +29 -0
- package/addons/blissos/theme/livecd/isolinux.theme.cfg +45 -0
- package/addons/blissos/theme/livecd/splash.png +0 -0
- package/addons/debian/theme/README.md +23 -0
- package/addons/debian/theme/{branding → calamares/branding}/branding.desc +0 -0
- package/addons/debian/theme/{branding → calamares/branding}/debian-logo.png +0 -0
- package/addons/debian/theme/{branding → calamares/branding}/show.qml +0 -0
- package/addons/debian/theme/{branding → calamares/branding}/slide1.png +0 -0
- package/addons/debian/theme/{branding → calamares/branding}/welcome.png +0 -0
- package/addons/debian/theme/calamares/modules/partition.yml +233 -0
- package/addons/debian/theme/livecd/README.md +23 -0
- package/addons/debian/theme/livecd/grub.template.cfg +34 -0
- package/addons/{pve/theme/livecd/theme.cfg → debian/theme/livecd/grub.theme.cfg} +4 -0
- package/addons/debian/theme/livecd/isolinux.template.cfg +30 -0
- package/{conf/distros/buster/isolinux/stdmenu.template.cfg → addons/debian/theme/livecd/isolinux.theme.cfg} +4 -0
- package/addons/debian/theme/livecd/splash.png +0 -0
- package/addons/deblinux/theme/README.md +19 -12
- package/addons/eggs/adapt/applications/eggs-adapt.desktop +1 -1
- package/addons/eggs/theme/livecd/README.md +21 -6
- package/addons/eggs/theme/livecd/grub.template.cfg +11 -37
- package/addons/eggs/theme/livecd/{theme.cfg → grub.theme.cfg} +5 -1
- package/addons/eggs/theme/livecd/isolinux.template.cfg +29 -0
- package/addons/eggs/theme/livecd/isolinux.theme.cfg +46 -0
- package/addons/eggs/theme/livecd/splash.png +0 -0
- package/addons/guadalinex/theme/livecd/README.md +23 -0
- package/addons/guadalinex/theme/livecd/{menu.template.cfg → isolinux.template.cfg} +12 -3
- package/addons/guadalinex/theme/livecd/{theme.cfg → isolinux.theme.cfg} +0 -0
- package/addons/neon/theme/livecd/README.md +23 -0
- package/addons/neon/theme/livecd/grub.template.cfg +34 -0
- package/addons/{ufficiozero/theme/livecd/theme.cfg → neon/theme/livecd/grub.theme.cfg} +5 -1
- package/addons/neon/theme/livecd/isolinux.template.cfg +29 -0
- 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/openos/theme/livecd/README.md +23 -0
- package/addons/openos/theme/livecd/{theme.cfg → grub.theme.cfg} +0 -0
- package/addons/openos/theme/livecd/{menu.template.cfg → isolinux.template.cfg} +11 -3
- package/addons/openos/theme/livecd/isolinux.theme.cfg +45 -0
- package/addons/ufficiozero/theme/applications/install-debian.desktop +17 -2
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +2 -4
- package/conf/distros/bionic/calamares/settings.yml +5 -5
- package/conf/distros/bookworm/README.md +9 -0
- package/conf/distros/bullseye/README.md +6 -8
- package/conf/distros/buster/calamares/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/jammy/README.md +9 -0
- 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 +1 -1
- package/conf/exclude.list +2 -4
- package/conf/tools.yaml +1 -1
- package/lib/classes/basket.js +24 -28
- package/lib/classes/bleach.js +17 -17
- package/lib/classes/compressors.js +15 -14
- package/lib/classes/daddy.js +38 -31
- package/lib/classes/distro.d.ts +3 -2
- package/lib/classes/distro.js +288 -179
- package/lib/classes/family/archlinux.d.ts +69 -0
- package/lib/classes/family/archlinux.js +181 -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 -78
- 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 +135 -132
- package/lib/classes/krill_prepare.js +51 -51
- package/lib/classes/n8.js +6 -11
- package/lib/classes/ovary.d.ts +29 -11
- package/lib/classes/ovary.js +711 -605
- package/lib/classes/pacman.d.ts +53 -58
- package/lib/classes/pacman.js +512 -431
- package/lib/classes/pve-live.js +6 -6
- package/lib/classes/settings.js +46 -55
- 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 +9 -12
- package/lib/classes/utils.js +127 -106
- package/lib/classes/xdg.js +94 -90
- package/lib/classes/yolk.js +36 -29
- 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 +21 -46
- package/lib/commands/config.d.ts +5 -5
- package/lib/commands/config.js +68 -75
- 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 +4 -4
- package/lib/commands/install.js +19 -14
- 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 +42 -45
- 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 +12 -12
- 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.js +5 -5
- 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-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 +2 -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/oclif.manifest.json +1 -1
- package/package.json +115 -107
- package/scripts/bros/waydroid-helper.sh +92 -0
- package/scripts/eggs.bash +65 -35
- package/scripts/not-used/eggs-cleanup.sh +7 -0
- package/scripts/{install-eggs-ppa.sh → not-used/install-eggs-ppa.sh} +0 -0
- package/scripts/{mkinitramfs → not-used/mkinitramfs} +0 -0
- package/scripts/{pve-live.sh → not-used/pve-live.sh} +0 -0
- package/addons/eggs/theme/livecd/menu.template.cfg +0 -54
- package/addons/pve/theme/applications/penguins-pve.desktop +0 -24
- 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/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/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 -154
- 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/grub/theme.cfg +0 -42
- 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/scripts/python-minimal-deb/anti-python-minimal +0 -7
- package/scripts/python-minimal-deb/python-minimal_99_all.deb +0 -0
- package/scripts/python-minimal-deb/python-minimal_99_amd64.buildinfo +0 -168
- package/scripts/python-minimal-deb/python-minimal_99_amd64.changes +0 -25
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/${theme}/theme/livecd/isolinux.template.cfg`);
|
|
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.kernerlVersion(),
|
|
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,87 @@ 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
|
+
}
|
|
1012
|
+
else if (this.familyId === 'archlinux') {
|
|
1013
|
+
// adduser live to wheel and autologin
|
|
1014
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, verbose));
|
|
1015
|
+
// in manjaro they use autologin group for the iso, if not exist create it
|
|
1016
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} test $(grep "autologin" /etc/group) || groupadd -r autologin`, verbose));
|
|
1017
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG autologin ${this.settings.config.user_opt}`, verbose));
|
|
1018
|
+
}
|
|
1019
|
+
if (this.familyId === 'debian' || this.familyId === 'archlinux') {
|
|
1020
|
+
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));
|
|
1021
|
+
}
|
|
947
1022
|
}
|
|
948
1023
|
/**
|
|
949
1024
|
*
|
|
950
1025
|
*/
|
|
951
|
-
async
|
|
952
|
-
const echo =
|
|
1026
|
+
async createXdgAutostart(theme = 'eggs', myAddons, verbose = false) {
|
|
1027
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
953
1028
|
if (verbose) {
|
|
954
|
-
console.log('ovary:
|
|
1029
|
+
console.log('ovary: createXdgAutostart()');
|
|
955
1030
|
}
|
|
956
1031
|
const pathHomeLive = `/home/${this.settings.config.user_opt}`;
|
|
957
1032
|
// Copia icona penguins-eggs
|
|
958
|
-
|
|
959
|
-
|
|
1033
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/eggs.png'), '/usr/share/icons/');
|
|
1034
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/krill.svg'), '/usr/share/icons/');
|
|
960
1035
|
/**
|
|
961
1036
|
* creazione dei link in /usr/share/applications
|
|
962
1037
|
*
|
|
963
1038
|
*/
|
|
964
|
-
|
|
1039
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/penguins-eggs.desktop'), '/usr/share/applications/');
|
|
965
1040
|
let installerUrl = 'install-debian.desktop';
|
|
966
|
-
let installerIcon =
|
|
1041
|
+
let installerIcon = 'install-debian';
|
|
967
1042
|
if (pacman_1.default.packageIsInstalled('calamares')) {
|
|
968
|
-
|
|
1043
|
+
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
1044
|
}
|
|
970
1045
|
else {
|
|
971
1046
|
installerUrl = 'penguins-krill.desktop';
|
|
972
1047
|
installerIcon = 'utilities-terminal';
|
|
973
|
-
|
|
1048
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/penguins-krill.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
974
1049
|
}
|
|
975
1050
|
// flags
|
|
976
1051
|
if (myAddons.adapt) {
|
|
977
|
-
//
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
}
|
|
1052
|
+
// if (Pacman.packageIsInstalled('lxde-core') || Pacman.packageIsInstalled('deepin-desktop-base') || Pacman.packageIsInstalled('mate-desktop') || Pacman.packageIsInstalled('ubuntu-mate-core') || Pacman.packageIsInstalled('xfce4')) {
|
|
1053
|
+
const dirAddon = node_path_1.default.resolve(__dirname, `../../addons/eggs/adapt/`);
|
|
1054
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-adapt.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
1055
|
+
shelljs_1.default.cp(`${dirAddon}/bin/eggs-adapt.sh`, `${this.settings.work_dir.merged}/usr/local/bin/`);
|
|
1056
|
+
// }
|
|
983
1057
|
}
|
|
984
1058
|
if (myAddons.ichoice) {
|
|
985
1059
|
installerUrl = 'eggs-ichoice.desktop';
|
|
986
1060
|
installerIcon = 'system-software-install';
|
|
987
|
-
const dirAddon =
|
|
988
|
-
|
|
989
|
-
|
|
1061
|
+
const dirAddon = node_path_1.default.resolve(__dirname, '../../addons/eggs/ichoice/');
|
|
1062
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-ichoice.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
1063
|
+
shelljs_1.default.cp(`${dirAddon}/bin/eggs-ichoice.sh`, `${this.settings.work_dir.merged}/usr/local/bin/`);
|
|
990
1064
|
}
|
|
991
1065
|
if (myAddons.pve) {
|
|
992
1066
|
// Imposto service pve-lite
|
|
993
1067
|
const pve = new pve_live_1.default();
|
|
994
1068
|
pve.create(this.settings.work_dir.merged);
|
|
995
|
-
const dirAddon =
|
|
996
|
-
|
|
997
|
-
|
|
1069
|
+
const dirAddon = node_path_1.default.resolve(__dirname, '../../addons/eggs/pve');
|
|
1070
|
+
shelljs_1.default.cp(`${dirAddon}/artwork/eggs-pve.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
|
|
1071
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-pve.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
998
1072
|
}
|
|
999
1073
|
if (myAddons.rsupport) {
|
|
1000
|
-
const dirAddon =
|
|
1001
|
-
|
|
1002
|
-
|
|
1074
|
+
const dirAddon = node_path_1.default.resolve(__dirname, '../../addons/eggs/rsupport');
|
|
1075
|
+
shelljs_1.default.cp(`${dirAddon}/applications/eggs-rsupport.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
1076
|
+
shelljs_1.default.cp(`${dirAddon}/artwork/eggs-rsupport.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
|
|
1003
1077
|
}
|
|
1004
1078
|
/**
|
|
1005
1079
|
* configuro add-penguins-desktop-icons in /etc/xdg/autostart
|
|
@@ -1008,7 +1082,7 @@ class Ovary {
|
|
|
1008
1082
|
const dirRun = '/usr/bin';
|
|
1009
1083
|
if (fs.existsSync(dirAutostart)) {
|
|
1010
1084
|
// Creo l'avviatore xdg DEVE essere add-penguins-links.desktop
|
|
1011
|
-
|
|
1085
|
+
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/penguins-links-add.desktop'), dirAutostart);
|
|
1012
1086
|
// Creo lo script add-penguins-links.sh
|
|
1013
1087
|
const script = `${dirRun}/penguins-links-add.sh`;
|
|
1014
1088
|
let text = '';
|
|
@@ -1020,7 +1094,7 @@ class Ovary {
|
|
|
1020
1094
|
// per l'installer, lo tolgo altrimenti su LXDE riappare comunque
|
|
1021
1095
|
text += `cp /usr/share/applications/${installerUrl} $DESKTOP\n`;
|
|
1022
1096
|
if (pacman_1.default.packageIsInstalled('lxde-core')) {
|
|
1023
|
-
text += this.lxdeLink('penguins-eggs.desktop',
|
|
1097
|
+
text += this.lxdeLink('penguins-eggs.desktop', "penguin's eggs", 'eggs');
|
|
1024
1098
|
if (myAddons.adapt)
|
|
1025
1099
|
text += this.lxdeLink('eggs-adapt.desktop', 'Adapt', 'video-display');
|
|
1026
1100
|
if (myAddons.pve)
|
|
@@ -1038,9 +1112,9 @@ class Ovary {
|
|
|
1038
1112
|
text += 'cp /usr/share/applications/eggs-rsupport.desktop $DESKTOP\n';
|
|
1039
1113
|
}
|
|
1040
1114
|
fs.writeFileSync(script, text, 'utf8');
|
|
1041
|
-
await exec(`chmod a+x ${script}`, echo);
|
|
1115
|
+
await (0, utils_1.exec)(`chmod a+x ${script}`, echo);
|
|
1042
1116
|
}
|
|
1043
|
-
xdg_1.default.autologin(
|
|
1117
|
+
await xdg_1.default.autologin(utils_2.default.getPrimaryUser(), this.settings.config.user_opt, this.settings.work_dir.merged);
|
|
1044
1118
|
}
|
|
1045
1119
|
/**
|
|
1046
1120
|
* Creazione link desktop per lxde
|
|
@@ -1064,15 +1138,10 @@ class Ovary {
|
|
|
1064
1138
|
*/
|
|
1065
1139
|
addRemoveExclusion(add, exclusion) {
|
|
1066
1140
|
if (exclusion.startsWith('/')) {
|
|
1067
|
-
exclusion = exclusion.
|
|
1141
|
+
exclusion = exclusion.slice(1); // remove / initial Non compatible with
|
|
1068
1142
|
}
|
|
1069
1143
|
if (add) {
|
|
1070
|
-
|
|
1071
|
-
this.settings.session_excludes += `-e '${exclusion}' `;
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
this.settings.session_excludes += ` '${exclusion}' `;
|
|
1075
|
-
}
|
|
1144
|
+
this.settings.session_excludes += this.settings.session_excludes === '' ? `-e '${exclusion}' ` : ` '${exclusion}' `;
|
|
1076
1145
|
}
|
|
1077
1146
|
else {
|
|
1078
1147
|
this.settings.session_excludes.replace(` '${exclusion}'`, '');
|
|
@@ -1081,336 +1150,376 @@ class Ovary {
|
|
|
1081
1150
|
}
|
|
1082
1151
|
}
|
|
1083
1152
|
}
|
|
1153
|
+
// #######################################################################################
|
|
1084
1154
|
/**
|
|
1085
1155
|
* makeEfi
|
|
1086
|
-
|
|
1087
|
-
|
|
1156
|
+
*/
|
|
1157
|
+
// #######################################################################################
|
|
1088
1158
|
async makeEfi(theme = 'eggs', verbose = false) {
|
|
1089
|
-
const echo =
|
|
1159
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1090
1160
|
if (verbose) {
|
|
1091
1161
|
console.log('ovary: makeEfi');
|
|
1092
1162
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1163
|
+
const memdiskDir = this.settings.work_dir.path + 'memdiskDir';
|
|
1164
|
+
const efiWorkDir = this.settings.efi_work;
|
|
1165
|
+
const isoDir = this.settings.work_dir.pathIso;
|
|
1166
|
+
const versionLike = this.settings.distro.versionLike;
|
|
1167
|
+
/**
|
|
1168
|
+
* il pachetto grub/grub2 DEVE essere presente
|
|
1169
|
+
*/
|
|
1170
|
+
const grubName = pacman_1.default.whichGrubIsInstalled();
|
|
1171
|
+
if (grubName === '') {
|
|
1172
|
+
utils_2.default.error('Something went wrong! Cannot find grub');
|
|
1097
1173
|
process.exit(1);
|
|
1098
1174
|
}
|
|
1099
1175
|
/**
|
|
1100
|
-
*
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1176
|
+
* Creo o cancello e creo: memdiskDir
|
|
1177
|
+
*/
|
|
1178
|
+
if (fs.existsSync(memdiskDir)) {
|
|
1179
|
+
await (0, utils_1.exec)(`rm ${memdiskDir} -rf`, echo);
|
|
1180
|
+
}
|
|
1181
|
+
utils_2.default.warning('creating memdiskDir: ' + memdiskDir);
|
|
1182
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}`);
|
|
1183
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot`, echo);
|
|
1184
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot/grub`, echo);
|
|
1185
|
+
/**
|
|
1186
|
+
* for initial grub.cfg in memdisk
|
|
1104
1187
|
*/
|
|
1105
|
-
const
|
|
1106
|
-
// for initial grub.cfg
|
|
1107
|
-
shx.mkdir('-p', `${tempDir}/boot/grub`);
|
|
1108
|
-
const grubCfg = `${tempDir}/boot/grub/grub.cfg`;
|
|
1109
|
-
shx.touch(grubCfg);
|
|
1188
|
+
const grubCfg = `${memdiskDir}/boot/grub/grub.cfg`;
|
|
1110
1189
|
let text = '';
|
|
1111
|
-
text += 'search --file --set=root /
|
|
1190
|
+
text += 'search --file --set=root /.disk/info\n';
|
|
1112
1191
|
text += 'set prefix=($root)/boot/grub\n';
|
|
1113
|
-
text += `source $prefix
|
|
1114
|
-
|
|
1192
|
+
text += `source $prefix/x86_64-efi/grub.cfg\n`;
|
|
1193
|
+
utils_2.default.write(grubCfg, text);
|
|
1194
|
+
// #################################
|
|
1115
1195
|
/**
|
|
1116
|
-
*
|
|
1196
|
+
* start with empty efiWorkDir
|
|
1117
1197
|
*/
|
|
1118
|
-
if (
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1198
|
+
if (fs.existsSync(efiWorkDir)) {
|
|
1199
|
+
await (0, utils_1.exec)(`rm ${efiWorkDir} -rf`, echo);
|
|
1200
|
+
}
|
|
1201
|
+
utils_2.default.warning('creating efiWordDir: ' + efiWorkDir);
|
|
1202
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}`, echo);
|
|
1203
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot`, echo);
|
|
1204
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub`, echo);
|
|
1205
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}`, echo);
|
|
1206
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi`, echo);
|
|
1207
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi/boot`, echo);
|
|
1123
1208
|
/**
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1209
|
+
* copy splash to efiWorkDir
|
|
1210
|
+
*/
|
|
1211
|
+
const splashDest = `${efiWorkDir}/boot/grub/splash.png`;
|
|
1212
|
+
const splashSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/splash.png`);
|
|
1213
|
+
if (!fs.existsSync(splashSrc)) {
|
|
1214
|
+
utils_2.default.warning('Cannot find: ' + splashSrc);
|
|
1215
|
+
process.exit();
|
|
1216
|
+
}
|
|
1217
|
+
await (0, utils_1.exec)(`cp ${splashSrc} ${splashDest}`);
|
|
1127
1218
|
/**
|
|
1128
|
-
*
|
|
1219
|
+
* copy theme
|
|
1129
1220
|
*/
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
if (files[i] === './efi') {
|
|
1136
|
-
await exec(`rm ./efi -rf`, echo);
|
|
1137
|
-
}
|
|
1221
|
+
const themeDest = `${efiWorkDir}/boot/grub/theme.cfg`;
|
|
1222
|
+
const themeSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/isolinux.theme.cfg`);
|
|
1223
|
+
if (!fs.existsSync(themeSrc)) {
|
|
1224
|
+
utils_2.default.warning('Cannot find: ' + themeSrc);
|
|
1225
|
+
process.exit();
|
|
1138
1226
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
await
|
|
1227
|
+
await (0, utils_1.exec)(`cp ${themeSrc} ${themeDest}`);
|
|
1228
|
+
/**
|
|
1229
|
+
* second grub.cfg file in efiWork
|
|
1230
|
+
*/
|
|
1231
|
+
// 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
|
|
1232
|
+
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`;
|
|
1233
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1234
|
+
// 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
|
|
1235
|
+
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`;
|
|
1236
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1237
|
+
await (0, utils_1.exec)(`echo "source /boot/grub/grub.cfg" >> ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/grub.cfg`, echo);
|
|
1149
1238
|
/**
|
|
1150
|
-
*
|
|
1239
|
+
* andiamo in memdiskDir
|
|
1151
1240
|
*/
|
|
1152
|
-
// Torniamo alla directory precedente
|
|
1153
|
-
process.chdir(tempDir);
|
|
1154
1241
|
// make a tarred "memdisk" to embed in the grub image
|
|
1155
|
-
await exec(
|
|
1242
|
+
await (0, utils_1.exec)(`tar -cvf ${memdiskDir}/memdisk ${memdiskDir}/boot`, echo);
|
|
1156
1243
|
// make the grub image
|
|
1157
|
-
|
|
1158
|
-
//
|
|
1159
|
-
|
|
1244
|
+
// -O, --format=FORMAT
|
|
1245
|
+
// -m --memdisk=FILE embed FILE as a memdisk image
|
|
1246
|
+
// -o, --output=FILE embed FILE as a memdisk image
|
|
1247
|
+
// -p, --prefix=DIR set prefix directory
|
|
1248
|
+
// --format=x86_64-efi --memdisk=memdisk --output=bootx64.efi --prefix?DIR set prefix directory
|
|
1249
|
+
// 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
|
|
1250
|
+
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);
|
|
1251
|
+
// popd torna in efiWorkDir
|
|
1160
1252
|
// copy the grub image to efi/boot (to go later in the device's root)
|
|
1161
|
-
|
|
1253
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/efi/boot`, echo);
|
|
1254
|
+
// #######################
|
|
1162
1255
|
// Do the boot image "boot/grub/efiboot.img"
|
|
1163
|
-
await exec(
|
|
1164
|
-
await exec(
|
|
1165
|
-
|
|
1166
|
-
await exec(
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
//
|
|
1256
|
+
await (0, utils_1.exec)(`dd if=/dev/zero of=${efiWorkDir}/boot/grub/efiboot.img bs=1K count=1440`, echo);
|
|
1257
|
+
await (0, utils_1.exec)(`/sbin/mkdosfs -F 12 ${efiWorkDir}/boot/grub/efiboot.img`, echo);
|
|
1258
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt`, echo);
|
|
1259
|
+
await (0, utils_1.exec)(`mount -o loop ${efiWorkDir}/boot/grub/efiboot.img ${efiWorkDir}/img-mnt`, echo);
|
|
1260
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi`, echo);
|
|
1261
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi/boot`, echo);
|
|
1262
|
+
// era cp -r
|
|
1263
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/img-mnt/efi/boot`, echo);
|
|
1264
|
+
// #######################
|
|
1170
1265
|
// copy modules and font
|
|
1171
|
-
|
|
1266
|
+
await (0, utils_1.exec)(`cp -r /usr/lib/grub/${utils_2.default.machineUEFI()}/* ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/`, echo);
|
|
1172
1267
|
// if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
|
|
1173
1268
|
// 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
|
-
|
|
1269
|
+
if (fs.existsSync('/usr/share/grub/unicode.pf2')) {
|
|
1270
|
+
await (0, utils_1.exec)(`cp /usr/share/grub/unicode.pf2 ${efiWorkDir}/boot/grub/font.pf2`, echo);
|
|
1271
|
+
}
|
|
1272
|
+
else if (fs.existsSync('/usr/share/grub2/ascii.pf2')) {
|
|
1273
|
+
await (0, utils_1.exec)(`cp /usr/share/grub2/ascii.pf2 ${efiWorkDir}/boot/grub/font.pf2`, echo);
|
|
1274
|
+
}
|
|
1275
|
+
// doesn't need to be root-owned
|
|
1276
|
+
// chown -R 1000:1000 $(pwd) 2>/dev/null
|
|
1180
1277
|
// Cleanup efi temps
|
|
1181
|
-
await exec(
|
|
1182
|
-
await exec(
|
|
1183
|
-
//
|
|
1184
|
-
|
|
1278
|
+
await (0, utils_1.exec)(`umount ${efiWorkDir}/img-mnt`, echo);
|
|
1279
|
+
// await exec(`rmdir ${efiWorkDir}/img-mnt`, echo)
|
|
1280
|
+
// await exec(`rm ${memdiskDir}/img-mnt -rf`, echo)
|
|
1281
|
+
// popd
|
|
1185
1282
|
// Copy efi files to iso
|
|
1186
|
-
await exec(`rsync -
|
|
1187
|
-
await exec(`rsync -
|
|
1283
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/boot ${isoDir}/`, echo);
|
|
1284
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/efi ${isoDir}/`, echo);
|
|
1285
|
+
// Do the main grub.cfg (which gets loaded last):
|
|
1286
|
+
// grub.theme.cfg
|
|
1287
|
+
const grubThemeSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.theme.cfg`);
|
|
1288
|
+
const grubThemeDest = `${isoDir}/boot/grub/grub.theme.cfg`;
|
|
1289
|
+
if (!fs.existsSync(grubThemeSrc)) {
|
|
1290
|
+
utils_2.default.warning('Cannot find: ' + grubThemeSrc);
|
|
1291
|
+
process.exit();
|
|
1292
|
+
}
|
|
1293
|
+
fs.copyFileSync(grubThemeSrc, grubThemeDest);
|
|
1188
1294
|
/**
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
const grubDest = `${this.settings.work_dir.pathIso}/boot/grub/grub.cfg`;
|
|
1199
|
-
const themeDest = `${this.settings.work_dir.pathIso}/boot/grub/theme.cfg`;
|
|
1200
|
-
const splashDest = `${this.settings.work_dir.pathIso}/isolinux/splash.png`;
|
|
1201
|
-
// if a theme exist, change splash with theme splash of the theme
|
|
1202
|
-
const splashCandidate = path.resolve(__dirname, `../../addons/${theme}/theme/livecd/splash.png`);
|
|
1203
|
-
if (fs.existsSync(splashCandidate)) {
|
|
1204
|
-
splashSrc = splashCandidate;
|
|
1205
|
-
}
|
|
1206
|
-
// if a theme exist, change theme.cfg with theme.cfg of the theme
|
|
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');
|
|
1295
|
+
* prepare grub.cfg from grub.template.cfg
|
|
1296
|
+
*/
|
|
1297
|
+
const grubTemplate = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.template.cfg`);
|
|
1298
|
+
if (!fs.existsSync(grubTemplate)) {
|
|
1299
|
+
utils_2.default.warning('Cannot find: ' + grubTemplate);
|
|
1300
|
+
process.exit();
|
|
1301
|
+
}
|
|
1302
|
+
const grubDest = `${isoDir}/boot/grub/grub.cfg`;
|
|
1303
|
+
const template = fs.readFileSync(grubTemplate, 'utf8');
|
|
1215
1304
|
const view = {
|
|
1216
1305
|
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
1217
|
-
kernel:
|
|
1306
|
+
kernel: utils_2.default.kernerlVersion(),
|
|
1218
1307
|
vmlinuz: `/live${this.settings.vmlinuz}`,
|
|
1219
1308
|
initrdImg: `/live${this.settings.initrdImg}`,
|
|
1220
1309
|
usernameOpt: this.settings.config.user_opt,
|
|
1221
1310
|
netconfigOpt: this.settings.config.netconfig_opt,
|
|
1222
1311
|
timezoneOpt: this.settings.config.timezone,
|
|
1223
1312
|
lang: process.env.LANG,
|
|
1224
|
-
locales: process.env.LANG
|
|
1313
|
+
locales: process.env.LANG
|
|
1225
1314
|
};
|
|
1226
1315
|
fs.writeFileSync(grubDest, mustache_1.default.render(template, view));
|
|
1316
|
+
/**
|
|
1317
|
+
* loopback.cfg
|
|
1318
|
+
*/
|
|
1319
|
+
fs.writeFileSync(`${isoDir}/boot/grub/loopback.cfg`, 'source /boot/grub/grub.cfg\n');
|
|
1227
1320
|
}
|
|
1321
|
+
// #######################################################################################
|
|
1228
1322
|
/**
|
|
1229
|
-
*
|
|
1230
|
-
*
|
|
1323
|
+
* makeDotDisk
|
|
1324
|
+
* create .disk/info, .disk/mksquashfs, .disk/mkiso
|
|
1325
|
+
* return mkiso
|
|
1231
1326
|
*/
|
|
1232
|
-
|
|
1327
|
+
makeDotDisk(backup = false, verbose = false) {
|
|
1233
1328
|
const dotDisk = this.settings.work_dir.pathIso + '/.disk';
|
|
1234
1329
|
if (fs.existsSync(dotDisk)) {
|
|
1235
|
-
|
|
1330
|
+
shelljs_1.default.rm('-rf', dotDisk);
|
|
1236
1331
|
}
|
|
1237
|
-
|
|
1238
|
-
// info
|
|
1332
|
+
shelljs_1.default.mkdir('-p', dotDisk);
|
|
1333
|
+
// .disk/info
|
|
1239
1334
|
let file = dotDisk + '/info';
|
|
1240
|
-
let content = this.settings.config.snapshot_prefix + this.settings.config.snapshot_basename
|
|
1335
|
+
let content = utils_2.default.getVolid(this.settings.remix.name); //this.settings.config.snapshot_prefix + this.settings.config.snapshot_basename
|
|
1241
1336
|
fs.writeFileSync(file, content, 'utf-8');
|
|
1242
|
-
//
|
|
1337
|
+
// .disk/mksquashfs
|
|
1338
|
+
const scripts = this.settings.work_dir.path;
|
|
1339
|
+
shelljs_1.default.cp(scripts + '/mksquashfs', dotDisk + '/mksquashfs');
|
|
1340
|
+
// .disk/mkisofs
|
|
1341
|
+
content = this.xorrisoCommand(backup).replace(/\s\s+/g, ' ');
|
|
1243
1342
|
file = dotDisk + '/mkisofs';
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1343
|
+
fs.writeFileSync(file, content, 'utf-8');
|
|
1344
|
+
return content;
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
*
|
|
1348
|
+
* @param backup
|
|
1349
|
+
* @returns cmd 4 mkiso
|
|
1350
|
+
*/
|
|
1351
|
+
xorrisoCommand(backup = false) {
|
|
1352
|
+
const volid = utils_2.default.getVolid(this.settings.remix.name);
|
|
1353
|
+
let prefix = this.settings.config.snapshot_prefix;
|
|
1354
|
+
if (backup) {
|
|
1355
|
+
prefix = prefix.slice(0, 7) === 'egg-of-' ? 'egg-eb-' + prefix.slice(7) : 'egg-eb-' + prefix;
|
|
1247
1356
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1357
|
+
const postfix = utils_2.default.getPostfix();
|
|
1358
|
+
this.settings.isoFilename = prefix + volid + postfix;
|
|
1359
|
+
const output = this.settings.config.snapshot_dir + this.settings.isoFilename;
|
|
1360
|
+
let command = '';
|
|
1361
|
+
const appid = `-appid "${this.settings.distro.distroId}" `;
|
|
1362
|
+
const publisher = `-publisher "${this.settings.distro.distroId}/${this.settings.distro.versionId}" `;
|
|
1363
|
+
const preparer = '-preparer "prepared by eggs <https://penguins-eggs.net>" ';
|
|
1364
|
+
let isoHybridMbr = ``;
|
|
1254
1365
|
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';
|
|
1366
|
+
const isolinuxFile = this.settings.distro.isolinuxPath + 'isohdpfx.bin';
|
|
1367
|
+
if (fs.existsSync(isolinuxFile)) {
|
|
1368
|
+
isoHybridMbr = `-isohybrid-mbr ${isolinuxFile}`;
|
|
1263
1369
|
}
|
|
1264
1370
|
else {
|
|
1265
|
-
|
|
1371
|
+
utils_2.default.warning(`Can't create isohybrid image. File: ${isolinuxFile} not found. \nThe resulting image will be a standard iso file`);
|
|
1266
1372
|
}
|
|
1267
1373
|
}
|
|
1268
|
-
|
|
1269
|
-
let
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1374
|
+
// uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
|
|
1375
|
+
let uefi_elToritoAltBoot = '';
|
|
1376
|
+
let uefi_e = '';
|
|
1377
|
+
let uefi_isohybridGptBasdat = '';
|
|
1378
|
+
let uefi_noEmulBoot = '';
|
|
1379
|
+
if (this.settings.config.make_efi) {
|
|
1380
|
+
uefi_elToritoAltBoot = '-eltorito-alt-boot';
|
|
1381
|
+
uefi_e = '-e boot/grub/efiboot.img';
|
|
1382
|
+
uefi_isohybridGptBasdat = '-isohybrid-gpt-basdat';
|
|
1383
|
+
uefi_noEmulBoot = '-no-emul-boot';
|
|
1277
1384
|
}
|
|
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
1385
|
/**
|
|
1295
|
-
|
|
1386
|
+
* info Debian GNU/Linux 10.8.0 "Buster" - Official i386 NETINST 20210206-10:54
|
|
1387
|
+
* mkisofs xorriso -as mkisofs
|
|
1388
|
+
* -r
|
|
1389
|
+
* -checksum_algorithm_iso md5,sha1,sha256,sha512
|
|
1390
|
+
* -V 'Debian 10.8.0 i386 n'
|
|
1391
|
+
* -o /srv/cdbuilder.debian.org/dst/deb-cd/out/2busteri386/debian-10.8.0-i386-NETINST-1.iso
|
|
1392
|
+
* -jigdo-jigdo /srv/cdbuilder.debian.org/dst/deb-cd/out/2busteri386/debian-10.8.0-i386-NETINST-1.jigdo
|
|
1393
|
+
* -jigdo-template /srv/cdbuilder.debian.org/dst/deb-cd/out/2busteri386/debian-10.8.0-i386-NETINST-1.template
|
|
1394
|
+
* -jigdo-map Debian=/srv/cdbuilder.debian.org/src/ftp/debian/
|
|
1395
|
+
* -jigdo-exclude boot1
|
|
1396
|
+
* -md5-list /srv/cdbuilder.debian.org/src/deb-cd/tmp/2busteri386/buster/md5-check
|
|
1397
|
+
* -jigdo-min-file-size 1024
|
|
1398
|
+
* -jigdo-exclude 'README*'
|
|
1399
|
+
* -jigdo-exclude /doc/
|
|
1400
|
+
* -jigdo-exclude /md5sum.txt
|
|
1401
|
+
* -jigdo-exclude /.disk/
|
|
1402
|
+
* -jigdo-exclude /pics/
|
|
1403
|
+
* -jigdo-exclude 'Release*'
|
|
1404
|
+
* -jigdo-exclude 'Packages*'
|
|
1405
|
+
* -jigdo-exclude 'Sources*'
|
|
1406
|
+
* -J
|
|
1407
|
+
* -joliet-long
|
|
1408
|
+
* -cache-inodes
|
|
1409
|
+
* -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin
|
|
1410
|
+
* -b isolinux/isolinux.bin
|
|
1411
|
+
* -c isolinux/boot.cat
|
|
1412
|
+
* -boot-load-size 4
|
|
1413
|
+
* -boot-info-table
|
|
1414
|
+
* -no-emul-boot
|
|
1415
|
+
* -eltorito-alt-boot
|
|
1416
|
+
* -e boot/grub/efi.img
|
|
1417
|
+
* -no-emul-boot
|
|
1418
|
+
* -isohybrid-gpt-basdat
|
|
1419
|
+
* isohybrid-apm-hfsplus
|
|
1420
|
+
* boot1 CD1
|
|
1421
|
+
*/
|
|
1422
|
+
command = `xorriso -as mkisofs \
|
|
1423
|
+
-r \
|
|
1424
|
+
-checksum_algorithm_iso md5,sha1,sha256,sha512 \
|
|
1425
|
+
-V ${volid} \
|
|
1426
|
+
-o ${output} \
|
|
1427
|
+
-J \
|
|
1428
|
+
-joliet-long \
|
|
1429
|
+
-cache-inodes \
|
|
1430
|
+
${isoHybridMbr} \
|
|
1431
|
+
-b isolinux/isolinux.bin \
|
|
1432
|
+
-c isolinux/boot.cat \
|
|
1433
|
+
-boot-load-size 4 \
|
|
1434
|
+
-boot-info-table \
|
|
1435
|
+
-no-emul-boot \
|
|
1436
|
+
${uefi_elToritoAltBoot} \
|
|
1437
|
+
${uefi_e} \
|
|
1438
|
+
${uefi_noEmulBoot} \
|
|
1439
|
+
${uefi_isohybridGptBasdat}
|
|
1440
|
+
${this.settings.work_dir.pathIso}`;
|
|
1441
|
+
/**
|
|
1442
|
+
* how is made in refracta
|
|
1443
|
+
*
|
|
1444
|
+
* -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
|
|
1445
|
+
* uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
|
|
1446
|
+
*
|
|
1447
|
+
* xorriso -as mkisofs -r \
|
|
1448
|
+
* -J \
|
|
1449
|
+
* -joliet-long \
|
|
1450
|
+
* -l \
|
|
1451
|
+
* -iso-level 3 \
|
|
1452
|
+
* ${isohybrid_opt} \
|
|
1453
|
+
* -partition_offset 16 \
|
|
1454
|
+
* -V "$volid" \
|
|
1455
|
+
* -b isolinux/isolinux.bin \
|
|
1456
|
+
* -c isolinux/boot.cat \
|
|
1457
|
+
* -no-emul-boot \
|
|
1458
|
+
* -boot-load-size 4 \
|
|
1459
|
+
* -boot-info-table \
|
|
1460
|
+
* ${uefi_opt} \
|
|
1461
|
+
* -o "$snapshot_dir"/"$filename" iso/
|
|
1296
1462
|
*/
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1463
|
+
command = `xorriso -as mkisofs \
|
|
1464
|
+
-J \
|
|
1465
|
+
-joliet-long \
|
|
1466
|
+
-l \
|
|
1467
|
+
-iso-level 3 \
|
|
1468
|
+
${isoHybridMbr} \
|
|
1469
|
+
-partition_offset 16 \
|
|
1470
|
+
-V ${volid} \
|
|
1471
|
+
-b isolinux/isolinux.bin \
|
|
1472
|
+
-c isolinux/boot.cat \
|
|
1473
|
+
-no-emul-boot \
|
|
1474
|
+
-boot-load-size 4 \
|
|
1475
|
+
-boot-info-table \
|
|
1476
|
+
${uefi_elToritoAltBoot} \
|
|
1477
|
+
${uefi_e} \
|
|
1478
|
+
${uefi_isohybridGptBasdat} \
|
|
1479
|
+
${uefi_noEmulBoot} \
|
|
1480
|
+
-o ${output} ${this.settings.work_dir.pathIso}`;
|
|
1481
|
+
return command;
|
|
1301
1482
|
}
|
|
1302
1483
|
/**
|
|
1303
|
-
*
|
|
1484
|
+
* makeIso
|
|
1485
|
+
* cmd: cmd 4 xorirriso
|
|
1304
1486
|
*/
|
|
1305
|
-
async makeIso(
|
|
1487
|
+
async makeIso(cmd, scriptOnly = false, verbose = false) {
|
|
1306
1488
|
let echo = { echo: false, ignore: false };
|
|
1307
1489
|
if (verbose) {
|
|
1308
1490
|
echo = { echo: true, ignore: false };
|
|
1309
|
-
}
|
|
1310
|
-
if (verbose) {
|
|
1311
1491
|
console.log('ovary: makeIso');
|
|
1312
1492
|
}
|
|
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);
|
|
1493
|
+
console.log(cmd);
|
|
1494
|
+
utils_2.default.writeX(`${this.settings.work_dir.path}mkisofs`, cmd);
|
|
1356
1495
|
if (!scriptOnly) {
|
|
1357
|
-
await exec(cmd, echo);
|
|
1496
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1358
1497
|
}
|
|
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
1498
|
}
|
|
1390
1499
|
/**
|
|
1391
1500
|
* finished = show the results
|
|
1392
1501
|
* @param scriptOnly
|
|
1393
1502
|
*/
|
|
1394
1503
|
finished(scriptOnly = false) {
|
|
1395
|
-
|
|
1504
|
+
utils_2.default.titles('produce');
|
|
1396
1505
|
if (!scriptOnly) {
|
|
1397
1506
|
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
1507
|
}
|
|
1399
1508
|
else {
|
|
1400
1509
|
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(
|
|
1510
|
+
console.log('usage');
|
|
1402
1511
|
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(
|
|
1512
|
+
console.log(chalk_1.default.cyanBright('sudo ./bind'));
|
|
1513
|
+
console.log('Make all yours modifications in the directories filesystem.squashfs and iso.');
|
|
1514
|
+
console.log('After when you are ready:');
|
|
1515
|
+
console.log(chalk_1.default.cyanBright('sudo ./mksquashfs'));
|
|
1516
|
+
console.log(chalk_1.default.cyanBright('sudo ./mkisofs'));
|
|
1517
|
+
console.log(chalk_1.default.cyanBright('sudo ./ubind'));
|
|
1518
|
+
console.log('happy hacking!');
|
|
1410
1519
|
}
|
|
1411
1520
|
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));
|
|
1521
|
+
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));
|
|
1522
|
+
console.log(' root = ' + chalk_1.default.cyanBright('root') + '/' + chalk_1.default.cyanBright(this.settings.config.root_passwd));
|
|
1414
1523
|
}
|
|
1415
1524
|
}
|
|
1416
1525
|
exports.default = Ovary;
|
|
@@ -1422,11 +1531,11 @@ async function makeIfNotExist(path, verbose = false) {
|
|
|
1422
1531
|
if (verbose) {
|
|
1423
1532
|
console.log(`ovary: makeIfNotExist(${path})`);
|
|
1424
1533
|
}
|
|
1425
|
-
const echo =
|
|
1534
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1426
1535
|
let cmd = `# ${path} alreasy exist`;
|
|
1427
1536
|
if (!fs.existsSync(path)) {
|
|
1428
1537
|
cmd = `mkdir ${path} -p`;
|
|
1429
|
-
await exec(cmd, echo);
|
|
1538
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1430
1539
|
}
|
|
1431
1540
|
return cmd;
|
|
1432
1541
|
}
|
|
@@ -1436,10 +1545,7 @@ async function makeIfNotExist(path, verbose = false) {
|
|
|
1436
1545
|
* @param echo
|
|
1437
1546
|
*/
|
|
1438
1547
|
async function rexec(cmd, verbose = false) {
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
}
|
|
1442
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
1443
|
-
await exec(cmd, echo);
|
|
1548
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1549
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1444
1550
|
return cmd;
|
|
1445
1551
|
}
|