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
package/dist/commands/produce.js
CHANGED
|
@@ -144,7 +144,7 @@ export default class Produce extends Command {
|
|
|
144
144
|
const yolkRenew = flags.yolk;
|
|
145
145
|
const { nointeractive } = flags;
|
|
146
146
|
const { noicon } = flags;
|
|
147
|
-
// if clone
|
|
147
|
+
// if clone, homecrypt, fullcrypt
|
|
148
148
|
const includeRootHome = flags.includeRootHome || clone || homecrypt;
|
|
149
149
|
let { kernel } = flags;
|
|
150
150
|
if (kernel === undefined) {
|
|
@@ -209,14 +209,23 @@ export default class Produce extends Command {
|
|
|
209
209
|
let message = "this is a GUI system, calamares is available, but NOT installed\n";
|
|
210
210
|
Utils.warning(message);
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
/**
|
|
213
|
+
* se è appImage e fullcrypt esce
|
|
214
|
+
*/
|
|
215
|
+
if (Utils.isAppImage() && fullcrypt) {
|
|
216
|
+
Utils.warning("eggs produce --fullcrypt cannot be used on AppImage");
|
|
217
|
+
console.log(`\nyou can try: "sudo eggs produce --homecrypt"`);
|
|
218
|
+
process.exit(9);
|
|
219
|
+
}
|
|
220
|
+
if (!Utils.isAppImage() && fullcrypt) {
|
|
213
221
|
const distro = new Distro();
|
|
214
|
-
if (distro.familyId === 'debian') {
|
|
215
|
-
Utils.info("Use
|
|
222
|
+
if (distro.familyId === 'debian' && (distro.codenameId === 'trixie' || distro.codenameId === 'excalibur')) {
|
|
223
|
+
Utils.info("Use eggs --fullcrypt with extreme caution, and ALWAYS first try it out in a test environment.");
|
|
216
224
|
Utils.sleep(3000);
|
|
217
225
|
}
|
|
218
226
|
else {
|
|
219
|
-
Utils.warning(
|
|
227
|
+
Utils.warning(`eggs produce --fullcrypt cannot be used on ${distro.distroId}/${distro.codenameId}`);
|
|
228
|
+
console.log(`\nyou can try: "sudo eggs produce --homecrypt"`);
|
|
220
229
|
process.exit(9);
|
|
221
230
|
}
|
|
222
231
|
}
|
|
@@ -10,7 +10,7 @@ import Utils from '../../classes/utils.js';
|
|
|
10
10
|
import Pacman from '../../classes/pacman.js';
|
|
11
11
|
import { Command } from '@oclif/core';
|
|
12
12
|
import { DependencyManager } from '../../appimage/dependency-manager.js';
|
|
13
|
-
import { execSync } from '
|
|
13
|
+
import { execSync } from '../../lib/utils.js';
|
|
14
14
|
export default class Install extends Command {
|
|
15
15
|
static description = 'Automatically check and install system prerequisites';
|
|
16
16
|
static examples = [
|
|
@@ -10,7 +10,7 @@ import Utils from '../../classes/utils.js';
|
|
|
10
10
|
import Pacman from '../../classes/pacman.js';
|
|
11
11
|
import { Command } from '@oclif/core';
|
|
12
12
|
import { DependencyManager } from '../../appimage/dependency-manager.js';
|
|
13
|
-
import { execSync } from '
|
|
13
|
+
import { execSync } from '../../lib/utils.js';
|
|
14
14
|
export default class Purge extends Command {
|
|
15
15
|
static description = 'Automatically check and install system prerequisites';
|
|
16
16
|
static examples = [
|
package/dist/commands/update.js
CHANGED
|
@@ -11,8 +11,7 @@ import Distro from '../classes/distro.js';
|
|
|
11
11
|
import Tools from '../classes/tools.js';
|
|
12
12
|
import Utils from '../classes/utils.js';
|
|
13
13
|
import Diversions from '../classes/diversions.js';
|
|
14
|
-
import { exec } from '../lib/utils.js';
|
|
15
|
-
import { spawn } from 'child_process';
|
|
14
|
+
import { exec, spawn } from '../lib/utils.js';
|
|
16
15
|
import axios from 'axios';
|
|
17
16
|
import https from 'node:https';
|
|
18
17
|
const agent = new https.Agent({
|
|
@@ -1,46 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ./src/interfaces/i-calamares-branding.ts
|
|
3
|
-
* penguins-eggs v.25.
|
|
3
|
+
* penguins-eggs v.25.x / ecmascript 2020
|
|
4
4
|
* author: Piero Proietti
|
|
5
5
|
* email: piero.proietti@gmail.com
|
|
6
6
|
* license: MIT
|
|
7
|
+
*
|
|
8
|
+
* Questa interfaccia è allineata con la struttura reale di branding.desc
|
|
9
|
+
* (basata sull'output 'cat /etc/calamares/branding/eggs/branding.desc').
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 💡 Interfaccia per la sezione 'strings'
|
|
13
|
+
* Contiene le informazioni testuali del prodotto.
|
|
14
|
+
*/
|
|
15
|
+
export interface IBrandingStrings {
|
|
16
|
+
bootloaderEntryName: string;
|
|
17
|
+
knownIssuesUrl: string;
|
|
18
|
+
productName: string;
|
|
19
|
+
productUrl: string;
|
|
20
|
+
releaseNotesUrl: string;
|
|
21
|
+
shortProductName: string;
|
|
22
|
+
shortVersion: string;
|
|
23
|
+
shortVersionedName: string;
|
|
24
|
+
supportUrl: string;
|
|
25
|
+
version: string;
|
|
26
|
+
versionedName: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 💡 Interfaccia per la sezione 'images'
|
|
30
|
+
* Contiene i nomi dei file delle risorse grafiche.
|
|
31
|
+
*/
|
|
32
|
+
export interface IBrandingImages {
|
|
33
|
+
productIcon: string;
|
|
34
|
+
productLogo: string;
|
|
35
|
+
productWelcome: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 💡 Interfaccia per la sezione 'style'
|
|
39
|
+
* Contiene le definizioni dei colori per l'interfaccia.
|
|
40
|
+
* Nota: Sono incluse sia le varianti con maiuscola che minuscola trovate nel tuo file.
|
|
41
|
+
*/
|
|
42
|
+
export interface IBrandingStyle {
|
|
43
|
+
SidebarBackground: string;
|
|
44
|
+
SidebarBackgroundCurrent: string;
|
|
45
|
+
SidebarText: string;
|
|
46
|
+
SidebarTextCurrent: string;
|
|
47
|
+
sidebarBackground: string;
|
|
48
|
+
sidebarBackgroundCurrent: string;
|
|
49
|
+
sidebarText: string;
|
|
50
|
+
sidebarTextCurrent: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 💡 Interfaccia Principale: IBranding
|
|
54
|
+
* Mappa la struttura radice del file YAML branding.desc.
|
|
7
55
|
*/
|
|
8
56
|
export interface IBranding {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
string_release_title?: string;
|
|
17
|
-
/** Il colore principale usato per gli accenti (pulsanti, selezioni). */
|
|
18
|
-
color_accent?: string;
|
|
19
|
-
/** Colore del testo principale. */
|
|
20
|
-
color_text?: string;
|
|
21
|
-
/** Colore di sfondo principale della finestra. */
|
|
22
|
-
color_background?: string;
|
|
23
|
-
/** Colore di sfondo della barra laterale. */
|
|
24
|
-
color_sidebar_background?: string;
|
|
25
|
-
/** Colore del testo nella barra laterale. */
|
|
26
|
-
color_sidebar_text?: string;
|
|
27
|
-
/** Logo principale mostrato nell'installer. */
|
|
28
|
-
logo?: string;
|
|
29
|
-
/** Icona del prodotto. */
|
|
30
|
-
product_icon?: string;
|
|
31
|
-
/** Icona della finestra dell'applicazione. */
|
|
32
|
-
window_icon?: string;
|
|
33
|
-
/** Larghezza iniziale della finestra in pixel. */
|
|
34
|
-
window_width?: number;
|
|
35
|
-
/** Altezza iniziale della finestra in pixel. */
|
|
36
|
-
window_height?: number;
|
|
37
|
-
/** Se `true`, posiziona la barra laterale a sinistra (default), altrimenti a destra. */
|
|
38
|
-
sidebar_on_left?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* L'API da usare per lo slideshow. 'qml' per le slideshow tradizionali,
|
|
41
|
-
* 'contextual' per quelle basate sul modulo in esecuzione.
|
|
42
|
-
*/
|
|
43
|
-
slideshow_api?: 'qml' | 'contextual';
|
|
44
|
-
/** Percorso al file QML principale dello slideshow (se slideshow_api è 'qml'). */
|
|
45
|
-
slideshow_qml_path?: string;
|
|
57
|
+
componentName: string;
|
|
58
|
+
slideshow: string;
|
|
59
|
+
slideshowAPI: number;
|
|
60
|
+
welcomeStyleCalamares: boolean;
|
|
61
|
+
images: IBrandingImages;
|
|
62
|
+
strings: IBrandingStrings;
|
|
63
|
+
style: IBrandingStyle;
|
|
46
64
|
}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/interfaces/i-calamares-branding.ts
|
|
3
|
+
* penguins-eggs v.25.x / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*
|
|
8
|
+
* Questa interfaccia è allineata con la struttura reale di branding.desc
|
|
9
|
+
* (basata sull'output 'cat /etc/calamares/branding/eggs/branding.desc').
|
|
10
|
+
*/
|
|
1
11
|
export {};
|
|
@@ -12,7 +12,7 @@ import Location from '../../components/location.js';
|
|
|
12
12
|
import selectRegions from '../../lib/select_regions.js';
|
|
13
13
|
import selectZones from '../../lib/select_zones.js';
|
|
14
14
|
import axios from 'axios';
|
|
15
|
-
import shx from '
|
|
15
|
+
import { shx } from '../../../lib/utils.js';
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
* @param this
|
|
@@ -14,7 +14,7 @@ import selectFileSystemType from '../../lib/select_filesystem_type.js';
|
|
|
14
14
|
import selectInstallationDevice from '../../lib/select_installation_device.js';
|
|
15
15
|
import selectReplacedPartition from '../../lib/select_replaced_partition.js';
|
|
16
16
|
import selectUserSwapChoice from '../../lib/select_user_swap_choice.js';
|
|
17
|
-
import shx from '
|
|
17
|
+
import { shx } from '../../../lib/utils.js';
|
|
18
18
|
import selectInstallationMode from '../../lib/select_installation_mode.js';
|
|
19
19
|
/**
|
|
20
20
|
* PARTITIONS
|
|
@@ -13,7 +13,7 @@ import getUsername from '../../lib/get_username.js';
|
|
|
13
13
|
import getUserfullname from '../../lib/get_userfullname.js';
|
|
14
14
|
import getPassword from '../../lib/get_password.js';
|
|
15
15
|
import getHostname from '../../lib/get_hostname.js';
|
|
16
|
-
import shx from '
|
|
16
|
+
import { shx } from '../../../lib/utils.js';
|
|
17
17
|
/**
|
|
18
18
|
* USERS
|
|
19
19
|
*/
|
|
@@ -36,7 +36,7 @@ export async function users() {
|
|
|
36
36
|
}
|
|
37
37
|
let hostname = this.krillConfig.hostname;
|
|
38
38
|
if (hostname === '' || hostname === undefined) {
|
|
39
|
-
hostname = shx.exec('cat /etc/hostname').trim();
|
|
39
|
+
hostname = shx.exec('cat /etc/hostname', { silent: true }).stdout.trim();
|
|
40
40
|
}
|
|
41
41
|
let autologin = true;
|
|
42
42
|
let sameUserPassword = true;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import os from 'os';
|
|
10
10
|
import fs from 'fs';
|
|
11
|
-
import shx from '
|
|
11
|
+
import { shx } from '../../lib/utils.js';
|
|
12
12
|
import axios from 'axios';
|
|
13
13
|
import { SwapChoice, InstallationMode, FsType } from './krill_enums.js';
|
|
14
14
|
import Keyboards from '../../classes/keyboards.js';
|
|
@@ -199,15 +199,15 @@ export default class Krill {
|
|
|
199
199
|
generateHostname(ip, random) {
|
|
200
200
|
let hostname = this.krillConfig.hostname;
|
|
201
201
|
if (hostname === '') {
|
|
202
|
-
hostname = shx.exec('cat /etc/hostname', { silent: true }).trim();
|
|
202
|
+
hostname = shx.exec('cat /etc/hostname', { silent: true }).stdout.trim();
|
|
203
203
|
}
|
|
204
204
|
if (ip) {
|
|
205
205
|
hostname = 'ip-' + Utils.address().replaceAll('.', '-');
|
|
206
206
|
}
|
|
207
207
|
if (random) {
|
|
208
|
-
const fl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).trim();
|
|
209
|
-
const n = shx.exec(`tr -dc 0-9 </dev/urandom | head -c 3 ; echo ''`, { silent: true }).trim();
|
|
210
|
-
const sl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).trim();
|
|
208
|
+
const fl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).stdout.trim();
|
|
209
|
+
const n = shx.exec(`tr -dc 0-9 </dev/urandom | head -c 3 ; echo ''`, { silent: true }).stdout.trim();
|
|
210
|
+
const sl = shx.exec(`tr -dc a-z </dev/urandom | head -c 2 ; echo ''`, { silent: true }).stdout.trim();
|
|
211
211
|
hostname = `${os.hostname()}-${fl}${n}${sl}`;
|
|
212
212
|
}
|
|
213
213
|
return hostname;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ./src/krill/
|
|
2
|
+
* ./src/krill/classes/secquence.d/add-user.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* license: MIT
|
|
7
|
-
* https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
|
|
4
|
+
* * REFACTORED: Uses "The SysUser Master" class.
|
|
5
|
+
* Replaces chroot/binary dependencies with pure Node.js manipulation.
|
|
8
6
|
*/
|
|
9
7
|
import Sequence from '../sequence.js';
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param this
|
|
13
|
-
* @param username
|
|
14
|
-
* @param password
|
|
15
|
-
* @param fullusername
|
|
16
|
-
* @param roomNumber
|
|
17
|
-
* @param workPhone
|
|
18
|
-
* @param homePhone
|
|
19
|
-
*/
|
|
20
8
|
export default function addUser(this: Sequence, username?: string, password?: string, fullusername?: string, roomNumber?: string, workPhone?: string, homePhone?: string): Promise<void>;
|
|
@@ -1,77 +1,107 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ./src/krill/
|
|
2
|
+
* ./src/krill/classes/secquence.d/add-user.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* license: MIT
|
|
7
|
-
* https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
|
|
4
|
+
* * REFACTORED: Uses "The SysUser Master" class.
|
|
5
|
+
* Replaces chroot/binary dependencies with pure Node.js manipulation.
|
|
8
6
|
*/
|
|
9
|
-
import
|
|
7
|
+
import SysUsers from '../../../classes/sys-users.js';
|
|
8
|
+
import { exec } from '../../../lib/utils.js';
|
|
10
9
|
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
11
|
import yaml from 'js-yaml';
|
|
12
|
-
import { exec } from '../../../lib/utils.js';
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @param this
|
|
16
|
-
* @param username
|
|
17
|
-
* @param password
|
|
18
|
-
* @param fullusername
|
|
19
|
-
* @param roomNumber
|
|
20
|
-
* @param workPhone
|
|
21
|
-
* @param homePhone
|
|
22
|
-
*/
|
|
23
12
|
export default async function addUser(username = 'live', password = 'evolution', fullusername = '', roomNumber = '', workPhone = '', homePhone = '') {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
else if (this.distro.familyId === 'opensuse') {
|
|
36
|
-
cmd = `chroot ${this.installTarget} useradd ${username} --create-home --shell /bin/bash --comment "${fullusername},${roomNumber},${workPhone},${homePhone}" ${this.toNull}`;
|
|
13
|
+
const target = this.installTarget;
|
|
14
|
+
const familyId = this.distro.familyId;
|
|
15
|
+
// --- 1. INIZIALIZZAZIONE SYSUSERS ---
|
|
16
|
+
const sysUsers = new SysUsers(target, familyId);
|
|
17
|
+
sysUsers.load(); // Carica passwd, shadow, group in memoria
|
|
18
|
+
console.log(`Creating user ${username} via SysUsers (Safe Mode)...`);
|
|
19
|
+
// --- 2. PREPARAZIONE DATI ---
|
|
20
|
+
// Shell detection (Fallback per Alpine/Minimal)
|
|
21
|
+
let shell = '/bin/bash';
|
|
22
|
+
if (!fs.existsSync(path.join(target, 'bin/bash')) && fs.existsSync(path.join(target, 'bin/ash'))) {
|
|
23
|
+
shell = '/bin/ash';
|
|
37
24
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
// Definizione oggetto utente
|
|
26
|
+
const newUser = {
|
|
27
|
+
username: username,
|
|
28
|
+
password: 'x',
|
|
29
|
+
uid: '1000', // Hardcoded per il primo utente (standard installer)
|
|
30
|
+
gid: '1000',
|
|
31
|
+
gecos: `${fullusername},${roomNumber},${workPhone},${homePhone}`,
|
|
32
|
+
home: `/home/${username}`,
|
|
33
|
+
shell: shell
|
|
34
|
+
};
|
|
35
|
+
// --- 3. MODIFICHE LOGICHE (IN MEMORIA) ---
|
|
36
|
+
// Aggiunge l'utente (gestisce passwd, shadow, group primario, subuid)
|
|
37
|
+
sysUsers.addUser(newUser, password);
|
|
38
|
+
// Aggiungi ai gruppi amministrativi (logica distro)
|
|
39
|
+
let adminGroup = 'wheel';
|
|
40
|
+
if (['debian', 'ubuntu', 'linuxmint', 'pop', 'neon'].includes(familyId)) {
|
|
41
|
+
adminGroup = 'sudo';
|
|
44
42
|
}
|
|
45
|
-
else if (
|
|
46
|
-
|
|
43
|
+
else if (familyId === 'openmamba') {
|
|
44
|
+
adminGroup = 'sysadmin';
|
|
47
45
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// add autologin group in archlinux
|
|
51
|
-
await exec(cmd, this.echo);
|
|
52
|
-
if (this.distro.familyId === 'archlinux') {
|
|
53
|
-
await exec(`chroot ${this.installTarget} getent group autologin || groupadd autologin`);
|
|
54
|
-
await exec(`chroot ${this.installTarget} usermod -aG autologin ${username}`);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* look to calamares/modules/users.conf for groups
|
|
58
|
-
*/
|
|
46
|
+
sysUsers.addUserToGroup(username, adminGroup);
|
|
47
|
+
// Aggiungi ai gruppi definiti in Calamares/Eggs config
|
|
59
48
|
let usersConf = '/etc/calamares/modules/users.conf';
|
|
60
49
|
if (!fs.existsSync(usersConf)) {
|
|
61
50
|
usersConf = '/etc/penguins-eggs.d/krill/modules/users.conf';
|
|
62
51
|
}
|
|
63
52
|
if (fs.existsSync(usersConf)) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
try {
|
|
54
|
+
const content = fs.readFileSync(usersConf, 'utf8');
|
|
55
|
+
const o = yaml.load(content);
|
|
56
|
+
if (o && o.defaultGroups) {
|
|
57
|
+
for (const grp of o.defaultGroups) {
|
|
58
|
+
sysUsers.addUserToGroup(username, grp);
|
|
59
|
+
}
|
|
70
60
|
}
|
|
71
61
|
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
console.error('Warning: Error parsing users.conf, skipping extra groups.', e);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Fix specifico Archlinux (Autologin)
|
|
67
|
+
if (familyId === 'archlinux') {
|
|
68
|
+
sysUsers.addUserToGroup(username, 'autologin');
|
|
69
|
+
}
|
|
70
|
+
// --- 4. SALVATAGGIO ATOMICO SU DISCO ---
|
|
71
|
+
// Scrive tutti i file di config e applica chcon (SELinux) se necessario
|
|
72
|
+
await sysUsers.save();
|
|
73
|
+
// --- 5. CREAZIONE FISICA HOME DIRECTORY ---
|
|
74
|
+
// Queste operazioni toccano il filesystem reale, quindi usiamo exec/fs
|
|
75
|
+
const homeDir = path.join(target, newUser.home);
|
|
76
|
+
// Cleanup preventivo
|
|
77
|
+
await exec(`rm -rf ${homeDir}`, this.echo);
|
|
78
|
+
// Creazione da /etc/skel
|
|
79
|
+
const skelPath = path.join(target, 'etc', 'skel');
|
|
80
|
+
if (fs.existsSync(skelPath)) {
|
|
81
|
+
await exec(`mkdir -p ${homeDir}`, this.echo);
|
|
82
|
+
await exec(`cp -rT ${skelPath} ${homeDir}`, this.echo);
|
|
72
83
|
}
|
|
73
84
|
else {
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
await exec(`mkdir -p ${homeDir}`, this.echo);
|
|
86
|
+
}
|
|
87
|
+
// Permessi e Proprietario
|
|
88
|
+
await exec(`chown -R ${newUser.uid}:${newUser.gid} ${homeDir}`, this.echo);
|
|
89
|
+
// Privacy: 700 è meglio di 755 per la home utente
|
|
90
|
+
await exec(`chmod 700 ${homeDir}`, this.echo);
|
|
91
|
+
// --- 6. FIX SELINUX FINALE (HOME & RELABEL) ---
|
|
92
|
+
// SysUsers ha sistemato /etc/*, ma la home directory è appena stata creata
|
|
93
|
+
// e potrebbe avere contesti errati.
|
|
94
|
+
if (['fedora', 'rhel', 'centos', 'almalinux', 'rocky'].includes(familyId)) {
|
|
95
|
+
try {
|
|
96
|
+
console.log('Applying SELinux contexts to home directory...');
|
|
97
|
+
// Fix contesto home
|
|
98
|
+
await exec(`chcon -R -t user_home_t ${homeDir}`, { echo: false }).catch(() => { });
|
|
99
|
+
// Fix "Nuclear Option": forza relabel al boot se qualcosa fosse sfuggito
|
|
100
|
+
await exec(`touch ${target}/.autorelabel`, { echo: false });
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
console.error('SELinux home fix warning:', e);
|
|
104
|
+
}
|
|
76
105
|
}
|
|
106
|
+
console.log(`User ${username} successfully configured via SysUser Master.`);
|
|
77
107
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* src/krill/modules/change-password.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* license: MIT
|
|
7
|
-
* https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
|
|
4
|
+
* * REFACTORED: Uses "The SysUser Master" class.
|
|
5
|
+
* Changes user password directly in /etc/shadow safely (No binaries, SELinux safe).
|
|
8
6
|
*/
|
|
9
7
|
import Sequence from '../sequence.js';
|
|
10
8
|
/**
|
|
11
9
|
* changePassword
|
|
12
|
-
* @param name
|
|
13
|
-
* @param newPassword
|
|
10
|
+
* @param name - Username to update
|
|
11
|
+
* @param newPassword - New plain text password
|
|
14
12
|
*/
|
|
15
13
|
export default function changePassword(this: Sequence, name?: string, newPassword?: string): Promise<void>;
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* src/krill/modules/change-password.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* license: MIT
|
|
7
|
-
* https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
|
|
4
|
+
* * REFACTORED: Uses "The SysUser Master" class.
|
|
5
|
+
* Changes user password directly in /etc/shadow safely (No binaries, SELinux safe).
|
|
8
6
|
*/
|
|
9
|
-
import
|
|
7
|
+
import SysUsers from '../../../classes/sys-users.js';
|
|
8
|
+
import fs from 'fs';
|
|
10
9
|
/**
|
|
11
10
|
* changePassword
|
|
12
|
-
* @param name
|
|
13
|
-
* @param newPassword
|
|
11
|
+
* @param name - Username to update
|
|
12
|
+
* @param newPassword - New plain text password
|
|
14
13
|
*/
|
|
15
14
|
export default async function changePassword(name = 'live', newPassword = 'evolution') {
|
|
16
|
-
const
|
|
17
|
-
|
|
15
|
+
const target = this.installTarget;
|
|
16
|
+
const familyId = this.distro.familyId;
|
|
17
|
+
console.log(`Changing password for user '${name}' via SysUsers...`);
|
|
18
|
+
// 1. CARICAMENTO
|
|
19
|
+
// Se non esiste il target (caso strano), usciamo
|
|
20
|
+
if (!fs.existsSync(target)) {
|
|
21
|
+
console.error(`Error: Target ${target} not found for password change.`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const sysUsers = new SysUsers(target, familyId);
|
|
25
|
+
sysUsers.load();
|
|
26
|
+
// 2. MODIFICA (In Memoria)
|
|
27
|
+
// La classe SysUsers ha già il metodo setPassword che usa bcryptjs
|
|
28
|
+
// e aggiorna il timestamp di lastChange.
|
|
29
|
+
sysUsers.setPassword(name, newPassword);
|
|
30
|
+
// 3. SALVATAGGIO (Atomico + SELinux Fix)
|
|
31
|
+
await sysUsers.save();
|
|
32
|
+
console.log(`Password updated for '${name}'.`);
|
|
18
33
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* src/krill/classes/sequence.d/del_live_user.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* license: MIT
|
|
7
|
-
* https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
|
|
4
|
+
* * REFACTORED: Uses "The SysUser Master" class.
|
|
5
|
+
* Removes the live user from the installed target safely (SELinux friendly).
|
|
8
6
|
*/
|
|
9
7
|
import Sequence from '../sequence.js';
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* delLiveUser
|
|
10
|
+
* Rimuove l'utente live dal sistema installato (target)
|
|
13
11
|
*/
|
|
14
12
|
export default function delLiveUser(this: Sequence): Promise<void>;
|
|
@@ -1,39 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* src/krill/classes/sequence.d/del_live_user.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* license: MIT
|
|
7
|
-
* https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
|
|
4
|
+
* * REFACTORED: Uses "The SysUser Master" class.
|
|
5
|
+
* Removes the live user from the installed target safely (SELinux friendly).
|
|
8
6
|
*/
|
|
7
|
+
import SysUsers from '../../../classes/sys-users.js';
|
|
9
8
|
import Utils from '../../../classes/utils.js';
|
|
10
9
|
import { exec } from '../../../lib/utils.js';
|
|
10
|
+
import fs from 'fs';
|
|
11
|
+
import path from 'path';
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* delLiveUser
|
|
14
|
+
* Rimuove l'utente live dal sistema installato (target)
|
|
14
15
|
*/
|
|
15
16
|
export default async function delLiveUser() {
|
|
17
|
+
// Eseguiamo solo se siamo in modalità live (ovvero stiamo installando da una ISO)
|
|
16
18
|
if (Utils.isLive()) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
// Recuperiamo il nome utente live (default: 'live' o quello impostato in build)
|
|
20
|
+
const liveUsername = this.settings.config.user_opt || 'live';
|
|
21
|
+
const target = this.installTarget;
|
|
22
|
+
const familyId = this.distro.familyId;
|
|
23
|
+
console.log(`Removing live user '${liveUsername}' from target via SysUsers...`);
|
|
24
|
+
// --- 1. CARICAMENTO CONFIGURAZIONE ---
|
|
25
|
+
// Istanziamo il nostro "Master" puntando alla root del sistema installato
|
|
26
|
+
const sysUsers = new SysUsers(target, familyId);
|
|
27
|
+
sysUsers.load();
|
|
28
|
+
// --- 2. RIMOZIONE LOGICA (IN MEMORIA) ---
|
|
29
|
+
// Rimuove l'utente da passwd, shadow, group e dai membri dei gruppi extra
|
|
30
|
+
sysUsers.removeUser(liveUsername);
|
|
31
|
+
// --- 3. SALVATAGGIO ATOMICO ---
|
|
32
|
+
// Scrive i file fisici e ripristina i contesti SELinux in un colpo solo
|
|
33
|
+
await sysUsers.save();
|
|
34
|
+
// --- 4. PULIZIA FILESYSTEM (File non gestiti da SysUsers) ---
|
|
35
|
+
// a) Home Directory
|
|
36
|
+
const homeDir = path.join(target, 'home', liveUsername);
|
|
37
|
+
if (fs.existsSync(homeDir)) {
|
|
38
|
+
await exec(`rm -rf ${homeDir}`, this.echo);
|
|
23
39
|
}
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
// b) File Sudoers (spesso creato in /etc/sudoers.d/)
|
|
41
|
+
const sudoersFile = path.join(target, 'etc', 'sudoers.d', liveUsername);
|
|
42
|
+
if (fs.existsSync(sudoersFile)) {
|
|
43
|
+
fs.unlinkSync(sudoersFile);
|
|
44
|
+
console.log(`Removed sudoers file: ${sudoersFile}`);
|
|
26
45
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.distro.familyId === 'fedora' ||
|
|
32
|
-
this.distro.familyId === 'opensuse') {
|
|
33
|
-
cmd = `chroot ${this.installTarget} sudo userdel -r ${user} ${this.toNull}`;
|
|
34
|
-
}
|
|
35
|
-
await exec(cmd, this.echo);
|
|
36
|
-
}
|
|
46
|
+
// c) Mail spool
|
|
47
|
+
const mailFile = path.join(target, 'var', 'mail', liveUsername);
|
|
48
|
+
if (fs.existsSync(mailFile)) {
|
|
49
|
+
fs.unlinkSync(mailFile);
|
|
37
50
|
}
|
|
51
|
+
console.log(`Live user '${liveUsername}' removed successfully via SysUser Master.`);
|
|
38
52
|
}
|
|
39
53
|
}
|