penguins-eggs 25.12.15 → 26.1.3

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.
Files changed (34) hide show
  1. package/.oclif.manifest.json +192 -192
  2. package/README.md +109 -489
  3. package/README.pdf +3174 -19913
  4. package/addons/eggs/theme/applications/install-system.desktop +3 -9
  5. package/assets/calamares/install-system.sh +23 -22
  6. package/assets/penguins-krill.desktop +5 -23
  7. package/dist/classes/distro.js +2 -1
  8. package/dist/classes/incubation/incubator.js +21 -8
  9. package/dist/classes/ovary.d/create-xdg-autostart.d.ts +3 -3
  10. package/dist/classes/ovary.d/create-xdg-autostart.js +139 -149
  11. package/dist/classes/ovary.d/luks-home-support-systemd.d.ts +12 -0
  12. package/dist/classes/ovary.d/luks-home-support-systemd.js +70 -0
  13. package/dist/classes/ovary.d/luks-home-support.d.ts +1 -0
  14. package/dist/classes/ovary.d/luks-home-support.js +101 -24
  15. package/dist/classes/ovary.d/produce.js +2 -2
  16. package/dist/classes/ovary.d/user-create-live.js +6 -1
  17. package/dist/classes/ovary.d/xorriso-command.js +11 -21
  18. package/dist/classes/utils.js +3 -0
  19. package/dist/classes/xdg.d.ts +6 -1
  20. package/dist/classes/xdg.js +119 -108
  21. package/dist/commands/export/appimage.js +2 -1
  22. package/dist/commands/export/pkg.js +16 -8
  23. package/dist/commands/update.js +1 -1
  24. package/dist/krill/classes/prepare.d/users.js +6 -6
  25. package/dist/krill/classes/prepare.js +6 -2
  26. package/dist/krill/classes/sequence.d/remove-homecrypt-hack.d.ts +13 -0
  27. package/dist/krill/classes/sequence.d/remove-homecrypt-hack.js +65 -0
  28. package/dist/krill/classes/sequence.d.ts +2 -0
  29. package/dist/krill/classes/sequence.js +7 -2
  30. package/dist/krill/components/users.js +4 -4
  31. package/dist/krill/lib/get_userfullname.js +1 -1
  32. package/dist/krill/lib/get_username.js +3 -3
  33. package/package.json +16 -15
  34. package/perrisbrewery/template/dependencies.yaml +3 -0
@@ -1,14 +1,8 @@
1
1
  [Desktop Entry]
2
2
  Type=Application
3
- Version=1.0
4
3
  Name=Install System
5
- GenericName=System Installer
6
- Keywords=calamares;system;installer;
7
- TryExec=calamares
8
- Exec=sh -c "pkexec calamares"
9
- Comment=Calamares — System Installer
10
- Icon=install-system.png
4
+ Comment=Install the system to your disk
5
+ Exec=install-system.sh
6
+ Icon=install-system
11
7
  Terminal=false
12
- StartupNotify=true
13
8
  Categories=Qt;System;
14
- X-AppStream-Ignore=true
@@ -1,27 +1,28 @@
1
- #!/bin/sh
2
- ###
3
- # Wrapper for running calamares on Debian live media
4
- ###
1
+ #!/bin/bash
5
2
 
6
- # Stale file left behind by live-build that messes with partitioning
7
- sudo mv /etc/fstab /etc/fstab.orig.calamares
3
+ # Rileva se siamo su Wayland o X11
4
+ if [ -n "$WAYLAND_DISPLAY" ]; then
5
+ export QT_QPA_PLATFORM=wayland
6
+ else
7
+ export QT_QPA_PLATFORM=xcb
8
+ fi
8
9
 
9
- # Allow Calamares to scale the window for hidpi displays
10
- # This is fixed in the Calamares 3.3.0 series, so we can remove this
11
- # once we switch to that
12
- # Upstream commit that will make this obsolete:
13
- # https://github.com/calamares/calamares/commit/e9f011b686a0982fb7828e8ac02a8e0784d3b11f
14
- # Upstream bug:
15
- # https://github.com/calamares/calamares/issues/1945
16
- # Debian bug:
17
- # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992162
18
10
  export QT_AUTO_SCREEN_SCALE_FACTOR=1
19
11
 
20
- # Access control to run calamares as root for xwayland
21
- xhost +si:localuser:root
22
- #pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY calamares
23
- pkexec calamares
24
- xhost -si:localuser:root
12
+ # Sblocca permessi per root (fondamentale per X11/XWayland)
13
+ if command -v xhost >/dev/null 2>&1; then
14
+ xhost +si:localuser:root >/dev/null 2>&1
15
+ fi
25
16
 
