penguins-eggs 9.0.25 → 9.0.48
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 +448 -22
- package/addons/telos/theme/applications/install-debian.desktop +28 -0
- package/addons/telos/theme/artwork/install-debian.png +0 -0
- package/addons/telos/theme/calamares/branding/banner.png +0 -0
- package/addons/telos/theme/calamares/branding/branding.desc +25 -0
- package/addons/telos/theme/calamares/branding/show.qml +51 -0
- package/addons/telos/theme/calamares/branding/slide1.png +0 -0
- package/addons/telos/theme/calamares/branding/telos-logo.png +0 -0
- package/addons/telos/theme/calamares/branding/welcome.png +0 -0
- package/addons/telos/theme/calamares/modules/partition.yml +233 -0
- package/addons/telos/theme/livecd/grub.theme.cfg +43 -0
- package/addons/telos/theme/livecd/isolinux.theme.cfg +45 -0
- package/addons/telos/theme/livecd/splash.png +0 -0
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +57 -38
- package/conf/distros/buster/calamares/modules/bootloader.yml +3 -1
- package/conf/eggs.yaml +9 -2
- package/lib/classes/basket.js +4 -4
- package/lib/classes/bleach.js +2 -2
- package/lib/classes/compressors.js +1 -1
- package/lib/classes/daddy.js +13 -13
- package/lib/classes/distro.d.ts +4 -2
- package/lib/classes/distro.js +77 -79
- package/lib/classes/family/archlinux.js +4 -4
- package/lib/classes/family/debian.js +6 -6
- package/lib/classes/family/fedora.js +4 -4
- package/lib/classes/family/suse.js +4 -4
- package/lib/classes/i18n.d.ts +28 -4
- package/lib/classes/i18n.js +112 -84
- package/lib/classes/incubation/branding.js +13 -7
- package/lib/classes/incubation/distros/bionic.js +1 -1
- package/lib/classes/incubation/distros/buster.js +1 -1
- package/lib/classes/incubation/distros/focal.js +1 -1
- package/lib/classes/incubation/distros/jessie.js +1 -1
- package/lib/classes/incubation/distros/rolling.js +1 -1
- package/lib/classes/incubation/fisherman-helper/displaymanager.js +1 -1
- package/lib/classes/incubation/fisherman-helper/packages.js +2 -2
- package/lib/classes/incubation/fisherman.js +5 -5
- package/lib/classes/incubation/incubator.js +5 -5
- package/lib/classes/incubation/installer.d.ts +1 -1
- package/lib/classes/incubation/installer.js +4 -4
- package/lib/classes/initrd.js +2 -2
- package/lib/classes/keyboards.d.ts +45 -0
- package/lib/classes/keyboards.js +196 -0
- package/lib/classes/krill_install.d.ts +12 -1
- package/lib/classes/krill_install.js +300 -312
- package/lib/classes/krill_prepare.d.ts +4 -0
- package/lib/classes/krill_prepare.js +81 -83
- package/lib/classes/locales.d.ts +14 -0
- package/lib/classes/locales.js +54 -0
- package/lib/classes/n8.js +1 -1
- package/lib/classes/ovary.d.ts +27 -27
- package/lib/classes/ovary.js +356 -387
- package/lib/classes/pacman.d.ts +1 -1
- package/lib/classes/pacman.js +40 -40
- package/lib/classes/pve-live.js +12 -16
- package/lib/classes/settings.d.ts +6 -0
- package/lib/classes/settings.js +11 -13
- package/lib/classes/systemctl.d.ts +36 -7
- package/lib/classes/systemctl.js +63 -28
- package/lib/classes/tailor.d.ts +20 -0
- package/lib/classes/tailor.js +460 -0
- package/lib/classes/tools.js +4 -4
- package/lib/classes/users.js +1 -1
- package/lib/classes/utils.d.ts +14 -3
- package/lib/classes/utils.js +75 -28
- package/lib/classes/xdg.js +23 -39
- package/lib/classes/yolk.d.ts +12 -10
- package/lib/classes/yolk.js +54 -56
- package/lib/commands/adapt.js +1 -1
- package/lib/commands/analyze.js +2 -2
- package/lib/commands/bro.js +2 -2
- package/lib/commands/calamares.js +4 -4
- package/lib/commands/config.js +4 -4
- package/lib/commands/dad.js +2 -2
- package/lib/commands/export/deb.js +2 -2
- package/lib/commands/export/docs.js +2 -2
- package/lib/commands/export/iso.js +2 -2
- package/lib/commands/info.js +1 -1
- package/lib/commands/install.js +5 -5
- package/lib/commands/kill.js +2 -2
- package/lib/commands/mom.js +2 -2
- package/lib/commands/produce.js +11 -11
- package/lib/commands/remove.js +2 -2
- package/lib/commands/syncfrom.d.ts +9 -3
- package/lib/commands/syncfrom.js +39 -32
- package/lib/commands/syncto.d.ts +26 -6
- package/lib/commands/syncto.js +73 -50
- package/lib/commands/tools/clean.js +2 -2
- package/lib/commands/tools/locales.js +9 -4
- package/lib/commands/tools/skel.js +2 -2
- package/lib/commands/tools/stat.js +3 -3
- package/lib/commands/tools/yolk.js +4 -4
- package/lib/commands/update.js +5 -5
- package/lib/commands/wardrobe/ironing.d.ts +14 -0
- package/lib/commands/wardrobe/ironing.js +123 -0
- package/lib/commands/wardrobe/list.d.ts +13 -0
- package/lib/commands/wardrobe/list.js +46 -0
- package/lib/commands/wardrobe/show.d.ts +15 -0
- package/lib/commands/wardrobe/show.js +55 -0
- package/lib/commands/wardrobe/wear.d.ts +11 -0
- package/lib/commands/wardrobe/wear.js +42 -0
- package/lib/components/elements/information.js +37 -18
- package/lib/components/elements/steps.js +1 -1
- package/lib/components/elements/title.js +2 -2
- package/lib/components/finished.js +5 -5
- package/lib/components/install.js +5 -5
- package/lib/components/keyboard.js +5 -8
- 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 +5 -5
- package/lib/components/welcome.js +6 -6
- package/lib/interfaces/i-costume.d.ts +43 -0
- package/lib/interfaces/i-costume.js +2 -0
- package/lib/interfaces/i-distro.d.ts +4 -2
- package/lib/interfaces/i-installer.d.ts +1 -1
- package/lib/interfaces/i-krill.d.ts +1 -0
- package/lib/interfaces/i-packages.d.ts +13 -0
- package/lib/interfaces/i-packages.js +2 -0
- package/lib/interfaces/i-xkb-model.d.ts +17 -0
- package/lib/interfaces/i-xkb-model.js +2 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/lib/cli-autologin.js +3 -3
- package/lib/lib/select_address_type.js +1 -1
- package/lib/lib/select_filesystem_type.js +2 -2
- package/lib/lib/select_installation_device.js +2 -1
- package/lib/lib/select_interface.js +1 -1
- package/lib/lib/select_keyboard_layout.d.ts +1 -28
- package/lib/lib/select_keyboard_layout.js +18 -33
- package/lib/lib/select_keyboard_model.d.ts +4 -0
- package/lib/lib/select_keyboard_model.js +36 -0
- package/lib/lib/select_keyboard_option.d.ts +4 -0
- package/lib/lib/select_keyboard_option.js +36 -0
- package/lib/lib/select_keyboard_variant.d.ts +1 -5
- package/lib/lib/select_keyboard_variant.js +32 -5
- package/lib/lib/select_languages.d.ts +1 -1
- package/lib/lib/select_languages.js +8 -7
- package/lib/lib/select_regions.d.ts +1 -1
- package/lib/lib/select_regions.js +2 -2
- package/lib/lib/select_user_swap_choice.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +6 -5
- package/scripts/_eggs +43 -2
- package/scripts/bros/waydroid-helper.sh +1 -1
- package/scripts/eggs.bash +6 -2
- package/scripts/{not-used/install-eggs-ppa.sh → install-eggs-ppa.sh} +1 -0
- package/scripts/mom-cli.sh +1 -1
- package/scripts/pve-live.sh +2 -6
- package/scripts/resy.sh +8 -0
- package/scripts/userexist.sh +6 -0
- package/wardrobe.d/external.yml +7 -0
- package/wardrobe.d/hen/control.template +10 -0
- package/wardrobe.d/hen/index.yml +212 -0
- package/wardrobe.d/kde/index.yml +41 -0
- package/wardrobe.d/lamp/index.yml +35 -0
- package/wardrobe.d/xfce4/index.yml +53 -0
- package/conf/distros/buster/locales/locale.gen.template +0 -10
- package/conf/distros/buster/locales/locale.template +0 -11
- package/conf/distros/focal/locale.gen.template +0 -8
- package/scripts/not-used/eggs-cleanup.sh +0 -7
- package/scripts/not-used/mkinitramfs +0 -469
- package/scripts/update-initramfs +0 -94
package/lib/classes/ovary.js
CHANGED
|
@@ -11,83 +11,68 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
*/
|
|
12
12
|
// packages
|
|
13
13
|
const fs = require("fs");
|
|
14
|
-
const node_path_1 =
|
|
15
|
-
const node_os_1 =
|
|
16
|
-
const shelljs_1 =
|
|
17
|
-
const chalk_1 =
|
|
18
|
-
const mustache_1 =
|
|
19
|
-
const pve_live_1 =
|
|
14
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
15
|
+
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
16
|
+
const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
|
|
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"));
|
|
20
20
|
// libraries
|
|
21
21
|
const utils_1 = require("../lib/utils");
|
|
22
22
|
// classes
|
|
23
|
-
const utils_2 =
|
|
24
|
-
const n8_1 =
|
|
25
|
-
const incubator_1 =
|
|
26
|
-
const xdg_1 =
|
|
27
|
-
const pacman_1 =
|
|
28
|
-
const settings_1 =
|
|
29
|
-
const systemctl_1 =
|
|
30
|
-
const bleach_1 =
|
|
31
|
-
const yolk_1 =
|
|
23
|
+
const utils_2 = tslib_1.__importDefault(require("./utils"));
|
|
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"));
|
|
32
32
|
const cliAutologin = require("../lib/cli-autologin");
|
|
33
33
|
const displaymanager_1 = require("./incubation/fisherman-helper/displaymanager");
|
|
34
34
|
// backup
|
|
35
35
|
const promises_1 = require("fs/promises");
|
|
36
36
|
const fs_1 = require("fs");
|
|
37
|
-
const users_1 =
|
|
37
|
+
const users_1 = tslib_1.__importDefault(require("./users"));
|
|
38
38
|
/**
|
|
39
39
|
* Ovary:
|
|
40
40
|
*/
|
|
41
41
|
class Ovary {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
constructor(snapshot_prefix = '', snapshot_basename = '', theme = '', compression = '') {
|
|
47
|
-
this.toNull = ' > /dev/null 2>&1';
|
|
42
|
+
constructor() {
|
|
43
|
+
this.verbose = false;
|
|
44
|
+
this.echo = {};
|
|
45
|
+
this.toNull = '';
|
|
48
46
|
this.incubator = {};
|
|
49
47
|
this.settings = {};
|
|
50
48
|
this.familyId = '';
|
|
51
49
|
this.snapshot_prefix = '';
|
|
52
50
|
this.snapshot_basename = '';
|
|
53
|
-
this.theme = '';
|
|
54
51
|
this.compression = '';
|
|
55
|
-
this.settings = new settings_1.default();
|
|
56
|
-
// I flags di produce hanno la preferenza
|
|
57
|
-
if (snapshot_prefix !== '') {
|
|
58
|
-
this.snapshot_prefix = snapshot_prefix;
|
|
59
|
-
}
|
|
60
|
-
if (snapshot_basename !== '') {
|
|
61
|
-
this.snapshot_basename = snapshot_basename;
|
|
62
|
-
}
|
|
63
|
-
if (theme !== '') {
|
|
64
|
-
this.theme = theme;
|
|
65
|
-
}
|
|
66
|
-
if (compression !== '') {
|
|
67
|
-
this.compression = compression;
|
|
68
|
-
}
|
|
69
52
|
}
|
|
70
53
|
/**
|
|
71
54
|
* @returns {boolean} success
|
|
72
55
|
*/
|
|
73
|
-
async fertilization() {
|
|
56
|
+
async fertilization(snapshot_prefix = '', snapshot_basename = '', theme = '', compression = '') {
|
|
57
|
+
this.settings = new settings_1.default();
|
|
74
58
|
if (await this.settings.load()) {
|
|
75
59
|
this.familyId = this.settings.distro.familyId;
|
|
76
|
-
if (
|
|
77
|
-
this.settings.config.snapshot_prefix =
|
|
60
|
+
if (snapshot_prefix !== '') {
|
|
61
|
+
this.settings.config.snapshot_prefix = snapshot_prefix;
|
|
78
62
|
}
|
|
79
|
-
if (
|
|
80
|
-
this.settings.config.snapshot_basename =
|
|
63
|
+
if (snapshot_basename !== '') {
|
|
64
|
+
this.settings.config.snapshot_basename = snapshot_basename;
|
|
81
65
|
}
|
|
82
|
-
if (
|
|
83
|
-
this.settings.config.theme =
|
|
66
|
+
if (theme !== '') {
|
|
67
|
+
this.settings.config.theme = theme;
|
|
84
68
|
}
|
|
85
|
-
if (
|
|
86
|
-
this.settings.config.compression =
|
|
69
|
+
if (compression !== '') {
|
|
70
|
+
this.settings.config.compression = compression;
|
|
87
71
|
}
|
|
88
72
|
this.settings.listFreeSpace();
|
|
89
|
-
if (await utils_2.default.customConfirm('Select yes to continue...'))
|
|
73
|
+
if (await utils_2.default.customConfirm('Select yes to continue...')) {
|
|
90
74
|
return true;
|
|
75
|
+
}
|
|
91
76
|
}
|
|
92
77
|
return false;
|
|
93
78
|
}
|
|
@@ -96,21 +81,24 @@ class Ovary {
|
|
|
96
81
|
* @param basename
|
|
97
82
|
*/
|
|
98
83
|
async produce(backup = false, scriptOnly = false, yolkRenew = false, release = false, myAddons, verbose = false) {
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
this.verbose = verbose;
|
|
85
|
+
this.echo = utils_2.default.setEcho(verbose);
|
|
86
|
+
if (this.verbose) {
|
|
87
|
+
this.toNull = ' > /dev/null 2>&1';
|
|
88
|
+
}
|
|
101
89
|
let luksName = 'luks-eggs-backup';
|
|
102
90
|
let luksFile = `/tmp/${luksName}`;
|
|
103
|
-
let luksDevice = `/dev/mapper/${luksName}
|
|
104
|
-
let luksMountpoint = `/mnt
|
|
91
|
+
// let luksDevice = `/dev/mapper/${luksName}`
|
|
92
|
+
// let luksMountpoint = `/mnt`
|
|
105
93
|
if (this.familyId === 'debian') {
|
|
106
94
|
const yolk = new yolk_1.default();
|
|
107
|
-
if (!yolk.
|
|
108
|
-
utils_2.default.warning('local
|
|
95
|
+
if (!yolk.yolkExists()) {
|
|
96
|
+
utils_2.default.warning('local repository /var/local/yolk creation...');
|
|
109
97
|
await yolk.create(verbose);
|
|
110
98
|
}
|
|
111
99
|
else if (yolkRenew) {
|
|
112
|
-
utils_2.default.warning('force renew local repository yolk...');
|
|
113
|
-
yolk.
|
|
100
|
+
utils_2.default.warning('force renew local repository /var/local/yolk...');
|
|
101
|
+
yolk.yolkClean();
|
|
114
102
|
await yolk.create(verbose);
|
|
115
103
|
}
|
|
116
104
|
else {
|
|
@@ -120,12 +108,12 @@ class Ovary {
|
|
|
120
108
|
if (!fs.existsSync(this.settings.config.snapshot_dir)) {
|
|
121
109
|
shelljs_1.default.mkdir('-p', this.settings.config.snapshot_dir);
|
|
122
110
|
}
|
|
123
|
-
await this.settings.loadRemix(this.snapshot_basename, this.theme);
|
|
111
|
+
await this.settings.loadRemix(this.snapshot_basename, this.settings.config.theme);
|
|
124
112
|
if (utils_2.default.isLive()) {
|
|
125
113
|
console.log(chalk_1.default.red('>>> eggs: This is a live system! An egg cannot be produced from an egg!'));
|
|
126
114
|
}
|
|
127
115
|
else {
|
|
128
|
-
await this.liveCreateStructure(
|
|
116
|
+
await this.liveCreateStructure();
|
|
129
117
|
if (this.settings.distro.isCalamaresAvailable && (pacman_1.default.isInstalledGui()) && this.settings.config.force_installer && !(await pacman_1.default.calamaresCheck())) {
|
|
130
118
|
console.log('Installing ' + chalk_1.default.bgGray('calamares') + ' due force_installer=yes.');
|
|
131
119
|
await pacman_1.default.calamaresInstall(verbose);
|
|
@@ -133,14 +121,15 @@ class Ovary {
|
|
|
133
121
|
await bleach.clean(verbose);
|
|
134
122
|
}
|
|
135
123
|
if (backup) {
|
|
136
|
-
|
|
137
|
-
* We will remove users and servers homes from ISO
|
|
138
|
-
*/
|
|
139
|
-
console.log(`The following private data will removed from your ISO:`);
|
|
124
|
+
console.log(`eggs will remove all users and services data from live. Following datas will included on a crypted LUKS volume:`);
|
|
140
125
|
const users = await this.usersFill();
|
|
141
126
|
for (let i = 0; i < users.length; i++) {
|
|
142
127
|
if (users[i].saveIt) {
|
|
143
|
-
|
|
128
|
+
let utype = 'user ';
|
|
129
|
+
if (parseInt(users[i].uid) < 1000) {
|
|
130
|
+
utype = 'service';
|
|
131
|
+
}
|
|
132
|
+
console.log(`- ${utype}: ${users[i].login.padEnd(16)} \thome: ${users[i].home}`);
|
|
144
133
|
if (users[i].login !== 'root') {
|
|
145
134
|
this.addRemoveExclusion(true, users[i].home);
|
|
146
135
|
}
|
|
@@ -148,10 +137,7 @@ class Ovary {
|
|
|
148
137
|
}
|
|
149
138
|
}
|
|
150
139
|
else {
|
|
151
|
-
|
|
152
|
-
* We will remove all the users from ISO, but servers and data will be included uncrypted
|
|
153
|
-
*/
|
|
154
|
-
utils_2.default.warning('eggs will remove all the users from ISO, but servers homes will be included uncrypted');
|
|
140
|
+
utils_2.default.warning('eggs will remove all the users data from live, but all services data will be included uncrypted');
|
|
155
141
|
}
|
|
156
142
|
/**
|
|
157
143
|
* NOTE: reCreate = false
|
|
@@ -168,141 +154,115 @@ class Ovary {
|
|
|
168
154
|
*/
|
|
169
155
|
this.incubator = new incubator_1.default(this.settings.remix, this.settings.distro, this.settings.config.user_opt, verbose);
|
|
170
156
|
await this.incubator.config(release);
|
|
171
|
-
await this.syslinux(
|
|
172
|
-
await this.isolinux(this.theme
|
|
173
|
-
await this.kernelCopy(
|
|
157
|
+
await this.syslinux();
|
|
158
|
+
await this.isolinux(this.settings.config.theme);
|
|
159
|
+
await this.kernelCopy();
|
|
174
160
|
/**
|
|
175
161
|
* we need different behaviour on
|
|
176
162
|
* initrd for different familis
|
|
177
163
|
*/
|
|
178
164
|
if (this.familyId === 'debian') {
|
|
179
|
-
await this.initrdCopy(
|
|
165
|
+
await this.initrdCopy();
|
|
180
166
|
}
|
|
181
167
|
else if (this.familyId === 'archlinux') {
|
|
182
|
-
await this.initrdCreate(
|
|
168
|
+
await this.initrdCreate();
|
|
183
169
|
}
|
|
184
170
|
if (this.settings.config.make_efi) {
|
|
185
|
-
await this.makeEfi(this.theme
|
|
171
|
+
await this.makeEfi(this.settings.config.theme);
|
|
186
172
|
}
|
|
187
|
-
await this.bindLiveFs(
|
|
173
|
+
await this.bindLiveFs();
|
|
188
174
|
await this.cleanUsersAccounts();
|
|
189
|
-
await this.createUserLive(
|
|
175
|
+
await this.createUserLive();
|
|
190
176
|
if (pacman_1.default.isInstalledGui()) {
|
|
191
|
-
await this.createXdgAutostart(this.theme, myAddons);
|
|
177
|
+
await this.createXdgAutostart(this.settings.config.theme, myAddons);
|
|
192
178
|
if ((0, displaymanager_1.displaymanager)() === '') {
|
|
193
179
|
// If GUI is installed and not Desktop manager
|
|
194
|
-
cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.
|
|
195
|
-
cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.
|
|
180
|
+
cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
181
|
+
cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
196
182
|
}
|
|
197
183
|
}
|
|
198
184
|
else {
|
|
199
|
-
cliAutologin.addAutologin(this.settings.distro.distroId, this.settings.distro.
|
|
185
|
+
cliAutologin.addAutologin(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
200
186
|
}
|
|
201
|
-
await this.editLiveFs(
|
|
202
|
-
await this.makeSquashfs(scriptOnly
|
|
203
|
-
await this.uBindLiveFs(
|
|
187
|
+
await this.editLiveFs();
|
|
188
|
+
await this.makeSquashfs(scriptOnly);
|
|
189
|
+
await this.uBindLiveFs(); // Lo smonto prima della fase di backup
|
|
204
190
|
}
|
|
205
191
|
if (backup) {
|
|
206
|
-
await (0, utils_1.exec)('eggs syncto');
|
|
192
|
+
await (0, utils_1.exec)('eggs syncto', utils_2.default.setEcho(true));
|
|
207
193
|
utils_2.default.warning(`moving ${luksFile} in ${this.settings.config.snapshot_dir}ovarium/iso/live`);
|
|
208
|
-
await (0, utils_1.exec)(`mv ${luksFile} ${this.settings.config.snapshot_dir}ovarium/iso/live`, echo);
|
|
194
|
+
await (0, utils_1.exec)(`mv ${luksFile} ${this.settings.config.snapshot_dir}ovarium/iso/live`, this.echo);
|
|
209
195
|
}
|
|
210
|
-
const xorrisoCommand = this.makeDotDisk(backup
|
|
196
|
+
const xorrisoCommand = this.makeDotDisk(backup);
|
|
211
197
|
/**
|
|
212
198
|
* patch to emulate miso archilinux
|
|
213
199
|
*/
|
|
214
200
|
if (this.familyId === 'archlinux') {
|
|
215
|
-
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.pathIso}/live/x86_64`, echo);
|
|
216
|
-
await (0, utils_1.exec)(`ln ${this.settings.work_dir.pathIso}/live/filesystem.squashfs ${this.settings.work_dir.pathIso}/live/x86_64/livefs.sfs`, echo);
|
|
201
|
+
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.pathIso}/live/x86_64`, this.echo);
|
|
202
|
+
await (0, utils_1.exec)(`ln ${this.settings.work_dir.pathIso}/live/filesystem.squashfs ${this.settings.work_dir.pathIso}/live/x86_64/livefs.sfs`, this.echo);
|
|
217
203
|
}
|
|
218
|
-
await this.makeIso(xorrisoCommand, scriptOnly
|
|
204
|
+
await this.makeIso(xorrisoCommand, scriptOnly);
|
|
219
205
|
}
|
|
220
206
|
}
|
|
221
207
|
/**
|
|
222
208
|
* Crea la struttura della workdir
|
|
223
209
|
*/
|
|
224
|
-
async liveCreateStructure(
|
|
225
|
-
if (verbose) {
|
|
210
|
+
async liveCreateStructure() {
|
|
211
|
+
if (this.verbose) {
|
|
226
212
|
console.log('Overy: liveCreateStructure');
|
|
227
213
|
}
|
|
228
214
|
utils_2.default.warning(`Creating egg in ${this.settings.work_dir.path}`);
|
|
215
|
+
let cmd;
|
|
229
216
|
if (!fs.existsSync(this.settings.work_dir.path)) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
console.log('error: ' + error + ' creating ' + this.settings.work_dir.path);
|
|
235
|
-
}
|
|
217
|
+
cmd = `mkdir -p ${this.settings.work_dir.path}`;
|
|
218
|
+
this.tryCatch(cmd);
|
|
236
219
|
}
|
|
237
220
|
if (!fs.existsSync(this.settings.work_dir.path + '/README.md')) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
console.log('error: ' + error + ' creating ' + node_path_1.default.resolve(__dirname, '../../conf/README.md'), this.settings.work_dir.path + 'README.md');
|
|
243
|
-
}
|
|
221
|
+
cmd = `cp ${node_path_1.default.resolve(__dirname, '../../conf/README.md')} ${this.settings.work_dir.path}README.md}`;
|
|
222
|
+
this.tryCatch(cmd);
|
|
244
223
|
}
|
|
245
224
|
if (!fs.existsSync(this.settings.work_dir.lowerdir)) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
250
|
-
console.log('error: ' + error + ' creating ' + this.settings.work_dir.lowerdir);
|
|
251
|
-
}
|
|
225
|
+
cmd = `mkdir -p ${this.settings.work_dir.lowerdir}`;
|
|
226
|
+
this.tryCatch(cmd);
|
|
252
227
|
}
|
|
253
228
|
if (!fs.existsSync(this.settings.work_dir.upperdir)) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
catch (error) {
|
|
258
|
-
console.log('error: ' + error + ' creating ' + this.settings.work_dir.upperdir);
|
|
259
|
-
}
|
|
229
|
+
cmd = `mkdir -p ${this.settings.work_dir.upperdir}`;
|
|
230
|
+
this.tryCatch(cmd);
|
|
260
231
|
}
|
|
261
232
|
if (!fs.existsSync(this.settings.work_dir.workdir)) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
catch (error) {
|
|
266
|
-
console.log('error: ' + error + ' creating ' + this.settings.work_dir.workdir);
|
|
267
|
-
}
|
|
233
|
+
cmd = `mkdir -p ${this.settings.work_dir.workdir}`;
|
|
234
|
+
this.tryCatch(cmd);
|
|
268
235
|
}
|
|
269
236
|
if (!fs.existsSync(this.settings.work_dir.merged)) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
catch (error) {
|
|
274
|
-
console.log('error: ' + error + ' creating ' + this.settings.work_dir.merged);
|
|
275
|
-
}
|
|
237
|
+
cmd = `mkdir -p ${this.settings.work_dir.merged}`;
|
|
238
|
+
this.tryCatch(cmd);
|
|
276
239
|
}
|
|
277
240
|
/**
|
|
278
241
|
* Creo le directory di destinazione per boot, efi, isolinux e live
|
|
279
242
|
* precedentemente in isolinux
|
|
280
243
|
*/
|
|
281
244
|
if (!fs.existsSync(this.settings.work_dir.pathIso)) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
catch {
|
|
304
|
-
shelljs_1.default.mkdir('-p', this.settings.work_dir.pathIso + '/live');
|
|
305
|
-
}
|
|
245
|
+
cmd = `mkdir -p ${this.settings.work_dir.pathIso}/boot/grub/${utils_2.default.machineUEFI()}`;
|
|
246
|
+
this.tryCatch(cmd);
|
|
247
|
+
cmd = `mkdir -p ${this.settings.work_dir.pathIso}/efi/boot`;
|
|
248
|
+
this.tryCatch(cmd);
|
|
249
|
+
cmd = `mkdir -p ${this.settings.work_dir.pathIso}/isolinux`;
|
|
250
|
+
this.tryCatch(cmd);
|
|
251
|
+
cmd = `mkdir -p ${this.settings.work_dir.pathIso}/live`;
|
|
252
|
+
this.tryCatch(cmd);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
*
|
|
257
|
+
* @param cmd
|
|
258
|
+
*/
|
|
259
|
+
async tryCatch(cmd = '') {
|
|
260
|
+
try {
|
|
261
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
console.log(`Error: ${error}`);
|
|
265
|
+
await utils_2.default.pressKeyToExit(cmd);
|
|
306
266
|
}
|
|
307
267
|
}
|
|
308
268
|
/**
|
|
@@ -315,9 +275,8 @@ class Ovary {
|
|
|
315
275
|
* - Add some basic files to /dev
|
|
316
276
|
* - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
|
|
317
277
|
*/
|
|
318
|
-
async editLiveFs(
|
|
319
|
-
|
|
320
|
-
if (verbose) {
|
|
278
|
+
async editLiveFs() {
|
|
279
|
+
if (this.verbose) {
|
|
321
280
|
console.log('ovary: editLiveFs');
|
|
322
281
|
}
|
|
323
282
|
if (this.familyId === 'debian') {
|
|
@@ -326,42 +285,50 @@ class Ovary {
|
|
|
326
285
|
const file = '/etc/initramfs-tools/conf.d/eggs-safe-initramfs.conf';
|
|
327
286
|
utils_2.default.write(file, text);
|
|
328
287
|
}
|
|
329
|
-
// sudo systemctl disable wpa_supplicant
|
|
330
288
|
// Truncate logs, remove archived logs.
|
|
331
289
|
let cmd = `find ${this.settings.work_dir.merged}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
|
|
332
|
-
await (0, utils_1.exec)(cmd, echo);
|
|
290
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
333
291
|
cmd = `find ${this.settings.work_dir.merged}/var/log/ -type f -exec truncate -s 0 {} \\;`;
|
|
334
|
-
await (0, utils_1.exec)(cmd, echo);
|
|
292
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
335
293
|
// Allow all fixed drives to be mounted with pmount
|
|
336
294
|
if (this.settings.config.pmount_fixed && fs.existsSync(`${this.settings.work_dir.merged}/etc/pmount.allow`)) {
|
|
337
295
|
// MX aggiunto /etc
|
|
338
|
-
await (0, utils_1.exec)(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${this.settings.work_dir.merged}/etc/pmount.allow`, echo);
|
|
296
|
+
await (0, utils_1.exec)(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${this.settings.work_dir.merged}/etc/pmount.allow`, this.echo);
|
|
339
297
|
}
|
|
340
298
|
// Enable or disable password login through ssh for users (not root)
|
|
341
299
|
// Remove obsolete live-config file
|
|
342
300
|
if (fs.existsSync(`${this.settings.work_dir.merged}lib/live/config/1161-openssh-server`)) {
|
|
343
|
-
await (0, utils_1.exec)('rm -f "$work_dir"/myfs/lib/live/config/1161-openssh-server', echo);
|
|
301
|
+
await (0, utils_1.exec)('rm -f "$work_dir"/myfs/lib/live/config/1161-openssh-server', this.echo);
|
|
344
302
|
}
|
|
345
303
|
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/ssh/sshd_config`)) {
|
|
346
|
-
await (0, utils_1.exec)(`sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo);
|
|
304
|
+
await (0, utils_1.exec)(`sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
347
305
|
await (this.settings.config.ssh_pass
|
|
348
|
-
? (0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*no|PasswordAuthentication yes|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo)
|
|
349
|
-
: (0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*yes|PasswordAuthentication no|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, echo));
|
|
306
|
+
? (0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*no|PasswordAuthentication yes|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo)
|
|
307
|
+
: (0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*yes|PasswordAuthentication no|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo));
|
|
350
308
|
}
|
|
351
309
|
/**
|
|
352
310
|
* /etc/fstab should exist, even if it's empty,
|
|
353
311
|
* to prevent error messages at boot
|
|
354
312
|
*/
|
|
355
|
-
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/fstab`, echo);
|
|
356
|
-
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/fstab`, echo);
|
|
313
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
314
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
357
315
|
/**
|
|
358
|
-
*
|
|
359
|
-
*
|
|
316
|
+
* Remove crypttab if exists
|
|
317
|
+
* this is crucial for tpm systems.
|
|
318
|
+
*/
|
|
319
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/crypttab`)) {
|
|
320
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/crypttab`, this.echo);
|
|
321
|
+
// await exec(`touch ${this.settings.work_dir.merged}/etc/crypttab`, echo)
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Blank out systemd machine id.
|
|
325
|
+
* If it does not exist, systemd-journald will fail,
|
|
326
|
+
* but if it exists and is empty, systemd will automatically
|
|
360
327
|
* set up a new unique ID.
|
|
361
328
|
*/
|
|
362
329
|
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/machine-id`)) {
|
|
363
|
-
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/machine-id`, echo);
|
|
364
|
-
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/machine-id`, echo);
|
|
330
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
331
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
365
332
|
utils_2.default.write(`${this.settings.work_dir.merged}/etc/machine-id`, ':');
|
|
366
333
|
}
|
|
367
334
|
/**
|
|
@@ -373,158 +340,160 @@ class Ovary {
|
|
|
373
340
|
* Per tutte le distro systemd
|
|
374
341
|
*/
|
|
375
342
|
if (utils_2.default.isSystemd()) {
|
|
343
|
+
utils_2.default.warning('systemd');
|
|
344
|
+
const systemdctl = new systemctl_1.default(this.verbose);
|
|
376
345
|
/**
|
|
377
346
|
* SU UBUNTU E DERIVATE NON DISABILITARE systemd-resolved.service
|
|
378
347
|
*/
|
|
379
348
|
if (this.settings.distro.distroLike !== 'Ubuntu') {
|
|
380
|
-
|
|
349
|
+
if (await systemdctl.isEnabled('systemd-systemd-resolved.service')) {
|
|
350
|
+
await systemdctl.disable('systemd-systemd-resolved.service', this.settings.work_dir.merged, true);
|
|
351
|
+
}
|
|
381
352
|
}
|
|
382
|
-
// systemctl is-enabled
|
|
383
|
-
const systemdctl = new systemctl_1.default();
|
|
384
353
|
if (await systemdctl.isEnabled('systemd-networkd.service')) {
|
|
385
|
-
await (
|
|
354
|
+
await systemdctl.disable('systemd-networkd.service', this.settings.work_dir.merged, true);
|
|
386
355
|
}
|
|
387
356
|
if (await systemdctl.isEnabled('remote-cryptsetup.target')) {
|
|
388
|
-
await (
|
|
357
|
+
await systemdctl.disable('remote-cryptsetup.target', this.settings.work_dir.merged, true);
|
|
389
358
|
}
|
|
390
359
|
if (await systemdctl.isEnabled('speech-dispatcherd.service')) {
|
|
391
|
-
await (
|
|
360
|
+
await systemdctl.disable('speech-dispatcherd.service', this.settings.work_dir.merged, true);
|
|
392
361
|
}
|
|
393
362
|
if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service')) {
|
|
394
|
-
await (
|
|
363
|
+
await systemdctl.disable('wpa_supplicant-nl80211@.service', this.settings.work_dir.merged, true);
|
|
395
364
|
}
|
|
396
365
|
if (await systemdctl.isEnabled('wpa_supplicant@.service')) {
|
|
397
|
-
await (
|
|
366
|
+
await systemdctl.disable('wpa_supplicant@.service', this.settings.work_dir.merged, true);
|
|
398
367
|
}
|
|
399
368
|
if (await systemdctl.isEnabled('wpa_supplicant-wired@.service')) {
|
|
400
|
-
await (
|
|
369
|
+
await systemdctl.disable('wpa_supplicant-wired@.service', this.settings.work_dir.merged, true);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* All systemd distros rm
|
|
373
|
+
*/
|
|
374
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/var/lib/wicd/configurations/*`, this.echo);
|
|
375
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/wicd/wireless-settings.conf`, this.echo);
|
|
376
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/NetworkManager/system-connections/*`, this.echo);
|
|
377
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/wifi/*`, this.echo);
|
|
378
|
+
/**
|
|
379
|
+
* removing from /etc/network/:
|
|
380
|
+
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
381
|
+
*/
|
|
382
|
+
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
383
|
+
let cleanDir = '';
|
|
384
|
+
for (cleanDir of cleanDirs) {
|
|
385
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/${cleanDir}/wpasupplicant`, this.echo);
|
|
401
386
|
}
|
|
402
387
|
}
|
|
403
|
-
|
|
404
|
-
|
|
388
|
+
/**
|
|
389
|
+
* cleaning /etc/resolv.conf
|
|
390
|
+
* /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
|
|
391
|
+
*/
|
|
392
|
+
shelljs_1.default.rm(`${this.settings.work_dir.merged}/etc/resolv.conf`);
|
|
393
|
+
shelljs_1.default.touch(`${this.settings.work_dir.merged}/etc/resolv.conf`);
|
|
405
394
|
/**
|
|
406
395
|
* Clear configs from /etc/network/interfaces, wicd and NetworkManager
|
|
407
396
|
* and netman, so they aren't stealthily included in the snapshot.
|
|
408
397
|
*/
|
|
409
398
|
if (this.familyId === 'debian') {
|
|
410
399
|
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/network/interfaces`)) {
|
|
411
|
-
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/network/interfaces`, echo);
|
|
400
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/network/interfaces`, this.echo);
|
|
412
401
|
}
|
|
413
|
-
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/network/interfaces`, echo);
|
|
402
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/network/interfaces`, this.echo);
|
|
414
403
|
utils_2.default.write(`${this.settings.work_dir.merged}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
415
404
|
}
|
|
416
|
-
/**
|
|
417
|
-
* Per tutte le distro systemd
|
|
418
|
-
*/
|
|
419
|
-
if (utils_2.default.isSystemd()) {
|
|
420
|
-
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/var/lib/wicd/configurations/*`, echo);
|
|
421
|
-
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/wicd/wireless-settings.conf`, echo);
|
|
422
|
-
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/NetworkManager/system-connections/*`, echo);
|
|
423
|
-
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/wifi/*`, echo);
|
|
424
|
-
/**
|
|
425
|
-
* Andiamo a fare pulizia in /etc/network/:
|
|
426
|
-
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
427
|
-
*/
|
|
428
|
-
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
429
|
-
let cleanDir = '';
|
|
430
|
-
for (cleanDir of cleanDirs) {
|
|
431
|
-
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/${cleanDir}/wpasupplicant`, echo);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
405
|
/**
|
|
435
406
|
* add some basic files to /dev
|
|
436
407
|
*/
|
|
437
408
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/console`)) {
|
|
438
|
-
await (0, utils_1.exec)(`mknod -m 622 ${this.settings.work_dir.merged}/dev/console c 5 1`, echo);
|
|
409
|
+
await (0, utils_1.exec)(`mknod -m 622 ${this.settings.work_dir.merged}/dev/console c 5 1`, this.echo);
|
|
439
410
|
}
|
|
440
411
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/null`)) {
|
|
441
|
-
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/null c 1 3`, echo);
|
|
412
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/null c 1 3`, this.echo);
|
|
442
413
|
}
|
|
443
414
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/zero`)) {
|
|
444
|
-
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/zero c 1 5`, echo);
|
|
415
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/zero c 1 5`, this.echo);
|
|
445
416
|
}
|
|
446
417
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/ptmx`)) {
|
|
447
|
-
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/ptmx c 5 2`, echo);
|
|
418
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/ptmx c 5 2`, this.echo);
|
|
448
419
|
}
|
|
449
420
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/tty`)) {
|
|
450
|
-
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/tty c 5 0`, echo);
|
|
421
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/tty c 5 0`, this.echo);
|
|
451
422
|
}
|
|
452
423
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/random`)) {
|
|
453
|
-
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, echo);
|
|
424
|
+
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, this.echo);
|
|
454
425
|
}
|
|
455
426
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/urandom`)) {
|
|
456
|
-
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, echo);
|
|
427
|
+
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, this.echo);
|
|
457
428
|
}
|
|
458
429
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`)) {
|
|
459
|
-
await (0, utils_1.exec)(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, echo);
|
|
430
|
+
await (0, utils_1.exec)(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, this.echo);
|
|
460
431
|
}
|
|
461
432
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/fd`)) {
|
|
462
|
-
await (0, utils_1.exec)(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, echo);
|
|
433
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, this.echo);
|
|
463
434
|
}
|
|
464
435
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdin`)) {
|
|
465
|
-
await (0, utils_1.exec)(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, echo);
|
|
436
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, this.echo);
|
|
466
437
|
}
|
|
467
438
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdout`)) {
|
|
468
|
-
await (0, utils_1.exec)(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, echo);
|
|
439
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, this.echo);
|
|
469
440
|
}
|
|
470
441
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stderr`)) {
|
|
471
|
-
await (0, utils_1.exec)(`ln -sv /proc/self/fd/2 ${this.settings.work_dir.merged}/dev/stderr`, echo);
|
|
442
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/2 ${this.settings.work_dir.merged}/dev/stderr`, this.echo);
|
|
472
443
|
}
|
|
473
444
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/core`)) {
|
|
474
|
-
await (0, utils_1.exec)(`ln -sv /proc/kcore ${this.settings.work_dir.merged}/dev/core`, echo);
|
|
445
|
+
await (0, utils_1.exec)(`ln -sv /proc/kcore ${this.settings.work_dir.merged}/dev/core`, this.echo);
|
|
475
446
|
}
|
|
476
447
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
477
|
-
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/shm`, echo);
|
|
448
|
+
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
478
449
|
}
|
|
479
450
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/pts`)) {
|
|
480
|
-
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/pts`, echo);
|
|
451
|
+
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/pts`, this.echo);
|
|
481
452
|
}
|
|
482
453
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
483
|
-
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/dev/shm`, echo);
|
|
454
|
+
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
484
455
|
}
|
|
485
456
|
/**
|
|
486
457
|
* Assegno 1777 a /tmp
|
|
487
458
|
* creava problemi con MXLINUX
|
|
488
459
|
*/
|
|
489
460
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/tmp`)) {
|
|
490
|
-
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.merged}/tmp`, echo);
|
|
461
|
+
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
491
462
|
}
|
|
492
|
-
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/tmp`, echo);
|
|
463
|
+
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
493
464
|
}
|
|
494
465
|
/**
|
|
495
466
|
* syslinux
|
|
496
467
|
*/
|
|
497
|
-
async syslinux(
|
|
498
|
-
|
|
499
|
-
if (verbose) {
|
|
468
|
+
async syslinux() {
|
|
469
|
+
if (this.verbose) {
|
|
500
470
|
console.log('ovary: syslinux');
|
|
501
471
|
console.log('syslinux path: ' + this.settings.distro.syslinuxPath);
|
|
502
472
|
}
|
|
503
|
-
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/vesamenu.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
504
|
-
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/chain.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
473
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/vesamenu.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
474
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/chain.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
505
475
|
/**
|
|
506
476
|
* per openSuse non sono riusciuto a determinare
|
|
507
477
|
* quale pacchetto installi:
|
|
508
478
|
* ldllinux.c43, libcom32 e libutil.c32
|
|
509
479
|
*/
|
|
510
480
|
if (this.familyId !== 'suse') {
|
|
511
|
-
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/ldlinux.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
512
|
-
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libcom32.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
513
|
-
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libutil.c32 ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
481
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/ldlinux.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
482
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libcom32.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
483
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libutil.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
514
484
|
}
|
|
515
485
|
}
|
|
516
486
|
/**
|
|
517
487
|
* async isolinux
|
|
518
488
|
*/
|
|
519
|
-
async isolinux(theme = 'eggs'
|
|
520
|
-
|
|
521
|
-
if (verbose) {
|
|
489
|
+
async isolinux(theme = 'eggs') {
|
|
490
|
+
if (this.verbose) {
|
|
522
491
|
console.log('ovary: isolinux');
|
|
523
492
|
}
|
|
524
493
|
/**
|
|
525
494
|
* isolinux.bin
|
|
526
495
|
*/
|
|
527
|
-
await (0, utils_1.exec)(`cp ${this.settings.distro.isolinuxPath}/isolinux.bin ${this.settings.work_dir.pathIso}/isolinux/`, echo);
|
|
496
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.isolinuxPath}/isolinux.bin ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
528
497
|
/**
|
|
529
498
|
* isolinux.theme.cfg
|
|
530
499
|
*/
|
|
@@ -572,14 +541,13 @@ class Ovary {
|
|
|
572
541
|
/**
|
|
573
542
|
* copy kernel
|
|
574
543
|
*/
|
|
575
|
-
async kernelCopy(
|
|
576
|
-
|
|
577
|
-
if (verbose) {
|
|
544
|
+
async kernelCopy() {
|
|
545
|
+
if (this.verbose) {
|
|
578
546
|
console.log('ovary: kernelCopy');
|
|
579
547
|
}
|
|
580
548
|
let lackVmlinuzImage = false;
|
|
581
549
|
if (fs.existsSync(this.settings.kernel_image)) {
|
|
582
|
-
await (0, utils_1.exec)(`cp ${this.settings.kernel_image} ${this.settings.work_dir.pathIso}/live/`, echo);
|
|
550
|
+
await (0, utils_1.exec)(`cp ${this.settings.kernel_image} ${this.settings.work_dir.pathIso}/live/`, this.echo);
|
|
583
551
|
}
|
|
584
552
|
else {
|
|
585
553
|
utils_2.default.error(`Cannot find ${this.settings.kernel_image}`);
|
|
@@ -592,60 +560,64 @@ class Ovary {
|
|
|
592
560
|
}
|
|
593
561
|
}
|
|
594
562
|
/**
|
|
595
|
-
* necessita di
|
|
563
|
+
* necessita di echoYes
|
|
596
564
|
*/
|
|
597
|
-
async initrdCreate(
|
|
598
|
-
verbose = true;
|
|
599
|
-
const echo = utils_2.default.setEcho(verbose);
|
|
565
|
+
async initrdCreate() {
|
|
600
566
|
let initrdImg = utils_2.default.initrdImg();
|
|
601
567
|
initrdImg = initrdImg.substring(initrdImg.lastIndexOf('/') + 1);
|
|
602
568
|
utils_2.default.warning(`Creating ${initrdImg} in ${this.settings.work_dir.pathIso}/live/`);
|
|
603
|
-
|
|
604
|
-
await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/manjaro/mkinitcpio.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, echo);
|
|
569
|
+
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}`, utils_2.default.setEcho(true));
|
|
605
570
|
}
|
|
606
571
|
/**
|
|
607
|
-
*
|
|
608
|
-
* @param verbose
|
|
572
|
+
* We must upgrade to initrdCreate for Debian/Ubuntu
|
|
609
573
|
* @returns
|
|
610
574
|
*/
|
|
611
575
|
async initrdCopy(verbose = false) {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
if (
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
576
|
+
let isCrypted = false;
|
|
577
|
+
utils_2.default.warning(`initrdCreate`);
|
|
578
|
+
if (fs.existsSync(`/etc/crypttab`)) {
|
|
579
|
+
isCrypted = true;
|
|
580
|
+
await (0, utils_1.exec)(`mv /etc/crypttab /etc/crypttab.saved`, this.echo);
|
|
581
|
+
}
|
|
582
|
+
await (0, utils_1.exec)(`mkinitramfs -o ${this.settings.work_dir.pathIso}/live/initrd.img-$(uname -r) ${this.toNull}`, this.echo);
|
|
583
|
+
if (isCrypted) {
|
|
584
|
+
await (0, utils_1.exec)(`mv /etc/crypttab.saved /etc/crypttab`, this.echo);
|
|
585
|
+
}
|
|
586
|
+
/*
|
|
587
|
+
|
|
588
|
+
Utils.warning(`initrdCopy`)
|
|
589
|
+
if (this.verbose) {
|
|
590
|
+
console.log('ovary: initrdCopy')
|
|
591
|
+
}
|
|
592
|
+
let lackInitrdImage = false
|
|
618
593
|
if (fs.existsSync(this.settings.initrd_image)) {
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
lackInitrdImage = true;
|
|
594
|
+
await exec(`cp ${this.settings.initrd_image} ${this.settings.work_dir.pathIso}/live/`, this.echo)
|
|
595
|
+
} else {
|
|
596
|
+
Utils.error(`Cannot find ${this.settings.initrdImg}`)
|
|
597
|
+
lackInitrdImage = true
|
|
624
598
|
}
|
|
599
|
+
|
|
625
600
|
if (lackInitrdImage) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
601
|
+
Utils.warning('Try to edit /etc/penguins-eggs.d/eggs.yaml and check for')
|
|
602
|
+
Utils.warning(`initrd_img: ${this.settings.initrd_image}`)
|
|
603
|
+
process.exit(1)
|
|
629
604
|
}
|
|
605
|
+
*/
|
|
630
606
|
}
|
|
631
607
|
/**
|
|
632
608
|
* squashFs: crea in live filesystem.squashfs
|
|
633
609
|
*/
|
|
634
|
-
async makeSquashfs(scriptOnly = false
|
|
635
|
-
|
|
636
|
-
if (verbose) {
|
|
637
|
-
echo = { echo: true, ignore: false };
|
|
638
|
-
}
|
|
639
|
-
if (verbose) {
|
|
610
|
+
async makeSquashfs(scriptOnly = false) {
|
|
611
|
+
if (this.verbose) {
|
|
640
612
|
console.log('ovary: makeSquashfs');
|
|
641
613
|
}
|
|
642
614
|
/**
|
|
643
615
|
* exclude all the accurence of cryptdisks in rc0.d, etc
|
|
644
616
|
*/
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
617
|
+
let fexcludes = ["/boot/efi/EFI", "/etc/fstab", "/etc/mtab", "/etc/udev/rules.d/70-persistent-cd.rules", "/etc/udev/rules.d/70-persistent-net.rules"];
|
|
618
|
+
for (let i in fexcludes) {
|
|
619
|
+
this.addRemoveExclusion(true, fexcludes[i]);
|
|
620
|
+
}
|
|
649
621
|
/**
|
|
650
622
|
* Non sò che fa, ma sicuro non serve per archlinux
|
|
651
623
|
*/
|
|
@@ -675,7 +647,7 @@ class Ovary {
|
|
|
675
647
|
utils_2.default.writeX(`${this.settings.work_dir.path}mksquashfs`, cmd);
|
|
676
648
|
if (!scriptOnly) {
|
|
677
649
|
utils_2.default.warning('squashing filesystem: ' + compression);
|
|
678
|
-
await (0, utils_1.exec)(cmd,
|
|
650
|
+
await (0, utils_1.exec)(cmd, utils_2.default.setEcho(true));
|
|
679
651
|
}
|
|
680
652
|
}
|
|
681
653
|
/**
|
|
@@ -738,10 +710,8 @@ class Ovary {
|
|
|
738
710
|
*
|
|
739
711
|
* @param verbose
|
|
740
712
|
*/
|
|
741
|
-
async bindLiveFs(
|
|
742
|
-
verbose
|
|
743
|
-
const echo = utils_2.default.setEcho(verbose);
|
|
744
|
-
if (verbose) {
|
|
713
|
+
async bindLiveFs() {
|
|
714
|
+
if (this.verbose) {
|
|
745
715
|
console.log('ovary: bindLiveFs');
|
|
746
716
|
}
|
|
747
717
|
/**
|
|
@@ -769,35 +739,35 @@ class Ovary {
|
|
|
769
739
|
*/
|
|
770
740
|
cmds.push(`${cmd} need to be presente, and rw`, titleLine, '# create mountpoint lower');
|
|
771
741
|
cmds.push(await makeIfNotExist(`${this.settings.work_dir.lowerdir}/${dir}`), `# first: mount /${dir} rw in ${this.settings.work_dir.lowerdir}/${dir}`);
|
|
772
|
-
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.lowerdir}/${dir}`, verbose), '# now remount it ro');
|
|
773
|
-
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.lowerdir}/${dir}`, verbose), `\n# second: create mountpoint upper, work and ${this.settings.work_dir.merged} and mount ${dir}`);
|
|
774
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.upperdir}/${dir}`, verbose));
|
|
775
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.workdir}/${dir}`, verbose));
|
|
776
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose), `\n# thirth: mount /${dir} rw in ${this.settings.work_dir.merged}`);
|
|
777
|
-
cmds.push(await rexec(`mount -t overlay overlay -o lowerdir=${this.settings.work_dir.lowerdir}/${dir},upperdir=${this.settings.work_dir.upperdir}/${dir},workdir=${this.settings.work_dir.workdir}/${dir} ${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
742
|
+
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.lowerdir}/${dir}`, this.verbose), '# now remount it ro');
|
|
743
|
+
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.lowerdir}/${dir}`, this.verbose), `\n# second: create mountpoint upper, work and ${this.settings.work_dir.merged} and mount ${dir}`);
|
|
744
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.upperdir}/${dir}`, this.verbose));
|
|
745
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.workdir}/${dir}`, this.verbose));
|
|
746
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, this.verbose), `\n# thirth: mount /${dir} rw in ${this.settings.work_dir.merged}`);
|
|
747
|
+
cmds.push(await rexec(`mount -t overlay overlay -o lowerdir=${this.settings.work_dir.lowerdir}/${dir},upperdir=${this.settings.work_dir.upperdir}/${dir},workdir=${this.settings.work_dir.workdir}/${dir} ${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
778
748
|
}
|
|
779
749
|
else if (this.merged(dir)) {
|
|
780
750
|
/*
|
|
781
751
|
* merged creazione della directory e mount ro
|
|
782
752
|
*/
|
|
783
753
|
cmds.push(`${cmd} need to be present, mount ro`, titleLine);
|
|
784
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
785
|
-
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
786
|
-
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.merged}/${dir}`, verbose));
|
|
754
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
755
|
+
cmds.push(await rexec(`mount --bind --make-slave /${dir} ${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
756
|
+
cmds.push(await rexec(`mount -o remount,bind,ro ${this.settings.work_dir.merged}/${dir}`, this.verbose));
|
|
787
757
|
}
|
|
788
758
|
else {
|
|
789
759
|
/**
|
|
790
760
|
* normal solo la creazione della directory, nessun mount
|
|
791
761
|
*/
|
|
792
762
|
cmds.push(`${cmd} need to be present, no mount`, titleLine);
|
|
793
|
-
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, verbose), `# mount -o bind /${dir} ${this.settings.work_dir.merged}/${dir}`);
|
|
763
|
+
cmds.push(await makeIfNotExist(`${this.settings.work_dir.merged}/${dir}`, this.verbose), `# mount -o bind /${dir} ${this.settings.work_dir.merged}/${dir}`);
|
|
794
764
|
}
|
|
795
765
|
}
|
|
796
766
|
}
|
|
797
767
|
else if (n8_1.default.isFile(dir)) {
|
|
798
768
|
cmds.push(`# /${dir} is just a file`, titleLine);
|
|
799
769
|
if (!fs.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
|
|
800
|
-
cmds.push(await rexec(`cp /${dir} ${this.settings.work_dir.merged}`, verbose));
|
|
770
|
+
cmds.push(await rexec(`cp /${dir} ${this.settings.work_dir.merged}`, this.verbose));
|
|
801
771
|
}
|
|
802
772
|
else {
|
|
803
773
|
cmds.push('# file exist... skip');
|
|
@@ -811,7 +781,7 @@ class Ovary {
|
|
|
811
781
|
cmds.push(`ln -s ${this.settings.work_dir.merged}/${lnkDest} ${this.settings.work_dir.merged}/${lnkDest}`);
|
|
812
782
|
}
|
|
813
783
|
else {
|
|
814
|
-
cmds.push(await rexec(`cp -r /${dir} ${this.settings.work_dir.merged}`, verbose));
|
|
784
|
+
cmds.push(await rexec(`cp -r /${dir} ${this.settings.work_dir.merged}`, this.verbose));
|
|
815
785
|
}
|
|
816
786
|
}
|
|
817
787
|
else {
|
|
@@ -826,9 +796,8 @@ class Ovary {
|
|
|
826
796
|
* ubind del fs live
|
|
827
797
|
* @param verbose
|
|
828
798
|
*/
|
|
829
|
-
async uBindLiveFs(
|
|
830
|
-
|
|
831
|
-
if (verbose) {
|
|
799
|
+
async uBindLiveFs() {
|
|
800
|
+
if (this.verbose) {
|
|
832
801
|
console.log('ovary: uBindLiveFs');
|
|
833
802
|
}
|
|
834
803
|
const cmds = [];
|
|
@@ -846,11 +815,11 @@ class Ovary {
|
|
|
846
815
|
cmds.push(`\n# directory: ${dirname}`);
|
|
847
816
|
if (this.mergedAndOvelay(dirname)) {
|
|
848
817
|
cmds.push(`\n# ${dirname} has overlay`, `\n# First, umount it from ${this.settings.work_dir.path}`);
|
|
849
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, verbose), `\n# Second, umount it from ${this.settings.work_dir.lowerdir}`);
|
|
850
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.lowerdir}/${dirname}`, verbose));
|
|
818
|
+
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, this.verbose), `\n# Second, umount it from ${this.settings.work_dir.lowerdir}`);
|
|
819
|
+
cmds.push(await rexec(`umount ${this.settings.work_dir.lowerdir}/${dirname}`, this.verbose));
|
|
851
820
|
}
|
|
852
821
|
else if (this.merged(dirname)) {
|
|
853
|
-
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, verbose));
|
|
822
|
+
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
854
823
|
}
|
|
855
824
|
cmds.push(`\n# remove in ${this.settings.work_dir.merged} and ${this.settings.work_dir.lowerdir}`);
|
|
856
825
|
/**
|
|
@@ -858,16 +827,16 @@ class Ovary {
|
|
|
858
827
|
*/
|
|
859
828
|
let nest = this.settings.work_dir.path.split('/');
|
|
860
829
|
if (dirname !== nest[1]) { // We can't remove first level nest
|
|
861
|
-
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname} -rf`, verbose));
|
|
830
|
+
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname} -rf`, this.verbose));
|
|
862
831
|
}
|
|
863
832
|
}
|
|
864
833
|
else if (n8_1.default.isFile(dirname)) {
|
|
865
834
|
cmds.push(`\n# ${dirname} = file`);
|
|
866
|
-
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname}`, verbose));
|
|
835
|
+
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
867
836
|
}
|
|
868
837
|
else if (n8_1.default.isSymbolicLink(dirname)) {
|
|
869
838
|
cmds.push(`\n# ${dirname} = symbolicLink`);
|
|
870
|
-
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname}`, verbose));
|
|
839
|
+
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
871
840
|
}
|
|
872
841
|
}
|
|
873
842
|
}
|
|
@@ -876,7 +845,7 @@ class Ovary {
|
|
|
876
845
|
/**
|
|
877
846
|
* bind dei virtual file system
|
|
878
847
|
*/
|
|
879
|
-
async bindVfs(
|
|
848
|
+
async bindVfs() {
|
|
880
849
|
const cmds = [];
|
|
881
850
|
cmds.push(`mount -o bind /dev ${this.settings.work_dir.merged}/dev`, `mount -o bind /dev/pts ${this.settings.work_dir.merged}/dev/pts`, `mount -o bind /proc ${this.settings.work_dir.merged}/proc`, `mount -o bind /sys ${this.settings.work_dir.merged}/sys`, `mount -o bind /run ${this.settings.work_dir.merged}/run`);
|
|
882
851
|
utils_2.default.writeXs(`${this.settings.work_dir.path}bindvfs`, cmds);
|
|
@@ -885,7 +854,7 @@ class Ovary {
|
|
|
885
854
|
*
|
|
886
855
|
* @param verbose
|
|
887
856
|
*/
|
|
888
|
-
async ubindVfs(
|
|
857
|
+
async ubindVfs() {
|
|
889
858
|
const cmds = [];
|
|
890
859
|
cmds.push(`umount ${this.settings.work_dir.merged}/dev/pts`, `umount ${this.settings.work_dir.merged}/dev`, `umount ${this.settings.work_dir.merged}/proc`, `umount ${this.settings.work_dir.merged}/run`, `umount ${this.settings.work_dir.merged}/sys`);
|
|
891
860
|
utils_2.default.writeXs(`${this.settings.work_dir.path}ubindvfs`, cmds);
|
|
@@ -894,22 +863,21 @@ class Ovary {
|
|
|
894
863
|
*
|
|
895
864
|
* @param verbose
|
|
896
865
|
*/
|
|
897
|
-
async cleanUsersAccounts(
|
|
898
|
-
const echo = utils_2.default.setEcho(verbose);
|
|
866
|
+
async cleanUsersAccounts() {
|
|
899
867
|
/**
|
|
900
868
|
* delete all user in chroot
|
|
901
869
|
*/
|
|
902
870
|
const cmds = [];
|
|
903
871
|
const cmd = `chroot ${this.settings.work_dir.merged} getent passwd {1000..60000} |awk -F: '{print $1}'`;
|
|
904
872
|
const result = await (0, utils_1.exec)(cmd, {
|
|
905
|
-
echo: verbose,
|
|
873
|
+
echo: this.verbose,
|
|
906
874
|
ignore: false,
|
|
907
875
|
capture: true
|
|
908
876
|
});
|
|
909
877
|
const users = result.data.split('\n');
|
|
910
878
|
for (let i = 0; i < users.length - 1; i++) {
|
|
911
879
|
// cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} deluser ${users[i]}`, verbose))
|
|
912
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} userdel ${users[i]}`, verbose));
|
|
880
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} userdel ${users[i]}`, this.verbose));
|
|
913
881
|
}
|
|
914
882
|
}
|
|
915
883
|
/**
|
|
@@ -917,50 +885,48 @@ class Ovary {
|
|
|
917
885
|
* create la home per user_opt
|
|
918
886
|
* @param verbose
|
|
919
887
|
*/
|
|
920
|
-
async createUserLive(
|
|
921
|
-
|
|
922
|
-
if (verbose) {
|
|
888
|
+
async createUserLive() {
|
|
889
|
+
if (this.verbose) {
|
|
923
890
|
console.log('ovary: createUserLive');
|
|
924
891
|
}
|
|
925
892
|
const cmds = [];
|
|
926
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' rm /home/' + this.settings.config.user_opt + ' -rf', verbose));
|
|
927
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' mkdir /home/' + this.settings.config.user_opt, verbose));
|
|
928
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' useradd ' + this.settings.config.user_opt + ' --home-dir /home/' + this.settings.config.user_opt + ' --shell /bin/bash ', verbose));
|
|
929
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' echo ' + this.settings.config.user_opt + ':' + this.settings.config.user_opt_passwd + '| chroot ' + this.settings.work_dir.merged + ' chpasswd', verbose));
|
|
930
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', verbose));
|
|
893
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' rm /home/' + this.settings.config.user_opt + ' -rf', this.verbose));
|
|
894
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' mkdir /home/' + this.settings.config.user_opt, this.verbose));
|
|
895
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' useradd ' + this.settings.config.user_opt + ' --home-dir /home/' + this.settings.config.user_opt + ' --shell /bin/bash ', this.verbose));
|
|
896
|
+
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', this.verbose));
|
|
897
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', this.verbose));
|
|
931
898
|
// cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', verbose))
|
|
932
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' chown ' + this.settings.config.user_opt + ':users' + ' /home/' + this.settings.config.user_opt + ' -R', verbose));
|
|
899
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' chown ' + this.settings.config.user_opt + ':users' + ' /home/' + this.settings.config.user_opt + ' -R', this.verbose));
|
|
933
900
|
if (this.familyId === 'debian') {
|
|
934
901
|
// add user live to sudo
|
|
935
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sudo ${this.settings.config.user_opt}`, verbose));
|
|
902
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sudo ${this.settings.config.user_opt}`, this.verbose));
|
|
936
903
|
// educaandos
|
|
937
|
-
if (this.theme === 'educaandos') {
|
|
938
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG adm ${this.settings.config.user_opt}`, verbose));
|
|
939
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG cdrom ${this.settings.config.user_opt}`, verbose));
|
|
940
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG dip ${this.settings.config.user_opt}`, verbose));
|
|
941
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG plugdev ${this.settings.config.user_opt}`, verbose));
|
|
942
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG lpadmin ${this.settings.config.user_opt}`, verbose));
|
|
943
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sambashare ${this.settings.config.user_opt}`, verbose));
|
|
944
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG admin ${this.settings.config.user_opt}`, verbose));
|
|
904
|
+
if (this.settings.config.theme === 'educaandos') {
|
|
905
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG adm ${this.settings.config.user_opt}`, this.verbose));
|
|
906
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG cdrom ${this.settings.config.user_opt}`, this.verbose));
|
|
907
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG dip ${this.settings.config.user_opt}`, this.verbose));
|
|
908
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG plugdev ${this.settings.config.user_opt}`, this.verbose));
|
|
909
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG lpadmin ${this.settings.config.user_opt}`, this.verbose));
|
|
910
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sambashare ${this.settings.config.user_opt}`, this.verbose));
|
|
911
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG admin ${this.settings.config.user_opt}`, this.verbose));
|
|
945
912
|
}
|
|
946
913
|
}
|
|
947
914
|
else if (this.familyId === 'archlinux') {
|
|
948
915
|
// adduser live to wheel and autologin
|
|
949
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, verbose));
|
|
916
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, this.verbose));
|
|
950
917
|
// in manjaro they use autologin group for the iso, if not exist create it
|
|
951
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} test $(grep "autologin" /etc/group) || groupadd -r autologin`, verbose));
|
|
952
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG autologin ${this.settings.config.user_opt}`, verbose));
|
|
918
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} test $(grep "autologin" /etc/group) || groupadd -r autologin`, this.verbose));
|
|
919
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG autologin ${this.settings.config.user_opt}`, this.verbose));
|
|
953
920
|
}
|
|
954
921
|
if (this.familyId === 'debian' || this.familyId === 'archlinux') {
|
|
955
|
-
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' echo root:' + this.settings.config.root_passwd + '| chroot ' + this.settings.work_dir.merged + ' chpasswd', verbose));
|
|
922
|
+
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' echo root:' + this.settings.config.root_passwd + '| chroot ' + this.settings.work_dir.merged + ' chpasswd', this.verbose));
|
|
956
923
|
}
|
|
957
924
|
}
|
|
958
925
|
/**
|
|
959
926
|
*
|
|
960
927
|
*/
|
|
961
|
-
async createXdgAutostart(theme = 'eggs', myAddons
|
|
962
|
-
|
|
963
|
-
if (verbose) {
|
|
928
|
+
async createXdgAutostart(theme = 'eggs', myAddons) {
|
|
929
|
+
if (this.verbose) {
|
|
964
930
|
console.log('ovary: createXdgAutostart()');
|
|
965
931
|
}
|
|
966
932
|
const pathHomeLive = `/home/${this.settings.config.user_opt}`;
|
|
@@ -1002,9 +968,14 @@ class Ovary {
|
|
|
1002
968
|
}
|
|
1003
969
|
// pve
|
|
1004
970
|
if (myAddons.pve) {
|
|
1005
|
-
|
|
971
|
+
/**
|
|
972
|
+
* create service pve-live
|
|
973
|
+
*/
|
|
1006
974
|
const pve = new pve_live_1.default();
|
|
1007
975
|
pve.create(this.settings.work_dir.merged);
|
|
976
|
+
/**
|
|
977
|
+
* adding a desktop link for pve
|
|
978
|
+
*/
|
|
1008
979
|
const dirAddon = node_path_1.default.resolve(__dirname, '../../addons/eggs/pve');
|
|
1009
980
|
shelljs_1.default.cp(`${dirAddon}/artwork/eggs-pve.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
|
|
1010
981
|
shelljs_1.default.cp(`${dirAddon}/applications/eggs-pve.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
|
|
@@ -1069,7 +1040,7 @@ class Ovary {
|
|
|
1069
1040
|
text += `test -f "$DESKTOP/install-debian.desktop" && gio set "$DESKTOP/install-debian.desktop" metadata::trusted true\n`;
|
|
1070
1041
|
}
|
|
1071
1042
|
fs.writeFileSync(script, text, 'utf8');
|
|
1072
|
-
await (0, utils_1.exec)(`chmod a+x ${script}`, echo);
|
|
1043
|
+
await (0, utils_1.exec)(`chmod a+x ${script}`, this.echo);
|
|
1073
1044
|
}
|
|
1074
1045
|
await xdg_1.default.autologin(utils_2.default.getPrimaryUser(), this.settings.config.user_opt, this.settings.work_dir.merged);
|
|
1075
1046
|
}
|
|
@@ -1112,15 +1083,14 @@ class Ovary {
|
|
|
1112
1083
|
* makeEfi
|
|
1113
1084
|
*/
|
|
1114
1085
|
// #######################################################################################
|
|
1115
|
-
async makeEfi(theme = 'eggs'
|
|
1116
|
-
|
|
1117
|
-
if (verbose) {
|
|
1086
|
+
async makeEfi(theme = 'eggs') {
|
|
1087
|
+
if (this.verbose) {
|
|
1118
1088
|
console.log('ovary: makeEfi');
|
|
1119
1089
|
}
|
|
1120
1090
|
const memdiskDir = this.settings.work_dir.path + 'memdiskDir';
|
|
1121
1091
|
const efiWorkDir = this.settings.efi_work;
|
|
1122
1092
|
const isoDir = this.settings.work_dir.pathIso;
|
|
1123
|
-
const
|
|
1093
|
+
// const codenameLikeId = this.settings.distro.codenameLikeId
|
|
1124
1094
|
/**
|
|
1125
1095
|
* il pachetto grub/grub2 DEVE essere presente
|
|
1126
1096
|
*/
|
|
@@ -1133,12 +1103,12 @@ class Ovary {
|
|
|
1133
1103
|
* Creo o cancello e creo: memdiskDir
|
|
1134
1104
|
*/
|
|
1135
1105
|
if (fs.existsSync(memdiskDir)) {
|
|
1136
|
-
await (0, utils_1.exec)(`rm ${memdiskDir} -rf`, echo);
|
|
1106
|
+
await (0, utils_1.exec)(`rm ${memdiskDir} -rf`, this.echo);
|
|
1137
1107
|
}
|
|
1138
1108
|
utils_2.default.warning('creating memdiskDir: ' + memdiskDir);
|
|
1139
1109
|
await (0, utils_1.exec)(`mkdir ${memdiskDir}`);
|
|
1140
|
-
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot`, echo);
|
|
1141
|
-
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot/grub`, echo);
|
|
1110
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot`, this.echo);
|
|
1111
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot/grub`, this.echo);
|
|
1142
1112
|
/**
|
|
1143
1113
|
* for initial grub.cfg in memdisk
|
|
1144
1114
|
*/
|
|
@@ -1153,15 +1123,15 @@ class Ovary {
|
|
|
1153
1123
|
* start with empty efiWorkDir
|
|
1154
1124
|
*/
|
|
1155
1125
|
if (fs.existsSync(efiWorkDir)) {
|
|
1156
|
-
await (0, utils_1.exec)(`rm ${efiWorkDir} -rf`, echo);
|
|
1126
|
+
await (0, utils_1.exec)(`rm ${efiWorkDir} -rf`, this.echo);
|
|
1157
1127
|
}
|
|
1158
1128
|
utils_2.default.warning('creating efiWordDir: ' + efiWorkDir);
|
|
1159
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}`, echo);
|
|
1160
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot`, echo);
|
|
1161
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub`, echo);
|
|
1162
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}`, echo);
|
|
1163
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi`, echo);
|
|
1164
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi/boot`, echo);
|
|
1129
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}`, this.echo);
|
|
1130
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot`, this.echo);
|
|
1131
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub`, this.echo);
|
|
1132
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}`, this.echo);
|
|
1133
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi`, this.echo);
|
|
1134
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi/boot`, this.echo);
|
|
1165
1135
|
/**
|
|
1166
1136
|
* copy splash to efiWorkDir
|
|
1167
1137
|
*/
|
|
@@ -1171,7 +1141,7 @@ class Ovary {
|
|
|
1171
1141
|
utils_2.default.warning('Cannot find: ' + splashSrc);
|
|
1172
1142
|
process.exit();
|
|
1173
1143
|
}
|
|
1174
|
-
await (0, utils_1.exec)(`cp ${splashSrc} ${splashDest}
|
|
1144
|
+
await (0, utils_1.exec)(`cp ${splashSrc} ${splashDest}`, this.echo);
|
|
1175
1145
|
/**
|
|
1176
1146
|
* copy theme
|
|
1177
1147
|
*/
|
|
@@ -1181,17 +1151,17 @@ class Ovary {
|
|
|
1181
1151
|
utils_2.default.warning('Cannot find: ' + themeSrc);
|
|
1182
1152
|
process.exit();
|
|
1183
1153
|
}
|
|
1184
|
-
await (0, utils_1.exec)(`cp ${themeSrc} ${themeDest}
|
|
1154
|
+
await (0, utils_1.exec)(`cp ${themeSrc} ${themeDest}`, this.echo);
|
|
1185
1155
|
/**
|
|
1186
1156
|
* second grub.cfg file in efiWork
|
|
1187
1157
|
*/
|
|
1188
1158
|
// for i in $(ls /usr/lib/grub/x86_64-efi |grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg; done
|
|
1189
1159
|
let cmd = `for i in $(ls /usr/lib/grub/${utils_2.default.machineUEFI()}|grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> ${efiWorkDir}boot/grub/${utils_2.default.machineUEFI()}/grub.cfg; done`;
|
|
1190
|
-
await (0, utils_1.exec)(cmd, echo);
|
|
1160
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
1191
1161
|
// for i in efi_gop efi_uga ieee1275_fb vbe vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg ; done
|
|
1192
1162
|
cmd = `for i in efi_gop efi_uga ieee1275_fb vbe vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/grub.cfg ; done`;
|
|
1193
|
-
await (0, utils_1.exec)(cmd, echo);
|
|
1194
|
-
await (0, utils_1.exec)(`echo "source /boot/grub/grub.cfg" >> ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/grub.cfg`, echo);
|
|
1163
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
1164
|
+
await (0, utils_1.exec)(`echo "source /boot/grub/grub.cfg" >> ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/grub.cfg`, this.echo);
|
|
1195
1165
|
/**
|
|
1196
1166
|
* andiamo in memdiskDir
|
|
1197
1167
|
*/
|
|
@@ -1202,7 +1172,7 @@ class Ovary {
|
|
|
1202
1172
|
*/
|
|
1203
1173
|
const currentDir = process.cwd();
|
|
1204
1174
|
process.chdir(memdiskDir);
|
|
1205
|
-
await (0, utils_1.exec)(`tar -cvf memdisk boot`, echo);
|
|
1175
|
+
await (0, utils_1.exec)(`tar -cvf memdisk boot`, this.echo);
|
|
1206
1176
|
process.chdir(currentDir);
|
|
1207
1177
|
// make the grub image
|
|
1208
1178
|
// -O, --format=FORMAT
|
|
@@ -1211,41 +1181,41 @@ class Ovary {
|
|
|
1211
1181
|
// -p, --prefix=DIR set prefix directory
|
|
1212
1182
|
// --format=x86_64-efi --memdisk=memdisk --output=bootx64.efi --prefix?DIR set prefix directory
|
|
1213
1183
|
// grub-mkimage -O "x86_64-efi" -m "memdisk" -o "bootx64.efi" -p '(memdisk)/boot/grub' search iso9660 configfile normal memdisk tar cat part_msdos part_gpt fat ext2 ntfs ntfscomp hfsplus chain boot linux
|
|
1214
|
-
await (0, utils_1.exec)(`${grubName}-mkimage -O "${utils_2.default.machineUEFI()}" -m "${memdiskDir}/memdisk" -o "${memdiskDir}/bootx64.efi" -p '(memdisk)/boot/grub' search iso9660 configfile normal memdisk tar cat part_msdos part_gpt fat ext2 ntfs ntfscomp hfsplus chain boot linux`, echo);
|
|
1184
|
+
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`, this.echo);
|
|
1215
1185
|
// popd torna in efiWorkDir
|
|
1216
1186
|
// copy the grub image to efi/boot (to go later in the device's root)
|
|
1217
|
-
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/efi/boot`, echo);
|
|
1187
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/efi/boot`, this.echo);
|
|
1218
1188
|
// #######################
|
|
1219
1189
|
// Do the boot image "boot/grub/efiboot.img"
|
|
1220
|
-
await (0, utils_1.exec)(`dd if=/dev/zero of=${efiWorkDir}/boot/grub/efiboot.img bs=1K count=1440`, echo);
|
|
1221
|
-
await (0, utils_1.exec)(`/sbin/mkdosfs -F 12 ${efiWorkDir}/boot/grub/efiboot.img`, echo);
|
|
1222
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt`, echo);
|
|
1223
|
-
await (0, utils_1.exec)(`mount -o loop ${efiWorkDir}/boot/grub/efiboot.img ${efiWorkDir}/img-mnt`, echo);
|
|
1224
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi`, echo);
|
|
1225
|
-
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi/boot`, echo);
|
|
1190
|
+
await (0, utils_1.exec)(`dd if=/dev/zero of=${efiWorkDir}/boot/grub/efiboot.img bs=1K count=1440`, this.echo);
|
|
1191
|
+
await (0, utils_1.exec)(`/sbin/mkdosfs -F 12 ${efiWorkDir}/boot/grub/efiboot.img`, this.echo);
|
|
1192
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt`, this.echo);
|
|
1193
|
+
await (0, utils_1.exec)(`mount -o loop ${efiWorkDir}/boot/grub/efiboot.img ${efiWorkDir}/img-mnt`, this.echo);
|
|
1194
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi`, this.echo);
|
|
1195
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi/boot`, this.echo);
|
|
1226
1196
|
// era cp -r
|
|
1227
|
-
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/img-mnt/efi/boot`, echo);
|
|
1197
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/img-mnt/efi/boot`, this.echo);
|
|
1228
1198
|
// #######################
|
|
1229
1199
|
// copy modules and font
|
|
1230
|
-
await (0, utils_1.exec)(`cp -r /usr/lib/grub/${utils_2.default.machineUEFI()}/* ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/`, echo);
|
|
1200
|
+
await (0, utils_1.exec)(`cp -r /usr/lib/grub/${utils_2.default.machineUEFI()}/* ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/`, this.echo);
|
|
1231
1201
|
// if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
|
|
1232
1202
|
// Either of these will work, and they look the same to me. Unicode seems to work with qemu. -fsr
|
|
1233
1203
|
if (fs.existsSync('/usr/share/grub/unicode.pf2')) {
|
|
1234
|
-
await (0, utils_1.exec)(`cp /usr/share/grub/unicode.pf2 ${efiWorkDir}/boot/grub/font.pf2`, echo);
|
|
1204
|
+
await (0, utils_1.exec)(`cp /usr/share/grub/unicode.pf2 ${efiWorkDir}/boot/grub/font.pf2`, this.echo);
|
|
1235
1205
|
}
|
|
1236
1206
|
else if (fs.existsSync('/usr/share/grub2/ascii.pf2')) {
|
|
1237
|
-
await (0, utils_1.exec)(`cp /usr/share/grub2/ascii.pf2 ${efiWorkDir}/boot/grub/font.pf2`, echo);
|
|
1207
|
+
await (0, utils_1.exec)(`cp /usr/share/grub2/ascii.pf2 ${efiWorkDir}/boot/grub/font.pf2`, this.echo);
|
|
1238
1208
|
}
|
|
1239
1209
|
// doesn't need to be root-owned
|
|
1240
1210
|
// chown -R 1000:1000 $(pwd) 2>/dev/null
|
|
1241
1211
|
// Cleanup efi temps
|
|
1242
|
-
await (0, utils_1.exec)(`umount ${efiWorkDir}/img-mnt`, echo);
|
|
1212
|
+
await (0, utils_1.exec)(`umount ${efiWorkDir}/img-mnt`, this.echo);
|
|
1243
1213
|
// await exec(`rmdir ${efiWorkDir}/img-mnt`, echo)
|
|
1244
1214
|
// await exec(`rm ${memdiskDir}/img-mnt -rf`, echo)
|
|
1245
1215
|
// popd
|
|
1246
1216
|
// Copy efi files to iso
|
|
1247
|
-
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/boot ${isoDir}/`, echo);
|
|
1248
|
-
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/efi ${isoDir}/`, echo);
|
|
1217
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/boot ${isoDir}/`, this.echo);
|
|
1218
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/efi ${isoDir}/`, this.echo);
|
|
1249
1219
|
// Do the main grub.cfg (which gets loaded last):
|
|
1250
1220
|
// grub.theme.cfg
|
|
1251
1221
|
const grubThemeSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.theme.cfg`);
|
|
@@ -1271,7 +1241,7 @@ class Ovary {
|
|
|
1271
1241
|
const grubDest = `${isoDir}/boot/grub/grub.cfg`;
|
|
1272
1242
|
const template = fs.readFileSync(grubTemplate, 'utf8');
|
|
1273
1243
|
// let rmModules = ''
|
|
1274
|
-
// if (this.settings.distro.
|
|
1244
|
+
// if (this.settings.distro.codenameLikeId === 'focal') {
|
|
1275
1245
|
// rmModules = 'rmmod tpm'
|
|
1276
1246
|
// }
|
|
1277
1247
|
const view = {
|
|
@@ -1294,7 +1264,7 @@ class Ovary {
|
|
|
1294
1264
|
* create .disk/info, .disk/mksquashfs, .disk/mkiso
|
|
1295
1265
|
* return mkiso
|
|
1296
1266
|
*/
|
|
1297
|
-
makeDotDisk(backup = false
|
|
1267
|
+
makeDotDisk(backup = false) {
|
|
1298
1268
|
const dotDisk = this.settings.work_dir.pathIso + '/.disk';
|
|
1299
1269
|
if (fs.existsSync(dotDisk)) {
|
|
1300
1270
|
shelljs_1.default.rm('-rf', dotDisk);
|
|
@@ -1328,9 +1298,9 @@ class Ovary {
|
|
|
1328
1298
|
this.settings.isoFilename = prefix + volid + postfix;
|
|
1329
1299
|
const output = this.settings.config.snapshot_dir + this.settings.isoFilename;
|
|
1330
1300
|
let command = '';
|
|
1331
|
-
const appid = `-appid "${this.settings.distro.distroId}"
|
|
1332
|
-
const publisher = `-publisher "${this.settings.distro.distroId}/${this.settings.distro.
|
|
1333
|
-
const preparer = '-preparer "prepared by eggs <https://penguins-eggs.net>" '
|
|
1301
|
+
// const appid = `-appid "${this.settings.distro.distroId}" `
|
|
1302
|
+
// const publisher = `-publisher "${this.settings.distro.distroId}/${this.settings.distro.codenameId}" `
|
|
1303
|
+
// const preparer = '-preparer "prepared by eggs <https://penguins-eggs.net>" '
|
|
1334
1304
|
let isoHybridMbr = ``;
|
|
1335
1305
|
if (this.settings.config.make_isohybrid) {
|
|
1336
1306
|
const isolinuxFile = this.settings.distro.isolinuxPath + 'isohdpfx.bin';
|
|
@@ -1388,26 +1358,27 @@ class Ovary {
|
|
|
1388
1358
|
* -isohybrid-gpt-basdat
|
|
1389
1359
|
* isohybrid-apm-hfsplus
|
|
1390
1360
|
* boot1 CD1
|
|
1391
|
-
|
|
1361
|
+
|
|
1392
1362
|
command = `xorriso -as mkisofs \
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1363
|
+
-r \
|
|
1364
|
+
-checksum_algorithm_iso md5,sha1,sha256,sha512 \
|
|
1365
|
+
-V ${volid} \
|
|
1366
|
+
-o ${output} \
|
|
1367
|
+
-J \
|
|
1368
|
+
-joliet-long \
|
|
1369
|
+
-cache-inodes \
|
|
1370
|
+
${isoHybridMbr} \
|
|
1371
|
+
-b isolinux/isolinux.bin \
|
|
1372
|
+
-c isolinux/boot.cat \
|
|
1373
|
+
-boot-load-size 4 \
|
|
1374
|
+
-boot-info-table \
|
|
1375
|
+
-no-emul-boot \
|
|
1376
|
+
${uefi_elToritoAltBoot} \
|
|
1377
|
+
${uefi_e} \
|
|
1378
|
+
${uefi_noEmulBoot} \
|
|
1379
|
+
${uefi_isohybridGptBasdat}
|
|
1380
|
+
${this.settings.work_dir.pathIso}`
|
|
1381
|
+
*/
|
|
1411
1382
|
/**
|
|
1412
1383
|
* how is made in refracta
|
|
1413
1384
|
*
|
|
@@ -1454,16 +1425,14 @@ class Ovary {
|
|
|
1454
1425
|
* makeIso
|
|
1455
1426
|
* cmd: cmd 4 xorirriso
|
|
1456
1427
|
*/
|
|
1457
|
-
async makeIso(cmd, scriptOnly = false
|
|
1458
|
-
|
|
1459
|
-
if (verbose) {
|
|
1460
|
-
echo = { echo: true, ignore: false };
|
|
1428
|
+
async makeIso(cmd, scriptOnly = false) {
|
|
1429
|
+
//echo = { echo: true, ignore: false }
|
|
1430
|
+
if (this.verbose) {
|
|
1461
1431
|
console.log('ovary: makeIso');
|
|
1462
1432
|
}
|
|
1463
|
-
console.log(cmd);
|
|
1464
1433
|
utils_2.default.writeX(`${this.settings.work_dir.path}mkisofs`, cmd);
|
|
1465
1434
|
if (!scriptOnly) {
|
|
1466
|
-
await (0, utils_1.exec)(cmd,
|
|
1435
|
+
await (0, utils_1.exec)(cmd, utils_2.default.setEcho(true));
|
|
1467
1436
|
}
|
|
1468
1437
|
}
|
|
1469
1438
|
/**
|