penguins-eggs 25.10.19 → 25.10.24

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 (53) hide show
  1. package/.oclif.manifest.json +17 -3
  2. package/README.md +769 -2
  3. package/README.pdf +1705 -1747
  4. package/addons/eggs/theme/livecd/{grub.theme.cfg → full.grub.theme.cfg} +1 -1
  5. package/addons/eggs/theme/livecd/{isolinux.theme.cfg → full.isolinux.theme.cfg} +1 -1
  6. package/addons/eggs/theme/livecd/generic-splash.png +0 -0
  7. package/addons/eggs/theme/livecd/generic.grub.main.cfg +29 -0
  8. package/addons/eggs/theme/livecd/generic.grub.theme.cfg +67 -0
  9. package/addons/eggs/theme/livecd/generic.isolinux.main.cfg +34 -0
  10. package/addons/eggs/theme/livecd/generic.isolinux.theme.cfg +34 -0
  11. package/addons/eggs/theme/livecd/simple.grub.main.cfg +29 -0
  12. package/addons/eggs/theme/livecd/simple.grub.theme.cfg +67 -0
  13. package/addons/eggs/theme/livecd/{isolinux.main.simple.cfg → simple.isolinux.main.cfg} +1 -2
  14. package/addons/eggs/theme/livecd/simple.isolinux.theme.cfg +47 -0
  15. package/dist/classes/diversions.d.ts +1 -1
  16. package/dist/classes/diversions.js +4 -25
  17. package/dist/classes/ovary.d/bind-live-fs.js +1 -1
  18. package/dist/classes/ovary.d/initrd.js +3 -2
  19. package/dist/classes/ovary.d/luks-get-password.js +1 -0
  20. package/dist/classes/ovary.d/luks-home.js +41 -29
  21. package/dist/classes/ovary.d/luks-root-initrd.d.ts +17 -0
  22. package/dist/classes/ovary.d/luks-root-initrd.js +213 -0
  23. package/dist/classes/ovary.d/luks-root.js +60 -35
  24. package/dist/classes/ovary.d/make-dot-disk.js +10 -1
  25. package/dist/classes/ovary.d/make-efi.js +59 -43
  26. package/dist/classes/ovary.d/make-squashfs.d.ts +1 -1
  27. package/dist/classes/ovary.d/make-squashfs.js +2 -5
  28. package/dist/classes/ovary.d/merged.js +1 -1
  29. package/dist/classes/ovary.d/produce.d.ts +2 -2
  30. package/dist/classes/ovary.d/produce.js +45 -44
  31. package/dist/classes/ovary.d/syslinux.js +47 -34
  32. package/dist/classes/ovary.d/xorriso-command.js +1 -2
  33. package/dist/classes/ovary.d.ts +3 -4
  34. package/dist/classes/ovary.js +6 -6
  35. package/dist/classes/utils.d.ts +2 -0
  36. package/dist/classes/utils.js +13 -3
  37. package/dist/commands/love.d.ts +1 -0
  38. package/dist/commands/love.js +9 -2
  39. package/dist/commands/produce.d.ts +2 -1
  40. package/dist/commands/produce.js +18 -4
  41. package/dist/krill/classes/sequence.d.ts +1 -1
  42. package/dist/krill/classes/sequence.js +3 -3
  43. package/package.json +4 -4
  44. package/scripts/_eggs +3 -1
  45. package/scripts/boot-encrypted-root.sh +177 -0
  46. package/scripts/eggs.bash +2 -2
  47. package/scripts/mount-encrypted-home.sh +92 -56
  48. package/dist/classes/ovary.d/luks-root-bootstrap-builder.d.ts +0 -11
  49. package/dist/classes/ovary.d/luks-root-bootstrap-builder.js +0 -45
  50. package/scripts/luks-root-bootstrap-create.sh +0 -235
  51. package/scripts/luks-root-unlock.sh +0 -172
  52. /package/addons/eggs/theme/livecd/{grub.main.cfg → full.grub.main.cfg} +0 -0
  53. /package/addons/eggs/theme/livecd/{isolinux.main.full.cfg → full.isolinux.main.cfg} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Global Property