26
- # Restore stale fstab, for what it's worth
27
- sudo mv /etc/fstab.orig.calamares /etc/fstab
17
+ # Lancio Calamares
18
+ # Usiamo env -u per assicurarci che non ci siano residui di sessione utente
19
+ sudo env \
20
+ DISPLAY=$DISPLAY \
21
+ WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
22
+ XDG_RUNTIME_DIR=/run/user/0 \
23
+ /usr/bin/calamares "$@"
24
+
25
+ # Pulizia
26
+ if command -v xhost >/dev/null 2>&1; then
27
+ xhost -si:localuser:root >/dev/null 2>&1
28
+ fi
@@ -1,27 +1,9 @@
1
1
  #!/usr/bin/env xdg-open
2
2
  [Desktop Entry]
3
3
  Type=Application
4
- Version=1.0
5
- Name=Krill Linux installer
6
- GenericName=krill Installer
7
- Exec=sudo /usr/bin/eggs install
8
- Comment=Krill — Linux system installer
9
- Keywords=krill;system;install;debian;installer
4
+ Name=Install System CLI
5
+ Comment=Install the system to your disk (CLI)
6
+ Exec=x-terminal-emulator -e "sudo eggs krill"
10
7
  Icon=krill
11
- Terminal=true
12
- Categories=System;
13
- Name[it]=Krill Installer
14
- GenericName[it]=Installa sistema
15
- Comment[it]=Installazione sistema krill
16
- Name[en]=Install system
17
- GenericName[en]=Install the system
18
- Comment[en]=Install the system krill
19
- Name[es]=Instalación del sistema
20
- GenericName[es]=Instalación del sistema
21
- Comment[es]=Instalación del sistema krill
22
- Name[pt]=Instalação do sistema
23
- GenericName[pt]=Instalação do sistema
24
- Comment[pt]=Instalação do sistema krill
25
- Name[fr]=Installation du système
26
- GenericName[fr]=Installation du système
27
- Comment[fr]=Installation du système krill
8
+ Terminal=false
9
+ Categories=Qt;System;
@@ -82,12 +82,13 @@ class Distro {
82
82
  this.distroUniqueId = this.familyId; // per krill
83
83
  this.liveMediumPath = '/mnt/'; // Qua è deciso da noi
84
84
  /**
85
- * Fedora family: Almalinux, Fedora, Nobara. Rocky
85
+ * Fedora family: Almalinux, Fedora, Nobara. Rhel, Rocky
86
86
  */
87
87
  }
