penguins-eggs 25.11.29 → 25.12.15
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/README.md +118 -127
- package/README.pdf +10950 -11893
- package/addons/eggs/theme/livecd/simple.grub.main.cfg +3 -3
- package/conf/derivatives.yaml +2 -1
- package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
- package/conf/distros/focal/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
- package/conf/distros/noble/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
- package/conf/distros/noble/calamares/libexec/calamares-l10n-helper.sh +2 -1
- package/conf/distros/noble/calamares/settings.yml +1 -0
- package/conf/distros/trixie/calamares/calamares-modules/cleanup/cleanup.sh +1 -1
- package/conf/exclude.list.d/var.list +11 -6
- package/dist/appimage/dependency-manager.js +1 -1
- package/dist/classes/cli-autologin.d.ts +37 -4
- package/dist/classes/cli-autologin.js +153 -115
- package/dist/classes/compressors.d.ts +7 -10
- package/dist/classes/compressors.js +44 -31
- package/dist/classes/daddy.js +4 -1
- package/dist/classes/distro.js +2 -2
- package/dist/classes/diversions.js +2 -3
- package/dist/classes/incubation/fisherman-helper/initcpio.d.ts +3 -5
- package/dist/classes/incubation/fisherman-helper/initcpio.js +28 -20
- package/dist/classes/incubation/fisherman-helper/settings.js +1 -1
- package/dist/classes/incubation/fisherman.js +1 -1
- package/dist/classes/incubation/incubator.d/manjaro.js +1 -0
- package/dist/classes/incubation/incubator.js +1 -1
- package/dist/classes/ovary.d/create-xdg-autostart.js +1 -1
- package/dist/classes/ovary.d/edit-live-fs.d.ts +2 -13
- package/dist/classes/ovary.d/edit-live-fs.js +33 -146
- package/dist/classes/ovary.d/fertilization.js +1 -1
- package/dist/classes/ovary.d/luks-home.js +33 -19
- package/dist/classes/ovary.d/luks-root.d.ts +1 -2
- package/dist/classes/ovary.d/luks-root.js +46 -27
- package/dist/classes/ovary.d/luks-shrink.d.ts +14 -0
- package/dist/classes/ovary.d/luks-shrink.js +86 -0
- package/dist/classes/ovary.d/make-dot-disk.js +1 -1
- package/dist/classes/ovary.d/produce.js +64 -22
- package/dist/classes/ovary.d/user-create-live.d.ts +4 -10
- package/dist/classes/ovary.d/user-create-live.js +82 -84
- package/dist/classes/ovary.d/users-remove.d.ts +5 -6
- package/dist/classes/ovary.d/users-remove.js +61 -31
- package/dist/classes/ovary.d.ts +5 -3
- package/dist/classes/ovary.js +5 -3
- package/dist/classes/pacman.d/alpine.js +2 -2
- package/dist/classes/pacman.d/archlinux.js +2 -2
- package/dist/classes/pacman.d/debian.js +2 -3
- package/dist/classes/pacman.d/fedora.js +2 -3
- package/dist/classes/pacman.d/openmamba.js +2 -3
- package/dist/classes/pacman.d/opensuse.js +2 -3
- package/dist/classes/pacman.d.ts +0 -5
- package/dist/classes/pacman.js +3 -16
- package/dist/classes/pve-live.js +1 -1
- package/dist/classes/settings.js +1 -1
- package/dist/classes/sys-users.d.ts +76 -0
- package/dist/classes/sys-users.js +206 -0
- package/dist/classes/utils.d/kernel.js +3 -3
- package/dist/classes/utils.d.ts +15 -6
- package/dist/classes/utils.js +80 -47
- package/dist/classes/xdg.js +1 -1
- package/dist/classes/yolk.js +3 -5
- package/dist/commands/export/appimage.js +3 -3
- package/dist/commands/export/pkg.js +3 -3
- package/dist/commands/export/tarballs.js +3 -3
- package/dist/commands/krill.js +1 -1
- package/dist/commands/produce.js +14 -5
- package/dist/commands/setup/install.js +1 -1
- package/dist/commands/setup/purge.js +1 -1
- package/dist/commands/tools/yolk.js +1 -1
- package/dist/commands/update.js +1 -2
- package/dist/interfaces/calamares/i-calamares-branding.d.ts +56 -38
- package/dist/interfaces/calamares/i-calamares-branding.js +10 -0
- package/dist/interfaces/i-exec.d.ts +1 -0
- package/dist/krill/classes/prepare.d/location.js +1 -1
- package/dist/krill/classes/prepare.d/partitions.js +1 -1
- package/dist/krill/classes/prepare.d/users.js +2 -2
- package/dist/krill/classes/prepare.js +5 -5
- package/dist/krill/classes/sequence.d/add_user.d.ts +3 -15
- package/dist/krill/classes/sequence.d/add_user.js +87 -57
- package/dist/krill/classes/sequence.d/change_password.d.ts +5 -7
- package/dist/krill/classes/sequence.d/change_password.js +25 -10
- package/dist/krill/classes/sequence.d/del_live_user.d.ts +5 -7
- package/dist/krill/classes/sequence.d/del_live_user.js +39 -25
- package/dist/krill/classes/sequence.d/fstab.js +2 -2
- package/dist/krill/classes/sequence.d/grubcfg.d.ts +3 -7
- package/dist/krill/classes/sequence.d/grubcfg.js +33 -13
- package/dist/krill/classes/sequence.d/mkfs.js +2 -3
- package/dist/krill/classes/sequence.d/unpackfs.d.ts +2 -4
- package/dist/krill/classes/sequence.d/unpackfs.js +8 -5
- package/dist/krill/classes/sequence.d.ts +1 -5
- package/dist/krill/classes/sequence.js +28 -32
- package/dist/krill/components/finished.js +2 -2
- package/dist/krill/components/install.js +2 -2
- package/dist/krill/components/keyboard.js +2 -2
- package/dist/krill/components/location.js +2 -2
- package/dist/krill/components/network.js +2 -2
- package/dist/krill/components/partitions.js +2 -2
- package/dist/krill/components/summary.js +2 -2
- package/dist/krill/components/title.js +2 -2
- package/dist/krill/components/users.js +2 -2
- package/dist/krill/components/welcome.js +2 -2
- package/dist/krill/lib/select_installation_device.js +1 -1
- package/dist/krill/lib/select_replaced_partition.js +1 -1
- package/dist/lib/utils.d.ts +52 -19
- package/dist/lib/utils.js +271 -20
- package/manpages/doc/man/eggs.1.gz +0 -0
- package/manpages/doc/man/eggs.html +8 -8
- package/package.json +9 -9
- package/perrisbrewery/template/dependencies.yaml +1 -0
- package/scripts/boot-encrypted-root.sh +220 -0
- package/scripts/mount-encrypted-home.sh +324 -0
- package/scripts/restore_homecrypt_krill.sh +93 -0
- package/dracut/create-symlink +0 -71
- package/dracut/dracut-log.txt +0 -3
- package/dracut/export +0 -4
- package/dracut/export-dracut-analysis +0 -51
- package/dracut/export-dracut-log +0 -2
- package/dracut/mkisofs +0 -10
- package/dracut/renew-initramfs +0 -17
- package/dracut/sbin2bin +0 -10
- package/dracut/update-dracut-conf-d +0 -2
- package/dracut/update-dracut-modules +0 -62
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ./src/classes/compressors.ts
|
|
3
|
-
* penguins-eggs v.25.
|
|
3
|
+
* penguins-eggs v.25.11.x / ecmascript 2020
|
|
4
4
|
* author: Piero Proietti
|
|
5
5
|
* email: piero.proietti@gmail.com
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import { execSync } from '../lib/utils.js'; // Assicurati che il path sia corretto
|
|
9
10
|
export default class Compressors {
|
|
10
11
|
dest = '/tmp/eggs-mksquash-dest';
|
|
12
|
+
source = '/tmp/eggs-mksquash-test';
|
|
11
13
|
isEnabled = {
|
|
12
14
|
error: false,
|
|
13
15
|
gzip: true,
|
|
@@ -17,10 +19,8 @@ export default class Compressors {
|
|
|
17
19
|
xz: false,
|
|
18
20
|
zstd: false
|
|
19
21
|
};
|
|
20
|
-
source = '/tmp/eggs-mksquash-test';
|
|
21
22
|
/**
|
|
22
23
|
* fast compression
|
|
23
|
-
* @returns
|
|
24
24
|
*/
|
|
25
25
|
fast() {
|
|
26
26
|
let comp = 'gzip';
|
|
@@ -34,7 +34,6 @@ export default class Compressors {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* max
|
|
37
|
-
* @returns
|
|
38
37
|
*/
|
|
39
38
|
max() {
|
|
40
39
|
let filter = 'x86';
|
|
@@ -42,9 +41,7 @@ export default class Compressors {
|
|
|
42
41
|
filter = 'arm';
|
|
43
42
|
}
|
|
44
43
|
const options = '-b 1M -no-duplicates -no-recovery -always-use-fragments';
|
|
45
|
-
if (process.arch === 'ia32') {
|
|
46
|
-
// options = '-b 1M'
|
|
47
|
-
}
|
|
44
|
+
// if (process.arch === 'ia32') { options = '-b 1M' }
|
|
48
45
|
const comp = `xz -Xbcj ${filter} ${options}`;
|
|
49
46
|
return comp;
|
|
50
47
|
}
|
|
@@ -60,50 +57,66 @@ export default class Compressors {
|
|
|
60
57
|
}
|
|
61
58
|
/**
|
|
62
59
|
* populate
|
|
60
|
+
* Manteniamo async per compatibilità con chi lo chiama,
|
|
61
|
+
* ma internamente ora è tutto sincrono e veloce.
|
|
63
62
|
*/
|
|
64
63
|
async populate() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.isEnabled.
|
|
68
|
-
this.isEnabled.
|
|
69
|
-
this.isEnabled.
|
|
70
|
-
this.isEnabled.
|
|
71
|
-
this.isEnabled.
|
|
72
|
-
|
|
64
|
+
this.prepareCheck();
|
|
65
|
+
// Non serve await perché check ora è sincrono
|
|
66
|
+
this.isEnabled.error = this.check('error');
|
|
67
|
+
this.isEnabled.lzma = this.check('lzma');
|
|
68
|
+
this.isEnabled.lzo = this.check('lzo');
|
|
69
|
+
this.isEnabled.lz4 = this.check('lz4');
|
|
70
|
+
this.isEnabled.xz = this.check('xz');
|
|
71
|
+
this.isEnabled.zstd = this.check('zstd');
|
|
72
|
+
this.removeCheck();
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* standard
|
|
76
|
-
* @returns
|
|
77
76
|
*/
|
|
78
77
|
standard() {
|
|
79
78
|
const comp = 'xz -b 1M';
|
|
80
79
|
return comp;
|
|
81
80
|
}
|
|
82
81
|
/**
|
|
83
|
-
* check mksquashfs exists
|
|
84
|
-
* @param compressor
|
|
85
|
-
* @returns
|
|
82
|
+
* check mksquashfs exists and supports compressor
|
|
86
83
|
*/
|
|
87
|
-
|
|
84
|
+
check(compressor) {
|
|
88
85
|
let result = false;
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
try {
|
|
87
|
+
// ignore: true silenzia output (stdio='ignore')
|
|
88
|
+
// Se mksquashfs fallisce (exit code != 0), execSync lancia un errore
|
|
89
|
+
execSync(`mksquashfs ${this.source} ${this.dest} -comp ${compressor} -no-xattrs -ef ${this.dest}`, { ignore: true });
|
|
91
90
|
result = true;
|
|
92
91
|
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
// Fallito (comando non trovato o compressore non supportato)
|
|
94
|
+
result = false;
|
|
95
|
+
}
|
|
93
96
|
return result;
|
|
94
97
|
}
|
|
95
98
|
/**
|
|
96
|
-
* prepareCheck
|
|
99
|
+
* prepareCheck: Usa FS nativo invece di shelljs
|
|
97
100
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
prepareCheck() {
|
|
102
|
+
// rm -rf
|
|
103
|
+
if (fs.existsSync(this.source)) {
|
|
104
|
+
fs.rmSync(this.source, { recursive: true, force: true });
|
|
105
|
+
}
|
|
106
|
+
// mkdir -p
|
|
107
|
+
fs.mkdirSync(this.source, { recursive: true });
|
|
101
108
|
}
|
|
102
109
|
/**
|
|
103
|
-
* removeCheck
|
|
110
|
+
* removeCheck: Usa FS nativo invece di shelljs
|
|
104
111
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
112
|
+
removeCheck() {
|
|
113
|
+
// rm -rf source
|
|
114
|
+
if (fs.existsSync(this.source)) {
|
|
115
|
+
fs.rmSync(this.source, { recursive: true, force: true });
|
|
116
|
+
}
|
|
117
|
+
// rm -f dest
|
|
118
|
+
if (fs.existsSync(this.dest)) {
|
|
119
|
+
fs.rmSync(this.dest, { recursive: true, force: true });
|
|
120
|
+
}
|
|
108
121
|
}
|
|
109
122
|
}
|
package/dist/classes/daddy.js
CHANGED
|
@@ -82,10 +82,13 @@ export default class Daddy {
|
|
|
82
82
|
default: compressionOpt,
|
|
83
83
|
},
|
|
84
84
|
];
|
|
85
|
+
// occorre aggiungere ad answer
|
|
86
|
+
// i campi mancanti
|
|
85
87
|
try {
|
|
86
88
|
// Prompt the user and return the typed config object
|
|
87
89
|
const answers = await inquirer.prompt(questions);
|
|
88
|
-
return answers;
|
|
90
|
+
return { ...config, ...answers };
|
|
91
|
+
//return answers;
|
|
89
92
|
}
|
|
90
93
|
catch (err) {
|
|
91
94
|
console.error(chalk.red('Error editing configuration:'), err);
|
package/dist/classes/distro.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import yaml from 'js-yaml';
|
|
9
9
|
import fs from 'node:fs';
|
|
10
10
|
import path from 'node:path';
|
|
11
|
-
import
|
|
11
|
+
import { shx } from '../lib/utils.js';
|
|
12
12
|
import Utils from './utils.js';
|
|
13
13
|
import Diversions from './diversions.js';
|
|
14
14
|
// _dirname
|
|
@@ -316,7 +316,7 @@ class Distro {
|
|
|
316
316
|
if (Diversions.isManjaroBased(this.distroId)) {
|
|
317
317
|
this.liveMediumPath = '/run/miso/bootmnt/';
|
|
318
318
|
this.squashfs = 'manjaro/x86_64/livefs.sfs';
|
|
319
|
-
this.codenameId =
|
|
319
|
+
this.codenameId = shx.exec(`lsb_release -cs`, { silent: true }).stdout.toString().trim();
|
|
320
320
|
this.distroUniqueId = 'manjaro';
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -68,7 +68,7 @@ export default class Diversions {
|
|
|
68
68
|
break;
|
|
69
69
|
case 'fedora':
|
|
70
70
|
case 'openmamba':
|
|
71
|
-
kp += `root=live:CDLABEL=${volid} rd.live.image rd.live.dir=/live rd.live.squashimg=filesystem.squashfs
|
|
71
|
+
kp += `root=live:CDLABEL=${volid} rd.live.image rd.live.dir=/live rd.live.squashimg=filesystem.squashfs enforcing=0`;
|
|
72
72
|
break;
|
|
73
73
|
case 'opensuse':
|
|
74
74
|
kp += `root=live:CDLABEL=${volid} rd.live.image rd.live.dir=/live rd.live.squashimg=filesystem.squashfs apparmor=0`;
|
|
@@ -104,8 +104,7 @@ export default class Diversions {
|
|
|
104
104
|
let pathBootloaders = '/usr/lib/';
|
|
105
105
|
if (familyId !== "debian") {
|
|
106
106
|
if (Utils.isAppImage()) {
|
|
107
|
-
|
|
108
|
-
pathBootloaders = appImagePath;
|
|
107
|
+
pathBootloaders = path.join(__dirname, '..', '..', 'bootloaders/');
|
|
109
108
|
}
|
|
110
109
|
else {
|
|
111
110
|
pathBootloaders = '/usr/lib/penguins-eggs/bootloaders/';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* email: piero.proietti@gmail.com
|
|
6
|
-
* license: MIT
|
|
2
|
+
* Cerca il file .preset per mkinitcpio appropriato per il kernel corrente.
|
|
3
|
+
* @returns Il percorso del file .preset trovato.
|
|
4
|
+
* @throws {Error} Se non è possibile trovare un file .preset valido.
|
|
7
5
|
*/
|
|
8
6
|
export declare function initcpio(): Promise<string>;
|
|
@@ -5,31 +5,43 @@
|
|
|
5
5
|
* email: piero.proietti@gmail.com
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
|
-
import { exec } from '
|
|
9
|
-
import { promisify } from 'util';
|
|
8
|
+
import { exec } from '../../../lib/utils.js';
|
|
10
9
|
import { access } from 'fs/promises';
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Cerca il file .preset per mkinitcpio appropriato per il kernel corrente.
|
|
12
|
+
* @returns Il percorso del file .preset trovato.
|
|
13
|
+
* @throws {Error} Se non è possibile trovare un file .preset valido.
|
|
14
|
+
*/
|
|
12
15
|
export async function initcpio() {
|
|
13
16
|
try {
|
|
14
|
-
const
|
|
17
|
+
const kernelVersion = (await exec('uname -r', { capture: true })).data;
|
|
15
18
|
const version = kernelVersion.trim();
|
|
16
|
-
// Manjaro
|
|
19
|
+
// Logica Manjaro
|
|
17
20
|
if (version.includes('MANJARO')) {
|
|
18
21
|
try {
|
|
19
|
-
// Estrai major e minor version. Es: da "6.12.48-1-MANJARO" -> ["6", "12", "48-1-MANJARO"]
|
|
20
22
|
const parts = version.split('.');
|
|
21
|
-
// Costruisci il nome del preset come "linux" + "6" + "12" -> "linux612"
|
|
22
23
|
const kernelName = `linux${parts[0]}${parts[1]}`;
|
|
24
|
+
// Tentativo 1: Major/Minor (es. /etc/mkinitcpio.d/linux61.preset)
|
|
23
25
|
const manjaroPreset = `/etc/mkinitcpio.d/${kernelName}.preset`;
|
|
24
|
-
await access(manjaroPreset);
|
|
25
|
-
return manjaroPreset;
|
|
26
|
+
await access(manjaroPreset);
|
|
27
|
+
return manjaroPreset;
|
|
26
28
|
}
|
|
27
|
-
catch {
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
catch (e) {
|
|
30
|
+
try {
|
|
31
|
+
const parts = version.split('.');
|
|
32
|
+
const kernelName = `linux${parts[0]}${parts[1]}`;
|
|
33
|
+
// Tentativo 2: Major/Minor con Architettura (es. /etc/mkinitcpio.d/linux61-x86_64.preset)
|
|
34
|
+
const manjaroPresetArch = `/etc/mkinitcpio.d/${kernelName}-x86_64.preset`;
|
|
35
|
+
await access(manjaroPresetArch);
|
|
36
|
+
return manjaroPresetArch;
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
// Fallito, si procede al FALLBACK ARCH
|
|
40
|
+
}
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
else if (version.includes('cachyos')) {
|
|
44
|
+
// Logica CachyOS
|
|
33
45
|
try {
|
|
34
46
|
let kernelType = 'linux-cachyos'; // default
|
|
35
47
|
if (version.includes('lts')) {
|
|
@@ -46,14 +58,10 @@ export async function initcpio() {
|
|
|
46
58
|
return cachyPreset;
|
|
47
59
|
}
|
|
48
60
|
catch {
|
|
49
|
-
//
|
|
50
|
-
// console.warn('Logica Manjaro fallita, si tenta il fallback per Arch...');
|
|
61
|
+
// Fallito, si procede al fallback Arch
|
|
51
62
|
}
|
|
52
63
|
}
|
|
53
|
-
|
|
54
|
-
* FALLBACK ARCH
|
|
55
|
-
*/
|
|
56
|
-
// Determina il tipo di kernel
|
|
64
|
+
// FALLBACK ARCH
|
|
57
65
|
let kernelType = 'linux'; // default
|
|
58
66
|
if (version.includes('lts')) {
|
|
59
67
|
kernelType = 'linux-lts';
|
|
@@ -70,7 +78,7 @@ export async function initcpio() {
|
|
|
70
78
|
return archPreset;
|
|
71
79
|
}
|
|
72
80
|
catch (error) {
|
|
73
|
-
//
|
|
74
|
-
throw new Error(`Impossibile trovare un file .preset valido in /etc/mkinitcpio.d
|
|
81
|
+
// Lancia un errore se tutti i tentativi falliscono.
|
|
82
|
+
throw new Error(`Impossibile trovare un file .preset valido in /etc/mkinitcpio.d/.`);
|
|
75
83
|
}
|
|
76
84
|
}
|
|
@@ -9,7 +9,7 @@ import chalk from 'chalk';
|
|
|
9
9
|
import mustache from 'mustache';
|
|
10
10
|
import fs from 'node:fs';
|
|
11
11
|
import path from 'node:path';
|
|
12
|
-
import shx from '
|
|
12
|
+
import { shx } from '../../lib/utils.js';
|
|
13
13
|
import yaml from 'js-yaml';
|
|
14
14
|
import { exec } from '../../lib/utils.js';
|
|
15
15
|
import { settings } from './fisherman-helper/settings.js';
|
|
@@ -13,7 +13,7 @@ const pjson = require('../../../package.json');
|
|
|
13
13
|
import yaml from 'js-yaml';
|
|
14
14
|
import fs from 'node:fs';
|
|
15
15
|
import path from 'node:path';
|
|
16
|
-
import shx from '
|
|
16
|
+
import { shx } from '../../lib/utils.js';
|
|
17
17
|
import Pacman from '../pacman.js';
|
|
18
18
|
import Utils from '../utils.js';
|
|
19
19
|
import { installer } from './installer.js';
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ./src/classes/ovary.d/edit-live-fs.ts
|
|
3
|
-
* penguins-eggs v.25.
|
|
3
|
+
* penguins-eggs v.25.12.5 / ecmascript 2020
|
|
4
4
|
* author: Piero Proietti
|
|
5
5
|
* email: piero.proietti@gmail.com
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
8
|
import Ovary from '../ovary.js';
|
|
9
|
-
|
|
10
|
-
* editLiveFs
|
|
11
|
-
* - Mark if is_clone or is_clone_crypted
|
|
12
|
-
* - Truncate logs, remove archived log
|
|
13
|
-
* - Allow all fixed drives to be mounted with pmount
|
|
14
|
-
* - Enable or disable password login trhough ssh for users (not root)
|
|
15
|
-
* - Create an empty /etc/fstab
|
|
16
|
-
* - Blanck /etc/machine-id
|
|
17
|
-
* - Add some basic files to /dev
|
|
18
|
-
* - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
|
|
19
|
-
*/
|
|
20
|
-
export declare function editLiveFs(this: Ovary, clone?: boolean): Promise<void>;
|
|
9
|
+
export declare function editLiveFs(this: Ovary): Promise<void>;
|
|
@@ -1,84 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ./src/classes/ovary.d/edit-live-fs.ts
|
|
3
|
-
* penguins-eggs v.25.
|
|
3
|
+
* penguins-eggs v.25.12.5 / ecmascript 2020
|
|
4
4
|
* author: Piero Proietti
|
|
5
5
|
* email: piero.proietti@gmail.com
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
|
-
// packages
|
|
9
8
|
import fs from 'fs';
|
|
10
9
|
import os from 'os';
|
|
11
10
|
import path from 'node:path';
|
|
12
|
-
import shx from '
|
|
11
|
+
import { shx } from '../../lib/utils.js';
|
|
13
12
|
import Utils from '../utils.js';
|
|
14
13
|
import Pacman from '../pacman.js';
|
|
15
14
|
import Systemctl from '../systemctl.js';
|
|
16
15
|
import { exec } from '../../lib/utils.js';
|
|
17
16
|
// _dirname
|
|
18
17
|
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* - Mark if is_clone or is_clone_crypted
|
|
22
|
-
* - Truncate logs, remove archived log
|
|
23
|
-
* - Allow all fixed drives to be mounted with pmount
|
|
24
|
-
* - Enable or disable password login trhough ssh for users (not root)
|
|
25
|
-
* - Create an empty /etc/fstab
|
|
26
|
-
* - Blanck /etc/machine-id
|
|
27
|
-
* - Add some basic files to /dev
|
|
28
|
-
* - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
|
|
29
|
-
*/
|
|
30
|
-
export async function editLiveFs(clone = false) {
|
|
31
|
-
if (this.verbose) {
|
|
18
|
+
export async function editLiveFs() {
|
|
19
|
+
if (this.verbose)
|
|
32
20
|
console.log('Ovary: editLiveFs');
|
|
33
|
-
}
|
|
34
21
|
const workDir = this.settings.work_dir.merged;
|
|
35
|
-
|
|
36
|
-
* /etc/penguins-eggs.d/is_clone file created on live
|
|
37
|
-
*/
|
|
38
|
-
if (clone) {
|
|
22
|
+
if (this.clone || this.homecrypt || this.fullcrypt) {
|
|
39
23
|
await exec(`touch ${workDir}/etc/penguins-eggs.d/is_clone`, this.echo);
|
|
40
24
|
}
|
|
41
|
-
/**
|
|
42
|
-
* /etc/default/epoptes-client created on live
|
|
43
|
-
*/
|
|
44
25
|
if (Pacman.packageIsInstalled('epoptes')) {
|
|
45
26
|
const file = `${workDir}/etc/default/epoptes-client`;
|
|
46
27
|
const text = `SERVER=${os.hostname}.local\n`;
|
|
47
28
|
fs.writeFileSync(file, text);
|
|
48
29
|
}
|
|
49
30
|
if (this.familyId === 'debian') {
|
|
50
|
-
// Aggiungo UMASK=0077 in /etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf
|
|
51
31
|
const text = 'UMASK=0077\n';
|
|
52
32
|
const file = '/etc/initramfs-tools/conf.d/eggs-safe-initramfs.conf';
|
|
53
33
|
Utils.write(file, text);
|
|
54
34
|
}
|
|
55
|
-
// Truncate logs
|
|
35
|
+
// Truncate logs
|
|
56
36
|
let cmd = `find ${workDir}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
|
|
57
37
|
await exec(cmd, this.echo);
|
|
58
38
|
cmd = `find ${workDir}/var/log/ -type f -exec truncate -s 0 {} \\;`;
|
|
59
39
|
await exec(cmd, this.echo);
|
|
60
|
-
//
|
|
61
|
-
// FIX STRUTTURALE PER DEVUAN/DEBIAN (/var folders)
|
|
62
|
-
// =========================================================================
|
|
63
|
-
// Ricrea le directory essenziali che potrebbero essere state rimosse
|
|
64
|
-
// o che devono esistere vuote per il corretto avvio dei servizi.
|
|
65
|
-
const dirsToCreate = [
|
|
66
|
-
`${workDir}/var/lib/dbus`, // Fondamentale per dbus
|
|
67
|
-
`${workDir}/var/spool/rsyslog`, // Fondamentale per rsyslog
|
|
68
|
-
`${workDir}/var/spool/cron/crontabs` // Fondamentale per cron
|
|
69
|
-
];
|
|
70
|
-
for (const dir of dirsToCreate) {
|
|
71
|
-
if (!fs.existsSync(dir)) {
|
|
72
|
-
await exec(`mkdir -p ${dir}`, this.echo);
|
|
73
|
-
// Assicuriamo permessi corretti (dbus vuole 755 root:root di base)
|
|
74
|
-
await exec(`chmod 755 ${dir}`, this.echo);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// =========================================================================
|
|
78
|
-
// FIX CRITICO PER /var/run e /var/lock
|
|
79
|
-
// =========================================================================
|
|
80
|
-
// Su Debian/Devuan moderni, /var/run DEVE essere un symlink a /run.
|
|
81
|
-
// Se rsync lo ha copiato come directory, D-Bus e altri servizi falliscono.
|
|
40
|
+
// Fix Symlinks /var/run e /var/lock
|
|
82
41
|
const varRun = `${workDir}/var/run`;
|
|
83
42
|
if (fs.existsSync(varRun) && !fs.lstatSync(varRun).isSymbolicLink()) {
|
|
84
43
|
if (this.verbose)
|
|
@@ -93,20 +52,14 @@ export async function editLiveFs(clone = false) {
|
|
|
93
52
|
await exec(`rm -rf ${varLock}`, this.echo);
|
|
94
53
|
await exec(`ln -s /run/lock ${varLock}`, this.echo);
|
|
95
54
|
}
|
|
96
|
-
//
|
|
97
|
-
// Allow all fixed drives to be mounted with pmount
|
|
55
|
+
// Altri fix standard
|
|
98
56
|
if (this.settings.config.pmount_fixed && fs.existsSync(`${workDir}/etc/pmount.allow`)) {
|
|
99
|
-
// MX aggiunto /etc
|
|
100
57
|
await exec(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${workDir}/etc/pmount.allow`, this.echo);
|
|
101
58
|
}
|
|
102
|
-
// Remove obsolete live-config file
|
|
103
59
|
if (fs.existsSync(`${workDir}lib/live/config/1161-openssh-server`)) {
|
|
104
60
|
await exec(`rm -f ${workDir}/lib/live/config/1161-openssh-server`, this.echo);
|
|
105
61
|
}
|
|
106
62
|
if (fs.existsSync(`${workDir}/etc/ssh/sshd_config`)) {
|
|
107
|
-
/**
|
|
108
|
-
* enable/disable SSH root/users password login
|
|
109
|
-
*/
|
|
110
63
|
await exec(`sed -i '/PermitRootLogin/d' ${workDir}/etc/ssh/sshd_config`);
|
|
111
64
|
await exec(`sed -i '/PasswordAuthentication/d' ${workDir}/etc/ssh/sshd_config`);
|
|
112
65
|
if (this.settings.config.ssh_pass) {
|
|
@@ -117,111 +70,57 @@ export async function editLiveFs(clone = false) {
|
|
|
117
70
|
await exec(`echo 'PasswordAuthentication no' | tee -a ${workDir}/etc/ssh/sshd_config`, this.echo);
|
|
118
71
|
}
|
|
119
72
|
}
|
|
120
|
-
/**
|
|
121
|
-
* /etc/fstab should exist, even if it's empty,
|
|
122
|
-
* to prevent error messages at boot
|
|
123
|
-
*/
|
|
124
73
|
await exec(`rm ${workDir}/etc/fstab`, this.echo);
|
|
125
74
|
await exec(`touch ${workDir}/etc/fstab`, this.echo);
|
|
126
|
-
/**
|
|
127
|
-
* Remove crypttab if exists
|
|
128
|
-
* this is crucial for tpm systems.
|
|
129
|
-
*/
|
|
130
75
|
if (fs.existsSync(`${workDir}/etc/crypttab`)) {
|
|
131
76
|
await exec(`rm ${workDir}/etc/crypttab`, this.echo);
|
|
132
77
|
}
|
|
133
|
-
// =========================================================================
|
|
134
|
-
// FIX MACHINE-ID (Il colpevole del blocco SysVinit)
|
|
135
|
-
// =========================================================================
|
|
136
78
|
/**
|
|
137
|
-
*
|
|
138
|
-
* SU SYSTEMD: File vuoto = rigenerazione.
|
|
139
|
-
* SU SYSVINIT (Devuan): File NON deve esistere o deve essere 0 bytes.
|
|
79
|
+
* machine-id
|
|
140
80
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
await exec(`rm ${workDir}/var/lib/dbus/machine-id`, this.echo);
|
|
81
|
+
await exec(`rm -f ${workDir}/etc/machine-id`);
|
|
82
|
+
await exec(`rm -f ${workDir}/var/lib/dbus/machine-id`);
|
|
83
|
+
if (Utils.isSysvinit()) {
|
|
84
|
+
await exec(`chroot ${workDir} dbus-uuidgen --ensure=/etc/machine-id`);
|
|
85
|
+
await exec(`ln -sf /etc/machine-id ${workDir}/var/lib/dbus/machine-id`);
|
|
86
|
+
// const machineId = crypto.randomBytes(16).toString('hex')
|
|
87
|
+
// fs.writeFileSync(`${workDir}/etc/machine-id`, machineId + '\n')
|
|
88
|
+
// fs.writeFileSync(`${workDir}/var/lib/dbus/machine-id`, machineId + '\n')
|
|
89
|
+
}
|
|
90
|
+
else if (Utils.isSystemd()) {
|
|
91
|
+
await exec(`touch ${workDir}/etc/machine-id`);
|
|
153
92
|
}
|
|
154
|
-
// =========================================================================
|
|
155
|
-
/**
|
|
156
|
-
* LMDE4: utilizza UbuntuMono16.pf2
|
|
157
|
-
* aggiungo un link a /boot/grub/fonts/UbuntuMono16.pf2
|
|
158
|
-
*/
|
|
159
93
|
if (fs.existsSync(`${workDir}/boot/grub/fonts/unicode.pf2`)) {
|
|
160
94
|
shx.cp(`${workDir}/boot/grub/fonts/unicode.pf2`, `${workDir}/boot/grub/fonts/UbuntuMono16.pf2`);
|
|
161
95
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*/
|
|
165
|
-
const resolvFile = `${workDir}/etc/resolv.conf`;
|
|
166
|
-
shx.rm(resolvFile);
|
|
167
|
-
/**
|
|
168
|
-
* Per tutte le distro systemd
|
|
169
|
-
*/
|
|
96
|
+
shx.rm(`${workDir}/etc/resolv.conf`);
|
|
97
|
+
// Systemd cleanup
|
|
170
98
|
if (Utils.isSystemd()) {
|
|
171
99
|
const systemdctl = new Systemctl(this.verbose);
|
|
172
|
-
|
|
173
|
-
* Arch: /ci/minimal/arch-minimal.sh:
|
|
174
|
-
* systemctl set-default multi-user.target
|
|
175
|
-
* systemctl enable getty@tty1.service
|
|
176
|
-
* systemctl enable systemd-networkd.service
|
|
177
|
-
* systemctl enable 'systemd-resolved.service
|
|
178
|
-
*/
|
|
179
|
-
if (await systemdctl.isEnabled('remote-cryptsetup.target')) {
|
|
100
|
+
if (await systemdctl.isEnabled('remote-cryptsetup.target'))
|
|
180
101
|
await systemdctl.disable('remote-cryptsetup.target', workDir, true);
|
|
181
|
-
|
|
182
|
-
if (await systemdctl.isEnabled('speech-dispatcherd.service')) {
|
|
102
|
+
if (await systemdctl.isEnabled('speech-dispatcherd.service'))
|
|
183
103
|
await systemdctl.disable('speech-dispatcherd.service', workDir, true);
|
|
184
|
-
|
|
185
|
-
if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service')) {
|
|
104
|
+
if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service'))
|
|
186
105
|
await systemdctl.disable('wpa_supplicant-nl80211@.service', workDir, true);
|
|
187
|
-
|
|
188
|
-
if (await systemdctl.isEnabled('wpa_supplicant@.service')) {
|
|
106
|
+
if (await systemdctl.isEnabled('wpa_supplicant@.service'))
|
|
189
107
|
await systemdctl.disable('wpa_supplicant@.service', workDir, true);
|
|
190
|
-
|
|
191
|
-
if (await systemdctl.isEnabled('wpa_supplicant-wired@.service')) {
|
|
108
|
+
if (await systemdctl.isEnabled('wpa_supplicant-wired@.service'))
|
|
192
109
|
await systemdctl.disable('wpa_supplicant-wired@.service', workDir, true);
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* All systemd distros
|
|
196
|
-
*/
|
|
197
110
|
await exec(`rm -f ${workDir}/var/lib/wicd/configurations/*`, this.echo);
|
|
198
111
|
await exec(`rm -f ${workDir}/etc/wicd/wireless-settings.conf`, this.echo);
|
|
199
112
|
await exec(`rm -f ${workDir}/etc/NetworkManager/system-connections/*`, this.echo);
|
|
200
113
|
await exec(`rm -f ${workDir}/etc/network/wifi/*`, this.echo);
|
|
201
|
-
/**
|
|
202
|
-
* removing from /etc/network/:
|
|
203
|
-
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
204
|
-
*/
|
|
205
114
|
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
206
|
-
|
|
207
|
-
for (cleanDir of cleanDirs) {
|
|
115
|
+
for (const cleanDir of cleanDirs) {
|
|
208
116
|
await exec(`rm -f ${workDir}/etc/network/${cleanDir}/wpasupplicant`, this.echo);
|
|
209
117
|
}
|
|
210
118
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Clear configs from /etc/network/interfaces, wicd and NetworkManager
|
|
213
|
-
* and netman, so they aren't stealthily included in the snapshot.
|
|
214
|
-
*/
|
|
215
119
|
if (this.familyId === 'debian') {
|
|
216
120
|
if (fs.existsSync(`${workDir}/etc/network/interfaces`)) {
|
|
217
121
|
await exec(`rm -f ${workDir}/etc/network/interfaces`, this.echo);
|
|
218
122
|
Utils.write(`${workDir}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
219
123
|
}
|
|
220
|
-
/**
|
|
221
|
-
* add some basic files to /dev
|
|
222
|
-
*/
|
|
223
|
-
// Ho condensato i controlli ripetitivi su mknod per leggibilità
|
|
224
|
-
// Nota: Questo è safe da eseguire, anche se devtmpfs solitamente gestisce tutto.
|
|
225
124
|
const devNodes = [
|
|
226
125
|
{ path: 'console', m: '622', type: 'c', major: 5, minor: 1 },
|
|
227
126
|
{ path: 'null', m: '666', type: 'c', major: 1, minor: 3 },
|
|
@@ -236,10 +135,9 @@ export async function editLiveFs(clone = false) {
|
|
|
236
135
|
await exec(`mknod -m ${node.m} ${workDir}/dev/${node.path} ${node.type} ${node.major} ${node.minor}`, this.echo);
|
|
237
136
|
}
|
|
238
137
|
}
|
|
239
|
-
if (!fs.existsSync(`${workDir}/dev/
|
|
138
|
+
if (!fs.existsSync(`${workDir}/dev/console`)) {
|
|
240
139
|
await exec(`chown -v root:tty ${workDir}/dev/{console,ptmx,tty}`, this.echo);
|
|
241
140
|
}
|
|
242
|
-
// Link simbolici standard
|
|
243
141
|
const links = [
|
|
244
142
|
{ src: '/proc/self/fd', dest: 'fd' },
|
|
245
143
|
{ src: '/proc/self/fd/0', dest: 'stdin' },
|
|
@@ -252,24 +150,13 @@ export async function editLiveFs(clone = false) {
|
|
|
252
150
|
await exec(`ln -sv ${link.src} ${workDir}/dev/${link.dest}`, this.echo);
|
|
253
151
|
}
|
|
254
152
|
}
|
|
255
|
-
if (!fs.existsSync(`${workDir}/dev/shm`))
|
|
153
|
+
if (!fs.existsSync(`${workDir}/dev/shm`))
|
|
256
154
|
await exec(`mkdir -v ${workDir}/dev/shm`, this.echo);
|
|
257
|
-
}
|
|
258
|
-
if (!fs.existsSync(`${workDir}/dev/pts`)) {
|
|
155
|
+
if (!fs.existsSync(`${workDir}/dev/pts`))
|
|
259
156
|
await exec(`mkdir -v ${workDir}/dev/pts`, this.echo);
|
|
260
|
-
}
|
|
261
|
-
if (!fs.existsSync(`${workDir}/
|
|
262
|
-
await exec(`chmod 1777 ${workDir}/dev/shm`, this.echo);
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* creo /tmp
|
|
266
|
-
*/
|
|
267
|
-
if (!fs.existsSync(`${workDir}/tmp`)) {
|
|
157
|
+
await exec(`chmod 1777 ${workDir}/dev/shm`, this.echo);
|
|
158
|
+
if (!fs.existsSync(`${workDir}/tmp`))
|
|
268
159
|
await exec(`mkdir ${workDir}/tmp`, this.echo);
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Assegno 1777 a /tmp creava problemi con MXLINUX
|
|
272
|
-
*/
|
|
273
160
|
await exec(`chmod 1777 ${workDir}/tmp`, this.echo);
|
|
274
161
|
}
|
|
275
162
|
}
|
|
@@ -21,7 +21,7 @@ export async function fertilization(snapshot_prefix = '', snapshot_basename = ''
|
|
|
21
21
|
this.familyId = distro.familyId;
|
|
22
22
|
this.distroId = distro.distroId;
|
|
23
23
|
this.distroLike = distro.distroLike;
|
|
24
|
-
this.
|
|
24
|
+
this.distroLiveMediumPath = distro.liveMediumPath;
|
|
25
25
|
this.settings = new Settings();
|
|
26
26
|
if (await this.settings.load()) {
|
|
27
27
|
await this.settings.loadRemix(this.theme);
|