penguins-eggs 9.3.29 → 9.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +1 -1
- package/dist/classes/bleach.js +22 -22
- package/dist/classes/daddy.js +25 -25
- package/dist/classes/family/archlinux.js +16 -16
- package/dist/classes/family/debian.js +23 -23
- package/dist/classes/family/fedora.js +14 -14
- package/dist/classes/family/suse.js +14 -14
- package/dist/classes/incubation/distros/bionic.js +5 -4
- package/dist/classes/incubation/distros/buster.js +5 -4
- package/dist/classes/incubation/distros/focal.js +5 -4
- package/dist/classes/incubation/distros/jessie.js +2 -2
- package/dist/classes/incubation/distros/rolling.js +6 -4
- package/dist/classes/incubation/fisherman-helper/displaymanager.js +2 -2
- package/dist/classes/incubation/fisherman-helper/packages.js +6 -6
- package/dist/classes/incubation/fisherman.js +13 -17
- package/dist/classes/incubation/incubator.js +26 -25
- package/dist/classes/incubation/installer.js +5 -5
- package/dist/classes/keyboards.js +5 -5
- package/dist/classes/locales.js +6 -6
- package/dist/classes/n8.js +1 -1
- package/dist/classes/network.js +6 -0
- package/dist/classes/ovary.js +202 -204
- package/dist/classes/pacman.js +121 -121
- package/dist/classes/pve-live.js +2 -2
- package/dist/classes/pxe.js +32 -32
- package/dist/classes/settings.js +24 -24
- package/dist/classes/sources_list.js +8 -8
- package/dist/classes/systemctl.js +11 -11
- package/dist/classes/tailor.js +57 -57
- package/dist/classes/tools.js +2 -2
- package/dist/classes/users.js +2 -2
- package/dist/classes/utils.js +12 -12
- package/dist/classes/xdg.js +38 -38
- package/dist/classes/yolk.js +27 -27
- package/dist/commands/adapt.js +9 -9
- package/dist/commands/analyze.js +10 -10
- package/dist/commands/calamares.js +19 -19
- package/dist/commands/config.js +67 -67
- package/dist/commands/cuckoo.js +8 -8
- package/dist/commands/dad.js +8 -8
- package/dist/commands/export/deb.js +9 -9
- package/dist/commands/export/iso.js +8 -8
- package/dist/commands/install.js +8 -8
- package/dist/commands/kill.js +11 -11
- package/dist/commands/mom.js +5 -5
- package/dist/commands/produce.js +15 -15
- package/dist/commands/status.js +2 -2
- package/dist/commands/syncfrom.js +34 -34
- package/dist/commands/syncto.js +42 -42
- package/dist/commands/tools/clean.js +7 -7
- package/dist/commands/tools/ppa.js +17 -17
- package/dist/commands/tools/skel.js +11 -11
- package/dist/commands/tools/stat.js +2 -2
- package/dist/commands/tools/yolk.js +6 -6
- package/dist/commands/update.js +21 -21
- package/dist/commands/wardrobe/get.js +7 -7
- package/dist/commands/wardrobe/list.js +5 -5
- package/dist/commands/wardrobe/show.js +6 -6
- package/dist/commands/wardrobe/wear.js +10 -10
- package/dist/components/elements/information.js +16 -16
- package/dist/components/finished.js +4 -4
- package/dist/components/install.js +4 -4
- package/dist/components/keyboard.js +4 -4
- package/dist/components/location.js +4 -4
- package/dist/components/network.js +4 -4
- package/dist/components/partitions.js +4 -4
- package/dist/components/summary.js +4 -4
- package/dist/components/users.js +4 -4
- package/dist/components/welcome.js +4 -4
- package/dist/krill/krill-prepare.js +84 -84
- package/dist/krill/krill-sequence.js +140 -140
- package/dist/krill/modules/add-user.js +6 -6
- package/dist/krill/modules/bootloader-config-ubuntu.js +21 -21
- package/dist/krill/modules/bootloader.js +6 -6
- package/dist/krill/modules/change-password.js +2 -2
- package/dist/krill/modules/del-live-user.js +5 -5
- package/dist/krill/modules/fstab.js +10 -10
- package/dist/krill/modules/grubcfg.js +3 -3
- package/dist/krill/modules/initramfs-cfg.js +3 -3
- package/dist/krill/modules/initramfs.js +9 -9
- package/dist/krill/modules/locale.js +4 -4
- package/dist/krill/modules/m-keyboard.js +9 -9
- package/dist/krill/modules/m-timezone.js +3 -3
- package/dist/krill/modules/machine-id.js +3 -3
- package/dist/krill/modules/mkfs.js +6 -6
- package/dist/krill/modules/mount-fs.js +13 -13
- package/dist/krill/modules/mount-vfs.js +12 -12
- package/dist/krill/modules/network-cfg.js +5 -5
- package/dist/krill/modules/packages.js +10 -10
- package/dist/krill/modules/partition.js +69 -69
- package/dist/krill/modules/umount.js +6 -6
- package/dist/krill/modules/unpackfs.js +4 -4
- package/dist/lib/cli-autologin.js +12 -12
- package/dist/lib/select_keyboard_layout.js +2 -2
- package/dist/lib/select_keyboard_model.js +2 -2
- package/dist/lib/select_keyboard_option.js +2 -2
- package/dist/lib/select_keyboard_variant.js +2 -2
- package/dist/lib/select_languages.js +2 -2
- package/package.json +1 -1
package/dist/classes/ovary.js
CHANGED
|
@@ -17,25 +17,25 @@ const node_os_1 = __importDefault(require("node:os"));
|
|
|
17
17
|
const shelljs_1 = __importDefault(require("shelljs"));
|
|
18
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
19
19
|
const mustache_1 = __importDefault(require("mustache"));
|
|
20
|
-
const
|
|
20
|
+
const pve_live_1 = __importDefault(require("./pve-live"));
|
|
21
21
|
// libraries
|
|
22
|
-
const
|
|
22
|
+
const utils_1 = require("../lib/utils");
|
|
23
23
|
// classes
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
24
|
+
const utils_2 = __importDefault(require("./utils"));
|
|
25
|
+
const n8_1 = __importDefault(require("./n8"));
|
|
26
|
+
const incubator_1 = __importDefault(require("./incubation/incubator"));
|
|
27
|
+
const xdg_1 = __importDefault(require("./xdg"));
|
|
28
|
+
const pacman_1 = __importDefault(require("./pacman"));
|
|
29
|
+
const settings_1 = __importDefault(require("./settings"));
|
|
30
|
+
const systemctl_1 = __importDefault(require("./systemctl"));
|
|
31
|
+
const bleach_1 = __importDefault(require("./bleach"));
|
|
32
|
+
const yolk_1 = __importDefault(require("./yolk"));
|
|
33
|
+
const displaymanager_1 = require("./incubation/fisherman-helper/displaymanager");
|
|
34
34
|
// backup
|
|
35
35
|
const promises_1 = require("fs/promises");
|
|
36
36
|
const fs_2 = require("fs");
|
|
37
|
-
const
|
|
38
|
-
const
|
|
37
|
+
const users_1 = __importDefault(require("./users"));
|
|
38
|
+
const cli_autologin_1 = __importDefault(require("../lib/cli-autologin"));
|
|
39
39
|
/**
|
|
40
40
|
* Ovary:
|
|
41
41
|
*/
|
|
@@ -53,13 +53,13 @@ class Ovary {
|
|
|
53
53
|
this.theme = '';
|
|
54
54
|
this.clone = false;
|
|
55
55
|
this.cryptedclone = false;
|
|
56
|
-
this.cliAutologin = new
|
|
56
|
+
this.cliAutologin = new cli_autologin_1.default();
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* @returns {boolean} success
|
|
60
60
|
*/
|
|
61
61
|
async fertilization(snapshot_prefix = '', snapshot_basename = '', theme = '', compression = '', nointeratctive = false) {
|
|
62
|
-
this.settings = new
|
|
62
|
+
this.settings = new settings_1.default();
|
|
63
63
|
if (await this.settings.load()) {
|
|
64
64
|
this.familyId = this.settings.distro.familyId;
|
|
65
65
|
if (snapshot_prefix !== '') {
|
|
@@ -78,7 +78,7 @@ class Ovary {
|
|
|
78
78
|
return true;
|
|
79
79
|
}
|
|
80
80
|
this.settings.listFreeSpace();
|
|
81
|
-
if (await
|
|
81
|
+
if (await utils_2.default.customConfirm('Select yes to continue...')) {
|
|
82
82
|
return true;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -90,7 +90,7 @@ class Ovary {
|
|
|
90
90
|
*/
|
|
91
91
|
async produce(clone = false, cryptedclone = false, scriptOnly = false, yolkRenew = false, release = false, myAddons, nointeractive = false, verbose = false) {
|
|
92
92
|
this.verbose = verbose;
|
|
93
|
-
this.echo =
|
|
93
|
+
this.echo = utils_2.default.setEcho(verbose);
|
|
94
94
|
if (this.verbose) {
|
|
95
95
|
this.toNull = ' > /dev/null 2>&1';
|
|
96
96
|
}
|
|
@@ -101,34 +101,34 @@ class Ovary {
|
|
|
101
101
|
// let luksDevice = `/dev/mapper/${this.luksName}`
|
|
102
102
|
// let luksMountpoint = `/mnt`
|
|
103
103
|
if (this.familyId === 'debian') {
|
|
104
|
-
const yolk = new
|
|
104
|
+
const yolk = new yolk_1.default();
|
|
105
105
|
if (!yolk.yolkExists()) {
|
|
106
|
-
|
|
106
|
+
utils_2.default.warning('local repository /var/local/yolk creation...');
|
|
107
107
|
await yolk.create(verbose);
|
|
108
108
|
}
|
|
109
109
|
else if (yolkRenew) {
|
|
110
|
-
|
|
110
|
+
utils_2.default.warning('force renew local repository /var/local/yolk...');
|
|
111
111
|
yolk.yolkClean();
|
|
112
112
|
await yolk.create(verbose);
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
|
|
115
|
+
utils_2.default.warning('Using preesixent yolk...');
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
if (!fs_1.default.existsSync(this.settings.config.snapshot_dir)) {
|
|
119
119
|
shelljs_1.default.mkdir('-p', this.settings.config.snapshot_dir);
|
|
120
120
|
}
|
|
121
121
|
await this.settings.loadRemix(this.snapshot_basename, this.theme);
|
|
122
|
-
if (
|
|
122
|
+
if (utils_2.default.isLive()) {
|
|
123
123
|
console.log(chalk_1.default.red('>>> eggs: This is a live system! An egg cannot be produced from an egg!'));
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
126
|
await this.liveCreateStructure();
|
|
127
|
-
if (!nointeractive && this.settings.distro.isCalamaresAvailable && (
|
|
128
|
-
this.settings.config.force_installer && !(await
|
|
127
|
+
if (!nointeractive && this.settings.distro.isCalamaresAvailable && (pacman_1.default.isInstalledGui()) &&
|
|
128
|
+
this.settings.config.force_installer && !(await pacman_1.default.calamaresCheck())) {
|
|
129
129
|
console.log('Installing ' + chalk_1.default.bgGray('calamares') + ' due force_installer=yes.');
|
|
130
|
-
await
|
|
131
|
-
const bleach = new
|
|
130
|
+
await pacman_1.default.calamaresInstall(verbose);
|
|
131
|
+
const bleach = new bleach_1.default();
|
|
132
132
|
await bleach.clean(verbose);
|
|
133
133
|
}
|
|
134
134
|
// CRYPTEDCLONE
|
|
@@ -150,11 +150,11 @@ class Ovary {
|
|
|
150
150
|
// CLONE
|
|
151
151
|
}
|
|
152
152
|
else if (this.clone) {
|
|
153
|
-
|
|
153
|
+
utils_2.default.warning('eggs will SAVE users and users\' data UNCRYPTED on the live');
|
|
154
154
|
// NORMAL
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
|
-
|
|
157
|
+
utils_2.default.warning('eggs will REMOVE users and users\' from live');
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
160
|
* NOTE: reCreate = false
|
|
@@ -165,11 +165,9 @@ class Ovary {
|
|
|
165
165
|
const reCreate = true;
|
|
166
166
|
if (reCreate) { // start pre-clone
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
169
|
-
* viene creata la configurazione dell'installer: krill/calamares
|
|
170
|
-
* L'installer prende il tema da settings.remix.branding
|
|
168
|
+
* installer
|
|
171
169
|
*/
|
|
172
|
-
this.incubator = new
|
|
170
|
+
this.incubator = new incubator_1.default(this.settings.remix, this.settings.distro, this.settings.config.user_opt, this.theme, this.clone, verbose);
|
|
173
171
|
await this.incubator.config(release);
|
|
174
172
|
await this.syslinux();
|
|
175
173
|
await this.isolinux(this.theme);
|
|
@@ -194,12 +192,12 @@ class Ovary {
|
|
|
194
192
|
*/
|
|
195
193
|
await this.cleanUsersAccounts();
|
|
196
194
|
await this.createUserLive();
|
|
197
|
-
if (
|
|
195
|
+
if (pacman_1.default.isInstalledGui()) {
|
|
198
196
|
await this.createXdgAutostart(this.settings.config.theme, myAddons);
|
|
199
197
|
/**
|
|
200
198
|
* GUI installed but NOT Desktop Manager: just create motd and issue
|
|
201
199
|
*/
|
|
202
|
-
if ((0,
|
|
200
|
+
if ((0, displaymanager_1.displaymanager)() === '') {
|
|
203
201
|
this.cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
204
202
|
this.cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
|
|
205
203
|
}
|
|
@@ -215,11 +213,11 @@ class Ovary {
|
|
|
215
213
|
await this.uBindLiveFs(); // Lo smonto prima della fase di backup
|
|
216
214
|
}
|
|
217
215
|
if (cryptedclone) {
|
|
218
|
-
await (0,
|
|
219
|
-
|
|
220
|
-
await (0,
|
|
221
|
-
|
|
222
|
-
await (0,
|
|
216
|
+
await (0, utils_1.exec)('eggs syncto', utils_2.default.setEcho(true));
|
|
217
|
+
utils_2.default.warning(`Waiting 10s, before to move ${luksFile} in ${this.settings.config.snapshot_dir}ovarium/iso/live`);
|
|
218
|
+
await (0, utils_1.exec)('sleep 10', utils_2.default.setEcho(false));
|
|
219
|
+
utils_2.default.warning(`moving ${luksFile} in ${this.settings.config.snapshot_dir}ovarium/iso/live`);
|
|
220
|
+
await (0, utils_1.exec)(`mv ${luksFile} ${this.settings.config.snapshot_dir}ovarium/iso/live`, this.echo);
|
|
223
221
|
}
|
|
224
222
|
const xorrisoCommand = this.makeDotDisk(clone, cryptedclone);
|
|
225
223
|
/**
|
|
@@ -227,14 +225,14 @@ class Ovary {
|
|
|
227
225
|
*/
|
|
228
226
|
if (this.familyId === 'archlinux') {
|
|
229
227
|
if (this.settings.distro.distroId === 'ManjaroLinux') {
|
|
230
|
-
await (0,
|
|
231
|
-
await (0,
|
|
232
|
-
await (0,
|
|
228
|
+
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.pathIso}manjaro/x86_64 -p`, this.echo);
|
|
229
|
+
await (0, utils_1.exec)(`ln ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${this.settings.work_dir.pathIso}manjaro/x86_64/livefs.sfs`, this.echo);
|
|
230
|
+
await (0, utils_1.exec)(`md5sum ${this.settings.work_dir.pathIso}live/filesystem.squashfs > ${this.settings.work_dir.pathIso}manjaro/x86_64/livefs.md5`, this.echo);
|
|
233
231
|
}
|
|
234
232
|
else if (this.settings.distro.distroId === 'Arch' || this.settings.distro.distroId === 'RebornOS') {
|
|
235
|
-
await (0,
|
|
236
|
-
await (0,
|
|
237
|
-
await (0,
|
|
233
|
+
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.pathIso}arch/x86_64 -p`, this.echo);
|
|
234
|
+
await (0, utils_1.exec)(`ln ${this.settings.work_dir.pathIso}live/filesystem.squashfs ${this.settings.work_dir.pathIso}arch/x86_64/airootfs.sfs`, this.echo);
|
|
235
|
+
await (0, utils_1.exec)(`sha512sum ${this.settings.work_dir.pathIso}live/filesystem.squashfs > ${this.settings.work_dir.pathIso}arch/x86_64/airootfs.sha512`, this.echo);
|
|
238
236
|
}
|
|
239
237
|
}
|
|
240
238
|
await this.makeIso(xorrisoCommand, scriptOnly);
|
|
@@ -247,7 +245,7 @@ class Ovary {
|
|
|
247
245
|
if (this.verbose) {
|
|
248
246
|
console.log('Overy: liveCreateStructure');
|
|
249
247
|
}
|
|
250
|
-
|
|
248
|
+
utils_2.default.warning(`Creating egg in ${this.settings.work_dir.path}`);
|
|
251
249
|
let cmd;
|
|
252
250
|
if (!fs_1.default.existsSync(this.settings.work_dir.path)) {
|
|
253
251
|
cmd = `mkdir -p ${this.settings.work_dir.path}`;
|
|
@@ -278,7 +276,7 @@ class Ovary {
|
|
|
278
276
|
* precedentemente in isolinux
|
|
279
277
|
*/
|
|
280
278
|
if (!fs_1.default.existsSync(this.settings.work_dir.pathIso)) {
|
|
281
|
-
cmd = `mkdir -p ${this.settings.work_dir.pathIso}/boot/grub/${
|
|
279
|
+
cmd = `mkdir -p ${this.settings.work_dir.pathIso}/boot/grub/${utils_2.default.machineUEFI()}`;
|
|
282
280
|
this.tryCatch(cmd);
|
|
283
281
|
cmd = `mkdir -p ${this.settings.work_dir.pathIso}/efi/boot`;
|
|
284
282
|
this.tryCatch(cmd);
|
|
@@ -295,11 +293,11 @@ class Ovary {
|
|
|
295
293
|
*/
|
|
296
294
|
async tryCatch(cmd = '') {
|
|
297
295
|
try {
|
|
298
|
-
await (0,
|
|
296
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
299
297
|
}
|
|
300
298
|
catch (error) {
|
|
301
299
|
console.log(`Error: ${error}`);
|
|
302
|
-
await
|
|
300
|
+
await utils_2.default.pressKeyToExit(cmd);
|
|
303
301
|
}
|
|
304
302
|
}
|
|
305
303
|
/**
|
|
@@ -320,18 +318,18 @@ class Ovary {
|
|
|
320
318
|
* /etc/penguins-eggs.d/is_clone file created on live
|
|
321
319
|
*/
|
|
322
320
|
if (clone) {
|
|
323
|
-
await (0,
|
|
321
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/penguins-eggs.d/is_clone`, this.echo);
|
|
324
322
|
}
|
|
325
323
|
/**
|
|
326
324
|
* /etc/penguins-eggs.d/is_crypted_clone file created on live
|
|
327
325
|
*/
|
|
328
326
|
if (cryptedclone) {
|
|
329
|
-
await (0,
|
|
327
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/penguins-eggs.d/is_crypted_clone`, this.echo);
|
|
330
328
|
}
|
|
331
329
|
/**
|
|
332
330
|
* /etc/default/epoptes-client created on live
|
|
333
331
|
*/
|
|
334
|
-
if (
|
|
332
|
+
if (pacman_1.default.packageIsInstalled('epoptes')) {
|
|
335
333
|
const file = `${this.settings.work_dir.merged}/etc/default/epoptes-client`;
|
|
336
334
|
const text = `SERVER=${node_os_1.default.hostname}.local\n`;
|
|
337
335
|
fs_1.default.writeFileSync(file, text);
|
|
@@ -340,41 +338,41 @@ class Ovary {
|
|
|
340
338
|
// Aggiungo UMASK=0077 in /etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf
|
|
341
339
|
const text = 'UMASK=0077\n';
|
|
342
340
|
const file = '/etc/initramfs-tools/conf.d/eggs-safe-initramfs.conf';
|
|
343
|
-
|
|
341
|
+
utils_2.default.write(file, text);
|
|
344
342
|
}
|
|
345
343
|
// Truncate logs, remove archived logs.
|
|
346
344
|
let cmd = `find ${this.settings.work_dir.merged}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
|
|
347
|
-
await (0,
|
|
345
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
348
346
|
cmd = `find ${this.settings.work_dir.merged}/var/log/ -type f -exec truncate -s 0 {} \\;`;
|
|
349
|
-
await (0,
|
|
347
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
350
348
|
// Allow all fixed drives to be mounted with pmount
|
|
351
349
|
if (this.settings.config.pmount_fixed && fs_1.default.existsSync(`${this.settings.work_dir.merged}/etc/pmount.allow`)) {
|
|
352
350
|
// MX aggiunto /etc
|
|
353
|
-
await (0,
|
|
351
|
+
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);
|
|
354
352
|
}
|
|
355
353
|
// Enable or disable password login through ssh for users (not root)
|
|
356
354
|
// Remove obsolete live-config file
|
|
357
355
|
if (fs_1.default.existsSync(`${this.settings.work_dir.merged}lib/live/config/1161-openssh-server`)) {
|
|
358
|
-
await (0,
|
|
356
|
+
await (0, utils_1.exec)('rm -f "$work_dir"/myfs/lib/live/config/1161-openssh-server', this.echo);
|
|
359
357
|
}
|
|
360
358
|
if (fs_1.default.existsSync(`${this.settings.work_dir.merged}/etc/ssh/sshd_config`)) {
|
|
361
|
-
await (0,
|
|
359
|
+
await (0, utils_1.exec)(`sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
362
360
|
await (this.settings.config.ssh_pass ?
|
|
363
|
-
(0,
|
|
364
|
-
(0,
|
|
361
|
+
(0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*no|PasswordAuthentication yes|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo) :
|
|
362
|
+
(0, utils_1.exec)(`sed -i 's|.*PasswordAuthentication.*yes|PasswordAuthentication no|' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo));
|
|
365
363
|
}
|
|
366
364
|
/**
|
|
367
365
|
* /etc/fstab should exist, even if it's empty,
|
|
368
366
|
* to prevent error messages at boot
|
|
369
367
|
*/
|
|
370
|
-
await (0,
|
|
371
|
-
await (0,
|
|
368
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
369
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
372
370
|
/**
|
|
373
371
|
* Remove crypttab if exists
|
|
374
372
|
* this is crucial for tpm systems.
|
|
375
373
|
*/
|
|
376
374
|
if (fs_1.default.existsSync(`${this.settings.work_dir.merged}/etc/crypttab`)) {
|
|
377
|
-
await (0,
|
|
375
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/crypttab`, this.echo);
|
|
378
376
|
// await exec(`touch ${this.settings.work_dir.merged}/etc/crypttab`, echo)
|
|
379
377
|
}
|
|
380
378
|
/**
|
|
@@ -384,9 +382,9 @@ class Ovary {
|
|
|
384
382
|
* set up a new unique ID.
|
|
385
383
|
*/
|
|
386
384
|
if (fs_1.default.existsSync(`${this.settings.work_dir.merged}/etc/machine-id`)) {
|
|
387
|
-
await (0,
|
|
388
|
-
await (0,
|
|
389
|
-
|
|
385
|
+
await (0, utils_1.exec)(`rm ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
386
|
+
await (0, utils_1.exec)(`touch ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
387
|
+
utils_2.default.write(`${this.settings.work_dir.merged}/etc/machine-id`, ':');
|
|
390
388
|
}
|
|
391
389
|
/**
|
|
392
390
|
* LMDE4: utilizza UbuntuMono16.pf2
|
|
@@ -401,8 +399,8 @@ class Ovary {
|
|
|
401
399
|
/**
|
|
402
400
|
* Per tutte le distro systemd
|
|
403
401
|
*/
|
|
404
|
-
if (
|
|
405
|
-
const systemdctl = new
|
|
402
|
+
if (utils_2.default.isSystemd()) {
|
|
403
|
+
const systemdctl = new systemctl_1.default(this.verbose);
|
|
406
404
|
/**
|
|
407
405
|
* systemd-systemd-resolved
|
|
408
406
|
*/
|
|
@@ -433,10 +431,10 @@ class Ovary {
|
|
|
433
431
|
/**
|
|
434
432
|
* All systemd distros rm
|
|
435
433
|
*/
|
|
436
|
-
await (0,
|
|
437
|
-
await (0,
|
|
438
|
-
await (0,
|
|
439
|
-
await (0,
|
|
434
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/var/lib/wicd/configurations/*`, this.echo);
|
|
435
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/wicd/wireless-settings.conf`, this.echo);
|
|
436
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/NetworkManager/system-connections/*`, this.echo);
|
|
437
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/wifi/*`, this.echo);
|
|
440
438
|
/**
|
|
441
439
|
* removing from /etc/network/:
|
|
442
440
|
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
@@ -444,7 +442,7 @@ class Ovary {
|
|
|
444
442
|
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
445
443
|
let cleanDir = '';
|
|
446
444
|
for (cleanDir of cleanDirs) {
|
|
447
|
-
await (0,
|
|
445
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/${cleanDir}/wpasupplicant`, this.echo);
|
|
448
446
|
}
|
|
449
447
|
}
|
|
450
448
|
/**
|
|
@@ -453,68 +451,68 @@ class Ovary {
|
|
|
453
451
|
*/
|
|
454
452
|
if (this.familyId === 'debian') {
|
|
455
453
|
if (fs_1.default.existsSync(`${this.settings.work_dir.merged}/etc/network/interfaces`)) {
|
|
456
|
-
await (0,
|
|
457
|
-
|
|
454
|
+
await (0, utils_1.exec)(`rm -f ${this.settings.work_dir.merged}/etc/network/interfaces`, this.echo);
|
|
455
|
+
utils_2.default.write(`${this.settings.work_dir.merged}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
458
456
|
}
|
|
459
457
|
/**
|
|
460
458
|
* add some basic files to /dev
|
|
461
459
|
*/
|
|
462
460
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/console`)) {
|
|
463
|
-
await (0,
|
|
461
|
+
await (0, utils_1.exec)(`mknod -m 622 ${this.settings.work_dir.merged}/dev/console c 5 1`, this.echo);
|
|
464
462
|
}
|
|
465
463
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/null`)) {
|
|
466
|
-
await (0,
|
|
464
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/null c 1 3`, this.echo);
|
|
467
465
|
}
|
|
468
466
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/zero`)) {
|
|
469
|
-
await (0,
|
|
467
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/zero c 1 5`, this.echo);
|
|
470
468
|
}
|
|
471
469
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/ptmx`)) {
|
|
472
|
-
await (0,
|
|
470
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/ptmx c 5 2`, this.echo);
|
|
473
471
|
}
|
|
474
472
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/tty`)) {
|
|
475
|
-
await (0,
|
|
473
|
+
await (0, utils_1.exec)(`mknod -m 666 ${this.settings.work_dir.merged}/dev/tty c 5 0`, this.echo);
|
|
476
474
|
}
|
|
477
475
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/random`)) {
|
|
478
|
-
await (0,
|
|
476
|
+
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, this.echo);
|
|
479
477
|
}
|
|
480
478
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/urandom`)) {
|
|
481
|
-
await (0,
|
|
479
|
+
await (0, utils_1.exec)(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, this.echo);
|
|
482
480
|
}
|
|
483
481
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`)) {
|
|
484
|
-
await (0,
|
|
482
|
+
await (0, utils_1.exec)(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, this.echo);
|
|
485
483
|
}
|
|
486
484
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/fd`)) {
|
|
487
|
-
await (0,
|
|
485
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, this.echo);
|
|
488
486
|
}
|
|
489
487
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/stdin`)) {
|
|
490
|
-
await (0,
|
|
488
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, this.echo);
|
|
491
489
|
}
|
|
492
490
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/stdout`)) {
|
|
493
|
-
await (0,
|
|
491
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, this.echo);
|
|
494
492
|
}
|
|
495
493
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/stderr`)) {
|
|
496
|
-
await (0,
|
|
494
|
+
await (0, utils_1.exec)(`ln -sv /proc/self/fd/2 ${this.settings.work_dir.merged}/dev/stderr`, this.echo);
|
|
497
495
|
}
|
|
498
496
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/core`)) {
|
|
499
|
-
await (0,
|
|
497
|
+
await (0, utils_1.exec)(`ln -sv /proc/kcore ${this.settings.work_dir.merged}/dev/core`, this.echo);
|
|
500
498
|
}
|
|
501
499
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
502
|
-
await (0,
|
|
500
|
+
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
503
501
|
}
|
|
504
502
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/pts`)) {
|
|
505
|
-
await (0,
|
|
503
|
+
await (0, utils_1.exec)(`mkdir -v ${this.settings.work_dir.merged}/dev/pts`, this.echo);
|
|
506
504
|
}
|
|
507
505
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
508
|
-
await (0,
|
|
506
|
+
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
509
507
|
}
|
|
510
508
|
/**
|
|
511
509
|
* Assegno 1777 a /tmp
|
|
512
510
|
* creava problemi con MXLINUX
|
|
513
511
|
*/
|
|
514
512
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/tmp`)) {
|
|
515
|
-
await (0,
|
|
513
|
+
await (0, utils_1.exec)(`mkdir ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
516
514
|
}
|
|
517
|
-
await (0,
|
|
515
|
+
await (0, utils_1.exec)(`chmod 1777 ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
518
516
|
}
|
|
519
517
|
}
|
|
520
518
|
/**
|
|
@@ -525,17 +523,17 @@ class Ovary {
|
|
|
525
523
|
console.log('ovary: syslinux');
|
|
526
524
|
console.log('syslinux path: ' + this.settings.distro.syslinuxPath);
|
|
527
525
|
}
|
|
528
|
-
await (0,
|
|
529
|
-
await (0,
|
|
526
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/vesamenu.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
527
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/chain.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
530
528
|
/**
|
|
531
529
|
* per openSuse non sono riusciuto a determinare
|
|
532
530
|
* quale pacchetto installi:
|
|
533
531
|
* ldllinux.c43, libcom32 e libutil.c32
|
|
534
532
|
*/
|
|
535
533
|
if (this.familyId !== 'suse') {
|
|
536
|
-
await (0,
|
|
537
|
-
await (0,
|
|
538
|
-
await (0,
|
|
534
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/ldlinux.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
535
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libcom32.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
536
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.syslinuxPath}/libutil.c32 ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
539
537
|
}
|
|
540
538
|
}
|
|
541
539
|
/**
|
|
@@ -548,7 +546,7 @@ class Ovary {
|
|
|
548
546
|
/**
|
|
549
547
|
* isolinux.bin
|
|
550
548
|
*/
|
|
551
|
-
await (0,
|
|
549
|
+
await (0, utils_1.exec)(`cp ${this.settings.distro.isolinuxPath}/isolinux.bin ${this.settings.work_dir.pathIso}/isolinux/`, this.echo);
|
|
552
550
|
/**
|
|
553
551
|
* isolinux.theme.cfg
|
|
554
552
|
*/
|
|
@@ -558,7 +556,7 @@ class Ovary {
|
|
|
558
556
|
isolinuxThemeSrc = `${theme}/theme/livecd/isolinux.theme.cfg`;
|
|
559
557
|
}
|
|
560
558
|
if (!fs_1.default.existsSync(isolinuxThemeSrc)) {
|
|
561
|
-
|
|
559
|
+
utils_2.default.warning('Cannot find: ' + isolinuxThemeSrc);
|
|
562
560
|
process.exit();
|
|
563
561
|
}
|
|
564
562
|
fs_1.default.copyFileSync(isolinuxThemeSrc, isolinuxThemeDest);
|
|
@@ -568,7 +566,7 @@ class Ovary {
|
|
|
568
566
|
const isolinuxDest = this.settings.work_dir.pathIso + 'isolinux/isolinux.cfg';
|
|
569
567
|
const isolinuxTemplate = node_path_1.default.resolve(__dirname, '../../addons/templates/isolinux.template');
|
|
570
568
|
if (!fs_1.default.existsSync(isolinuxTemplate)) {
|
|
571
|
-
|
|
569
|
+
utils_2.default.warning('Cannot find: ' + isolinuxTemplate);
|
|
572
570
|
process.exit();
|
|
573
571
|
}
|
|
574
572
|
/**
|
|
@@ -576,7 +574,7 @@ class Ovary {
|
|
|
576
574
|
*/
|
|
577
575
|
let kernel_parameters = `boot=live components locales=${process.env.LANG}`;
|
|
578
576
|
if (this.familyId === 'archlinux') {
|
|
579
|
-
const volid =
|
|
577
|
+
const volid = utils_2.default.getVolid(this.settings.remix.name);
|
|
580
578
|
if (this.settings.distro.distroId === 'ManjaroLinux') {
|
|
581
579
|
kernel_parameters += ` misobasedir=manjaro misolabel=${volid}`;
|
|
582
580
|
}
|
|
@@ -587,7 +585,7 @@ class Ovary {
|
|
|
587
585
|
const template = fs_1.default.readFileSync(isolinuxTemplate, 'utf8');
|
|
588
586
|
const view = {
|
|
589
587
|
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
590
|
-
kernel:
|
|
588
|
+
kernel: utils_2.default.kernelVersion(),
|
|
591
589
|
vmlinuz: `/live${this.settings.vmlinuz}`,
|
|
592
590
|
initrdImg: `/live${this.settings.initrdImg}`,
|
|
593
591
|
kernel_parameters: kernel_parameters,
|
|
@@ -602,7 +600,7 @@ class Ovary {
|
|
|
602
600
|
splashSrc = node_path_1.default.resolve(`${theme}/theme/livecd/splash.png`);
|
|
603
601
|
}
|
|
604
602
|
if (!fs_1.default.existsSync(splashSrc)) {
|
|
605
|
-
|
|
603
|
+
utils_2.default.warning('Cannot find: ' + splashSrc);
|
|
606
604
|
process.exit();
|
|
607
605
|
}
|
|
608
606
|
fs_1.default.copyFileSync(splashSrc, splashDest);
|
|
@@ -616,15 +614,15 @@ class Ovary {
|
|
|
616
614
|
}
|
|
617
615
|
let lackVmlinuzImage = false;
|
|
618
616
|
if (fs_1.default.existsSync(this.settings.kernel_image)) {
|
|
619
|
-
await (0,
|
|
617
|
+
await (0, utils_1.exec)(`cp ${this.settings.kernel_image} ${this.settings.work_dir.pathIso}/live/`, this.echo);
|
|
620
618
|
}
|
|
621
619
|
else {
|
|
622
|
-
|
|
620
|
+
utils_2.default.error(`Cannot find ${this.settings.kernel_image}`);
|
|
623
621
|
lackVmlinuzImage = true;
|
|
624
622
|
}
|
|
625
623
|
if (lackVmlinuzImage) {
|
|
626
|
-
|
|
627
|
-
|
|
624
|
+
utils_2.default.warning('Try to edit /etc/penguins-eggs.d/eggs.yaml and check for');
|
|
625
|
+
utils_2.default.warning(`vmlinuz: ${this.settings.kernel_image}`);
|
|
628
626
|
process.exit(1);
|
|
629
627
|
}
|
|
630
628
|
}
|
|
@@ -632,14 +630,14 @@ class Ovary {
|
|
|
632
630
|
* necessita di echoYes
|
|
633
631
|
*/
|
|
634
632
|
async initrdCreate() {
|
|
635
|
-
let initrdImg =
|
|
633
|
+
let initrdImg = utils_2.default.initrdImg();
|
|
636
634
|
initrdImg = initrdImg.slice(Math.max(0, initrdImg.lastIndexOf('/') + 1));
|
|
637
|
-
|
|
635
|
+
utils_2.default.warning(`Creating ${initrdImg} in ${this.settings.work_dir.pathIso}/live/`);
|
|
638
636
|
if (this.settings.distro.distroId === 'ManjaroLinux') {
|
|
639
|
-
await (0,
|
|
637
|
+
await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/manjaro/mkinitcpio-produce.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, utils_2.default.setEcho(true));
|
|
640
638
|
}
|
|
641
639
|
else if (this.settings.distro.distroId === 'Arch' || this.settings.distro.distroId === 'RebornOS') {
|
|
642
|
-
await (0,
|
|
640
|
+
await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/archlinux/mkinitcpio-produce.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, utils_2.default.setEcho(true));
|
|
643
641
|
}
|
|
644
642
|
}
|
|
645
643
|
/**
|
|
@@ -648,14 +646,14 @@ class Ovary {
|
|
|
648
646
|
*/
|
|
649
647
|
async initrdCopy(verbose = false) {
|
|
650
648
|
let isCrypted = false;
|
|
651
|
-
|
|
649
|
+
utils_2.default.warning('initrdCreate');
|
|
652
650
|
if (fs_1.default.existsSync('/etc/crypttab')) {
|
|
653
651
|
isCrypted = true;
|
|
654
|
-
await (0,
|
|
652
|
+
await (0, utils_1.exec)('mv /etc/crypttab /etc/crypttab.saved', this.echo);
|
|
655
653
|
}
|
|
656
|
-
await (0,
|
|
654
|
+
await (0, utils_1.exec)(`mkinitramfs -o ${this.settings.work_dir.pathIso}/live/initrd.img-$(uname -r) ${this.toNull}`, this.echo);
|
|
657
655
|
if (isCrypted) {
|
|
658
|
-
await (0,
|
|
656
|
+
await (0, utils_1.exec)('mv /etc/crypttab.saved /etc/crypttab', this.echo);
|
|
659
657
|
}
|
|
660
658
|
/*
|
|
661
659
|
|
|
@@ -724,10 +722,10 @@ class Ovary {
|
|
|
724
722
|
// 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}`
|
|
725
723
|
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}`;
|
|
726
724
|
cmd = cmd.replace(/\s\s+/g, ' ');
|
|
727
|
-
|
|
725
|
+
utils_2.default.writeX(`${this.settings.work_dir.path}mksquashfs`, cmd);
|
|
728
726
|
if (!scriptOnly) {
|
|
729
|
-
|
|
730
|
-
await (0,
|
|
727
|
+
utils_2.default.warning('squashing filesystem: ' + compression);
|
|
728
|
+
await (0, utils_1.exec)(cmd, utils_2.default.setEcho(true));
|
|
731
729
|
}
|
|
732
730
|
}
|
|
733
731
|
/**
|
|
@@ -811,10 +809,10 @@ class Ovary {
|
|
|
811
809
|
let cmd = '';
|
|
812
810
|
const cmds = [];
|
|
813
811
|
cmds.push('# NOTE: cdrom, dev, live, media, mnt, proc, run, sys and tmp', `# need just a mkdir in ${this.settings.work_dir.merged}`);
|
|
814
|
-
cmds.push(`# host: ${node_os_1.default.hostname()} user: ${await
|
|
812
|
+
cmds.push(`# host: ${node_os_1.default.hostname()} user: ${await utils_2.default.getPrimaryUser()}\n`);
|
|
815
813
|
for (const dir of dirs) {
|
|
816
814
|
cmds.push(startLine);
|
|
817
|
-
if (
|
|
815
|
+
if (n8_1.default.isDirectory(dir)) {
|
|
818
816
|
if (dir !== 'lost+found') {
|
|
819
817
|
cmd = `# /${dir} is a directory`;
|
|
820
818
|
if (this.mergedAndOvelay(dir)) {
|
|
@@ -848,7 +846,7 @@ class Ovary {
|
|
|
848
846
|
}
|
|
849
847
|
}
|
|
850
848
|
}
|
|
851
|
-
else if (
|
|
849
|
+
else if (n8_1.default.isFile(dir)) {
|
|
852
850
|
cmds.push(`# /${dir} is just a file`, titleLine);
|
|
853
851
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
|
|
854
852
|
cmds.push(await rexec(`cp /${dir} ${this.settings.work_dir.merged}`, this.verbose));
|
|
@@ -857,7 +855,7 @@ class Ovary {
|
|
|
857
855
|
cmds.push('# file exist... skip');
|
|
858
856
|
}
|
|
859
857
|
}
|
|
860
|
-
else if (
|
|
858
|
+
else if (n8_1.default.isSymbolicLink(dir)) {
|
|
861
859
|
lnkDest = fs_1.default.readlinkSync(`/${dir}`);
|
|
862
860
|
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);
|
|
863
861
|
if (!fs_1.default.existsSync(`${this.settings.work_dir.merged}/${dir}`)) {
|
|
@@ -874,7 +872,7 @@ class Ovary {
|
|
|
874
872
|
}
|
|
875
873
|
cmds.push(endLine);
|
|
876
874
|
}
|
|
877
|
-
|
|
875
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}bind`, cmds);
|
|
878
876
|
}
|
|
879
877
|
/**
|
|
880
878
|
* ubind del fs live
|
|
@@ -886,16 +884,16 @@ class Ovary {
|
|
|
886
884
|
}
|
|
887
885
|
const cmds = [];
|
|
888
886
|
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}`);
|
|
889
|
-
cmds.push(`# host: ${node_os_1.default.hostname()} user: ${await
|
|
887
|
+
cmds.push(`# host: ${node_os_1.default.hostname()} user: ${await utils_2.default.getPrimaryUser()}\n`);
|
|
890
888
|
// await exec(`/usr/bin/pkill mksquashfs; /usr/bin/pkill md5sum`, {echo: true})
|
|
891
889
|
if (fs_1.default.existsSync(this.settings.work_dir.merged)) {
|
|
892
890
|
const bindDirs = fs_1.default.readdirSync(this.settings.work_dir.merged, {
|
|
893
891
|
withFileTypes: true,
|
|
894
892
|
});
|
|
895
893
|
for (const dir of bindDirs) {
|
|
896
|
-
const dirname =
|
|
894
|
+
const dirname = n8_1.default.dirent2string(dir);
|
|
897
895
|
cmds.push('#############################################################');
|
|
898
|
-
if (
|
|
896
|
+
if (n8_1.default.isDirectory(dirname)) {
|
|
899
897
|
cmds.push(`\n# directory: ${dirname}`);
|
|
900
898
|
if (this.mergedAndOvelay(dirname)) {
|
|
901
899
|
cmds.push(`\n# ${dirname} has overlay`, `\n# First, umount it from ${this.settings.work_dir.path}`);
|
|
@@ -914,11 +912,11 @@ class Ovary {
|
|
|
914
912
|
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname} -rf`, this.verbose));
|
|
915
913
|
}
|
|
916
914
|
}
|
|
917
|
-
else if (
|
|
915
|
+
else if (n8_1.default.isFile(dirname)) {
|
|
918
916
|
cmds.push(`\n# ${dirname} = file`);
|
|
919
917
|
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
920
918
|
}
|
|
921
|
-
else if (
|
|
919
|
+
else if (n8_1.default.isSymbolicLink(dirname)) {
|
|
922
920
|
cmds.push(`\n# ${dirname} = symbolicLink`);
|
|
923
921
|
cmds.push(await rexec(`rm ${this.settings.work_dir.merged}/${dirname}`, this.verbose));
|
|
924
922
|
}
|
|
@@ -927,7 +925,7 @@ class Ovary {
|
|
|
927
925
|
if (this.clone) {
|
|
928
926
|
cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/home`, this.verbose));
|
|
929
927
|
}
|
|
930
|
-
|
|
928
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}ubind`, cmds);
|
|
931
929
|
}
|
|
932
930
|
/**
|
|
933
931
|
* bind dei virtual file system
|
|
@@ -935,7 +933,7 @@ class Ovary {
|
|
|
935
933
|
async bindVfs() {
|
|
936
934
|
const cmds = [];
|
|
937
935
|
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`);
|
|
938
|
-
|
|
936
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}bindvfs`, cmds);
|
|
939
937
|
}
|
|
940
938
|
/**
|
|
941
939
|
*
|
|
@@ -944,7 +942,7 @@ class Ovary {
|
|
|
944
942
|
async ubindVfs() {
|
|
945
943
|
const cmds = [];
|
|
946
944
|
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`);
|
|
947
|
-
|
|
945
|
+
utils_2.default.writeXs(`${this.settings.work_dir.path}ubindvfs`, cmds);
|
|
948
946
|
}
|
|
949
947
|
/**
|
|
950
948
|
*
|
|
@@ -956,7 +954,7 @@ class Ovary {
|
|
|
956
954
|
*/
|
|
957
955
|
const cmds = [];
|
|
958
956
|
const cmd = `chroot ${this.settings.work_dir.merged} getent passwd {1000..60000} |awk -F: '{print $1}'`;
|
|
959
|
-
const result = await (0,
|
|
957
|
+
const result = await (0, utils_1.exec)(cmd, {
|
|
960
958
|
echo: this.verbose,
|
|
961
959
|
ignore: false,
|
|
962
960
|
capture: true,
|
|
@@ -1027,15 +1025,15 @@ class Ovary {
|
|
|
1027
1025
|
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/penguins-eggs.desktop'), '/usr/share/applications/');
|
|
1028
1026
|
let installerUrl = 'install-debian.desktop';
|
|
1029
1027
|
let installerIcon = 'install-debian';
|
|
1030
|
-
if (
|
|
1028
|
+
if (pacman_1.default.packageIsInstalled('calamares')) {
|
|
1031
1029
|
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/`);
|
|
1032
1030
|
}
|
|
1033
|
-
else if (
|
|
1031
|
+
else if (pacman_1.default.packageIsInstalled('live-installer')) {
|
|
1034
1032
|
// carico la policy per live-installer
|
|
1035
1033
|
const policySource = node_path_1.default.resolve(__dirname, '../../assets/live-installer/com.github.pieroproietti.penguins-eggs.policy');
|
|
1036
1034
|
const policyDest = '/usr/share/polkit-1/actions/com.github.pieroproietti.penguins-eggs.policy';
|
|
1037
1035
|
shelljs_1.default.cp(policySource, policyDest);
|
|
1038
|
-
await (0,
|
|
1036
|
+
await (0, utils_1.exec)(`sed -i 's/auth_admin/yes/' ${policyDest}`);
|
|
1039
1037
|
// carico in filesystem.live packages-remove
|
|
1040
1038
|
shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../assets/live-installer/filesystem.packages-remove'), `${this.settings.work_dir.pathIso}/live/`);
|
|
1041
1039
|
shelljs_1.default.touch(`${this.settings.work_dir.pathIso}/live/filesystem.packages`);
|
|
@@ -1072,7 +1070,7 @@ class Ovary {
|
|
|
1072
1070
|
/**
|
|
1073
1071
|
* create service pve-live
|
|
1074
1072
|
*/
|
|
1075
|
-
const pve = new
|
|
1073
|
+
const pve = new pve_live_1.default();
|
|
1076
1074
|
pve.create(this.settings.work_dir.merged);
|
|
1077
1075
|
/**
|
|
1078
1076
|
* adding a desktop link for pve
|
|
@@ -1101,7 +1099,7 @@ class Ovary {
|
|
|
1101
1099
|
text += 'DESKTOP=$(xdg-user-dir DESKTOP)\n';
|
|
1102
1100
|
text += 'test -d "$DESKTOP" && mkdir -p "$DESKTOP"\n';
|
|
1103
1101
|
text += `cp /usr/share/applications/${installerUrl} "$DESKTOP"\n`;
|
|
1104
|
-
if (
|
|
1102
|
+
if (pacman_1.default.packageIsInstalled('lxde-core')) {
|
|
1105
1103
|
text += this.lxdeLink('penguins-eggs.desktop', "penguin's eggs", 'eggs');
|
|
1106
1104
|
if (myAddons.adapt)
|
|
1107
1105
|
text += this.lxdeLink('eggs-adapt.desktop', 'Adapt', 'video-display');
|
|
@@ -1122,7 +1120,7 @@ class Ovary {
|
|
|
1122
1120
|
/**
|
|
1123
1121
|
* enable desktop links
|
|
1124
1122
|
*/
|
|
1125
|
-
if (
|
|
1123
|
+
if (pacman_1.default.packageIsInstalled('gdm3') || pacman_1.default.packageIsInstalled('gdm')) {
|
|
1126
1124
|
// GNOME
|
|
1127
1125
|
text += 'test -f /usr/share/applications/penguins-eggs.desktop && cp /usr/share/applications/penguins-eggs.desktop "$DESKTOP"\n';
|
|
1128
1126
|
text += 'test -f "$DESKTOP"/penguins-eggs.desktop && chmod a+x "$DESKTOP"/penguins-eggs.desktop\n';
|
|
@@ -1136,9 +1134,9 @@ class Ovary {
|
|
|
1136
1134
|
text += 'chmod +x "$DESKTOP"/*.desktop';
|
|
1137
1135
|
}
|
|
1138
1136
|
fs_1.default.writeFileSync(script, text, 'utf8');
|
|
1139
|
-
await (0,
|
|
1137
|
+
await (0, utils_1.exec)(`chmod a+x ${script}`, this.echo);
|
|
1140
1138
|
}
|
|
1141
|
-
await
|
|
1139
|
+
await xdg_1.default.autologin(await utils_2.default.getPrimaryUser(), this.settings.config.user_opt, this.settings.work_dir.merged);
|
|
1142
1140
|
}
|
|
1143
1141
|
/**
|
|
1144
1142
|
* Creazione link desktop per lxde
|
|
@@ -1190,21 +1188,21 @@ class Ovary {
|
|
|
1190
1188
|
/**
|
|
1191
1189
|
* il pachetto grub/grub2 DEVE essere presente
|
|
1192
1190
|
*/
|
|
1193
|
-
const grubName =
|
|
1191
|
+
const grubName = pacman_1.default.whichGrubIsInstalled();
|
|
1194
1192
|
if (grubName === '') {
|
|
1195
|
-
|
|
1193
|
+
utils_2.default.error('Something went wrong! Cannot find grub! Run lsb_release -a and check the result');
|
|
1196
1194
|
process.exit(1);
|
|
1197
1195
|
}
|
|
1198
1196
|
/**
|
|
1199
1197
|
* Creo o cancello e creo: memdiskDir
|
|
1200
1198
|
*/
|
|
1201
1199
|
if (fs_1.default.existsSync(memdiskDir)) {
|
|
1202
|
-
await (0,
|
|
1200
|
+
await (0, utils_1.exec)(`rm ${memdiskDir} -rf`, this.echo);
|
|
1203
1201
|
}
|
|
1204
|
-
|
|
1205
|
-
await (0,
|
|
1206
|
-
await (0,
|
|
1207
|
-
await (0,
|
|
1202
|
+
utils_2.default.warning('creating memdiskDir: ' + memdiskDir);
|
|
1203
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}`);
|
|
1204
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot`, this.echo);
|
|
1205
|
+
await (0, utils_1.exec)(`mkdir ${memdiskDir}/boot/grub`, this.echo);
|
|
1208
1206
|
/**
|
|
1209
1207
|
* for initial grub.cfg in memdisk
|
|
1210
1208
|
*/
|
|
@@ -1212,22 +1210,22 @@ class Ovary {
|
|
|
1212
1210
|
let text = '';
|
|
1213
1211
|
text += 'search --file --set=root /.disk/info\n';
|
|
1214
1212
|
text += 'set prefix=($root)/boot/grub\n';
|
|
1215
|
-
text += `source $prefix/${
|
|
1216
|
-
|
|
1213
|
+
text += `source $prefix/${utils_2.default.machineUEFI()}/grub.cfg\n`;
|
|
1214
|
+
utils_2.default.write(grubCfg, text);
|
|
1217
1215
|
// #################################
|
|
1218
1216
|
/**
|
|
1219
1217
|
* start with empty efiWorkDir
|
|
1220
1218
|
*/
|
|
1221
1219
|
if (fs_1.default.existsSync(efiWorkDir)) {
|
|
1222
|
-
await (0,
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
await (0,
|
|
1226
|
-
await (0,
|
|
1227
|
-
await (0,
|
|
1228
|
-
await (0,
|
|
1229
|
-
await (0,
|
|
1230
|
-
await (0,
|
|
1220
|
+
await (0, utils_1.exec)(`rm ${efiWorkDir} -rf`, this.echo);
|
|
1221
|
+
}
|
|
1222
|
+
utils_2.default.warning('creating efiWordDir: ' + efiWorkDir);
|
|
1223
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}`, this.echo);
|
|
1224
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot`, this.echo);
|
|
1225
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub`, this.echo);
|
|
1226
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}`, this.echo);
|
|
1227
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi`, this.echo);
|
|
1228
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/efi/boot`, this.echo);
|
|
1231
1229
|
/**
|
|
1232
1230
|
* copy splash to efiWorkDir
|
|
1233
1231
|
*/
|
|
@@ -1237,10 +1235,10 @@ class Ovary {
|
|
|
1237
1235
|
splashSrc = `${theme}/theme/livecd/splash.png`;
|
|
1238
1236
|
}
|
|
1239
1237
|
if (!fs_1.default.existsSync(splashSrc)) {
|
|
1240
|
-
|
|
1238
|
+
utils_2.default.warning('Cannot find: ' + splashSrc);
|
|
1241
1239
|
process.exit();
|
|
1242
1240
|
}
|
|
1243
|
-
await (0,
|
|
1241
|
+
await (0, utils_1.exec)(`cp ${splashSrc} ${splashDest}`, this.echo);
|
|
1244
1242
|
/**
|
|
1245
1243
|
* copy theme
|
|
1246
1244
|
*/
|
|
@@ -1250,20 +1248,20 @@ class Ovary {
|
|
|
1250
1248
|
themeSrc = `${theme}/theme/livecd/grub.theme.cfg`;
|
|
1251
1249
|
}
|
|
1252
1250
|
if (!fs_1.default.existsSync(themeSrc)) {
|
|
1253
|
-
|
|
1251
|
+
utils_2.default.warning('Cannot find: ' + themeSrc);
|
|
1254
1252
|
process.exit();
|
|
1255
1253
|
}
|
|
1256
|
-
await (0,
|
|
1254
|
+
await (0, utils_1.exec)(`cp ${themeSrc} ${themeDest}`, this.echo);
|
|
1257
1255
|
/**
|
|
1258
1256
|
* second grub.cfg file in efiWork
|
|
1259
1257
|
*/
|
|
1260
1258
|
// 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
|
|
1261
|
-
let cmd = `for i in $(ls /usr/lib/grub/${
|
|
1262
|
-
await (0,
|
|
1259
|
+
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`;
|
|
1260
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
1263
1261
|
// 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
|
|
1264
|
-
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/${
|
|
1265
|
-
await (0,
|
|
1266
|
-
await (0,
|
|
1262
|
+
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`;
|
|
1263
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
1264
|
+
await (0, utils_1.exec)(`echo "source /boot/grub/grub.cfg" >> ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/grub.cfg`, this.echo);
|
|
1267
1265
|
/**
|
|
1268
1266
|
* andiamo in memdiskDir
|
|
1269
1267
|
*/
|
|
@@ -1274,7 +1272,7 @@ class Ovary {
|
|
|
1274
1272
|
*/
|
|
1275
1273
|
const currentDir = process.cwd();
|
|
1276
1274
|
process.chdir(memdiskDir);
|
|
1277
|
-
await (0,
|
|
1275
|
+
await (0, utils_1.exec)('tar -cvf memdisk boot', this.echo);
|
|
1278
1276
|
process.chdir(currentDir);
|
|
1279
1277
|
// make the grub image
|
|
1280
1278
|
// -O, --format=FORMAT
|
|
@@ -1283,41 +1281,41 @@ class Ovary {
|
|
|
1283
1281
|
// -p, --prefix=DIR set prefix directory
|
|
1284
1282
|
// --format=x86_64-efi --memdisk=memdisk --output=bootx64.efi --prefix?DIR set prefix directory
|
|
1285
1283
|
// 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
|
|
1286
|
-
await (0,
|
|
1284
|
+
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);
|
|
1287
1285
|
// popd torna in efiWorkDir
|
|
1288
1286
|
// copy the grub image to efi/boot (to go later in the device's root)
|
|
1289
|
-
await (0,
|
|
1287
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/efi/boot`, this.echo);
|
|
1290
1288
|
// #######################
|
|
1291
1289
|
// Do the boot image "boot/grub/efiboot.img"
|
|
1292
|
-
await (0,
|
|
1293
|
-
await (0,
|
|
1294
|
-
await (0,
|
|
1295
|
-
await (0,
|
|
1296
|
-
await (0,
|
|
1297
|
-
await (0,
|
|
1290
|
+
await (0, utils_1.exec)(`dd if=/dev/zero of=${efiWorkDir}/boot/grub/efiboot.img bs=1K count=1440`, this.echo);
|
|
1291
|
+
await (0, utils_1.exec)(`/sbin/mkdosfs -F 12 ${efiWorkDir}/boot/grub/efiboot.img`, this.echo);
|
|
1292
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt`, this.echo);
|
|
1293
|
+
await (0, utils_1.exec)(`mount -o loop ${efiWorkDir}/boot/grub/efiboot.img ${efiWorkDir}/img-mnt`, this.echo);
|
|
1294
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi`, this.echo);
|
|
1295
|
+
await (0, utils_1.exec)(`mkdir ${efiWorkDir}/img-mnt/efi/boot`, this.echo);
|
|
1298
1296
|
// era cp -r
|
|
1299
|
-
await (0,
|
|
1297
|
+
await (0, utils_1.exec)(`cp ${memdiskDir}/bootx64.efi ${efiWorkDir}/img-mnt/efi/boot`, this.echo);
|
|
1300
1298
|
// #######################
|
|
1301
1299
|
// copy modules and font
|
|
1302
|
-
await (0,
|
|
1300
|
+
await (0, utils_1.exec)(`cp -r /usr/lib/grub/${utils_2.default.machineUEFI()}/* ${efiWorkDir}/boot/grub/${utils_2.default.machineUEFI()}/`, this.echo);
|
|
1303
1301
|
// if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
|
|
1304
1302
|
// Either of these will work, and they look the same to me. Unicode seems to work with qemu. -fsr
|
|
1305
1303
|
if (fs_1.default.existsSync('/usr/share/grub/unicode.pf2')) {
|
|
1306
|
-
await (0,
|
|
1304
|
+
await (0, utils_1.exec)(`cp /usr/share/grub/unicode.pf2 ${efiWorkDir}/boot/grub/font.pf2`, this.echo);
|
|
1307
1305
|
}
|
|
1308
1306
|
else if (fs_1.default.existsSync('/usr/share/grub/ascii.pf2')) {
|
|
1309
|
-
await (0,
|
|
1307
|
+
await (0, utils_1.exec)(`cp /usr/share/grub/ascii.pf2 ${efiWorkDir}/boot/grub/font.pf2`, this.echo);
|
|
1310
1308
|
}
|
|
1311
1309
|
// doesn't need to be root-owned
|
|
1312
1310
|
// chown -R 1000:1000 $(pwd) 2>/dev/null
|
|
1313
1311
|
// Cleanup efi temps
|
|
1314
|
-
await (0,
|
|
1315
|
-
await (0,
|
|
1316
|
-
await (0,
|
|
1312
|
+
await (0, utils_1.exec)(`umount ${efiWorkDir}/img-mnt`, this.echo);
|
|
1313
|
+
await (0, utils_1.exec)(`rmdir ${efiWorkDir}/img-mnt`, this.echo);
|
|
1314
|
+
await (0, utils_1.exec)(`rm ${memdiskDir}/img-mnt -rf`, this.echo);
|
|
1317
1315
|
// popd
|
|
1318
1316
|
// Copy efi files to iso
|
|
1319
|
-
await (0,
|
|
1320
|
-
await (0,
|
|
1317
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/boot ${isoDir}/`, this.echo);
|
|
1318
|
+
await (0, utils_1.exec)(`rsync -avx ${efiWorkDir}/efi ${isoDir}/`, this.echo);
|
|
1321
1319
|
// Do the main grub.cfg (which gets loaded last):
|
|
1322
1320
|
// grub.theme.cfg
|
|
1323
1321
|
let grubThemeSrc = node_path_1.default.resolve(__dirname, `../../addons/${theme}/theme/livecd/grub.theme.cfg`);
|
|
@@ -1326,7 +1324,7 @@ class Ovary {
|
|
|
1326
1324
|
}
|
|
1327
1325
|
const grubThemeDest = `${isoDir}/boot/grub/theme.cfg`;
|
|
1328
1326
|
if (!fs_1.default.existsSync(grubThemeSrc)) {
|
|
1329
|
-
|
|
1327
|
+
utils_2.default.warning('Cannot find: ' + grubThemeSrc);
|
|
1330
1328
|
process.exit();
|
|
1331
1329
|
}
|
|
1332
1330
|
fs_1.default.copyFileSync(grubThemeSrc, grubThemeDest);
|
|
@@ -1335,7 +1333,7 @@ class Ovary {
|
|
|
1335
1333
|
*/
|
|
1336
1334
|
const grubTemplate = node_path_1.default.resolve(__dirname, '../../addons/templates/grub.template');
|
|
1337
1335
|
if (!fs_1.default.existsSync(grubTemplate)) {
|
|
1338
|
-
|
|
1336
|
+
utils_2.default.warning('Cannot find: ' + grubTemplate);
|
|
1339
1337
|
process.exit();
|
|
1340
1338
|
}
|
|
1341
1339
|
/**
|
|
@@ -1343,7 +1341,7 @@ class Ovary {
|
|
|
1343
1341
|
*/
|
|
1344
1342
|
let kernel_parameters = `boot=live components locales=${process.env.LANG}`;
|
|
1345
1343
|
if (this.familyId === 'archlinux') {
|
|
1346
|
-
const volid =
|
|
1344
|
+
const volid = utils_2.default.getVolid(this.settings.remix.name);
|
|
1347
1345
|
if (this.settings.distro.distroId === 'ManjaroLinux') {
|
|
1348
1346
|
kernel_parameters += ` misobasedir=manjaro misolabel=${volid}`;
|
|
1349
1347
|
}
|
|
@@ -1355,7 +1353,7 @@ class Ovary {
|
|
|
1355
1353
|
const template = fs_1.default.readFileSync(grubTemplate, 'utf8');
|
|
1356
1354
|
const view = {
|
|
1357
1355
|
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
1358
|
-
kernel:
|
|
1356
|
+
kernel: utils_2.default.kernelVersion(),
|
|
1359
1357
|
vmlinuz: `/live${this.settings.vmlinuz}`,
|
|
1360
1358
|
initrdImg: `/live${this.settings.initrdImg}`,
|
|
1361
1359
|
kernel_parameters: kernel_parameters,
|
|
@@ -1380,7 +1378,7 @@ class Ovary {
|
|
|
1380
1378
|
shelljs_1.default.mkdir('-p', dotDisk);
|
|
1381
1379
|
// .disk/info
|
|
1382
1380
|
let file = dotDisk + '/info';
|
|
1383
|
-
let content =
|
|
1381
|
+
let content = utils_2.default.getVolid(this.settings.remix.name);
|
|
1384
1382
|
fs_1.default.writeFileSync(file, content, 'utf-8');
|
|
1385
1383
|
// .disk/mksquashfs
|
|
1386
1384
|
const scripts = this.settings.work_dir.path;
|
|
@@ -1397,7 +1395,7 @@ class Ovary {
|
|
|
1397
1395
|
* @returns cmd 4 mkiso
|
|
1398
1396
|
*/
|
|
1399
1397
|
xorrisoCommand(clone = false, cryptedclone = false) {
|
|
1400
|
-
const volid =
|
|
1398
|
+
const volid = utils_2.default.getVolid(this.settings.remix.name);
|
|
1401
1399
|
const prefix = this.settings.config.snapshot_prefix;
|
|
1402
1400
|
let typology = '';
|
|
1403
1401
|
// typology is applied only with standard egg-of
|
|
@@ -1409,7 +1407,7 @@ class Ovary {
|
|
|
1409
1407
|
typology = '_crypted';
|
|
1410
1408
|
}
|
|
1411
1409
|
}
|
|
1412
|
-
const postfix =
|
|
1410
|
+
const postfix = utils_2.default.getPostfix();
|
|
1413
1411
|
this.settings.isoFilename = prefix + volid + typology + postfix;
|
|
1414
1412
|
const output = this.settings.config.snapshot_dir + this.settings.isoFilename;
|
|
1415
1413
|
let command = '';
|
|
@@ -1423,7 +1421,7 @@ class Ovary {
|
|
|
1423
1421
|
isoHybridMbr = `-isohybrid-mbr ${isolinuxFile}`;
|
|
1424
1422
|
}
|
|
1425
1423
|
else {
|
|
1426
|
-
|
|
1424
|
+
utils_2.default.warning(`Can't create isohybrid image. File: ${isolinuxFile} not found. \nThe resulting image will be a standard iso file`);
|
|
1427
1425
|
}
|
|
1428
1426
|
}
|
|
1429
1427
|
// uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
|
|
@@ -1545,9 +1543,9 @@ class Ovary {
|
|
|
1545
1543
|
if (this.verbose) {
|
|
1546
1544
|
console.log('ovary: makeIso');
|
|
1547
1545
|
}
|
|
1548
|
-
|
|
1546
|
+
utils_2.default.writeX(`${this.settings.work_dir.path}mkisofs`, cmd);
|
|
1549
1547
|
if (!scriptOnly) {
|
|
1550
|
-
await (0,
|
|
1548
|
+
await (0, utils_1.exec)(cmd, utils_2.default.setEcho(true));
|
|
1551
1549
|
}
|
|
1552
1550
|
}
|
|
1553
1551
|
/**
|
|
@@ -1555,7 +1553,7 @@ class Ovary {
|
|
|
1555
1553
|
* @param scriptOnly
|
|
1556
1554
|
*/
|
|
1557
1555
|
finished(scriptOnly = false) {
|
|
1558
|
-
|
|
1556
|
+
utils_2.default.titles('produce');
|
|
1559
1557
|
if (!scriptOnly) {
|
|
1560
1558
|
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) + '.');
|
|
1561
1559
|
}
|
|
@@ -1584,7 +1582,7 @@ class Ovary {
|
|
|
1584
1582
|
const passwd = fs_1.default.readFileSync('/etc/passwd', 'utf-8').split('\n');
|
|
1585
1583
|
for (const element of passwd) {
|
|
1586
1584
|
const line = element.split(':');
|
|
1587
|
-
const users = new
|
|
1585
|
+
const users = new users_1.default(line[0], line[1], line[2], line[3], line[4], line[5], line[6]);
|
|
1588
1586
|
await users.getValues();
|
|
1589
1587
|
if (users.password !== undefined) {
|
|
1590
1588
|
usersArray.push(users);
|
|
@@ -1602,11 +1600,11 @@ async function makeIfNotExist(path, verbose = false) {
|
|
|
1602
1600
|
if (verbose) {
|
|
1603
1601
|
console.log(`ovary: makeIfNotExist(${path})`);
|
|
1604
1602
|
}
|
|
1605
|
-
const echo =
|
|
1603
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1606
1604
|
let cmd = `# ${path} alreasy exist`;
|
|
1607
1605
|
if (!fs_1.default.existsSync(path)) {
|
|
1608
1606
|
cmd = `mkdir ${path} -p`;
|
|
1609
|
-
await (0,
|
|
1607
|
+
await (0, utils_1.exec)(cmd, echo);
|
|
1610
1608
|
}
|
|
1611
1609
|
return cmd;
|
|
1612
1610
|
}
|
|
@@ -1616,13 +1614,13 @@ async function makeIfNotExist(path, verbose = false) {
|
|
|
1616
1614
|
* @param echo
|
|
1617
1615
|
*/
|
|
1618
1616
|
async function rexec(cmd, verbose = false) {
|
|
1619
|
-
const echo =
|
|
1620
|
-
const check = await (0,
|
|
1617
|
+
const echo = utils_2.default.setEcho(verbose);
|
|
1618
|
+
const check = await (0, utils_1.exec)(cmd, echo);
|
|
1621
1619
|
if (!cmd.startsWith('umount')) { // skip umount errors
|
|
1622
1620
|
if (check.code !== 0) {
|
|
1623
1621
|
console.log(`command: ${chalk_1.default.cyan(cmd)} ended with code ${chalk_1.default.cyan(check.code)}`);
|
|
1624
1622
|
console.log();
|
|
1625
|
-
await
|
|
1623
|
+
await utils_2.default.pressKeyToExit("eggs caused an error in the previous operation, press enter to continue", true);
|
|
1626
1624
|
}
|
|
1627
1625
|
}
|
|
1628
1626
|
return cmd;
|