88
88
  else if (this.distroId === 'Almalinux' ||
89
89
  this.distroId === 'Fedora' ||
90
90
  this.distroId === 'Nobara' ||
91
+ this.distroId === 'Rhel' ||
91
92
  this.distroId === 'Rocky') {
92
93
  this.familyId = 'fedora';
93
94
  this.distroLike = 'Fedora';
@@ -69,7 +69,6 @@ export default class Incubator {
69
69
  Utils.warning(`creating ${installer().name} configuration files on ${installer().configRoot}`);
70
70
  this.createInstallerDirs();
71
71
  this.createBranding();
72
- // this.sudoers()
73
72
  const distroUniqueId = this.distro.distroUniqueId;
74
73
  try {
75
74
  /**
@@ -353,19 +352,33 @@ export default class Incubator {
353
352
  /**
354
353
  * install-system.sh
355
354
  */
356
- shx.cp(path.resolve(__dirname, '../../../assets/calamares/install-system.sh'), '/usr/sbin/install-system.sh');
357
- shx.chmod('+x', '/usr/sbin/install-system.sh');
355
+ {
356
+ const sourceScript = path.resolve(__dirname, '../../../assets/calamares/install-system.sh');
357
+ const targetScript = '/usr/bin/install-system.sh';
358
+ fs.copyFileSync(sourceScript, targetScript);
359
+ fs.chmodSync(targetScript, 0o755);
360
+ fs.chownSync(targetScript, 0, 0);
361
+ }
362
+ this.sudoers();
358
363
  }
359
364
  /**
360
365
  * soluzione tampone from Glenn
361
366
  *
362
367
  */
363
368
  sudoers() {
364
- let live = this.user_opt;
365
- let content = '';
366
- content += `# grants the live user passwordless permission to run /usr/bin/calamare\n`;
367
- content += `${live} ALL=(ALL) NOPASSWD: /usr/bin/calamares\n`;
368
- let fname = '/etc/sudoers.d/calamares';
369
+ const live = this.user_opt;
370
+ if (!live)
371
+ return;
372
+ const sudoersPath = '/etc/sudoers.d/99-eggs-calamares';
373
+ // Nota il SETENV: prima di NOPASSWD
374
+ const content = `${live} ALL=(ALL) SETENV: NOPASSWD: /usr/bin/calamares\n`;
375
+ try {
376
+ fs.writeFileSync(sudoersPath, content, { encoding: 'utf8', mode: 0o440 });
377
+ fs.chownSync(sudoersPath, 0, 0);
378
+ }
379
+ catch (e) {
380
+ console.error(e);
381
+ }
369
382
  }
370
383
  }
371
384
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ./src/classes/ovary.d/create-xdg-autostart.ts
3
- * penguins-eggs v.25.7.x / ecmascript 2020
3
+ * penguins-eggs v.25.12.x / ecmascript 2020
4
4
  * author: Piero Proietti
5
5
  * email: piero.proietti@gmail.com
6
6
  * license: MIT
@@ -8,6 +8,6 @@
8
8
  import Ovary from '../ovary.js';
9
9
  import { IAddons } from '../../interfaces/index.js';
10
10
  /**
11
- *
12
- */
11
+ * Crea la configurazione XDG Autostart e gestisce l'autologin universale
12
+ */
13
13
  export declare function createXdgAutostart(this: Ovary, theme: string | undefined, myAddons: IAddons, myLinks?: string[], noicons?: boolean): Promise<void>;
@@ -1,193 +1,183 @@
1
1
  /**
2
2
  * ./src/classes/ovary.d/create-xdg-autostart.ts
3
- * penguins-eggs v.25.7.x / ecmascript 2020
3
+ * penguins-eggs v.25.12.x / 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 'node:fs';
10
9
  import path from 'node:path';
11
- import { shx } from '../../lib/utils.js';
10
+ import { fileURLToPath } from 'node:url';
12
11
  import Pacman from '../pacman.js';
13
- import Utils from '../utils.js';
14
- import Xdg from '../xdg.js';
15
12
  import { exec } from '../../lib/utils.js';
16
13
  import PveLive from '../pve-live.js';
17
- // _dirname
18
- const __dirname = path.dirname(new URL(import.meta.url).pathname);
14
+ // Setup __dirname per moduli ESM
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = path.dirname(__filename);
19
17
  /**
20
- *
21
- */
18
+ * Crea la configurazione XDG Autostart e gestisce l'autologin universale
19
+ */
22
20
  export async function createXdgAutostart(theme = 'eggs', myAddons, myLinks = [], noicons = false) {
23
21
  if (this.verbose) {
24
- console.log('Ovary: createXdgAutostart');
25
- }
26
- const pathHomeLive = `/home/${this.settings.config.user_opt}`;
27
- // VOGLIO le icone
28
- // Copia icona penguins-eggs
29
- shx.cp(path.resolve(__dirname, '../../../assets/eggs.png'), '/usr/share/icons/');
30
- shx.cp(path.resolve(__dirname, '../../../assets/krill.svg'), '/usr/share/icons/');
31
- shx.cp(path.resolve(__dirname, '../../../assets/leaves.svg'), '/usr/share/icons/');
22
+ console.log('Ovary: createXdgAutostart (Native TS implementation)');
23
+ }
24
+ const mergedRoot = this.settings.work_dir.merged;
25
+ const newuser = this.settings.config.user_opt;
26
+ /**
27
+ * Helper per gestire file e directory in modo nativo
28
+ */
29
+ const copyToMerged = (srcRelative, destRelative) => {
30
+ const src = path.resolve(__dirname, srcRelative);
31
+ const dest = path.join(mergedRoot, destRelative);
32
+ if (fs.existsSync(src)) {
33
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
34
+ fs.copyFileSync(src, dest);
35
+ }
36
+ };
32
37
  /**
33
- * creazione dei link in /usr/share/applications
38
+ * 1. ICONE & ASSETS
34
39
  */
35
- shx.cp(path.resolve(__dirname, '../../../assets/penguins-eggs.desktop'), '/usr/share/applications/');
40
+ const assets = ['eggs.png', 'krill.svg', 'leaves.svg'];
41
+ assets.forEach(asset => copyToMerged(`../../../assets/${asset}`, `/usr/share/icons/${asset}`));
42
+ copyToMerged('../../../assets/penguins-eggs.desktop', '/usr/share/applications/penguins-eggs.desktop');
36
43
  /**
37
- * Scrivania/install-system.desktop
44
+ * 2. INSTALLER & POLKIT
38
45
  */
39
46
  let installerLink = 'install-system.desktop';
40
47
  if (Pacman.calamaresExists()) {
41
- // 1. Copia il lanciatore .desktop STANDARD (quello con pkexec)
42
- shx.cp(path.resolve(__dirname, `../../../addons/${theme}/theme/applications/install-system.desktop`), `${this.settings.work_dir.merged}/usr/share/applications/`);
43
- // 2. Copia la TUA policy Polkit per Calamares
44
- const policySource = path.resolve(__dirname, '../../../assets/calamares/io.calamares.calamares.policy');
45
- const policyDest = '/usr/share/polkit-1/actions/';
46
- shx.cp(policySource, policyDest);
47
- await exec(`sed -i 's/auth_admin/yes/' ${policyDest}io.calamares.calamares.policy`);
48
+ copyToMerged(`../../../addons/${theme}/theme/applications/install-system.desktop`, '/usr/share/applications/install-system.desktop');
49
+ const policyPath = '/usr/share/polkit-1/actions/io.calamares.calamares.policy';
50
+ copyToMerged('../../../assets/calamares/io.calamares.calamares.policy', policyPath);
51
+ const fullPolicyPath = path.join(mergedRoot, policyPath);
52
+ if (fs.existsSync(fullPolicyPath)) {
53
+ let policy = fs.readFileSync(fullPolicyPath, 'utf8');
54
+ policy = policy.replace(/<(allow_any|allow_inactive|allow_active)>.*?<\/\1>/g, '<$1>yes</$1>');
55
+ fs.writeFileSync(fullPolicyPath, policy, 'utf8');
56
+ }
48
57
  }
49
58
  else if (Pacman.packageIsInstalled('live-installer')) {
50
- /**
51
- * LMD£ live-installer
52
- */
53
- const policySource = path.resolve(__dirname, '../../../assets/live-installer/com.github.pieroproietti.penguins-eggs.policy');
54
- const policyDest = '/usr/share/polkit-1/actions/com.github.pieroproietti.penguins-eggs.policy';
55
- shx.cp(policySource, policyDest);
56
- await exec(`sed -i 's/auth_admin/yes/' ${policyDest}`);
57
- // carico in filesystem.live packages-remove
58
- shx.cp(path.resolve(__dirname, '../../../assets/live-installer/filesystem.packages-remove'), `${this.settings.iso_work}/live/`);
59
- shx.touch(`${this.settings.iso_work}/live/filesystem.packages`);
60
59
  installerLink = 'penguins-live-installer.desktop';
61
- shx.cp(path.resolve(__dirname, '../../../assets/penguins-live-installer.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
60
+ copyToMerged('../../../assets/penguins-live-installer.desktop', '/usr/share/applications/penguins-live-installer.desktop');
62
61
  }
63
62
  else if (Pacman.packageIsInstalled('ubiquity')) {
64
- /**
65
- * UBUNTU ubiquity
66
- */
67
- const policySource = path.resolve(__dirname, '../../../assets/ubiquity-installer/com.github.pieroproietti.penguins-eggs.policy');
68
- const policyDest = '/usr/share/polkit-1/actions/com.github.pieroproietti.penguins-eggs.policy';
69
- shx.cp(policySource, policyDest);
70
- await exec(`sed -i 's/auth_admin/yes/' ${policyDest}`);
71
- // carico in filesystem.live packages-remove
72
- shx.cp(path.resolve(__dirname, '../../../assets/ubiquity-installer/filesystem.packages-remove'), `${this.settings.iso_work}/live/`);
73
- shx.touch(`${this.settings.iso_work}/live/filesystem.packages`);
74
63
  installerLink = 'penguins-ubiquity-installer.desktop';
75
- shx.cp(path.resolve(__dirname, '../../../assets/penguins-ubiquity-installer.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
64
+ copyToMerged('../../../assets/penguins-ubiquity-installer.desktop', '/usr/share/applications/penguins-ubiquity-installer.desktop');
76
65
  }
77
66
  else {
78
67
  installerLink = 'penguins-krill.desktop';
79
- shx.cp(path.resolve(__dirname, '../../../assets/penguins-krill.desktop'), `${this.settings.work_dir.merged}/usr/share/applications/`);
68
+ copyToMerged('../../../assets/penguins-krill.desktop', '/usr/share/applications/penguins-krill.desktop');
80
69
  }
81
70
  /**
82
- * flags
71
+ * 3. ADDONS
83
72
  */
84
- // adapt
85
- if (myAddons.adapt) {
86
- const dirAddon = path.resolve(__dirname, '../../../addons/eggs/adapt/');
87
- shx.cp(`${dirAddon}/applications/eggs-adapt.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
73
+ if (myAddons.adapt)
74
+ copyToMerged('../../../addons/eggs/adapt/applications/eggs-adapt.desktop', '/usr/share/applications/eggs-adapt.desktop');
75
+ if (myAddons.rsupport) {
76
+ copyToMerged('../../../addons/eggs/rsupport/applications/eggs-rsupport.desktop', '/usr/share/applications/eggs-rsupport.desktop');
77
+ copyToMerged('../../../addons/eggs/rsupport/artwork/eggs-rsupport.png', '/usr/share/icons/eggs-rsupport.png');
88
78
  }
89
- // pve
90
79
  if (myAddons.pve) {
91
- /**
92
- * create service pve-live
93
- */
94
80
  const pve = new PveLive();
95
- pve.create(this.settings.work_dir.merged);
96
- /**
97
- * adding a desktop link for pve
98
- */
99
- const dirAddon = path.resolve(__dirname, '../../../addons/eggs/pve');
100
- shx.cp(`${dirAddon}/artwork/eggs-pve.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
101
- shx.cp(`${dirAddon}/applications/eggs-pve.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
102
- }
103
- // rsupport
104
- if (myAddons.rsupport) {
105
- const dirAddon = path.resolve(__dirname, '../../../addons/eggs/rsupport');
106
- shx.cp(`${dirAddon}/applications/eggs-rsupport.desktop`, `${this.settings.work_dir.merged}/usr/share/applications/`);
107
- shx.cp(`${dirAddon}/artwork/eggs-rsupport.png`, `${this.settings.work_dir.merged}/usr/share/icons/`);
81
+ pve.create(mergedRoot);
82
+ copyToMerged('../../../addons/eggs/pve/artwork/eggs-pve.png', '/usr/share/icons/eggs-pve.png');
83
+ copyToMerged('../../../addons/eggs/pve/applications/eggs-pve.desktop', '/usr/share/applications/eggs-pve.desktop');
108
84
  }
109
85
  /**
110
- * configuro add-penguins-desktop-icons in /etc/xdg/autostart
86
+ * 4. SCRIPT AUTOSTART (Icone Desktop)
111
87
  */
112
- const dirAutostart = `${this.settings.work_dir.merged}/etc/xdg/autostart`;
113
- if (fs.existsSync(dirAutostart)) {
114
- // Creo l'avviatore xdg: DEVE essere add-penguins-links.desktop
115
- shx.cp(path.resolve(__dirname, '../../../assets/penguins-links-add.desktop'), dirAutostart);
116
- // create /usr/bin/penguins-links-add.sh
117
- const script = '/usr/bin/penguins-links-add.sh';
118
- let text = '';
119
- text += '#!/bin/sh\n';
120
- text += 'DESKTOP=$(xdg-user-dir DESKTOP)\n';
121
- text += 'while [ ! -d "$DESKTOP" ]; do\n';
122
- text += ' DESKTOP=$(xdg-user-dir DESKTOP)\n';
123
- text += ' sleep 1\n';
124
- text += 'done\n';
125
- text += `cp /usr/share/applications/${installerLink} "$DESKTOP"\n`;
126
- if (Pacman.packageIsInstalled('lxde-core')) {
127
- if (!noicons) {
128
- text += lxdeLink('penguins-eggs.desktop', "Penguins' eggs", 'eggs');
129
- }
130
- if (myAddons.adapt)
131
- text += lxdeLink('eggs-adapt.desktop', 'Adapt', 'video-display');
132
- if (myAddons.pve)
133
- text += lxdeLink('eggs-pve.desktop', 'Proxmox VE', 'proxmox-ve');
134
- if (myAddons.rsupport)
135
- text += lxdeLink('eggs-rsupport.desktop', 'Remote assistance', 'remote-assistance');
136
- }
137
- else {
138
- if (!noicons) {
139
- text += 'cp /usr/share/applications/penguins-eggs.desktop "$DESKTOP"\n';
140
- }
141
- if (myLinks.length > 0) {
142
- for (const link of myLinks) {
143
- text += `cp /usr/share/applications/${link}.desktop "$DESKTOP"\n`;
144
- }
145
- }
146
- if (myAddons.adapt)
147
- text += 'cp /usr/share/applications/eggs-adapt.desktop "$DESKTOP"\n';
148
- if (myAddons.pve)
149
- text += 'cp /usr/share/applications/eggs-pve.desktop "$DESKTOP"\n';
150
- if (myAddons.rsupport)
151
- text += 'cp /usr/share/applications/eggs-rsupport.desktop "$DESKTOP"\n';
88
+ const autostartDir = path.join(mergedRoot, '/etc/xdg/autostart');
89
+ copyToMerged('../../../assets/penguins-links-add.desktop', '/etc/xdg/autostart/penguins-links-add.desktop');
90
+ const scriptPath = path.join(mergedRoot, '/usr/bin/penguins-links-add.sh');
91
+ let scriptText = '#!/bin/sh\nDESKTOP=$(xdg-user-dir DESKTOP)\n';
92
+ scriptText += 'while [ ! -d "$DESKTOP" ]; do sleep 1; DESKTOP=$(xdg-user-dir DESKTOP); done\n';
93
+ scriptText += `cp /usr/share/applications/${installerLink} "$DESKTOP"\n`;
94
+ if (!noicons)
95
+ scriptText += 'cp /usr/share/applications/penguins-eggs.desktop "$DESKTOP"\n';
96
+ myLinks.forEach(link => scriptText += `cp /usr/share/applications/${link}.desktop "$DESKTOP"\n`);
97
+ if (Pacman.packageIsInstalled('cosmic-session') || Pacman.packageIsInstalled('gdm3') || Pacman.packageIsInstalled('gdm')) {
98
+ scriptText += 'chmod a+x "$DESKTOP"/*.desktop\n';
99
+ scriptText += 'for f in "$DESKTOP"/*.desktop; do gio set "$f" metadata::trusted true 2>/dev/null; done\n';
100
+ }
101
+ else if (Pacman.packageIsInstalled('xfce4-session')) {
102
+ scriptText += 'for f in "$DESKTOP"/*.desktop; do chmod +x "$f"; gio set -t string "$f" metadata::xfce-exe-checksum "$(sha256sum "$f" | awk "{print $1}")"; done\n';
103
+ }
104
+ else {
105
+ scriptText += 'chmod +x "$DESKTOP"/*.desktop\n';
106
+ }
107
+ fs.mkdirSync(path.dirname(scriptPath), { recursive: true });
108
+ fs.writeFileSync(scriptPath, scriptText, 'utf8');
109
+ await exec(`chmod a+x ${scriptPath}`);
110
+ /**
111
+ * 5. LOGICA AUTOLOGIN UNIVERSALE (STRATEGIA BYPASS TTY)
112
+ */
113
+ // Sblocco utente (Shadow & PAM)
114
+ try {
115
+ await exec(`chroot ${mergedRoot} usermod -p "" ${newuser}`);
116
+ await exec(`chroot ${mergedRoot} passwd -u ${newuser}`);
117
+ }
118
+ catch (e) {
119
+ if (this.verbose)
120
+ console.log('Ovary: error unlocking');
121
+ }
122
+ const pamServices = ['common-auth', 'greetd', 'gdm-password', 'login'];
123
+ pamServices.forEach(s => {
124
+ const p = path.join(mergedRoot, `/etc/pam.d/${s}`);
125
+ if (fs.existsSync(p)) {
126
+ let c = fs.readFileSync(p, 'utf8');
127
+ c = c.replace(/pam_unix\.so(?!.*nullok)/g, 'pam_unix.so nullok');
128
+ fs.writeFileSync(p, c, 'utf8');
152
129
  }
153
- /**
154
- * enable desktop links
155
- */
156
- if (Pacman.packageIsInstalled('gdm3') || Pacman.packageIsInstalled('gdm')) {
157
- // GNOME
158
- text += 'test -f /usr/share/applications/penguins-eggs.desktop && cp /usr/share/applications/penguins-eggs.desktop "$DESKTOP"\n';
159
- text += 'test -f "$DESKTOP"/op && chmod a+x "$DESKTOP"/penguins-eggs.desktop\n';
160
- text += 'test -f "$DESKTOP"/penguins-eggs.desktop && gio set "$DESKTOP"/penguins-eggs.desktop metadata::trusted true\n';
161
- text += `test -f /usr/share/applications/${installerLink} && cp /usr/share/applications/${installerLink} "$DESKTOP"\n`;
162
- text += `test -f "$DESKTOP"/${installerLink} && chmod a+x "$DESKTOP"/${installerLink}\n`;
163
- text += `test -f "$DESKTOP"/${installerLink} && gio set "$DESKTOP"/${installerLink} metadata::trusted true\n`;
130
+ });
131
+ // CASO COSMIC/GREETD: Bypass totale del Display Manager
132
+ if (Pacman.packageIsInstalled('greetd')) {
133
+ // 1. Forza login automatico su TTY1 tramite Getty
134
+ const gettyDir = path.join(mergedRoot, '/etc/systemd/system/getty@tty1.service.d');
135
+ fs.mkdirSync(gettyDir, { recursive: true });
136
+ const gettyConf = `[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin ${newuser} --noclear %I $TERM\n`;
137
+ fs.writeFileSync(path.join(gettyDir, 'override.conf'), gettyConf, 'utf8');
138
+ // 2. Script che lancia la sessione (quello che fai a mano)
139
+ const startScript = path.join(mergedRoot, '/usr/bin/eggs-start-cosmic');
140
+ const startContent = `#!/bin/bash\nif [[ -z $DISPLAY && $(tty) == /dev/tty1 ]]; then\n exec dbus-run-session cosmic-session\nfi\n`;
141
+ fs.writeFileSync(startScript, startContent, 'utf8');
142
+ await exec(`chmod a+x ${startScript}`);
143
+ // 3. Esegui lo script al login della shell
144
+ const userHome = path.join(mergedRoot, 'home', newuser);
145
+ if (!fs.existsSync(userHome))
146
+ fs.mkdirSync(userHome, { recursive: true });
147
+ const profilePath = path.join(userHome, '.bash_profile');
148
+ fs.writeFileSync(profilePath, `[[ -f /usr/bin/eggs-start-cosmic ]] && . /usr/bin/eggs-start-cosmic\n`, 'utf8');
149
+ await exec(`chroot ${mergedRoot} chown -R ${newuser}:${newuser} /home/${newuser}`);
150
+ await exec(`chroot ${mergedRoot} usermod -aG video,render,input,tty,audio ${newuser}`);
151
+ // Disabilitiamo greetd per evitare che "rubi" il terminale
152
+ try {
153
+ await exec(`chroot ${mergedRoot} systemctl disable greetd`);
164
154
  }
165
- else if (Pacman.packageIsInstalled('xfce4-session')) {
166
- text += `# xfce: enable-desktop-links\n`;
167
- text += `for f in "$DESKTOP"/*.desktop; do chmod +x "$f"; gio set -t string "$f" metadata::xfce-exe-checksum "$(sha256sum "$f" | awk '{print $1}')"; done\n`;
155
+ catch (e) { }
156
+ }
157
+ // Altri Display Manager
158
+ else if (Pacman.packageIsInstalled('gdm3') || Pacman.packageIsInstalled('gdm')) {
159
+ const gdmFile = fs.existsSync(path.join(mergedRoot, '/etc/gdm3/daemon.conf')) ? path.join(mergedRoot, '/etc/gdm3/daemon.conf') : path.join(mergedRoot, '/etc/gdm3/custom.conf');
160
+ if (fs.existsSync(gdmFile)) {
161
+ let c = fs.readFileSync(gdmFile, 'utf8');
162
+ c = c.replace(/#?AutomaticLoginEnable=.*/, 'AutomaticLoginEnable=true').replace(/#?AutomaticLogin=.*/, `AutomaticLogin=${newuser}`);
163
+ fs.writeFileSync(gdmFile, c, 'utf8');
168
164
  }
169
- else {
170
- text += `# others: enable-desktop-links\n`;
171
- text += 'chmod +x "$DESKTOP"/*.desktop\n';
165
+ }
166
+ else if (Pacman.packageIsInstalled('sddm')) {
167
+ const sddmConf = path.join(mergedRoot, '/etc/sddm.conf.d/eggs-autologin.conf');
168
+ fs.mkdirSync(path.dirname(sddmConf), { recursive: true });
169
+ fs.writeFileSync(sddmConf, `[Autologin]\nUser=${newuser}\nSession=cosmic\n`, 'utf8');
170
+ }
171
+ else if (Pacman.packageIsInstalled('lightdm')) {
172
+ const lPath = path.join(mergedRoot, '/etc/lightdm/lightdm.conf');
173
+ if (fs.existsSync(lPath)) {
174
+ let c = fs.readFileSync(lPath, 'utf8');
175
+ if (!c.includes('[Seat:*]'))
176
+ c += '\n[Seat:*]\n';
177
+ c = c.replace(/autologin-user=.*/g, '').replace('[Seat:*]', `[Seat:*]\nautologin-user=${newuser}\nautologin-user-timeout=0`);
178
+ fs.writeFileSync(lPath, c, 'utf8');
172
179
  }
173
- fs.writeFileSync(script, text, 'utf8');
174
- await exec(`chmod a+x ${script}`, this.echo);
175
180
  }
176
- await Xdg.autologin(await Utils.getPrimaryUser(), this.settings.config.user_opt, this.settings.work_dir.merged);
177
- }
178
- /**
179
- * Creazione link desktop per lxde
180
- * @param name
181
- * @param icon
182
- * was private
183
- */
184
- function lxdeLink(file, name, icon) {
185
- const lnk = `lnk-${file}`;
186
- let text = '';
187
- text += `echo "[Desktop Entry]" >$DESKTOP/${lnk}\n`;
188
- text += `echo "Type=Link" >> $DESKTOP/${lnk}\n`;
189
- text += `echo "Name=${name}" >> $DESKTOP/${lnk}\n`;
190
- text += `echo "Icon=${icon}" >> $DESKTOP/${lnk}\n`;
191
- text += `echo "URL=/usr/share/applications/${file}" >> $DESKTOP/${lnk}\n\n`;
192
- return text;
181
+ if (this.verbose)
182
+ console.log(`Ovary: Autologin and Desktop links configured for user: ${newuser}`);
193
183
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ./src/classes/ovary.d/luks-home-support.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
+ * Installa i file necessari per sbloccare home.img LUKS durante il boot
11
+ */
12
+ export declare function installHomecryptSupport(this: Ovary, squashfsRoot: string, homeImgPath: string): void;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * ./src/classes/ovary.d/luks-home-support.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 path from 'path';
11
+ import { fileURLToPath } from 'url';
12
+ import { dirname } from 'path';
13
+ import Utils from '../utils.js';
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = dirname(__filename);
16
+ /**
17
+ * Installa i file necessari per sbloccare home.img LUKS durante il boot
18
+ */
19
+ export function installHomecryptSupport(squashfsRoot, homeImgPath) {
20
+ Utils.warning('installing encrypted home support...');
21
+ // console.log("squashfsRoot:", squashfsRoot)
22
+ // console.log("homeImgPath:", homeImgPath)
23
+ // Leggi il template bash
24
+ const templatePath = path.join(__dirname, '../../../scripts/mount-encrypted-home.sh');
25
+ let bashScript = fs.readFileSync(templatePath, 'utf8');
26
+ // Sostituisci il placeholder con il path reale
27
+ bashScript = bashScript.replace('__HOME_IMG_PATH__', homeImgPath);
28
+ // Systemd service
29
+ const systemdService = `[Unit]
30
+ Description=Unlock and mount encrypted home.img
31
+ DefaultDependencies=no
32
+ After=systemd-udev-settle.service local-fs-pre.target
33
+ Before=local-fs.target display-manager.service
34
+ ConditionPathExists=${homeImgPath}
35
+
36
+ [Service]
37
+ Type=oneshot
38
+ RemainAfterExit=yes
39
+ StandardInput=tty
40
+ StandardOutput=journal+console
41
+ StandardError=journal+console
42
+ TTYPath=/dev/console
43
+ TTYReset=yes
44
+ TTYVHangup=yes
45
+ ExecStart=/usr/local/bin/mount-encrypted-home.sh
46
+ ExecStop=/bin/bash -c 'umount /home && cryptsetup close live-home'
47
+
48
+ [Install]
49
+ WantedBy=local-fs.target
50
+ `;
51
+ // Percorsi di destinazione
52
+ const scriptPath = path.join(squashfsRoot, 'usr/local/bin/mount-encrypted-home.sh');
53
+ const servicePath = path.join(squashfsRoot, 'etc/systemd/system/mount-encrypted-home.service');
54
+ const symlinkDir = path.join(squashfsRoot, 'etc/systemd/system/local-fs.target.wants');
55
+ const symlinkPath = path.join(symlinkDir, 'mount-encrypted-home.service');
56
+ // Create dirs
57
+ fs.mkdirSync(path.dirname(scriptPath), { recursive: true });
58
+ fs.mkdirSync(path.dirname(servicePath), { recursive: true });
59
+ fs.mkdirSync(symlinkDir, { recursive: true });
60
+ // Scrivi lo script
61
+ fs.writeFileSync(scriptPath, bashScript);
62
+ fs.chmodSync(scriptPath, 0o755);
63
+ // Scrivi il service
64
+ fs.writeFileSync(servicePath, systemdService);
65
+ // Crea il symlink per abilitare il service
66
+ if (fs.existsSync(symlinkPath)) {
67
+ fs.unlinkSync(symlinkPath);
68
+ }
69
+ fs.symlinkSync('../mount-encrypted-home.service', symlinkPath);
70
+ }
@@ -8,5 +8,6 @@
8
8
  import Ovary from '../ovary.js';
9
9
  /**
10
10
  * Installa i file necessari per sbloccare home.img LUKS durante il boot
11
+ * Supporta sia Systemd (Debian/Ubuntu) che SysVinit (Devuan)
11
12
  */
12
13
  export declare function installHomecryptSupport(this: Ovary, squashfsRoot: string, homeImgPath: string): void;