penguins-eggs 25.10.6 → 25.10.19
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 +51 -145
- package/README.md +3 -829
- package/addons/eggs/theme/livecd/isolinux.main.simple.cfg +3 -3
- package/conf/distros/trixie/calamares/modules/shellprocess@boot_deploy.yml +3 -4
- package/conf/love.yaml +1 -1
- package/dist/classes/distro.js +9 -2
- package/dist/classes/diversions.d.ts +1 -1
- package/dist/classes/diversions.js +27 -8
- package/dist/classes/incubation/incubator.d/archlinux.js +1 -0
- package/dist/classes/incubation/incubator.d/trixie.js +7 -10
- package/dist/classes/ovary.d/edit-live-fs.d.ts +1 -1
- package/dist/classes/ovary.d/edit-live-fs.js +1 -7
- package/dist/classes/ovary.d/fertilization.js +1 -0
- package/dist/classes/ovary.d/finished.js +1 -5
- package/dist/classes/ovary.d/initrd.d.ts +1 -1
- package/dist/classes/ovary.d/initrd.js +17 -19
- package/dist/classes/ovary.d/live-create-structure.js +1 -4
- package/dist/classes/ovary.d/luks-get-password.d.ts +12 -0
- package/dist/classes/ovary.d/luks-get-password.js +57 -0
- package/dist/classes/ovary.d/luks-home-support.d.ts +12 -0
- package/dist/classes/ovary.d/luks-home-support.js +75 -0
- package/dist/classes/ovary.d/luks-home.d.ts +15 -0
- package/dist/classes/ovary.d/luks-home.js +140 -0
- package/dist/classes/ovary.d/luks-root-bootstrap-builder.d.ts +11 -0
- package/dist/classes/ovary.d/luks-root-bootstrap-builder.js +45 -0
- package/dist/classes/ovary.d/luks-root.d.ts +15 -0
- package/dist/classes/ovary.d/luks-root.js +126 -0
- package/dist/classes/ovary.d/make-efi.js +1 -1
- package/dist/classes/ovary.d/make-squashfs.d.ts +1 -1
- package/dist/classes/ovary.d/make-squashfs.js +7 -3
- package/dist/classes/ovary.d/produce.d.ts +3 -3
- package/dist/classes/ovary.d/produce.js +76 -48
- package/dist/classes/ovary.d/syslinux.js +1 -1
- package/dist/classes/ovary.d/xorriso-command.d.ts +2 -2
- package/dist/classes/ovary.d/xorriso-command.js +27 -29
- package/dist/classes/ovary.d.ts +35 -16
- package/dist/classes/ovary.js +42 -16
- package/dist/classes/utils.d.ts +1 -0
- package/dist/classes/utils.js +3 -0
- package/dist/commands/config.d.ts +1 -1
- package/dist/commands/config.js +2 -2
- package/dist/commands/love.d.ts +3 -0
- package/dist/commands/love.js +40 -2
- package/dist/commands/produce.d.ts +3 -2
- package/dist/commands/produce.js +14 -17
- package/dist/commands/tools/{ppa.d.ts → repo.d.ts} +2 -2
- package/dist/commands/tools/{ppa.js → repo.js} +69 -67
- package/dracut/create-symlink +71 -0
- package/dracut/dracut-log.txt +3 -0
- package/dracut/dracut.conf.d/50-live.conf +24 -6
- package/dracut/dracut.conf.d/README.md +10 -0
- package/dracut/export +4 -0
- package/dracut/export-dracut-analysis +51 -0
- package/dracut/export-dracut-log +2 -0
- package/dracut/mkisofs +10 -0
- package/dracut/modules.d/00debug-shell/debug-hook.sh +13 -0
- package/dracut/modules.d/00debug-shell/module-setup.sh +20 -0
- package/dracut/modules.d/90block/README.md +7 -0
- package/dracut/modules.d/90block/block-cmdline.sh +3 -0
- package/dracut/modules.d/90block/module-setup.sh +15 -0
- package/dracut/modules.d/95iso-scan/README.md +3 -0
- package/dracut/modules.d/95iso-scan/iso-scan-fallback.sh +12 -0
- package/dracut/modules.d/95iso-scan/iso-scan.sh +92 -0
- package/dracut/modules.d/95iso-scan/module-setup.sh +18 -0
- package/dracut/modules.d/95luks-loop/README.md +9 -0
- package/dracut/modules.d/95luks-loop/luks-loop.sh +90 -0
- package/dracut/modules.d/95luks-loop/module-setup.sh +17 -0
- package/dracut/renew-initramfs +17 -0
- package/dracut/sbin2bin +10 -0
- package/dracut/update-dracut-conf-d +2 -0
- package/dracut/update-dracut-modules +62 -0
- package/manpages/doc/man/eggs.1.gz +0 -0
- package/manpages/doc/man/eggs.html +7 -661
- package/package.json +9 -8
- package/perrisbrewery/template/dependencies.yaml +6 -5
- package/scripts/_eggs +16 -31
- package/scripts/eggs.bash +4 -6
- package/scripts/luks-root-bootstrap-create.sh +235 -0
- package/scripts/luks-root-unlock.sh +172 -0
- package/scripts/mount-encrypted-home.sh +223 -0
- package/dist/commands/syncfrom.d.ts +0 -45
- package/dist/commands/syncfrom.js +0 -152
- package/dist/commands/syncto.d.ts +0 -40
- package/dist/commands/syncto.js +0 -175
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* luks-root-bootstrap-builder.ts
|
|
3
|
+
*
|
|
4
|
+
* Crea un filesystem.squashfs bootstrap completo con Debian
|
|
5
|
+
* per sbloccare il sistema principale cifrato
|
|
6
|
+
*/
|
|
7
|
+
import Ovary from '../ovary.js';
|
|
8
|
+
/**
|
|
9
|
+
* Crea il filesystem bootstrap completo
|
|
10
|
+
*/
|
|
11
|
+
export declare function createBootstrapFilesystem(this: Ovary, outputSquashfs: string): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* luks-root-bootstrap-builder.ts
|
|
3
|
+
*
|
|
4
|
+
* Crea un filesystem.squashfs bootstrap completo con Debian
|
|
5
|
+
* per sbloccare il sistema principale cifrato
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'fs';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import Utils from '../utils.js';
|
|
10
|
+
import { exec } from '../../lib/utils.js';
|
|
11
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
12
|
+
/**
|
|
13
|
+
* Crea il filesystem bootstrap completo
|
|
14
|
+
*/
|
|
15
|
+
export async function createBootstrapFilesystem(outputSquashfs) {
|
|
16
|
+
Utils.warning('Creating full Debian bootstrap filesystem...');
|
|
17
|
+
Utils.warning('This will take several minutes...');
|
|
18
|
+
const scriptsDir = path.join(__dirname, '../../../scripts');
|
|
19
|
+
const createScript = path.join(scriptsDir, 'luks-root-bootstrap-create.sh');
|
|
20
|
+
const unlockScript = path.join(scriptsDir, 'luks-root-unlock.sh');
|
|
21
|
+
// Verifica che gli script esistano
|
|
22
|
+
if (!fs.existsSync(createScript)) {
|
|
23
|
+
throw new Error(`Build script not found: ${createScript}`);
|
|
24
|
+
}
|
|
25
|
+
if (!fs.existsSync(unlockScript)) {
|
|
26
|
+
throw new Error(`Unlock script not found: ${unlockScript}`);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
// Esegui lo script di creazione bash
|
|
30
|
+
Utils.warning('Executing bootstrap creation script...');
|
|
31
|
+
await exec(`bash ${createScript} ${outputSquashfs} ${unlockScript}`, { echo: true });
|
|
32
|
+
// Verifica che il file sia stato creato
|
|
33
|
+
if (!fs.existsSync(outputSquashfs)) {
|
|
34
|
+
throw new Error('Bootstrap filesystem was not created');
|
|
35
|
+
}
|
|
36
|
+
const stats = fs.statSync(outputSquashfs);
|
|
37
|
+
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
38
|
+
Utils.success(`✓ Bootstrap filesystem created: ${sizeMB} MB`);
|
|
39
|
+
Utils.success(' Full Debian system with systemd and encrypted root unlock');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
Utils.error(`Failed to create bootstrap filesystem: ${error}`);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/encrypt-live-fs.ts
|
|
3
|
+
* penguins-eggs v.25.10.x / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import Ovary from '../ovary.js';
|
|
9
|
+
/**
|
|
10
|
+
* luksRoot()
|
|
11
|
+
*
|
|
12
|
+
* create a container LUKS with the entire
|
|
13
|
+
* filesystem.squashfs
|
|
14
|
+
*/
|
|
15
|
+
export declare function luksRoot(this: Ovary): Promise<void>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/encrypt-live-fs.ts
|
|
3
|
+
* penguins-eggs v.25.10.x / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
// packages
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import { spawn } from 'node:child_process';
|
|
11
|
+
import Utils from '../utils.js';
|
|
12
|
+
import { exec } from '../../lib/utils.js';
|
|
13
|
+
/**
|
|
14
|
+
* luksRoot()
|
|
15
|
+
*
|
|
16
|
+
* create a container LUKS with the entire
|
|
17
|
+
* filesystem.squashfs
|
|
18
|
+
*/
|
|
19
|
+
export async function luksRoot() {
|
|
20
|
+
// filesystem.squashfs.real
|
|
21
|
+
const live_fs = `${this.settings.iso_work}live/filesystem.squashfs.real`;
|
|
22
|
+
try {
|
|
23
|
+
/**
|
|
24
|
+
* this.luksName = 'luks.img';
|
|
25
|
+
* this.luksFile = `/tmp/${luksName}`
|
|
26
|
+
* this.luksDevice = `/dev/mapper/${luksName}`
|
|
27
|
+
* this.luksMappedName = this.luksName
|
|
28
|
+
* this.luksMountpoint = `/tmp/mnt/${luksName}`
|
|
29
|
+
* this.luksPassword = 'evolution'
|
|
30
|
+
*/
|
|
31
|
+
console.log();
|
|
32
|
+
console.log('====================================');
|
|
33
|
+
console.log(` Creating ${this.luksName}`);
|
|
34
|
+
console.log('====================================');
|
|
35
|
+
// Utils.warning('1. Calculation of space requirements...')
|
|
36
|
+
const sizeString = (await exec(`unsquashfs -s ${live_fs} | grep "Filesystem size" | sed -e 's/.*size //' -e 's/ .*//'`, { capture: true, echo: false })).data;
|
|
37
|
+
let size = Number.parseInt(sizeString); // Dimensione in Byte
|
|
38
|
+
// Add overhead * 1.20
|
|
39
|
+
const luksSize = Math.ceil(size * 1.20);
|
|
40
|
+
Utils.warning(`filesystem.squashfs size: ${bytesToGB(size)}`);
|
|
41
|
+
Utils.warning(`partition LUKS ${this.luksFile} size: ${bytesToGB(luksSize)}`);
|
|
42
|
+
Utils.warning(`creating partition LUKS: ${this.luksFile}`);
|
|
43
|
+
await executeCommand('truncate', ['--size', `${luksSize}`, this.luksFile]);
|
|
44
|
+
Utils.warning(`formatting ${this.luksFile} as a LUKS volume...`);
|
|
45
|
+
await executeCommand('cryptsetup', ['--batch-mode', 'luksFormat', this.luksFile], `${this.luksPassword}\n`);
|
|
46
|
+
this.luksUuid = (await exec(`cryptsetup luksUUID ${this.luksFile}`, { capture: true, echo: false })).data.trim();
|
|
47
|
+
Utils.warning(`LUKS uuid: ${this.luksUuid}`);
|
|
48
|
+
Utils.warning(`opening the LUKS volume. It will be mapped to ${this.luksDevice}`);
|
|
49
|
+
await executeCommand('cryptsetup', ['luksOpen', this.luksFile, this.luksMappedName], `${this.luksPassword}\n`);
|
|
50
|
+
Utils.warning(`formatting ext4`);
|
|
51
|
+
await exec(`mkfs.ext4 -L live-root ${this.luksDevice}`, this.echo);
|
|
52
|
+
Utils.warning(`mounting ${this.luksDevice} on ${this.luksMountpoint}`);
|
|
53
|
+
if (fs.existsSync(this.luksMountpoint)) {
|
|
54
|
+
if (!Utils.isMountpoint(this.luksMountpoint)) {
|
|
55
|
+
await exec(`rm -rf ${this.luksMountpoint}`, this.echo);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error(`${this.luksMountpoint} is already mounted, process will abort!`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
await exec(`mkdir -p ${this.luksMountpoint}`, this.echo);
|
|
62
|
+
await exec(`mount /dev/mapper/${this.luksName} ${this.luksMountpoint}`, this.echo);
|
|
63
|
+
Utils.warning(`moving ${live_fs} ${this.luksMountpoint}/filesystem.squashfs`);
|
|
64
|
+
await exec(`mv ${live_fs} ${this.luksMountpoint}/filesystem.squashfs`, this.echo);
|
|
65
|
+
Utils.warning(`unmount ${this.luksMountpoint} `);
|
|
66
|
+
await exec(`umount ${this.luksMountpoint}`, this.echo);
|
|
67
|
+
Utils.warning(`closing LUKS volume ${this.luksFile}.`);
|
|
68
|
+
await executeCommand('cryptsetup', ['close', this.luksMappedName]);
|
|
69
|
+
Utils.warning(`moving ${this.luksMappedName} on (ISO)/live.`);
|
|
70
|
+
await exec(`mv ${this.luksFile} ${this.settings.iso_work}/live`, this.echo);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof Error) {
|
|
74
|
+
Utils.error(`ERROR: ${error.message}`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
Utils.error(`An unknown error has occurred.`);
|
|
78
|
+
}
|
|
79
|
+
Utils.warning('Cleaning performed following the error...');
|
|
80
|
+
if (fs.existsSync(this.luksMountpoint)) {
|
|
81
|
+
await exec(`umount -lf ${this.luksMountpoint}`).catch(() => { });
|
|
82
|
+
}
|
|
83
|
+
if (fs.existsSync(this.luksDevice)) {
|
|
84
|
+
await executeCommand('cryptsetup', ['luksClose', this.luksName]).catch(() => { });
|
|
85
|
+
}
|
|
86
|
+
await Utils.pressKeyToExit();
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Funzione helper per eseguire comandi esterni in modo asincrono,
|
|
92
|
+
* gestendo lo standard input per passare le password.
|
|
93
|
+
* Restituisce una Promise che si risolve al successo o si rigetta in caso di errore.
|
|
94
|
+
*/
|
|
95
|
+
function executeCommand(command, args, stdinData) {
|
|
96
|
+
return new Promise((resolve, reject) => {
|
|
97
|
+
// Se passiamo dati a stdin, dobbiamo usare 'pipe'. Altrimenti, 'inherit'.
|
|
98
|
+
const stdioConfig = stdinData ? ['pipe', 'inherit', 'inherit'] : 'inherit';
|
|
99
|
+
const process = spawn(command, args, { stdio: stdioConfig });
|
|
100
|
+
// Se fornito, scriviamo i dati (es. la password) nello stdin del processo.
|
|
101
|
+
if (stdinData && process.stdin) {
|
|
102
|
+
process.stdin.write(stdinData);
|
|
103
|
+
process.stdin.end();
|
|
104
|
+
}
|
|
105
|
+
process.on('error', (err) => {
|
|
106
|
+
reject(new Error(`Error starting command "${command}": ${err.message}`));
|
|
107
|
+
});
|
|
108
|
+
process.on('close', (code) => {
|
|
109
|
+
if (code === 0) {
|
|
110
|
+
resolve(); // Success
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
reject(new Error(`Command "${command} ${args.join(' ')}" ended with error code ${code}`));
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Converte bytes in gigabytes per la visualizzazione.
|
|
120
|
+
*/
|
|
121
|
+
function bytesToGB(bytes) {
|
|
122
|
+
if (bytes === 0)
|
|
123
|
+
return '0.00 GB';
|
|
124
|
+
const gigabytes = bytes / (1024 * 1024 * 1024);
|
|
125
|
+
return gigabytes.toFixed(2) + ' GB';
|
|
126
|
+
}
|
|
@@ -218,7 +218,7 @@ export async function makeEfi(theme = 'eggs') {
|
|
|
218
218
|
Utils.error(`error: ${grubTemplate} does not exist`);
|
|
219
219
|
process.exit(1);
|
|
220
220
|
}
|
|
221
|
-
const kernel_parameters = Diversions.kernelParameters(this.familyId, this.volid); // this.kernelParameters()
|
|
221
|
+
const kernel_parameters = Diversions.kernelParameters(this.familyId, this.volid, this.luksUuid); // this.kernelParameters()
|
|
222
222
|
const cfgMain = path.join(isoDir, '/boot/grub/grub.cfg');
|
|
223
223
|
const template = fs.readFileSync(grubTemplate, 'utf8');
|
|
224
224
|
const view = {
|
|
@@ -9,7 +9,7 @@ import Ovary from '../ovary.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* squashFs: crea in live filesystem.squashfs
|
|
11
11
|
*/
|
|
12
|
-
export declare function makeSquashfs(this: Ovary, scriptOnly?: boolean,
|
|
12
|
+
export declare function makeSquashfs(this: Ovary, scriptOnly?: boolean, includeRoot?: boolean): Promise<string>;
|
|
13
13
|
/**
|
|
14
14
|
* Add or remove exclusion
|
|
15
15
|
* @param add {boolean} true = add, false remove
|
|
@@ -16,7 +16,7 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
|
16
16
|
/**
|
|
17
17
|
* squashFs: crea in live filesystem.squashfs
|
|
18
18
|
*/
|
|
19
|
-
export async function makeSquashfs(scriptOnly = false,
|
|
19
|
+
export async function makeSquashfs(scriptOnly = false, includeRoot = false) {
|
|
20
20
|
if (this.verbose) {
|
|
21
21
|
console.log('Ovary: makeSquashfs');
|
|
22
22
|
}
|
|
@@ -57,7 +57,7 @@ export async function makeSquashfs(scriptOnly = false, unsecure = false) {
|
|
|
57
57
|
/**
|
|
58
58
|
* secure
|
|
59
59
|
*/
|
|
60
|
-
if (!
|
|
60
|
+
if (!includeRoot) {
|
|
61
61
|
this.addExclusion(`root/*`);
|
|
62
62
|
this.addExclusion(`root/.*`);
|
|
63
63
|
}
|
|
@@ -81,7 +81,11 @@ export async function makeSquashfs(scriptOnly = false, unsecure = false) {
|
|
|
81
81
|
* [-ef exclude.list]
|
|
82
82
|
* [-e list of exclude dirs/files]
|
|
83
83
|
*/
|
|
84
|
-
let
|
|
84
|
+
let sfsName = "filesystem.squashfs";
|
|
85
|
+
if (this.fullcrypt) {
|
|
86
|
+
sfsName = "filesystem.squashfs.real";
|
|
87
|
+
}
|
|
88
|
+
let cmd = `mksquashfs ${this.settings.work_dir.merged} ${this.settings.iso_work}live/${sfsName} ${compression} ${limit} -no-xattrs -wildcards -ef ${this.settings.config.snapshot_excludes} ${this.settings.session_excludes}`;
|
|
85
89
|
cmd = cmd.replaceAll(/\s\s+/g, ' ');
|
|
86
90
|
Utils.writeX(`${this.settings.work_dir.ovarium}mksquashfs`, cmd);
|
|
87
91
|
if (!scriptOnly) {
|
|
@@ -10,14 +10,14 @@ import Ovary from './../ovary.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* produce
|
|
12
12
|
* @param clone
|
|
13
|
-
* @param
|
|
13
|
+
* @param homecrypt
|
|
14
14
|
* @param scriptOnly
|
|
15
15
|
* @param yolkRenew
|
|
16
16
|
* @param release
|
|
17
17
|
* @param myAddons
|
|
18
18
|
* @param nointeractive
|
|
19
19
|
* @param noicons
|
|
20
|
-
* @param
|
|
20
|
+
* @param includeRoot
|
|
21
21
|
* @param verbose
|
|
22
22
|
*/
|
|
23
|
-
export declare function produce(this: Ovary, kernel: string | undefined, clone: boolean | undefined,
|
|
23
|
+
export declare function produce(this: Ovary, kernel: string | undefined, clone: boolean | undefined, homecrypt: boolean | undefined, fullcrypt: boolean | undefined, scriptOnly: boolean | undefined, yolkRenew: boolean | undefined, release: boolean | undefined, myAddons: IAddons, myLinks: string[], excludes: IExcludes, nointeractive?: boolean, noicons?: boolean, includeRoot?: boolean, verbose?: boolean): Promise<void>;
|
|
@@ -26,31 +26,47 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
|
26
26
|
/**
|
|
27
27
|
* produce
|
|
28
28
|
* @param clone
|
|
29
|
-
* @param
|
|
29
|
+
* @param homecrypt
|
|
30
30
|
* @param scriptOnly
|
|
31
31
|
* @param yolkRenew
|
|
32
32
|
* @param release
|
|
33
33
|
* @param myAddons
|
|
34
34
|
* @param nointeractive
|
|
35
35
|
* @param noicons
|
|
36
|
-
* @param
|
|
36
|
+
* @param includeRoot
|
|
37
37
|
* @param verbose
|
|
38
38
|
*/
|
|
39
|
-
export async function produce(kernel = '', clone = false,
|
|
39
|
+
export async function produce(kernel = '', clone = false, homecrypt = false, fullcrypt = false, scriptOnly = false, yolkRenew = false, release = false, myAddons, myLinks, excludes, nointeractive = false, noicons = false, includeRoot = false, verbose = false) {
|
|
40
40
|
this.verbose = verbose;
|
|
41
41
|
this.echo = Utils.setEcho(verbose);
|
|
42
42
|
if (this.verbose) {
|
|
43
43
|
this.toNull = ' > /dev/null 2>&1';
|
|
44
44
|
}
|
|
45
45
|
this.kernel = kernel;
|
|
46
|
-
this.clone = clone;
|
|
47
|
-
this.cryptedclone = cryptedclone;
|
|
48
|
-
const luksName = 'luks-volume';
|
|
49
|
-
const luksFile = `/tmp/${luksName}`;
|
|
50
46
|
this.nest = this.settings.config.snapshot_dir;
|
|
51
47
|
this.dotMnt = `${this.nest}.mnt`;
|
|
52
48
|
this.dotOverlay = this.settings.work_dir;
|
|
53
49
|
this.dotLivefs = this.settings.work_dir.merged;
|
|
50
|
+
this.clone = clone;
|
|
51
|
+
this.homecrypt = homecrypt;
|
|
52
|
+
this.fullcrypt = fullcrypt;
|
|
53
|
+
// Crittografia
|
|
54
|
+
if (this.homecrypt || this.fullcrypt) {
|
|
55
|
+
if (this.homecrypt) {
|
|
56
|
+
this.luksName = 'home.img';
|
|
57
|
+
}
|
|
58
|
+
else if (this.fullcrypt) {
|
|
59
|
+
this.luksName = 'root.img';
|
|
60
|
+
}
|
|
61
|
+
this.luksUuid = '';
|
|
62
|
+
this.luksFile = `/tmp/${this.luksName}`;
|
|
63
|
+
this.luksMappedName = this.luksName;
|
|
64
|
+
this.luksMountpoint = `/tmp/mnt/${this.luksName}`;
|
|
65
|
+
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
66
|
+
this.luksPassword = '0'; // USARE UNA PASSWORD SICURA IN PRODUZIONE!
|
|
67
|
+
Utils.warning("You choose an encrypted eggs");
|
|
68
|
+
await this.luksGetPassword();
|
|
69
|
+
}
|
|
54
70
|
/**
|
|
55
71
|
* define kernel
|
|
56
72
|
*/
|
|
@@ -59,15 +75,9 @@ export async function produce(kernel = '', clone = false, cryptedclone = false,
|
|
|
59
75
|
const moduleDirs = fs.readdirSync('/lib/modules');
|
|
60
76
|
this.kernel = moduleDirs[0];
|
|
61
77
|
}
|
|
62
|
-
else if (this.familyId === 'archlinux') {
|
|
78
|
+
else if (this.familyId === 'archlinux') { // arch, manjaro
|
|
63
79
|
const moduleDirs = fs.readdirSync('/usr/lib/modules');
|
|
64
80
|
this.kernel = moduleDirs[0];
|
|
65
|
-
/**
|
|
66
|
-
* no need more
|
|
67
|
-
*/
|
|
68
|
-
if (Diversions.isManjaroBased(this.distroId)) {
|
|
69
|
-
// this.kernel += '-MANJARO'
|
|
70
|
-
}
|
|
71
81
|
}
|
|
72
82
|
else { // debian, fedora, openmamba, opensuse, voidlinux
|
|
73
83
|
let vmlinuz = path.basename(Utils.vmlinuz());
|
|
@@ -120,25 +130,22 @@ export async function produce(kernel = '', clone = false, cryptedclone = false,
|
|
|
120
130
|
const bleach = new Bleach();
|
|
121
131
|
await bleach.clean(verbose);
|
|
122
132
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
/**
|
|
134
|
+
* homecrypt/fullcrypt/clone/standard
|
|
135
|
+
*/
|
|
136
|
+
if (this.homecrypt) {
|
|
137
|
+
Utils.warning("eggs will SAVE users and users' data ENCRYPTED on the live (ISO)/live/home.img");
|
|
138
|
+
}
|
|
139
|
+
else if (this.fullcrypt) {
|
|
140
|
+
Utils.warning("eggs will SAVE full system ENCRYPTED on the live (ISO)/live/root.img");
|
|
128
141
|
}
|
|
129
142
|
else if (this.clone) {
|
|
130
|
-
/**
|
|
131
|
-
* clone
|
|
132
|
-
*/
|
|
133
143
|
this.settings.config.user_opt = 'live'; // patch for humans
|
|
134
144
|
this.settings.config.user_opt_passwd = 'evolution';
|
|
135
145
|
this.settings.config.root_passwd = 'evolution';
|
|
136
|
-
Utils.warning("eggs will SAVE users and users' data
|
|
146
|
+
Utils.warning("eggs will SAVE users and users' data on CLEAR on the live (ISO)/live/filesystem.squashfs");
|
|
137
147
|
}
|
|
138
148
|
else {
|
|
139
|
-
/**
|
|
140
|
-
* normal
|
|
141
|
-
*/
|
|
142
149
|
Utils.warning("eggs will REMOVE users and users' data from live");
|
|
143
150
|
}
|
|
144
151
|
/**
|
|
@@ -191,14 +198,12 @@ export async function produce(kernel = '', clone = false, cryptedclone = false,
|
|
|
191
198
|
*/
|
|
192
199
|
this.incubator = new Incubator(this.settings.remix, this.settings.distro, this.settings.config.user_opt, this.theme, this.clone, verbose);
|
|
193
200
|
await this.incubator.config(release);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
await this.syslinux(this.theme);
|
|
198
|
-
}
|
|
201
|
+
/**
|
|
202
|
+
* kernelCopu
|
|
203
|
+
*/
|
|
199
204
|
await this.kernelCopy();
|
|
200
205
|
/**
|
|
201
|
-
*
|
|
206
|
+
* initrd creation
|
|
202
207
|
*/
|
|
203
208
|
if (this.familyId === 'alpine') {
|
|
204
209
|
await this.initrdAlpine();
|
|
@@ -215,16 +220,13 @@ export async function produce(kernel = '', clone = false, cryptedclone = false,
|
|
|
215
220
|
this.familyId === 'voidlinux') {
|
|
216
221
|
await this.initrdDracut();
|
|
217
222
|
}
|
|
218
|
-
if (this.settings.config.make_efi) {
|
|
219
|
-
await this.makeEfi(this.theme);
|
|
220
|
-
}
|
|
221
223
|
await this.bindLiveFs();
|
|
222
224
|
// We run them just to have scripts
|
|
223
225
|
await this.bindVfs();
|
|
224
226
|
await this.ubindVfs();
|
|
225
227
|
if (!this.clone) {
|
|
226
228
|
/**
|
|
227
|
-
*
|
|
229
|
+
* SOLO per clone no per homecrypt, ne per fullcrypt
|
|
228
230
|
*/
|
|
229
231
|
await this.usersRemove();
|
|
230
232
|
await this.userCreateLive();
|
|
@@ -242,20 +244,46 @@ export async function produce(kernel = '', clone = false, cryptedclone = false,
|
|
|
242
244
|
this.cliAutologin.add(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);
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
|
-
await this.editLiveFs(clone
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
247
|
+
await this.editLiveFs(clone);
|
|
248
|
+
if (this.homecrypt) {
|
|
249
|
+
/**
|
|
250
|
+
* homecrypt: installa il supporto
|
|
251
|
+
*/
|
|
252
|
+
const squashfsRoot = this.settings.work_dir.merged;
|
|
253
|
+
const homeImgPath = this.distroLliveMediumPath + 'live/home.img';
|
|
254
|
+
this.installHomecryptSupport(squashfsRoot, homeImgPath);
|
|
253
255
|
}
|
|
254
|
-
await
|
|
255
|
-
|
|
256
|
-
|
|
256
|
+
mksquashfsCmd = await this.makeSquashfs(scriptOnly, includeRoot);
|
|
257
|
+
await this.uBindLiveFs(); // smonto tutto prima della fase di backup
|
|
258
|
+
}
|
|
259
|
+
if (homecrypt) {
|
|
260
|
+
await this.luksHome();
|
|
261
|
+
}
|
|
262
|
+
else if (fullcrypt) {
|
|
263
|
+
await this.luksRoot();
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* makeEfi and syslinux was moved
|
|
267
|
+
* after luksRoot
|
|
268
|
+
* to get luks.uuid
|
|
269
|
+
*/
|
|
270
|
+
if (this.settings.config.make_efi) {
|
|
271
|
+
await this.makeEfi(this.theme);
|
|
272
|
+
}
|
|
273
|
+
// need syslinux?
|
|
274
|
+
const arch = process.arch;
|
|
275
|
+
if (arch === 'ia32' || arch === 'x64') {
|
|
276
|
+
await this.syslinux(this.theme);
|
|
277
|
+
}
|
|
278
|
+
// add the bootstrapt filesystem.squashfs
|
|
279
|
+
if (fullcrypt) {
|
|
280
|
+
let bootstrapSfs = path.join(this.settings.iso_work, '/live/filesystem.squashfs');
|
|
281
|
+
/**
|
|
282
|
+
* escludo la costruzione di filesystem.squashfs
|
|
283
|
+
*/
|
|
284
|
+
// await this.createBootstrapFilesystem(bootstrapSfs)
|
|
257
285
|
}
|
|
258
|
-
const mkIsofsCmd = (await this.xorrisoCommand(clone,
|
|
286
|
+
const mkIsofsCmd = (await this.xorrisoCommand(clone, homecrypt, fullcrypt)).replaceAll(/\s\s+/g, ' ');
|
|
259
287
|
this.makeDotDisk(this.volid, mksquashfsCmd, mkIsofsCmd);
|
|
260
288
|
/**
|
|
261
289
|
* AntiX/MX LINUX
|
|
@@ -56,7 +56,7 @@ export async function syslinux(theme = 'eggs') {
|
|
|
56
56
|
Utils.warning('Cannot find: ' + isolinuxTemplate);
|
|
57
57
|
process.exit();
|
|
58
58
|
}
|
|
59
|
-
const kernel_parameters = Diversions.kernelParameters(this.familyId, this.volid);
|
|
59
|
+
const kernel_parameters = Diversions.kernelParameters(this.familyId, this.volid, this.luksUuid);
|
|
60
60
|
const template = fs.readFileSync(isolinuxTemplate, 'utf8');
|
|
61
61
|
const view = {
|
|
62
62
|
fullname: this.settings.remix.fullname.toUpperCase(),
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Ovary from '../ovary.js';
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
|
-
* @param
|
|
11
|
+
* @param fullcrypt
|
|
12
12
|
* @returns cmd 4 mkiso
|
|
13
13
|
*/
|
|
14
|
-
export declare function xorrisoCommand(this: Ovary, clone?: boolean,
|
|
14
|
+
export declare function xorrisoCommand(this: Ovary, clone?: boolean, homecrypt?: boolean, fullcrypt?: boolean): Promise<string>;
|
|
@@ -15,30 +15,32 @@ import Diversions from '../diversions.js';
|
|
|
15
15
|
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
|
-
* @param
|
|
18
|
+
* @param fullcrypt
|
|
19
19
|
* @returns cmd 4 mkiso
|
|
20
20
|
*/
|
|
21
|
-
export async function xorrisoCommand(clone = false,
|
|
22
|
-
if (this.verbose) {
|
|
23
|
-
console.log('Ovary: xorrisoCommand');
|
|
24
|
-
}
|
|
21
|
+
export async function xorrisoCommand(clone = false, homecrypt = false, fullcrypt = false) {
|
|
25
22
|
const prefix = this.settings.config.snapshot_prefix;
|
|
26
|
-
let typology = '';
|
|
27
23
|
// typology is applied only with standard egg-of
|
|
24
|
+
let typology = '';
|
|
28
25
|
if (prefix.slice(0, 7) === 'egg-of_') {
|
|
29
26
|
if (clone) {
|
|
30
27
|
typology = '_clone';
|
|
31
28
|
}
|
|
32
|
-
else if (
|
|
33
|
-
typology = '
|
|
29
|
+
else if (homecrypt) {
|
|
30
|
+
typology = '_clone-home-crypted';
|
|
31
|
+
}
|
|
32
|
+
else if (fullcrypt) {
|
|
33
|
+
// filesystem.squashfs.real
|
|
34
|
+
typology = '_clone-full-crypted';
|
|
34
35
|
}
|
|
35
36
|
if (fs.existsSync('/usr/bin/eui-start.sh')) {
|
|
36
37
|
typology += '_EUI';
|
|
37
38
|
}
|
|
38
39
|
}
|
|
40
|
+
// postfix (data)
|
|
39
41
|
const postfix = Utils.getPostfix();
|
|
40
42
|
this.settings.isoFilename = prefix + this.volid + '_' + Utils.uefiArch() + typology + postfix;
|
|
41
|
-
//
|
|
43
|
+
// node della ISO
|
|
42
44
|
const output = this.settings.config.snapshot_mnt + this.settings.isoFilename;
|
|
43
45
|
let command = '';
|
|
44
46
|
// const appid = `-appid "${this.settings.distro.distroId}" `
|
|
@@ -80,6 +82,22 @@ export async function xorrisoCommand(clone = false, cryptedclone = false) {
|
|
|
80
82
|
uefi_isohybridGptBasdat = '-isohybrid-gpt-basdat';
|
|
81
83
|
uefi_noEmulBoot = '-no-emul-boot';
|
|
82
84
|
}
|
|
85
|
+
// <<< INIZIO BLOCCO AGGIUNTO >>>
|
|
86
|
+
let luksPartitionParam = ''; // Inizializziamo la variabile per il parametro LUKS
|
|
87
|
+
if (fullcrypt) {
|
|
88
|
+
// Costruiamo il percorso del file luks.img all'interno della directory di build
|
|
89
|
+
const luksImagePath = path.join(this.settings.iso_work, 'live', this.luksName);
|
|
90
|
+
// Verifichiamo che il file esista prima di aggiungerlo
|
|
91
|
+
if (fs.existsSync(luksImagePath)) {
|
|
92
|
+
// Costruiamo il parametro per aggiungere la partizione 3
|
|
93
|
+
luksPartitionParam = `-append_partition 3 0x80 ${luksImagePath}`;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
Utils.warning(`Errore: impossibile creare l'ISO criptata, file non trovato: ${luksImagePath}`);
|
|
97
|
+
process.exit();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// <<< FINE BLOCCO AGGIUNTO >>>
|
|
83
101
|
command = `xorriso -as mkisofs \
|
|
84
102
|
-J \
|
|
85
103
|
-joliet-long \
|
|
@@ -99,25 +117,5 @@ export async function xorrisoCommand(clone = false, cryptedclone = false) {
|
|
|
99
117
|
${uefi_noEmulBoot} \
|
|
100
118
|
-o ${output} ${this.settings.iso_work}`;
|
|
101
119
|
}
|
|
102
|
-
else {
|
|
103
|
-
this.genisoimage = true;
|
|
104
|
-
command = `genisoimage \
|
|
105
|
-
-iso-level 3 \
|
|
106
|
-
-allow-limited-size \
|
|
107
|
-
-joliet-long \
|
|
108
|
-
-r \
|
|
109
|
-
-V ${this.volid} \
|
|
110
|
-
-cache-inodes \
|
|
111
|
-
-J \
|
|
112
|
-
-l \
|
|
113
|
-
-b isolinux/isolinux.bin \
|
|
114
|
-
-c isolinux/boot.cat \
|
|
115
|
-
-no-emul-boot \
|
|
116
|
-
-boot-load-size 4 \
|
|
117
|
-
-boot-info-table \
|
|
118
|
-
-eltorito-alt-boot \
|
|
119
|
-
-e boot/grub/efi.img \
|
|
120
|
-
-o ${output} ${this.settings.iso_work}`;
|
|
121
|
-
}
|
|
122
120
|
return command;
|
|
123
121
|
}
|