4
4
  title-color: "blue"
5
- title-text: "Penguins' eggs - Perri's brewery edition"
5
+ title-text: "Linux live"
6
6
  title-font: "Sans Regular 16"
7
7
  desktop-color: "blue"
8
8
  desktop-image: "splash.png"
@@ -44,4 +44,4 @@ menu hshift 0
44
44
  menu vshift 0
45
45
  menu title Penguins' eggs - Perri's brewery edition
46
46
  menu background splash.png
47
- menu tabmsg Press ENTER to boot or TAB to edit a menu entry
47
+ menu tabmsg Press ENTER to boot or TAB to edit a menu entry
@@ -0,0 +1,29 @@
1
+ set theme=/boot/grub/theme.cfg
2
+
3
+ menuentry "{{{fullname}}} Live/Installation" {
4
+ set gfxpayload=keep
5
+ {{{rmModules}}}
6
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
7
+ initrd {{{initrdImg}}}
8
+ }
9
+
10
+ menuentry "{{{fullname}}} Safe Mode" {
11
+ set gfxpayload=keep
12
+ {{{rmModules}}}
13
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
14
+ initrd {{{initrdImg}}}
15
+ }
16
+
17
+ menuentry "{{{fullname}}} Text Mode" {
18
+ set gfxpayload=keep
19
+ {{{rmModules}}}
20
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
21
+ initrd {{{initrdImg}}}
22
+ }
23
+
24
+ if [ "$grub_platform" = "efi" ]; then
25
+ menuentry "Boot from local disk" {
26
+ exit 1
27
+ }
28
+ fi
29
+
@@ -0,0 +1,67 @@
1
+ # Quirinux GNU/Linux by Charlie Martínez
2
+
3
+ # Global Property
4
+ title-color: "blue"
5
+ title-text: "Debian live (Trixie)"
6
+ title-font: "Sans Regular 16"
7
+ desktop-color: "blue"
8
+ desktop-image: "splash.png"
9
+ message-color: "blue"
10
+ message-bg-color: "blue"
11
+ terminal-font: "Sans Regular 12"
12
+
13
+ # show boot_menu
14
+ + boot_menu {
15
+ top = 150
16
+ left = 15%
17
+ width = 75%
18
+ height = 300
19
+ item_font = "Sans Regular 12"
20
+ item_color = "blue"
21
+ selected_item_color = "cyan"
22
+ item_height = 20
23
+ item_padding = 15
24
+ item_spacing = 5
25
+ }
26
+
27
+ + vbox {
28
+ top = 100%-60
29
+ left = 10%
30
+ + hbox {
31
+ top = 0
32
+ left = 20%
33
+ + label {text = "Enter: " font = "Sans 10" color = "blue" align = "left"}
34
+ + label {text = "Select " font = "Sans 10" color = "blue" align = "left"}
35
+ }
36
+ + hbox {
37
+ top = 0
38
+ left = 20%
39
+ + label {text = "E: " font = "Sans 10" color = "blue" align = "left"}
40
+ + label {text = "Edit selection " font = "Sans 10" color = "blue" align = "left"}
41
+ + label {text = " " font = "Sans 10" color = "white" align = "left"}
42
+ + label {text = "C: " font = "Sans 10" color = "blue" align = "left"}
43
+ + label {text = "GRUB command line " font = "Sans 10" color = "blue" align = "left"}
44
+ + label {text = "Linea de Comando de GRUB" font = "Sans 10" color = "blue" align = "left"}
45
+ }
46
+ }
47
+
48
+ +progress_bar {
49
+ id = "__timeout__"
50
+ left = 15%
51
+ top = 100%-18
52
+ width = 70%
53
+ height = 18
54
+ bg_color = "201, 0, 22"
55
+ fg_color = "255, 99,9"
56
+ border_color = "255, 181, 21"
57
+ show_text = true
58
+ font = "DejaVu Sans Regular 10"
59
+ text_color = "blue"
60
+ text = "@TIMEOUT_NOTIFICATION_LONG@"
61
+ }
62
+
63
+ + vbox {
64
+ top = 100%
65
+ left = 2%
66
+ + label {text = "Press 'E' key to edit, 'C' for command." font = "Sans 10" color = "blue" align = "left"}
67
+ }
@@ -0,0 +1,34 @@
1
+ # isolinux.main.cfg
2
+ #
3
+
4
+ # search path for the c32 support libraries (libcom32, libutil etc.)
5
+ path
6
+ include isolinux.theme.cfg
7
+ default vesamenu.c32
8
+ prompt 0
9
+ timeout 100
10
+
11
+ label Live
12
+ menu label {{{fullname}}} Live/Installation Mode
13
+ say "Booting {{{fullname}}} GNU/Linux (kernel {{{kernel}}})"
14
+ linux {{{vmlinuz}}}
15
+ append initrd={{{initrdImg}}} {{{kernel_parameters}}} quiet splash
16
+
17
+ label Safe
18
+ menu label {{{fullname}}} Safe Mode
19
+ say "Booting {{{fullname}}} GNU/Linux (kernel {{{kernel}}})"
20
+ linux {{{vmlinuz}}}
21
+ append initrd={{{initrdImg}}} {{{kernel_parameters}}} quiet splash
22
+
23
+
24
+ label Text
25
+ menu label {{{fullname}}} Text Mode
26
+ say "Booting {{{fullname}}} GNU/Linux (kernel {{{kernel}}})"
27
+ linux {{{vmlinuz}}}
28
+ append initrd={{{initrdImg}}} {{{kernel_parameters}}} quiet splash
29
+
30
+ label local
31
+ menu label Boot from local disk
32
+ COM32 chain.c32
33
+ APPEND hd0
34
+ say "Booting from the first hard drive"
@@ -0,0 +1,34 @@
1
+ MENU TITLE Debian live (trixie)
2
+ MENU CLEAR
3
+ MENU MARGIN 8
4
+ MENU ROWS 12
5
+ MENU HELPMSGROW 15
6
+ MENU TABMSGROW 18
7
+
8
+ MENU COLOR border 0 #ffffffff #00000000 none
9
+ MENU COLOR sel 0 #ffffffff #ff000000 none
10
+ MENU COLOR unsel 0 #ffc0c0c0 #00000000 none
11
+ MENU COLOR help 0 #ffc0c0c0 #00000000 none
12
+ MENU COLOR title 0 #ef220cff #00000000 none
13
+ MENU COLOR tabmsg 0 #ffc0c0c0 #00000000 none
14
+ MENU COLOR cmdline 0 #ffffffff #00000000 none
15
+
16
+
17
+ # Position
18
+ menu width 80
19
+ menu margin 10
20
+ menu passwordmargin 3
21
+ menu rows 12
22
+ menu tabmsgrow 18
23
+ menu cmdlinegrow 18
24
+ menu endrow -1
25
+ menu passwordrow 11
26
+ menu timeout 20
27
+ menu helpmsggrow 22
28
+ menu helpmsgendrow -1
29
+ menu hiddenrow -2
30
+ menu hshift 0
31
+ menu vshift 0
32
+ menu title Linux live
33
+ menu background splash.png
34
+ menu tabmsg Press ENTER to boot or TAB to edit a menu entry
@@ -0,0 +1,29 @@
1
+ set theme=/boot/grub/theme.cfg
2
+
3
+ menuentry "{{{fullname}}} Live/Installation" {
4
+ set gfxpayload=keep
5
+ {{{rmModules}}}
6
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
7
+ initrd {{{initrdImg}}}
8
+ }
9
+
10
+ menuentry "{{{fullname}}} Safe Mode" {
11
+ set gfxpayload=keep
12
+ {{{rmModules}}}
13
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
14
+ initrd {{{initrdImg}}}
15
+ }
16
+
17
+ menuentry "{{{fullname}}} Text Mode" {
18
+ set gfxpayload=keep
19
+ {{{rmModules}}}
20
+ linux {{{vmlinuz}}} {{{kernel_parameters}}} quiet splash
21
+ initrd {{{initrdImg}}}
22
+ }
23
+
24
+ if [ "$grub_platform" = "efi" ]; then
25
+ menuentry "Boot from local disk" {
26
+ exit 1
27
+ }
28
+ fi
29
+
@@ -0,0 +1,67 @@
1
+ # Quirinux GNU/Linux by Charlie Martínez
2
+
3
+ # Global Property
4
+ title-color: "blue"
5
+ title-text: "Debian live (Trixie)"
6
+ title-font: "Sans Regular 16"
7
+ desktop-color: "blue"
8
+ desktop-image: "splash.png"
9
+ message-color: "blue"
10
+ message-bg-color: "blue"
11
+ terminal-font: "Sans Regular 12"
12
+
13
+ # show boot_menu
14
+ + boot_menu {
15
+ top = 150
16
+ left = 15%
17
+ width = 75%
18
+ height = 300
19
+ item_font = "Sans Regular 12"
20
+ item_color = "blue"
21
+ selected_item_color = "cyan"
22
+ item_height = 20
23
+ item_padding = 15
24
+ item_spacing = 5
25
+ }
26
+
27
+ + vbox {
28
+ top = 100%-60
29
+ left = 10%
30
+ + hbox {
31
+ top = 0
32
+ left = 20%
33
+ + label {text = "Enter: " font = "Sans 10" color = "blue" align = "left"}
34
+ + label {text = "Select " font = "Sans 10" color = "blue" align = "left"}
35
+ }
36
+ + hbox {
37
+ top = 0
38
+ left = 20%
39
+ + label {text = "E: " font = "Sans 10" color = "blue" align = "left"}
40
+ + label {text = "Edit selection " font = "Sans 10" color = "blue" align = "left"}
41
+ + label {text = " " font = "Sans 10" color = "white" align = "left"}
42
+ + label {text = "C: " font = "Sans 10" color = "blue" align = "left"}
43
+ + label {text = "GRUB command line " font = "Sans 10" color = "blue" align = "left"}
44
+ + label {text = "Linea de Comando de GRUB" font = "Sans 10" color = "blue" align = "left"}
45
+ }
46
+ }
47
+
48
+ +progress_bar {
49
+ id = "__timeout__"
50
+ left = 15%
51
+ top = 100%-18
52
+ width = 70%
53
+ height = 18
54
+ bg_color = "201, 0, 22"
55
+ fg_color = "255, 99,9"
56
+ border_color = "255, 181, 21"
57
+ show_text = true
58
+ font = "DejaVu Sans Regular 10"
59
+ text_color = "blue"
60
+ text = "@TIMEOUT_NOTIFICATION_LONG@"
61
+ }
62
+
63
+ + vbox {
64
+ top = 100%
65
+ left = 2%
66
+ + label {text = "Press 'E' key to edit, 'C' for command." font = "Sans 10" color = "blue" align = "left"}
67
+ }
@@ -1,4 +1,4 @@
1
- # eggs: isolinux.main.cfg
1
+ # isolinux.main.cfg
2
2
  #
