penguins-eggs 9.2.4 → 9.2.5
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/README.md +26 -26
- package/lib/classes/pxe.d.ts +31 -9
- package/lib/classes/pxe.js +156 -46
- package/lib/commands/cuckoo.d.ts +1 -1
- package/lib/commands/cuckoo.js +5 -4
- package/package.json +1 -1
- package/scripts/_eggs +8 -7
- package/scripts/eggs.bash +2 -2
- package/scripts/netgrub.sh +39 -0
package/README.md
CHANGED
|
@@ -45,8 +45,8 @@ You can read more on the [blog](https://penguins-eggs.net/2021/11/02/distros-tha
|
|
|
45
45
|
|
|
46
46
|
# Features
|
|
47
47
|
|
|
48
|
-
##
|
|
49
|
-
|
|
48
|
+
## cuckoo (PXE server)
|
|
49
|
+
The cuckoo lays its eggs in the nests of other birds, and the eggs are hatched by the latter. Similarly eggs can start a self-configuring PXE service to allow you to boot and install your iso on third party networked computers. Command cuckoo can be used either to deploy a newly created iso on an installed system or by live booting the iso itself.
|
|
50
50
|
|
|
51
51
|
## backup/clone
|
|
52
52
|
|
|
@@ -56,21 +56,21 @@ We have two methods to save in the live system all our data: clone and backup.
|
|
|
56
56
|
|
|
57
57
|
```eggs produces --fast --backup``` saves our data within the generated iso using a LUKS volume. Our data will NOT be visible in the live system but can be reinstalled automatically with krill installer. Even having the generated image available, our data will be protected by the LUKS passphrase.
|
|
58
58
|
|
|
59
|
-
* ```eggs produce```
|
|
59
|
+
* ```eggs produce``` this is the default: all private data are removed on the live.
|
|
60
60
|
* ```eggs produce --clone``` include all users data UNCRYPTED directly on the live.
|
|
61
61
|
* ```eggs produce --backup``` include all users data CRYPTED on a LUKS volume inside the iso.
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
Using ```sudo eggs install``` will automaticaly restore your CRYPTED backup automatically. Of course the original passphrase will be request.
|
|
65
|
-
|
|
66
|
-
## cuckoo
|
|
67
|
-
The cuckoo lays its eggs in the nests of other birds, and the eggs are hatched by the latter. Similarly eggs can start a self-configuring PXE service to allow you to boot and install your iso on third party networked computers. Command cuckoo can be used either to deploy a newly created iso on an installed system or by live booting the iso itself.
|
|
63
|
+
Using ```sudo eggs install --cli``` will automaticaly restore your CRYPTED backup automatically during the installation.
|
|
68
64
|
|
|
69
65
|
## yolk
|
|
70
66
|
yolk - so called staying on the subject of eggs - is a local repository included in the livecd that contains a minimum of indispensable packages during installation. Thanks to yolk, you can safely install your system without the need of an active internet connection. Yolk, It is used only for Debian families and derivated.
|
|
71
67
|
|
|
72
|
-
## krill installer
|
|
73
|
-
eggs include a
|
|
68
|
+
## GUI calamares or TUI krill installer
|
|
69
|
+
eggs include a TUI installer named krill, this let you to produce and install servers configurations. krill use a nice TUI interface using the same, configuration created by eggs for [calamares](calamares.io). This lead to have "about the same" experience installing, from old distros to new ones and for GUI and CLI. It's possible with krill to do unattended installations, simply add ```--unattended``` flag and the values in ```/etc/penguins-eggs.d/krill.yaml``` will be used for installation.
|
|
70
|
+
|
|
71
|
+
## helper: mom and dad
|
|
72
|
+
I've added two lightweight assistants integrated with eggs: mom and dad. While mom is a bash script with whiptail - and guides the user to the various commands and documentation, dad started as a short way to create isos. All you have to do is type **sudo eggs dad** and follow simple instructions. You can also shortcut the way to reset the configuration **sudo dad -c** or - even faster - reset the configuration, load defaults, kill created isos: simply type **sudo eggs dad -d** and you will immediately be able to produce the egg in the default /home/eggs nest.
|
|
73
|
+
|
|
74
74
|
|
|
75
75
|
## addons and themes
|
|
76
76
|
Addons are used mostly to let third parties to develop extensions. Note that currently we have an extension for the theme that includes both branding calamares, link and installer icon. In addition, also as an addon has been developed choose between GUI or CLI installation, adapt the video resolution, link to remote support, etc.
|
|
@@ -197,7 +197,7 @@ DESCRIPTION
|
|
|
197
197
|
adapt monitor resolution for VM only
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
_See code: [src/commands/adapt.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
200
|
+
_See code: [src/commands/adapt.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/adapt.ts)_
|
|
201
201
|
|
|
202
202
|
## `eggs analyze`
|
|
203
203
|
|
|
@@ -218,7 +218,7 @@ EXAMPLES
|
|
|
218
218
|
$ sudo eggs analyze
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
-
_See code: [src/commands/analyze.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
221
|
+
_See code: [src/commands/analyze.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/analyze.ts)_
|
|
222
222
|
|
|
223
223
|
## `eggs autocomplete [SHELL]`
|
|
224
224
|
|
|
@@ -276,7 +276,7 @@ EXAMPLES
|
|
|
276
276
|
install calamares and create it's configuration's files
|
|
277
277
|
```
|
|
278
278
|
|
|
279
|
-
_See code: [src/commands/calamares.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
279
|
+
_See code: [src/commands/calamares.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/calamares.ts)_
|
|
280
280
|
|
|
281
281
|
## `eggs config`
|
|
282
282
|
|
|
@@ -300,7 +300,7 @@ EXAMPLES
|
|
|
300
300
|
Configure and install prerequisites deb packages to run it
|
|
301
301
|
```
|
|
302
302
|
|
|
303
|
-
_See code: [src/commands/config.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
303
|
+
_See code: [src/commands/config.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/config.ts)_
|
|
304
304
|
|
|
305
305
|
## `eggs cuckoo`
|
|
306
306
|
|
|
@@ -308,11 +308,11 @@ cuckoo start a PXE boot server serving the live image
|
|
|
308
308
|
|
|
309
309
|
```
|
|
310
310
|
USAGE
|
|
311
|
-
$ eggs cuckoo [-
|
|
311
|
+
$ eggs cuckoo [-r] [-h] [-v]
|
|
312
312
|
|
|
313
313
|
FLAGS
|
|
314
|
-
-f, --full
|
|
315
314
|
-h, --help Show CLI help.
|
|
315
|
+
-r, --real start a real dhcp server
|
|
316
316
|
-v, --verbose verbose
|
|
317
317
|
|
|
318
318
|
DESCRIPTION
|
|
@@ -323,7 +323,7 @@ EXAMPLES
|
|
|
323
323
|
start a PXE boot server
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
_See code: [src/commands/cuckoo.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
326
|
+
_See code: [src/commands/cuckoo.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/cuckoo.ts)_
|
|
327
327
|
|
|
328
328
|
## `eggs dad`
|
|
329
329
|
|
|
@@ -343,7 +343,7 @@ DESCRIPTION
|
|
|
343
343
|
ask help from daddy - configuration helper
|
|
344
344
|
```
|
|
345
345
|
|
|
346
|
-
_See code: [src/commands/dad.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
346
|
+
_See code: [src/commands/dad.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/dad.ts)_
|
|
347
347
|
|
|
348
348
|
## `eggs export deb`
|
|
349
349
|
|
|
@@ -441,7 +441,7 @@ EXAMPLES
|
|
|
441
441
|
Install the system using krill installer
|
|
442
442
|
```
|
|
443
443
|
|
|
444
|
-
_See code: [src/commands/install.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
444
|
+
_See code: [src/commands/install.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/install.ts)_
|
|
445
445
|
|
|
446
446
|
## `eggs kill`
|
|
447
447
|
|
|
@@ -463,7 +463,7 @@ EXAMPLES
|
|
|
463
463
|
kill the eggs/free the nest
|
|
464
464
|
```
|
|
465
465
|
|
|
466
|
-
_See code: [src/commands/kill.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
466
|
+
_See code: [src/commands/kill.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/kill.ts)_
|
|
467
467
|
|
|
468
468
|
## `eggs mom`
|
|
469
469
|
|
|
@@ -480,7 +480,7 @@ DESCRIPTION
|
|
|
480
480
|
ask for mommy - gui helper
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
_See code: [src/commands/mom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
483
|
+
_See code: [src/commands/mom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/mom.ts)_
|
|
484
484
|
|
|
485
485
|
## `eggs produce`
|
|
486
486
|
|
|
@@ -542,7 +542,7 @@ EXAMPLES
|
|
|
542
542
|
in /home/eggs/ovarium and you can customize all you need
|
|
543
543
|
```
|
|
544
544
|
|
|
545
|
-
_See code: [src/commands/produce.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
545
|
+
_See code: [src/commands/produce.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/produce.ts)_
|
|
546
546
|
|
|
547
547
|
## `eggs status`
|
|
548
548
|
|
|
@@ -560,7 +560,7 @@ DESCRIPTION
|
|
|
560
560
|
informations about eggs status
|
|
561
561
|
```
|
|
562
562
|
|
|
563
|
-
_See code: [src/commands/status.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
563
|
+
_See code: [src/commands/status.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/status.ts)_
|
|
564
564
|
|
|
565
565
|
## `eggs syncfrom`
|
|
566
566
|
|
|
@@ -584,7 +584,7 @@ EXAMPLES
|
|
|
584
584
|
$ sudo eggs restore
|
|
585
585
|
```
|
|
586
586
|
|
|
587
|
-
_See code: [src/commands/syncfrom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
587
|
+
_See code: [src/commands/syncfrom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/syncfrom.ts)_
|
|
588
588
|
|
|
589
589
|
## `eggs syncto`
|
|
590
590
|
|
|
@@ -607,7 +607,7 @@ EXAMPLES
|
|
|
607
607
|
$ sudo eggs syncto
|
|
608
608
|
```
|
|
609
609
|
|
|
610
|
-
_See code: [src/commands/syncto.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
610
|
+
_See code: [src/commands/syncto.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/syncto.ts)_
|
|
611
611
|
|
|
612
612
|
## `eggs tools clean`
|
|
613
613
|
|
|
@@ -702,7 +702,7 @@ EXAMPLES
|
|
|
702
702
|
update/upgrade the penguin's eggs tool
|
|
703
703
|
```
|
|
704
704
|
|
|
705
|
-
_See code: [src/commands/update.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.
|
|
705
|
+
_See code: [src/commands/update.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.5/src/commands/update.ts)_
|
|
706
706
|
|
|
707
707
|
## `eggs version`
|
|
708
708
|
|
package/lib/classes/pxe.d.ts
CHANGED
|
@@ -11,32 +11,54 @@ export default class Pxe {
|
|
|
11
11
|
verbose: boolean;
|
|
12
12
|
echo: {};
|
|
13
13
|
settings: Settings;
|
|
14
|
-
|
|
14
|
+
bootLabel: string;
|
|
15
15
|
pxeRoot: string;
|
|
16
16
|
isoRoot: string;
|
|
17
|
-
isos: string[];
|
|
18
17
|
vmlinuz: string;
|
|
19
18
|
initrd: string;
|
|
19
|
+
isos: string[];
|
|
20
20
|
/**
|
|
21
21
|
* fertilization()
|
|
22
22
|
*/
|
|
23
23
|
fertilization(): Promise<void>;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* build
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
build(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* configure PXE bios
|
|
30
|
+
*/
|
|
31
|
+
bios(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* configure PXE UEFI
|
|
34
|
+
*/
|
|
35
|
+
uefi(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* configure PXE html
|
|
38
|
+
*/
|
|
39
|
+
html(): Promise<void>;
|
|
28
40
|
/**
|
|
29
41
|
*
|
|
42
|
+
* @param real
|
|
30
43
|
*/
|
|
31
|
-
|
|
44
|
+
dhcp(real?: boolean, dnsmasq?: boolean): Promise<void>;
|
|
32
45
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
private nodeDhcp;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param real
|
|
52
|
+
*/
|
|
53
|
+
private dnsmasq;
|
|
37
54
|
/**
|
|
38
55
|
* start http server for images
|
|
39
56
|
*
|
|
40
57
|
*/
|
|
41
58
|
httpStart(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param cmd
|
|
62
|
+
*/
|
|
63
|
+
tryCatch(cmd?: string): Promise<void>;
|
|
42
64
|
}
|
package/lib/classes/pxe.js
CHANGED
|
@@ -6,16 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
const tslib_1 = require("tslib");
|
|
9
|
-
const os_1 = tslib_1.__importDefault(require("os"));
|
|
10
9
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
11
10
|
const netmask_1 = require("netmask");
|
|
11
|
+
const node_static_1 = tslib_1.__importDefault(require("node-static"));
|
|
12
|
+
const http_1 = tslib_1.__importDefault(require("http"));
|
|
13
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
12
14
|
const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
|
|
13
15
|
const settings_1 = tslib_1.__importDefault(require("../classes/settings"));
|
|
14
|
-
const http_1 = tslib_1.__importDefault(require("http"));
|
|
15
|
-
const node_static_1 = tslib_1.__importDefault(require("node-static"));
|
|
16
16
|
const utils_2 = require("../lib/utils");
|
|
17
|
-
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
18
|
-
const distro_1 = tslib_1.__importDefault(require("./distro"));
|
|
19
17
|
/**
|
|
20
18
|
* Pxe:
|
|
21
19
|
*/
|
|
@@ -24,12 +22,12 @@ class Pxe {
|
|
|
24
22
|
this.verbose = false;
|
|
25
23
|
this.echo = {};
|
|
26
24
|
this.settings = {};
|
|
27
|
-
this.
|
|
25
|
+
this.bootLabel = '';
|
|
28
26
|
this.pxeRoot = '';
|
|
29
27
|
this.isoRoot = '';
|
|
30
|
-
this.isos = [];
|
|
31
28
|
this.vmlinuz = '';
|
|
32
29
|
this.initrd = '';
|
|
30
|
+
this.isos = [];
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* fertilization()
|
|
@@ -83,29 +81,44 @@ class Pxe {
|
|
|
83
81
|
/**
|
|
84
82
|
* bootLabel
|
|
85
83
|
*/
|
|
86
|
-
|
|
84
|
+
const a = fs_1.default.readFileSync(this.isoRoot + '/.disk/mkisofs', "utf-8");
|
|
85
|
+
const b = a.substring(a.indexOf('-o ') + 3);
|
|
86
|
+
const c = b.substring(0, b.indexOf(' '));
|
|
87
|
+
this.bootLabel = c.substring(c.lastIndexOf('/') + 1);
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
|
-
*
|
|
90
|
+
* build
|
|
90
91
|
*/
|
|
91
|
-
async
|
|
92
|
+
async build() {
|
|
92
93
|
if (fs_1.default.existsSync(this.pxeRoot)) {
|
|
93
94
|
await this.tryCatch(`rm ${this.pxeRoot} -rf`);
|
|
94
95
|
}
|
|
95
96
|
let cmd = `mkdir -p ${this.pxeRoot}`;
|
|
96
97
|
await this.tryCatch(cmd);
|
|
97
|
-
const distro = new distro_1.default();
|
|
98
98
|
await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
|
|
99
|
-
// boot efi isolinux live .disk
|
|
100
|
-
await this.tryCatch(`ln -s ${this.isoRoot}boot ${this.pxeRoot}/boot`);
|
|
101
|
-
await this.tryCatch(`ln -s ${this.isoRoot}efi ${this.pxeRoot}/efi`);
|
|
102
|
-
await this.tryCatch(`ln -s ${this.isoRoot}isolinux ${this.pxeRoot}/isolinux`);
|
|
103
99
|
await this.tryCatch(`ln -s ${this.isoRoot}live ${this.pxeRoot}/live`);
|
|
104
100
|
await this.tryCatch(`ln -s ${this.isoRoot}.disk ${this.pxeRoot}/.disk`);
|
|
101
|
+
await this.tryCatch(`ln -s ${this.isoRoot}live/${this.vmlinuz} ${this.pxeRoot}/vmlinuz`);
|
|
102
|
+
await this.tryCatch(`chmod 777 ${this.pxeRoot}/vmlinuz`);
|
|
103
|
+
await this.tryCatch(`ln -s ${this.isoRoot}live/${this.initrd} ${this.pxeRoot}/initrd`);
|
|
104
|
+
await this.tryCatch(`chmod 777 ${this.pxeRoot}/initrd`);
|
|
105
|
+
// link iso images in pxe
|
|
106
|
+
for (const iso of this.isos) {
|
|
107
|
+
await this.tryCatch(`ln /home/eggs/${iso} ${this.pxeRoot}/${iso}`);
|
|
108
|
+
}
|
|
109
|
+
await this.bios();
|
|
110
|
+
await this.uefi();
|
|
111
|
+
await this.html();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* configure PXE bios
|
|
115
|
+
*/
|
|
116
|
+
async bios() {
|
|
105
117
|
// isolinux.theme.cfg, splash.png MUST to be on root
|
|
106
118
|
await this.tryCatch(`ln -s ${this.isoRoot}isolinux/isolinux.theme.cfg ${this.pxeRoot}/isolinux.theme.cfg`);
|
|
107
119
|
await this.tryCatch(`ln -s ${this.isoRoot}isolinux/splash.png ${this.pxeRoot}/splash.png`);
|
|
108
120
|
// pxe
|
|
121
|
+
const distro = this.settings.distro;
|
|
109
122
|
await this.tryCatch(`ln ${distro.pxelinuxPath}pxelinux.0 ${this.pxeRoot}/pxelinux.0`);
|
|
110
123
|
await this.tryCatch(`ln ${distro.pxelinuxPath}lpxelinux.0 ${this.pxeRoot}/lpxelinux.0`);
|
|
111
124
|
// syslinux
|
|
@@ -115,10 +128,6 @@ class Pxe {
|
|
|
115
128
|
await this.tryCatch(`ln ${distro.syslinuxPath}libutil.c32 ${this.pxeRoot}/libutil.c32`);
|
|
116
129
|
await this.tryCatch(`ln /usr/lib/syslinux/memdisk ${this.pxeRoot}/memdisk`);
|
|
117
130
|
await this.tryCatch(`mkdir ${this.pxeRoot}/pxelinux.cfg`);
|
|
118
|
-
// link iso images in pxe
|
|
119
|
-
for (const iso of this.isos) {
|
|
120
|
-
await this.tryCatch(`ln /home/eggs/${iso} ${this.pxeRoot}/${iso}`);
|
|
121
|
-
}
|
|
122
131
|
let content = ``;
|
|
123
132
|
content += `# eggs: pxelinux.cfg/default\n`;
|
|
124
133
|
content += `# search path for the c32 support libraries (libcom32, libutil etc.)\n`;
|
|
@@ -131,24 +140,99 @@ class Pxe {
|
|
|
131
140
|
content += `TIMEOUT 0\n`;
|
|
132
141
|
content += `\n`;
|
|
133
142
|
content += `LABEL http\n`;
|
|
134
|
-
content += `MENU LABEL ${this.
|
|
143
|
+
content += `MENU LABEL ${this.bootLabel}\n`;
|
|
135
144
|
content += `MENU DEFAULT\n`;
|
|
136
145
|
content += `KERNEL http://${utils_1.default.address()}/live/${this.vmlinuz}\n`;
|
|
137
146
|
content += `APPEND initrd=http://${utils_1.default.address()}/live/${this.initrd} boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs\n`;
|
|
138
147
|
content += `SYSAPPEND 3\n`;
|
|
139
148
|
content += `\n`;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
if (this.isos.length > 0) {
|
|
150
|
+
content += `MENU SEPARATOR\n`;
|
|
151
|
+
for (const iso of this.isos) {
|
|
152
|
+
content += `\n`;
|
|
153
|
+
content += `LABEL isos\n`;
|
|
154
|
+
content += `MENU LABEL memdisk ${iso}\n`;
|
|
155
|
+
content += `KERNEL memdisk\n`;
|
|
156
|
+
content += `APPEND iso initrd=http://${utils_1.default.address()}/${iso}\n`;
|
|
157
|
+
}
|
|
147
158
|
}
|
|
148
159
|
let file = `${this.pxeRoot}/pxelinux.cfg/default`;
|
|
149
160
|
fs_1.default.writeFileSync(file, content);
|
|
150
|
-
|
|
151
|
-
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* configure PXE UEFI
|
|
164
|
+
*/
|
|
165
|
+
async uefi() {
|
|
166
|
+
await this.tryCatch(`mkdir ${this.pxeRoot}/grub`);
|
|
167
|
+
if (fs_1.default.existsSync('/usr/share/grub/unicode.pf2')) {
|
|
168
|
+
await this.tryCatch(`ln -s /usr/share/grub/unicode.pf2 ${this.pxeRoot}grub/font.pf2`);
|
|
169
|
+
}
|
|
170
|
+
// Copia spash.png, theme.cfg in /grub
|
|
171
|
+
await this.tryCatch(`ln -s ${this.isoRoot}boot/grub/splash.png ${this.pxeRoot}/grub/splash.png`);
|
|
172
|
+
await this.tryCatch(`ln -s ${this.isoRoot}boot/grub/theme.cfg ${this.pxeRoot}/grub/theme.cfg`);
|
|
173
|
+
// UEFI: /usr/lib/shim/shimx64.efi.signed
|
|
174
|
+
await this.tryCatch(`ln -s /usr/lib/shim/shimx64.efi.signed ${this.pxeRoot}/bootx64.efi`);
|
|
175
|
+
// UEFI: /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed
|
|
176
|
+
await this.tryCatch(`ln -s /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed ${this.pxeRoot}/grubx64.efi`);
|
|
177
|
+
/**
|
|
178
|
+
* creating /grub/grub.cfg
|
|
179
|
+
*/
|
|
180
|
+
let grubContent = '';
|
|
181
|
+
grubContent += `set default="0"\n`;
|
|
182
|
+
grubContent += `set timeout=-1\n`;
|
|
183
|
+
grubContent += `\n`;
|
|
184
|
+
grubContent += `if loadfont unicode ; then\n`;
|
|
185
|
+
grubContent += ` set gfxmode=auto\n`;
|
|
186
|
+
grubContent += ` set locale_dir=$prefix/locale\n`;
|
|
187
|
+
grubContent += ` set lang=en_US\n`;
|
|
188
|
+
grubContent += `fi\n`;
|
|
189
|
+
grubContent += `terminal_output gfxterm\n`;
|
|
190
|
+
grubContent += `\n`;
|
|
191
|
+
grubContent += `set menu_color_normal=white/black\n`;
|
|
192
|
+
grubContent += `set menu_color_highlight=black/light-gray\n`;
|
|
193
|
+
grubContent += `if background_color 44,0,30; then\n`;
|
|
194
|
+
grubContent += ` clear\n`;
|
|
195
|
+
grubContent += `fi\n`;
|
|
196
|
+
grubContent += `\n`;
|
|
197
|
+
grubContent += `function gfxmode {\n`;
|
|
198
|
+
grubContent += `\n`;
|
|
199
|
+
grubContent += ` set gfxpayload="${1}"\n`;
|
|
200
|
+
grubContent += ` if [ "${1}" = "keep" ]; then\n`;
|
|
201
|
+
grubContent += ` set vt_handoff=vt.handoff=7\n`;
|
|
202
|
+
grubContent += ` else\n`;
|
|
203
|
+
grubContent += ` set vt_handoff=\n`;
|
|
204
|
+
grubContent += ` fi\n`;
|
|
205
|
+
grubContent += `}\n`;
|
|
206
|
+
grubContent += `set linux_gfx_mode=keep\n`;
|
|
207
|
+
grubContent += `\n`;
|
|
208
|
+
grubContent += `export linux_gfx_mode\n`;
|
|
209
|
+
grubContent += `\n`;
|
|
210
|
+
grubContent += `if loadfont $prefix/font.pf2 ; then\n`;
|
|
211
|
+
grubContent += ` set gfxmode=640x480\n`;
|
|
212
|
+
grubContent += ` insmod efi_gop\n`;
|
|
213
|
+
grubContent += ` insmod efi_uga\n`;
|
|
214
|
+
grubContent += ` insmod video_bochs\n`;
|
|
215
|
+
grubContent += ` insmod video_cirrus\n`;
|
|
216
|
+
grubContent += ` insmod gfxterm\n`;
|
|
217
|
+
grubContent += ` insmod jpeg\n`;
|
|
218
|
+
grubContent += ` insmod png\n`;
|
|
219
|
+
grubContent += ` terminal_output gfxterm\n`;
|
|
220
|
+
grubContent += `fi\n`;
|
|
221
|
+
grubContent += `set theme=/grub/theme.cfg\n`;
|
|
222
|
+
grubContent += `menuentry '${this.bootLabel}' {\n`;
|
|
223
|
+
grubContent += ` gfxmode $linux_gfx_mode\n`;
|
|
224
|
+
grubContent += ` linuxefi vmlinuz boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs quiet splash sysappend 0x40000\n`;
|
|
225
|
+
grubContent += ` initrdefi initrd\n`;
|
|
226
|
+
grubContent += `}\n`;
|
|
227
|
+
let grubFile = `${this.pxeRoot}grub/grub.cfg`;
|
|
228
|
+
fs_1.default.writeFileSync(grubFile, grubContent);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* configure PXE html
|
|
232
|
+
*/
|
|
233
|
+
async html() {
|
|
234
|
+
let file = `${this.pxeRoot}/index.html`;
|
|
235
|
+
let content = ``;
|
|
152
236
|
content += `<html><title>Penguin's eggs PXE server</title>`;
|
|
153
237
|
content += `<div style="background-image:url('/splash.png');background-repeat:no-repeat;width: 640;height:480;padding:5px;border:1px solid black;">`;
|
|
154
238
|
content += `<h1>Penguin's eggs PXE server</h1>`;
|
|
@@ -165,10 +249,35 @@ class Pxe {
|
|
|
165
249
|
content += `discuss: <a href='https://t.me/penguins_eggs'>Telegram group<br/></body</html>`;
|
|
166
250
|
fs_1.default.writeFileSync(file, content);
|
|
167
251
|
}
|
|
252
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
253
|
+
//
|
|
254
|
+
// dncp: actually install and configure dnsmaq
|
|
255
|
+
//
|
|
256
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
257
|
+
/**
|
|
258
|
+
*
|
|
259
|
+
* @param real
|
|
260
|
+
*/
|
|
261
|
+
async dhcp(real = false, dnsmasq = true) {
|
|
262
|
+
if (dnsmasq) {
|
|
263
|
+
await this.dnsmasq(real);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
await this.nodeDhcp(real);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
*
|
|
271
|
+
*/
|
|
272
|
+
async nodeDhcp(real = false) {
|
|
273
|
+
console.log('to do!');
|
|
274
|
+
process.exit();
|
|
275
|
+
}
|
|
168
276
|
/**
|
|
169
277
|
*
|
|
278
|
+
* @param real
|
|
170
279
|
*/
|
|
171
|
-
async
|
|
280
|
+
async dnsmasq(real = false) {
|
|
172
281
|
await (0, utils_2.exec)(`systemctl stop dnsmasq.service`);
|
|
173
282
|
let domain = `penguins-eggs.lan`;
|
|
174
283
|
let n = new netmask_1.Netmask(`${utils_1.default.address()}/${utils_1.default.netmask()}`);
|
|
@@ -191,7 +300,8 @@ class Pxe {
|
|
|
191
300
|
content += `# boot config for UEFI\n`;
|
|
192
301
|
content += `dhcp-match=set:efi-x86_64,option:client-arch,7\n`;
|
|
193
302
|
content += `dhcp-match=set:efi-x86_64,option:client-arch,9\n`;
|
|
194
|
-
content += `dhcp-boot=tag:efi-x86_64
|
|
303
|
+
content += `dhcp-boot=tag:efi-x86_64,/bootx64.efi\n`;
|
|
304
|
+
// Here we are OK Starting grub
|
|
195
305
|
/**
|
|
196
306
|
* https://thekelleys.org.uk/dnsmasq/CHANGELOG
|
|
197
307
|
*
|
|
@@ -202,30 +312,17 @@ class Pxe {
|
|
|
202
312
|
* the DHCP server. Thanks to Spencer Clark for spotting this.
|
|
203
313
|
*/
|
|
204
314
|
content += `pxe-service=X86PC,"penguin's eggs cuckoo",pxelinux.0\n`;
|
|
205
|
-
if (
|
|
315
|
+
if (real) {
|
|
206
316
|
content += `dhcp-range=${await utils_1.default.iface()},${n.first},${n.last},${n.mask},8h\n`;
|
|
207
317
|
}
|
|
208
318
|
else {
|
|
209
|
-
content += `dhcp-range=${await utils_1.default.iface()},${
|
|
319
|
+
content += `dhcp-range=${await utils_1.default.iface()},${n.base},proxy,${n.mask},${n.broadcast} # dhcp proxy\n`;
|
|
210
320
|
}
|
|
211
321
|
let file = '/etc/dnsmasq.d/cuckoo.conf';
|
|
212
322
|
fs_1.default.writeFileSync(file, content);
|
|
213
323
|
// console.log(content)
|
|
214
324
|
await (0, utils_2.exec)(`systemctl start dnsmasq.service`);
|
|
215
325
|
}
|
|
216
|
-
/**
|
|
217
|
-
*
|
|
218
|
-
* @param cmd
|
|
219
|
-
*/
|
|
220
|
-
async tryCatch(cmd = '') {
|
|
221
|
-
try {
|
|
222
|
-
await (0, utils_2.exec)(cmd, this.echo);
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
console.log(`Error: ${error}`);
|
|
226
|
-
await utils_1.default.pressKeyToExit(cmd);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
326
|
/**
|
|
230
327
|
* start http server for images
|
|
231
328
|
*
|
|
@@ -238,5 +335,18 @@ class Pxe {
|
|
|
238
335
|
file.serve(req, res);
|
|
239
336
|
}).listen(port);
|
|
240
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
*
|
|
340
|
+
* @param cmd
|
|
341
|
+
*/
|
|
342
|
+
async tryCatch(cmd = '') {
|
|
343
|
+
try {
|
|
344
|
+
await (0, utils_2.exec)(cmd, this.echo);
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
console.log(`Error: ${error}`);
|
|
348
|
+
await utils_1.default.pressKeyToExit(cmd);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
241
351
|
}
|
|
242
352
|
exports.default = Pxe;
|
package/lib/commands/cuckoo.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export default class Cuckoo extends Command {
|
|
|
15
15
|
work_dir: IWorkDir;
|
|
16
16
|
static description: string;
|
|
17
17
|
static flags: {
|
|
18
|
-
|
|
18
|
+
real: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
19
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
20
20
|
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
21
|
};
|
package/lib/commands/cuckoo.js
CHANGED
|
@@ -28,7 +28,7 @@ class Cuckoo extends core_1.Command {
|
|
|
28
28
|
const { flags } = await this.parse(Cuckoo);
|
|
29
29
|
let verbose = flags.verbose;
|
|
30
30
|
const echo = utils_1.default.setEcho(verbose);
|
|
31
|
-
let
|
|
31
|
+
let real = flags.real;
|
|
32
32
|
const distro = new distro_1.default();
|
|
33
33
|
if (distro.familyId === 'debian') {
|
|
34
34
|
if (utils_1.default.isRoot()) {
|
|
@@ -47,8 +47,9 @@ class Cuckoo extends core_1.Command {
|
|
|
47
47
|
}
|
|
48
48
|
const pxe = new pxe_1.default();
|
|
49
49
|
await pxe.fertilization();
|
|
50
|
-
await pxe.
|
|
51
|
-
|
|
50
|
+
await pxe.build();
|
|
51
|
+
let dnsmasq = true;
|
|
52
|
+
await pxe.dhcp(real, dnsmasq);
|
|
52
53
|
await pxe.httpStart();
|
|
53
54
|
console.log(`Serving PXE boot, read more at: http://${utils_1.default.address()}`);
|
|
54
55
|
console.log(`CTRL-c to quit`);
|
|
@@ -62,7 +63,7 @@ class Cuckoo extends core_1.Command {
|
|
|
62
63
|
exports.default = Cuckoo;
|
|
63
64
|
Cuckoo.description = 'cuckoo start a PXE boot server serving the live image';
|
|
64
65
|
Cuckoo.flags = {
|
|
65
|
-
|
|
66
|
+
real: core_1.Flags.boolean({ char: 'r', description: 'start a real dhcp server' }),
|
|
66
67
|
help: core_1.Flags.help({ char: 'h' }),
|
|
67
68
|
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
|
|
68
69
|
};
|
package/package.json
CHANGED
package/scripts/_eggs
CHANGED
|
@@ -11,7 +11,7 @@ _eggs () {
|
|
|
11
11
|
"analyze:analyze for syncto"
|
|
12
12
|
"calamares:calamares or install or configure it"
|
|
13
13
|
"config:Configure and install prerequisites deb packages to run it"
|
|
14
|
-
"cuckoo:cuckoo start a boot server
|
|
14
|
+
"cuckoo:cuckoo start a PXE boot server serving the live image"
|
|
15
15
|
"dad:ask help from daddy - configuration helper"
|
|
16
16
|
"export\:deb:export deb/docs/iso to the destination host"
|
|
17
17
|
"export\:docs:remove and export docType documentation of the sources in the destination host"
|
|
@@ -33,8 +33,8 @@ _eggs () {
|
|
|
33
33
|
"wardrobe\:list:list costumes and accessoires in wardrobe"
|
|
34
34
|
"wardrobe\:show:show costumes/accessories in wardrobe"
|
|
35
35
|
"wardrobe\:wear:wear costume/accessories from wardrobe"
|
|
36
|
-
"help:Display help for <%= config.bin %>."
|
|
37
36
|
"autocomplete:display autocomplete installation instructions"
|
|
37
|
+
"help:Display help for <%= config.bin %>."
|
|
38
38
|
"version:"
|
|
39
39
|
)
|
|
40
40
|
|
|
@@ -76,7 +76,8 @@ config)
|
|
|
76
76
|
|
|
77
77
|
cuckoo)
|
|
78
78
|
_command_flags=(
|
|
79
|
-
"--
|
|
79
|
+
"--real[start a real dhcp server]"
|
|
80
|
+
"--help[Show CLI help.]"
|
|
80
81
|
"--verbose[verbose]"
|
|
81
82
|
)
|
|
82
83
|
;;
|
|
@@ -263,15 +264,15 @@ wardrobe:wear)
|
|
|
263
264
|
)
|
|
264
265
|
;;
|
|
265
266
|
|
|
266
|
-
|
|
267
|
+
autocomplete)
|
|
267
268
|
_command_flags=(
|
|
268
|
-
"--
|
|
269
|
+
"--refresh-cache[Refresh cache (ignores displaying instructions)]"
|
|
269
270
|
)
|
|
270
271
|
;;
|
|
271
272
|
|
|
272
|
-
|
|
273
|
+
help)
|
|
273
274
|
_command_flags=(
|
|
274
|
-
"--
|
|
275
|
+
"--nested-commands[Include all nested commands in the output.]"
|
|
275
276
|
)
|
|
276
277
|
;;
|
|
277
278
|
|
package/scripts/eggs.bash
CHANGED
|
@@ -15,7 +15,7 @@ adapt --verbose --help
|
|
|
15
15
|
analyze --help --verbose
|
|
16
16
|
calamares --help --verbose --install --release --remove --theme
|
|
17
17
|
config --nointeractive --clean --help --verbose
|
|
18
|
-
cuckoo --help --verbose
|
|
18
|
+
cuckoo --real --help --verbose
|
|
19
19
|
dad --help --clean --default --verbose
|
|
20
20
|
export:deb --help --clean --amd64 --i386 --armel --arm64 --all
|
|
21
21
|
export:docs --help
|
|
@@ -37,8 +37,8 @@ wardrobe:ironing --wardrobe --verbose --help
|
|
|
37
37
|
wardrobe:list --verbose --help
|
|
38
38
|
wardrobe:show --wardrobe --json --verbose --help
|
|
39
39
|
wardrobe:wear --wardrobe --no_accessories --no_firmwares --silent --verbose --help
|
|
40
|
-
help --nested-commands
|
|
41
40
|
autocomplete --refresh-cache
|
|
41
|
+
help --nested-commands
|
|
42
42
|
version --json --verbose
|
|
43
43
|
"
|
|
44
44
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
# Sets up a tftp server to netboot x86_64 systems over UEFI.
|
|
6
|
+
# Works on Ubuntu 13.10 and later.
|
|
7
|
+
|
|
8
|
+
# change to the root of your tftp server
|
|
9
|
+
TFTPROOT=/var/lib/tftpboot
|
|
10
|
+
|
|
11
|
+
# needed for unpacking the shim-signed source package
|
|
12
|
+
apt-get install dpkg-dev
|
|
13
|
+
|
|
14
|
+
tmpdir=$(mktemp -d)
|
|
15
|
+
|
|
16
|
+
cleanup () {
|
|
17
|
+
if [ -n "$tmpdir" ]; then
|
|
18
|
+
rm -rf "$tmpdir"
|
|
19
|
+
fi
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
trap cleanup EXIT HUP INT QUIT PIPE TERM
|
|
23
|
+
|
|
24
|
+
cd "$tmpdir"
|
|
25
|
+
apt-get source shim-signed
|
|
26
|
+
cp shim-signed-*/shim.efi.signed "$TFTPROOT"/bootx64.efi
|
|
27
|
+
|
|
28
|
+
cd "$TFTPROOT"
|
|
29
|
+
|
|
30
|
+
wget -O grubx64.efi http://archive.ubuntu.com/ubuntu/dists/saucy/main/uefi/grub2-amd64/current/grubnetx64.efi.signed
|
|
31
|
+
|
|
32
|
+
# Unfortunately the unicode font is assembled by the grub2 package at
|
|
33
|
+
# build-time, so we can't grab it from the source; and we have no persistent
|
|
34
|
+
# URL for it since that changes with each version number; so try to install
|
|
35
|
+
# it (which should be a no-op on x86 anyway) and copy the contents.
|
|
36
|
+
apt-get install grub-common
|
|
37
|
+
mkdir -p grub/fonts
|
|
38
|
+
cp /usr/share/grub/unicode.pf2 grub/fonts
|
|
39
|
+
|