3
3
 
4
4
  # search path for the c32 support libraries (libcom32, libutil etc.)
@@ -13,7 +13,6 @@ label Live
13
13
  say "Booting {{{fullname}}} GNU/Linux (kernel {{{kernel}}})"
14
14
  linux {{{vmlinuz}}}
15
15
  append initrd={{{initrdImg}}} {{{kernel_parameters}}}
16
- # RIMUOVERE O CONTROLLARE evm=off per overlayfs
17
16
 
18
17
  label Safe
19
18
  menu label {{{fullname}}} Safe Mode
@@ -0,0 +1,47 @@
1
+ #
2
+ # eggs: isolinux.theme
3
+ #
4
+
5
+ # MENU COLOR element background foreground shadow
6
+ # background and foreground are hexadecimal digits for alpha (opacity), red, green and blue,
7
+ # respectively. #00000000 represents fully transparent, and #ffffffff represents opaque white.
8
+ # shadow none/std
9
+
10
+ MENU COLOR screen 37;40 #80ffffff #00000000 std
11
+ MENU COLOR border 30;44 #40000000 #00000000 std
12
+ MENU COLOR title 1;36;44 #c00090f0 #00000000 std
13
+ MENU COLOR unsel 37;44 #c00090f0 #00000000 std
14
+ MENU COLOR sel 7;37;40 #FF00FF #E0FFAF all
15
+ MENU COLOR hotsel 1;7;37;40 #FF00FF #E0FFFF all
16
+ MENU COLOR disabled 1;30;44 #c00090f0 #00000000 std
17
+ MENU COLOR scrollbar 30;44 #c00090f0 #00000000 std
18
+ MENU COLOR tabmsg 31;40 #c00090f0 #00000000 std
19
+ MENU COLOR cmdmark 1;36;40 #c00090f0 #00000000 std
20
+ #MENU COLOR cmdline 37;40 #c00090f0 #00000000 std
21
+ MENU COLOR cmdline 37;40 #FFFFFF #0000FF std
22
+ MENU COLOR pwdborder 30;47 #c00090f0 #20ffffff std
23
+ MENU COLOR pwdheader 31;47 #c00090f0 #20ffffff std
24
+ MENU COLOR pwdentry 30;47 #c00090f0 #20ffffff std
25
+ MENU COLOR timeout_msg 37;40 #c00090f0 #00000000 std
26
+ MENU COLOR timeout 1;37;40 #c00090f0 #00000000 std
27
+ MENU COLOR help 37;40 #c00090f0 #00000000 std
28
+ MENU COLOR msg07 37;40 #c00090f0 #00000000 std
29
+
30
+ # Position
31
+ menu width 80
32
+ menu margin 10
33
+ #menu passwordmargin 3
34
+ menu rows 12
35
+ menu tabmsgrow 18
36
+ menu cmdlinegrow 18
37
+ menu endrow -1
38
+ menu passwordrow 11
39
+ menu timeout 20
40
+ menu helpmsggrow 22
41
+ menu helpmsgendrow -1
42
+ menu hiddenrow -2
43
+ menu hshift 0
44
+ menu vshift 0
45
+ menu title Penguins' eggs - Perri's brewery edition
46
+ menu background splash.png
47
+ menu tabmsg Press ENTER to boot or TAB to edit a menu entry
@@ -39,7 +39,7 @@ export default class Diversions {
39
39
  * @param volid
40
40
  * @returns
41
41
  */
42
- static kernelParameters(familyId: string, volid: string, luksUuid?: string): string;
42
+ static kernelParameters(familyId: string, volid: string, fullCrypt?: boolean): string;
43
43
  /**
44
44
  *
45
45
  * @returns
@@ -6,7 +6,6 @@
6
6
  * license: MIT
7
7
  */
8
8
  import Distro from './distro.js';
9
- import Pacman from './pacman.js';
10
9
  export default class Diversions {
11
10
  /**
12
11
  *
@@ -67,7 +66,7 @@ export default class Diversions {
67
66
  * @param volid
68
67
  * @returns
69
68
  */
70
- static kernelParameters(familyId, volid, luksUuid = '') {
69
+ static kernelParameters(familyId, volid, fullCrypt = false) {
71
70
  // GRUB_CMDLINE_LINUX='ipv6.disable=1'
72
71
  let kp = "";
73
72
  if (familyId === 'alpine') {
@@ -84,29 +83,9 @@ export default class Diversions {
84
83
  }
85
84
  }
86
85
  else if (familyId === 'debian') {
87
- /**
88
- * da rivedere dracut/initramfs
89
- */
90
- if (Pacman.packageIsInstalled('dracut')) {
91
- if (luksUuid !== '') {
92
- let append = `boot=live \
93
- root=live:LABEL=${volid} \
94
- rd.luks.loop=/live/luks.img \
95
- eggs.luks.uuid=${luksUuid} \
96
- rd.live.squashimg=filesystem.squashfs \
97
- rd.live.overlay.overlayfs=1 \
98
- nomodeset \
99
- rd.break=pre-mount \
100
- rd.shell`;
101
- kp += append.replaceAll(/\s\s+/g, ' ');
102
- }
103
- else {
104
- // dracut: rd.live.squashimg
105
- kp += `root=live:CDLABEL=${volid} rd.live.image rd.live.dir=/live rd.live.squashimg=filesystem.squashfs`;
106
- }
107
- }
108
- else {
109
- kp += `boot=live components locales=${process.env.LANG} cow_spacesize=2G`;
86
+ kp += `boot=live components locales=${process.env.LANG} cow_spacesize=2G`;
87
+ if (fullCrypt) {
88
+ kp += ` live-media=/run/live/medium`;
110
89
  }
111
90
  }
112
91
  else if (familyId === 'fedora') {
@@ -161,7 +161,7 @@ export async function uBindLiveFs() {
161
161
  }
162
162
  }
163
163
  }
164
- if (this.clone) {
164
+ if (this.clone || this.fullcrypt) {
165
165
  cmds.push(await rexec(`umount ${this.settings.work_dir.merged}/home`, this.verbose));
166
166
  }
167
167
  // Utils.writeXs(`${this.settings.config.snapshot_dir}ubind`, cmds)
@@ -71,9 +71,10 @@ export async function initrdArch() {
71
71
  export async function initrdDebian(verbose = false) {
72
72
  Utils.warning(`creating ${this.initrd} using mkinitramfs on (ISO)/live`);
73
73
  const prefix = this.settings.config.snapshot_prefix;
74
- const dest = `${this.settings.iso_work}live/${path.basename(this.initrd)}`;
74
+ const destFinal = `${this.settings.iso_work}live/${path.basename(this.initrd)}`;
75
75
  const log = `> ${this.settings.iso_work}${prefix}mkinitramfs.log.txt 2>&1`;
76
- const cmd = `mkinitramfs -o ${dest} ${this.kernel} ${log}`;
76
+ const target = path.join(this.dotMnt, 'filesystem.squashfs');
77
+ const cmd = `mkinitramfs -v -o ${destFinal} ${this.kernel} ${log}`;
77
78
  await exec(cmd, this.echo);
78
79
  }
79
80
  /*
@@ -47,6 +47,7 @@ export async function luksGetPassword() {
47
47
  if (answers.password === answers.confirm) {
48
48
  password = answers.password;
49
49
  confirmed = true;
50
+ this.hidden = true;
50
51
  Utils.success('Password confirmed!');
51
52
  }
52
53
  else {
@@ -10,6 +10,7 @@ import fs from 'fs';
10
10
  import { spawn } from 'node:child_process';
11
11
  import Utils from '../utils.js';
12
12
  import { exec } from '../../lib/utils.js';
13
+ const noop = () => { };
13
14
  /**
14
15
  * luksHome()
15
16
  *
@@ -17,38 +18,49 @@ import { exec } from '../../lib/utils.js';
17
18
  * filesystem.squashfs
18
19
  */
19
20
  export async function luksHome(clone = false, homecrypt = false) {
21
+ const loggers = {
22
+ log: this.hidden ? noop : console.log,
23
+ warning: this.hidden ? noop : Utils.warning,
24
+ success: this.hidden ? noop : Utils.success,
25
+ info: this.hidden ? noop : Utils.info,
26
+ };
27
+ const { log, warning, success, info } = loggers;
20
28
  try {
21
29
  /**
22
- * this.luksName = 'home.img';
23
- * this.luksFile = `/tmp/${luksName}`
24
- * this.luksDevice = `/dev/mapper/${luksName}`
25
- * this.luksMappedName = this.luksName
26
- * this.luksMountpoint = `/tmp/mnt/${luksName}`
27
- * this.luksPassword = 'evolution'
30
+ * this.luksMappedName = 'home.img';
31
+ * this.luksFile = `/tmp/${luksMappedName}`
32
+ * this.luksDevice = `/dev/mapper/${luksMappedName}`
33
+ * this.luksMountpoint = `/tmp/mnt/${luksMappedName}`
34
+ * this.luksPassword = '0'
28
35
  */
29
- console.log();
30
- console.log('====================================');
31
- console.log(` Creating ${this.luksName}`);
32
- console.log('====================================');
36
+ if (this.hidden) {
37
+ Utils.warning("intentionally blank. System is working, please wait");
38
+ }
39
+ log();
40
+ log('====================================');
41
+ log(` Creating ${this.luksMappedName}`);
42
+ log('====================================');
33
43
  // Utils.warning('1. Calculation of space requirements...')
34
44
  let sizeString = (await exec('du -sb --exclude=/home/eggs /home', { capture: true })).data.trim().split(/\s+/)[0];
35
45
  let size = Number.parseInt(sizeString, 10);
36
- // const fsOverhead = Math.max(size * 0.1, 100 * 1024 * 1024)
37
- // const luksSize = size + fsOverhead + (size * 0.2) // +20% di sicurezza
38
46
  const luksSize = Math.ceil(size * 2);
39
- Utils.warning(`homes size: ${bytesToGB(size)}`);
40
- Utils.warning(`partition LUKS ${this.luksFile} size: ${bytesToGB(luksSize)}`);
41
- Utils.warning(`creating partition LUKS: ${this.luksFile}`);
47
+ /**
48
+ * E' più precisa ma equivalente grazie
49
+ * al truncate
50
+ */
51
+ // const fsOverhead = Math.max(size * 0.1, 100 * 1024 * 1024)
52
+ // const luksSize = size * 1.25 + fsOverhead // +25%
53
+ warning(`homes size: ${bytesToGB(size)}`);
54
+ warning(`partition LUKS ${this.luksFile} size: ${bytesToGB(luksSize)}`);
55
+ warning(`creating partition LUKS: ${this.luksFile}`);
42
56
  await executeCommand('truncate', ['--size', `${luksSize}`, this.luksFile]);
43
- Utils.warning(`formatting ${this.luksFile} as a LUKS volume...`);
57
+ warning(`formatting ${this.luksFile} as a LUKS volume...`);
44
58
  await executeCommand('cryptsetup', ['--batch-mode', 'luksFormat', this.luksFile], `${this.luksPassword}\n`);
45
- this.luksUuid = (await exec(`cryptsetup luksUUID ${this.luksFile}`, { capture: true, echo: false })).data.trim();
46
- Utils.warning(`LUKS uuid: ${this.luksUuid}`);
47
- Utils.warning(`opening the LUKS volume. It will be mapped to ${this.luksDevice}`);
59
+ warning(`opening the LUKS volume. It will be mapped to ${this.luksDevice}`);
48
60
  await executeCommand('cryptsetup', ['luksOpen', this.luksFile, this.luksMappedName], `${this.luksPassword}\n`);
49
- Utils.warning(`formatting c ext4 `);
61
+ warning(`formatting c ext4 `);
50
62
  await exec(`mkfs.ext4 -L live-home ${this.luksDevice}`, this.echo);
51
- Utils.warning(`mounting ${this.luksDevice} on ${this.luksMountpoint}`);
63
+ warning(`mounting ${this.luksDevice} on ${this.luksMountpoint}`);
52
64
  if (fs.existsSync(this.luksMountpoint)) {
53
65
  if (!Utils.isMountpoint(this.luksMountpoint)) {
54
66
  await exec(`rm -rf ${this.luksMountpoint}`, this.echo);
@@ -58,10 +70,10 @@ export async function luksHome(clone = false, homecrypt = false) {
58
70
  }
59
71
  }
60
72
  await exec(`mkdir -p ${this.luksMountpoint}`, this.echo);
61
- await exec(`mount /dev/mapper/${this.luksName} ${this.luksMountpoint}`, this.echo);
62
- Utils.warning(`copying /home on ${this.luksMountpoint}`);
73
+ await exec(`mount /dev/mapper/${this.luksMappedName} ${this.luksMountpoint}`, this.echo);
74
+ warning(`copying /home on ${this.luksMountpoint}`);
63
75
  await exec(`rsync -ah --exclude='eggs' /home/ ${this.luksMountpoint}`, this.echo);
64
- Utils.warning(`saving user accounts info...`);
76
+ warning(`saving user accounts info...`);
65
77
  // Crea directory per backup system files
66
78
  await exec(`mkdir -p ${this.luksMountpoint}/.system-backup`, this.echo);
67
79
  // Filtra solo utenti con UID >= 1000
@@ -71,13 +83,13 @@ export async function luksHome(clone = false, homecrypt = false) {
71
83
  // Gli utenti possono appartenere a gruppi di sistema (sudo, audio, video, etc.)
72
84
  await exec(`cp /etc/group ${this.luksMountpoint}/.system-backup/group`, this.echo);
73
85
  await exec(`cp /etc/gshadow ${this.luksMountpoint}/.system-backup/gshadow`, this.echo);
74
- Utils.warning(`unmount ${this.luksDevice}`);
86
+ warning(`unmount ${this.luksDevice}`);
75
87
  await exec(`umount ${this.luksMountpoint}`, this.echo);
76
- Utils.warning(`closing LUKS volume ${this.luksMappedName}.`);
88
+ warning(`closing LUKS volume ${this.luksMappedName}.`);
77
89
  await executeCommand('cryptsetup', ['close', this.luksMappedName]);
78
- Utils.warning(`moving ${this.luksName} to (ISO)/live/.`);
90
+ warning(`moving ${this.luksMappedName} to (ISO)/live/.`);
79
91
  await exec(`mv ${this.luksFile} ${this.settings.iso_work}/live`, this.echo);
80
- Utils.warning('encryption process successfully completed!');
92
+ warning('encryption process successfully completed!');
81
93
  /**
82
94
  * YOU MUST! unlink the key on production
83
95
  */
@@ -95,7 +107,7 @@ export async function luksHome(clone = false, homecrypt = false) {
95
107
  await exec(`umount -lf ${this.luksMountpoint}`).catch(() => { });
96
108
  }
97
109
  if (fs.existsSync(this.luksDevice)) {
98
- await executeCommand('cryptsetup', ['luksClose', this.luksName]).catch(() => { });
110
+ await executeCommand('cryptsetup', ['close', this.luksMappedName]).catch(() => { });
99
111
  }
100
112
  await Utils.pressKeyToExit();
101
113
  process.exit(1);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ./src/classes/ovary.d/initrd-luks.ts
3
+ * penguins-eggs v.25.7.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
+ * Creates a streamlined initrd image for Debian/Ubuntu with LUKS support using mkinitramfs within a temporary chroot.
11
+ * Copies the necessary unlock script, ensures losetup is included via a hook, and wraps /scripts/live for debugging.
12
+ * Assumes live-boot and cryptsetup packages are installed in the chroot.
13
+ * No cleanup of /etc modifications is performed as the chroot is temporary.
14
+ * @param this - Ovary instance context
15
+ * @param verbose - Whether to show verbose output
16
+ */
17
+ export declare function luksRootInitrd(this: Ovary, verbose?: boolean): Promise<void>;