penguins-eggs 9.3.26 → 9.3.28
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/conf/derivatives.yaml +7 -0
- package/dist/classes/bleach.js +26 -24
- package/dist/classes/compressors.js +7 -5
- package/dist/classes/daddy.js +38 -36
- package/dist/classes/distro.js +30 -27
- package/dist/classes/family/archlinux.js +21 -19
- package/dist/classes/family/debian.js +33 -31
- package/dist/classes/family/fedora.js +19 -17
- package/dist/classes/family/suse.js +19 -17
- package/dist/classes/incubation/branding.js +8 -6
- package/dist/classes/incubation/distros/bionic.js +5 -3
- package/dist/classes/incubation/distros/buster.js +5 -3
- package/dist/classes/incubation/distros/focal.js +5 -3
- package/dist/classes/incubation/distros/jessie.js +6 -4
- package/dist/classes/incubation/distros/rolling.js +9 -7
- package/dist/classes/incubation/fisherman-helper/displaymanager.js +5 -3
- package/dist/classes/incubation/fisherman-helper/packages.js +17 -15
- package/dist/classes/incubation/fisherman.js +19 -19
- package/dist/classes/incubation/incubator.js +37 -35
- package/dist/classes/incubation/installer.js +8 -6
- package/dist/classes/initrd.js +5 -3
- package/dist/classes/keyboards.js +25 -23
- package/dist/classes/locales.js +19 -17
- package/dist/classes/n8.js +4 -2
- package/dist/classes/network.js +9 -9
- package/dist/classes/ovary.js +280 -281
- package/dist/classes/pacman.js +128 -128
- package/dist/classes/pve-live.js +7 -5
- package/dist/classes/pxe.js +141 -138
- package/dist/classes/settings.js +34 -32
- package/dist/classes/sources_list.js +31 -31
- package/dist/classes/systemctl.js +16 -14
- package/dist/classes/tailor.js +255 -262
- package/dist/classes/tools.js +7 -5
- package/dist/classes/users.js +30 -28
- package/dist/classes/utils.js +22 -20
- package/dist/classes/xdg.js +60 -58
- package/dist/classes/yolk.js +33 -33
- package/dist/commands/adapt.js +14 -12
- package/dist/commands/analyze.js +48 -15
- package/dist/commands/calamares.js +28 -26
- package/dist/commands/config.js +77 -79
- package/dist/commands/cuckoo.js +19 -17
- package/dist/commands/dad.js +16 -14
- package/dist/commands/export/deb.js +19 -17
- package/dist/commands/export/iso.js +17 -15
- package/dist/commands/install.js +31 -29
- package/dist/commands/kill.js +17 -15
- package/dist/commands/mom.js +11 -9
- package/dist/commands/produce.js +30 -28
- package/dist/commands/status.js +7 -5
- package/dist/commands/syncfrom.js +41 -41
- package/dist/commands/syncto.js +77 -80
- package/dist/commands/tools/clean.js +13 -11
- package/dist/commands/tools/ppa.js +26 -24
- package/dist/commands/tools/skel.js +18 -16
- package/dist/commands/tools/stat.js +12 -10
- package/dist/commands/tools/yolk.js +13 -11
- package/dist/commands/update.js +29 -27
- package/dist/commands/wardrobe/get.js +14 -12
- package/dist/commands/wardrobe/list.js +25 -23
- package/dist/commands/wardrobe/show.js +25 -23
- package/dist/commands/wardrobe/wear.js +24 -22
- package/dist/components/elements/information.js +21 -19
- package/dist/components/elements/steps.js +4 -2
- package/dist/components/elements/title.js +4 -2
- package/dist/components/finished.js +10 -8
- package/dist/components/install.js +10 -8
- package/dist/components/keyboard.js +10 -8
- package/dist/components/location.js +10 -8
- package/dist/components/network.js +10 -8
- package/dist/components/partitions.js +10 -8
- package/dist/components/summary.js +10 -8
- package/dist/components/users.js +33 -8
- package/dist/components/welcome.js +10 -8
- package/dist/interfaces/i-packages.js +1 -1
- package/dist/interfaces/i-pxe.js +39 -0
- package/dist/krill/krill-prepare.js +92 -90
- package/dist/krill/krill-sequence.js +148 -145
- package/dist/krill/modules/add-user.js +11 -9
- package/dist/krill/modules/bootloader-config-ubuntu.js +25 -23
- package/dist/krill/modules/bootloader.js +11 -9
- package/dist/krill/modules/change-password.js +2 -2
- package/dist/krill/modules/del-live-user.js +8 -6
- package/dist/krill/modules/fstab.js +35 -33
- package/dist/krill/modules/grubcfg.js +8 -6
- package/dist/krill/modules/hostname.js +19 -17
- package/dist/krill/modules/initramfs-cfg.js +6 -4
- package/dist/krill/modules/initramfs.js +17 -15
- package/dist/krill/modules/locale-cfg.js +12 -10
- package/dist/krill/modules/locale.js +13 -11
- package/dist/krill/modules/m-keyboard.js +33 -31
- package/dist/krill/modules/m-timezone.js +7 -5
- package/dist/krill/modules/machine-id.js +8 -6
- package/dist/krill/modules/mkfs.js +7 -7
- package/dist/krill/modules/mount-fs.js +22 -22
- package/dist/krill/modules/mount-vfs.js +12 -12
- package/dist/krill/modules/network-cfg.js +21 -21
- package/dist/krill/modules/packages.js +20 -18
- package/dist/krill/modules/partition.js +148 -139
- package/dist/krill/modules/remove-installer-link.js +5 -3
- package/dist/krill/modules/umount.js +9 -7
- package/dist/krill/modules/unpackfs.js +8 -6
- package/dist/lib/cli-autologin.js +163 -163
- package/dist/lib/dependencies.js +10 -10
- package/dist/lib/get_address.js +6 -4
- package/dist/lib/get_dns.js +6 -4
- package/dist/lib/get_domain.js +6 -4
- package/dist/lib/get_gateway.js +6 -4
- package/dist/lib/get_hostname.js +6 -4
- package/dist/lib/get_netmask.js +6 -4
- package/dist/lib/get_password.js +8 -6
- package/dist/lib/get_root_password.js +7 -5
- package/dist/lib/get_userfullname.js +6 -4
- package/dist/lib/get_username.js +6 -4
- package/dist/lib/select_address_type.js +6 -4
- package/dist/lib/select_filesystem_type.js +8 -6
- package/dist/lib/select_installation_device.js +7 -5
- package/dist/lib/select_installation_mode.js +6 -4
- package/dist/lib/select_interface.js +6 -4
- package/dist/lib/select_keyboard_layout.js +10 -8
- package/dist/lib/select_keyboard_model.js +10 -8
- package/dist/lib/select_keyboard_option.js +10 -8
- package/dist/lib/select_keyboard_variant.js +10 -8
- package/dist/lib/select_languages.js +9 -7
- package/dist/lib/select_regions.js +6 -4
- package/dist/lib/select_user_swap_choice.js +8 -6
- package/dist/lib/select_zones.js +12 -10
- package/dist/lib/utils.js +3 -3
- package/package.json +12 -5
- package/dist/dhcpd/dhcpd.js +0 -222
- package/dist/dhcpd/index.js +0 -7
- package/dist/dhcpd/packet/converters.js +0 -377
- package/dist/dhcpd/packet/options.js +0 -2
- package/dist/dhcpd/packet/types.js +0 -2
- package/dist/dhcpd/packet.js +0 -251
- package/dist/dhcpd/proxy.js +0 -152
- package/dist/dhcpd/server.js +0 -152
- package/dist/dhcpd/sprintf.js +0 -170
- package/dist/dhcpd/utils.js +0 -190
- package/dist/interfaces/i-pxe-options.js +0 -2
package/dist/classes/pxe.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
/**
|
|
5
7
|
* penguins-eggs: pxe.ts
|
|
6
8
|
* author: Piero Proietti
|
|
7
9
|
* mail: piero.proietti@gmail.com
|
|
8
10
|
*/
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
11
|
+
const utils_js_1 = require("../lib/utils.js");
|
|
12
|
+
const distro_js_1 = __importDefault(require("./distro.js"));
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const http_1 = __importDefault(require("http"));
|
|
15
|
+
const node_static_1 = __importDefault(require("node-static"));
|
|
16
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
17
|
+
const settings_js_1 = __importDefault(require("./settings.js"));
|
|
18
|
+
const utils_js_2 = __importDefault(require("./utils.js"));
|
|
19
|
+
const tftp_1 = __importDefault(require("tftp"));
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
const etrick_1 = __importDefault(require("etrick"));
|
|
19
22
|
/**
|
|
20
23
|
* Pxe:
|
|
21
24
|
*/
|
|
@@ -38,77 +41,77 @@ class Pxe {
|
|
|
38
41
|
* cuckoo's nest
|
|
39
42
|
*/
|
|
40
43
|
async fertilization() {
|
|
41
|
-
this.settings = new
|
|
44
|
+
this.settings = new settings_js_1.default();
|
|
42
45
|
await this.settings.load();
|
|
43
|
-
if (
|
|
46
|
+
if (utils_js_2.default.isLive()) {
|
|
44
47
|
this.eggRoot = this.settings.distro.liveMediumPath;
|
|
45
48
|
if (this.settings.distro.distroId === 'Arch' || this.settings.distro.distroId === 'RebornOS') {
|
|
46
49
|
this.eggRoot = '/run/archiso/bootmnt/';
|
|
47
|
-
await (0,
|
|
48
|
-
await (0,
|
|
50
|
+
await (0, utils_js_1.exec)(`mkdir ${this.eggRoot} -p`);
|
|
51
|
+
await (0, utils_js_1.exec)(`mount /dev/sr0 ${this.eggRoot}`);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
else {
|
|
52
55
|
this.eggRoot = node_path_1.default.dirname(this.settings.work_dir.path) + '/ovarium/iso/';
|
|
53
56
|
}
|
|
54
|
-
if (!
|
|
57
|
+
if (!utils_js_2.default.isLive() && !fs_1.default.existsSync(this.settings.work_dir.path)) {
|
|
55
58
|
console.log('no image available, build an image with: sudo eggs produce');
|
|
56
59
|
process.exit();
|
|
57
60
|
}
|
|
58
61
|
this.nest = '/home/eggs';
|
|
59
62
|
this.pxeRoot = this.nest + '/pxe';
|
|
60
63
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
* se pxeRoot non esiste viene creato
|
|
65
|
+
*/
|
|
63
66
|
if (!fs_1.default.existsSync(this.pxeRoot)) {
|
|
64
|
-
await (0,
|
|
67
|
+
await (0, utils_js_1.exec)(`mkdir ${this.pxeRoot} -p`);
|
|
65
68
|
}
|
|
66
69
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (!
|
|
71
|
-
|
|
70
|
+
* Ricerca delle uova
|
|
71
|
+
*/
|
|
72
|
+
const isos = [];
|
|
73
|
+
if (!utils_js_2.default.isLive()) {
|
|
74
|
+
const isos = fs_1.default.readdirSync(this.nest);
|
|
72
75
|
for (const iso of isos) {
|
|
73
|
-
if (node_path_1.default.extname(iso) ===
|
|
76
|
+
if (node_path_1.default.extname(iso) === '.iso') {
|
|
74
77
|
this.isos.push(iso);
|
|
75
78
|
}
|
|
76
79
|
this.isos = this.isos.sort();
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
* installed: /home/eggs/ovarium/iso/live
|
|
84
|
+
* live: this.iso/live
|
|
85
|
+
*/
|
|
86
|
+
const pathFiles = this.eggRoot + 'live';
|
|
87
|
+
const files = fs_1.default.readdirSync(pathFiles);
|
|
85
88
|
for (const file of files) {
|
|
86
89
|
if (this.settings.distro.familyId === 'debian') {
|
|
87
|
-
if (node_path_1.default.basename(file).
|
|
90
|
+
if (node_path_1.default.basename(file).slice(0, 7) === 'vmlinuz') {
|
|
88
91
|
this.vmlinuz = node_path_1.default.basename(file);
|
|
89
92
|
}
|
|
90
|
-
if (node_path_1.default.basename(file).
|
|
93
|
+
if (node_path_1.default.basename(file).slice(0, 6) === 'initrd') {
|
|
91
94
|
this.initrdImg = node_path_1.default.basename(file);
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
else if (this.settings.distro.familyId === 'archlinux') {
|
|
95
|
-
if (node_path_1.default.basename(file).
|
|
98
|
+
if (node_path_1.default.basename(file).slice(0, 7) === 'vmlinuz') {
|
|
96
99
|
this.vmlinuz = node_path_1.default.basename(file);
|
|
97
100
|
}
|
|
98
|
-
if (node_path_1.default.basename(file).
|
|
101
|
+
if (node_path_1.default.basename(file).slice(0, 9) === 'initramfs') {
|
|
99
102
|
this.initrdImg = node_path_1.default.basename(file);
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
* bootLabel
|
|
108
|
+
*/
|
|
106
109
|
this.bootLabel = 'not found';
|
|
107
110
|
if (fs_1.default.existsSync(this.eggRoot + '/.disk/mkisofs')) {
|
|
108
|
-
const a = fs_1.default.readFileSync(this.eggRoot + '/.disk/mkisofs',
|
|
109
|
-
const b = a.
|
|
110
|
-
const c = b.
|
|
111
|
-
this.bootLabel = c.
|
|
111
|
+
const a = fs_1.default.readFileSync(this.eggRoot + '/.disk/mkisofs', 'utf-8');
|
|
112
|
+
const b = a.slice(Math.max(0, a.indexOf('-o ') + 3));
|
|
113
|
+
const c = b.slice(0, Math.max(0, b.indexOf(' ')));
|
|
114
|
+
this.bootLabel = c.slice(Math.max(0, c.lastIndexOf('/') + 1));
|
|
112
115
|
}
|
|
113
116
|
console.log(`bootLabel: ${this.bootLabel}`);
|
|
114
117
|
console.log(`vmlinuz: ${this.vmlinuz}`);
|
|
@@ -153,11 +156,11 @@ class Pxe {
|
|
|
153
156
|
await this.tryCatch(`cp ${__dirname}/../../addons/eggs/theme/livecd/isolinux.theme.cfg ${this.pxeRoot}/isolinux.theme.cfg`);
|
|
154
157
|
await this.tryCatch(`cp ${__dirname}/../../addons/eggs/theme/livecd/splash.png ${this.pxeRoot}/splash.png`);
|
|
155
158
|
/**
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
* ipxe.efi
|
|
160
|
+
*/
|
|
158
161
|
await this.tryCatch(`ln -s ${__dirname}/../../ipxe/ipxe.efi ${this.pxeRoot}/ipxe.efi`);
|
|
159
162
|
// pxe
|
|
160
|
-
const distro = new
|
|
163
|
+
const distro = new distro_js_1.default();
|
|
161
164
|
await this.tryCatch(`ln -s ${distro.pxelinuxPath}pxelinux.0 ${this.pxeRoot}/pxelinux.0`);
|
|
162
165
|
await this.tryCatch(`ln -s ${distro.pxelinuxPath}lpxelinux.0 ${this.pxeRoot}/lpxelinux.0`);
|
|
163
166
|
// syslinux
|
|
@@ -167,58 +170,58 @@ class Pxe {
|
|
|
167
170
|
await this.tryCatch(`ln -s ${distro.syslinuxPath}libutil.c32 ${this.pxeRoot}/libutil.c32`);
|
|
168
171
|
await this.tryCatch(`ln -s ${distro.memdiskPath}memdisk ${this.pxeRoot}/memdisk`);
|
|
169
172
|
await this.tryCatch(`mkdir ${this.pxeRoot}/pxelinux.cfg`);
|
|
170
|
-
let content =
|
|
171
|
-
content +=
|
|
172
|
-
content +=
|
|
173
|
-
content +=
|
|
174
|
-
content +=
|
|
175
|
-
content +=
|
|
176
|
-
content +=
|
|
177
|
-
content += `menu title cuckoo: when you need a flying PXE server! ${
|
|
178
|
-
content +=
|
|
179
|
-
content +=
|
|
180
|
-
content +=
|
|
181
|
-
content +=
|
|
173
|
+
let content = '';
|
|
174
|
+
content += '# eggs: pxelinux.cfg/default\n';
|
|
175
|
+
content += '# search path for the c32 support libraries (libcom32, libutil etc.)\n';
|
|
176
|
+
content += 'path\n';
|
|
177
|
+
content += 'include isolinux.theme.cfg\n';
|
|
178
|
+
content += 'UI vesamenu.c32\n';
|
|
179
|
+
content += '\n';
|
|
180
|
+
content += `menu title cuckoo: when you need a flying PXE server! ${utils_js_2.default.address()}\n`;
|
|
181
|
+
content += 'PROMPT 0\n';
|
|
182
|
+
content += 'TIMEOUT 200\n';
|
|
183
|
+
content += '\n';
|
|
184
|
+
content += 'label egg\n';
|
|
182
185
|
content += `menu label ${this.bootLabel.replace('.iso', '')}\n`;
|
|
183
186
|
if (this.settings.distro.familyId === 'debian') {
|
|
184
187
|
/**
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
* DEBIAN
|
|
189
|
+
*/
|
|
190
|
+
const clid = this.settings.distro.codenameLikeId;
|
|
188
191
|
if (clid === 'bionic' || clid === 'stretch' || clid === 'jessie') {
|
|
189
|
-
content +=
|
|
190
|
-
content += `append initrd=initrd boot=live config noswap noprompt fetch=http://${
|
|
192
|
+
content += 'kernel vmlinuz\n';
|
|
193
|
+
content += `append initrd=initrd boot=live config noswap noprompt fetch=http://${utils_js_2.default.address()}/live/filesystem.squashfs\n`;
|
|
191
194
|
}
|
|
192
195
|
else {
|
|
193
|
-
content += `kernel http://${
|
|
194
|
-
content += `append initrd=http://${
|
|
196
|
+
content += `kernel http://${utils_js_2.default.address()}/vmlinuz\n`;
|
|
197
|
+
content += `append initrd=http://${utils_js_2.default.address()}/initrd boot=live config noswap noprompt fetch=http://${utils_js_2.default.address()}/live/filesystem.squashfs\n`;
|
|
195
198
|
}
|
|
196
199
|
}
|
|
197
200
|
else if (distro.familyId === 'archlinux') {
|
|
198
201
|
/**
|
|
199
|
-
|
|
200
|
-
|
|
202
|
+
* ARCH LINUX
|
|
203
|
+
*/
|
|
201
204
|
let tool = 'archiso';
|
|
202
205
|
if (distro.codenameId === 'Qonos' || distro.codenameId === 'Ruah' || distro.codenameId === 'Sikaris') {
|
|
203
206
|
tool = 'miso';
|
|
204
207
|
}
|
|
205
|
-
content += `kernel http://${
|
|
206
|
-
content += `append initrd=http://${
|
|
207
|
-
content +=
|
|
208
|
-
content +=
|
|
208
|
+
content += `kernel http://${utils_js_2.default.address()}/vmlinuz\n`;
|
|
209
|
+
content += `append initrd=http://${utils_js_2.default.address()}/initrd boot=live config noswap noprompt ${tool}_http_srv=http://${utils_js_2.default.address()}/\n`;
|
|
210
|
+
content += 'sysappend 3\n';
|
|
211
|
+
content += '\n';
|
|
209
212
|
}
|
|
210
213
|
if (this.isos.length > 0) {
|
|
211
|
-
content +=
|
|
214
|
+
content += 'menu separator\n';
|
|
212
215
|
for (const iso of this.isos) {
|
|
213
|
-
content +=
|
|
216
|
+
content += '\n';
|
|
214
217
|
content += `label ${iso}\n`;
|
|
215
218
|
content += `menu label ${iso}\n`;
|
|
216
|
-
content += `kernel http://${
|
|
217
|
-
content += `initrd http://${
|
|
218
|
-
content +=
|
|
219
|
+
content += `kernel http://${utils_js_2.default.address()}/memdisk\n`;
|
|
220
|
+
content += `initrd http://${utils_js_2.default.address()}/${iso}\n`;
|
|
221
|
+
content += 'append iso raw sysappend 3\n';
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
|
-
|
|
224
|
+
const file = `${this.pxeRoot}/pxelinux.cfg/default`;
|
|
222
225
|
fs_1.default.writeFileSync(file, content);
|
|
223
226
|
}
|
|
224
227
|
/**
|
|
@@ -226,16 +229,16 @@ class Pxe {
|
|
|
226
229
|
*/
|
|
227
230
|
async ipxe() {
|
|
228
231
|
console.log('creating cuckoo configuration pxe: UEFI');
|
|
229
|
-
let content =
|
|
230
|
-
content +=
|
|
231
|
-
content +=
|
|
232
|
-
content += `console --picture http://${
|
|
233
|
-
content +=
|
|
234
|
-
content +=
|
|
232
|
+
let content = '#!ipxe\n';
|
|
233
|
+
content += 'dhcp\n';
|
|
234
|
+
content += 'set net0/ip=dhcp\n';
|
|
235
|
+
content += `console --picture http://${utils_js_2.default.address()}/splash.png -x 1024 -y 768\n`;
|
|
236
|
+
content += 'goto start ||\n';
|
|
237
|
+
content += '\n';
|
|
235
238
|
content += ':start\n';
|
|
236
|
-
content += `set server_root http://${
|
|
239
|
+
content += `set server_root http://${utils_js_2.default.address()}:80/\n`;
|
|
237
240
|
const serverRootVars = '${server_root}';
|
|
238
|
-
content += `menu cuckoo: when you need a flying PXE server! ${
|
|
241
|
+
content += `menu cuckoo: when you need a flying PXE server! ${utils_js_2.default.address()}\n`;
|
|
239
242
|
content += 'item --gap boot from ovarium\n';
|
|
240
243
|
content += `item egg-menu \${space} ${this.bootLabel.replaceAll('.iso', '')}\n\n`;
|
|
241
244
|
if (this.isos.length > 0) {
|
|
@@ -247,55 +250,55 @@ class Pxe {
|
|
|
247
250
|
}
|
|
248
251
|
}
|
|
249
252
|
content += 'item --gap boot from internet\n';
|
|
250
|
-
content +=
|
|
253
|
+
content += 'item netboot ${space} netboot\n';
|
|
251
254
|
content += 'choose target || goto start\n';
|
|
252
255
|
content += 'goto ${target}\n';
|
|
253
256
|
content += '\n';
|
|
254
|
-
content +=
|
|
255
|
-
content += `kernel http://${
|
|
256
|
-
content += `initrd http://${
|
|
257
|
+
content += ':egg-menu\n';
|
|
258
|
+
content += `kernel http://${utils_js_2.default.address()}/vmlinuz\n`;
|
|
259
|
+
content += `initrd http://${utils_js_2.default.address()}/initrd\n`;
|
|
257
260
|
/**
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
* CORRECT:
|
|
262
|
+
* content += `imgargs vmlinuz fetch=http://${Utils.address()}/live/filesystem.squashfs boot=live dhcp initrd=initrd ro\n`
|
|
263
|
+
*/
|
|
261
264
|
if (this.settings.distro.familyId === 'debian') {
|
|
262
265
|
/**
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
content += `imgargs vmlinuz fetch=http://${
|
|
266
|
+
* DEBIAN
|
|
267
|
+
*/
|
|
268
|
+
content += `imgargs vmlinuz fetch=http://${utils_js_2.default.address()}/live/filesystem.squashfs boot=live dhcp initrd=initrd ro\n`;
|
|
266
269
|
}
|
|
267
270
|
else if (this.settings.distro.familyId === 'archlinux') {
|
|
268
271
|
/**
|
|
269
|
-
|
|
270
|
-
|
|
272
|
+
* ARCH LINUX
|
|
273
|
+
*/
|
|
271
274
|
let tool = 'archiso';
|
|
272
275
|
if (this.settings.distro.codenameId === 'Qonos' || this.settings.distro.codenameId === 'Ruah' || this.settings.distro.codenameId === 'Sikaris') {
|
|
273
276
|
tool = 'miso';
|
|
274
277
|
}
|
|
275
|
-
content += `imgargs vmlinuz ${tool}_http_srv=http://${
|
|
276
|
-
//content += 'ipappend 3\n'
|
|
278
|
+
content += `imgargs vmlinuz ${tool}_http_srv=http://${utils_js_2.default.address()}/ boot=live dhcp initrd=initrd ro\n`;
|
|
279
|
+
// content += 'ipappend 3\n'
|
|
277
280
|
}
|
|
278
|
-
content +=
|
|
279
|
-
content +=
|
|
281
|
+
content += 'sleep 5\n';
|
|
282
|
+
content += 'boot || goto start\n\n';
|
|
280
283
|
if (this.isos.length > 0) {
|
|
281
284
|
for (const iso of this.isos) {
|
|
282
285
|
const menu = iso.replace('.iso', '');
|
|
283
286
|
content += `:${menu}\n`;
|
|
284
287
|
content += `sanboot ${serverRootVars}/${iso}\n`;
|
|
285
|
-
content +=
|
|
288
|
+
content += 'boot || goto start\n\n';
|
|
286
289
|
}
|
|
287
290
|
}
|
|
288
291
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
content +=
|
|
292
|
-
content +=
|
|
293
|
-
content +=
|
|
294
|
-
content +=
|
|
295
|
-
content +=
|
|
296
|
-
content +=
|
|
297
|
-
content +=
|
|
298
|
-
|
|
292
|
+
* netboot.xyz
|
|
293
|
+
*/
|
|
294
|
+
content += ':netboot\n';
|
|
295
|
+
content += 'ifopen net0\n';
|
|
296
|
+
content += 'set conn_type https\n';
|
|
297
|
+
content += 'chain --autofree https://boot.netboot.xyz/menu.ipxe || echo HTTPS failed... attempting HTTP...\n';
|
|
298
|
+
content += 'set conn_type http\n';
|
|
299
|
+
content += 'chain --autofree http://boot.netboot.xyz/menu.ipxe || echo HTTP failed, localbooting...\n';
|
|
300
|
+
content += 'goto start\n\n';
|
|
301
|
+
const file = `${this.pxeRoot}/autoexec.ipxe`;
|
|
299
302
|
fs_1.default.writeFileSync(file, content);
|
|
300
303
|
}
|
|
301
304
|
/**
|
|
@@ -303,25 +306,25 @@ class Pxe {
|
|
|
303
306
|
*/
|
|
304
307
|
async http() {
|
|
305
308
|
console.log('creating cuckoo configuration: PXE html');
|
|
306
|
-
|
|
307
|
-
let content =
|
|
308
|
-
content +=
|
|
309
|
-
content +=
|
|
310
|
-
content +=
|
|
311
|
-
content += `<body>address: <a href=http://${
|
|
312
|
-
if (!
|
|
313
|
-
content +=
|
|
309
|
+
const file = `${this.pxeRoot}/index.html`;
|
|
310
|
+
let content = '';
|
|
311
|
+
content += '<html><title>Penguin\'s eggs PXE server</title>';
|
|
312
|
+
content += '<div style="background-image:url(\'/splash.png\');background-repeat:no-repeat;width: 640;height:480;padding:5px;border:1px solid black;">';
|
|
313
|
+
content += '<h1>Cucko PXE server</h1>';
|
|
314
|
+
content += `<body>address: <a href=http://${utils_js_2.default.address()}>${utils_js_2.default.address()}</a><br/>`;
|
|
315
|
+
if (!utils_js_2.default.isLive()) {
|
|
316
|
+
content += 'Serving:<li>';
|
|
314
317
|
for (const iso of this.isos) {
|
|
315
|
-
content += `<ul><a href='http://${
|
|
318
|
+
content += `<ul><a href='http://${utils_js_2.default.address()}/${iso}'>${iso}</a></ul>`;
|
|
316
319
|
}
|
|
317
|
-
content +=
|
|
320
|
+
content += '</li>';
|
|
318
321
|
}
|
|
319
322
|
else {
|
|
320
|
-
content +=
|
|
323
|
+
content += 'started from live iso image<br/>';
|
|
321
324
|
}
|
|
322
|
-
content +=
|
|
323
|
-
content +=
|
|
324
|
-
content +=
|
|
325
|
+
content += 'source: <a href=\'https://github.com/pieroproietti/penguins-eggs\'>https://github.com/pieroproietti/penguins-eggs</a><br/>';
|
|
326
|
+
content += 'manual: <a href=\'https://penguins-eggs.net/book/italiano9.2.html\'>italiano</a>, <a href=\'https://penguins--eggs-net.translate.goog/book/italiano9.2?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en\'>translated</a><br/>';
|
|
327
|
+
content += 'discuss: <a href=\'https://t.me/penguins_eggs\'>Telegram group<br/></body</html>';
|
|
325
328
|
fs_1.default.writeFileSync(file, content);
|
|
326
329
|
}
|
|
327
330
|
/**
|
|
@@ -329,7 +332,7 @@ class Pxe {
|
|
|
329
332
|
* @param dhcpOptions
|
|
330
333
|
*/
|
|
331
334
|
dhcpStart(dhcpOptions) {
|
|
332
|
-
|
|
335
|
+
new etrick_1.default(dhcpOptions);
|
|
333
336
|
}
|
|
334
337
|
/**
|
|
335
338
|
* start http server for images
|
|
@@ -337,9 +340,9 @@ class Pxe {
|
|
|
337
340
|
*/
|
|
338
341
|
async httpStart() {
|
|
339
342
|
const port = 80;
|
|
340
|
-
const httpRoot = this.pxeRoot +
|
|
341
|
-
console.log(
|
|
342
|
-
|
|
343
|
+
const httpRoot = this.pxeRoot + '/';
|
|
344
|
+
console.log('http listening: 0.0.0.0:' + port);
|
|
345
|
+
const file = new (node_static_1.default.Server)(httpRoot);
|
|
343
346
|
http_1.default.createServer(function (req, res) {
|
|
344
347
|
file.serve(req, res);
|
|
345
348
|
}).listen(port);
|
|
@@ -348,17 +351,17 @@ class Pxe {
|
|
|
348
351
|
* start tftp
|
|
349
352
|
*/
|
|
350
353
|
async tftpStart(tftpOptions) {
|
|
351
|
-
|
|
352
|
-
tftpServer.on(
|
|
353
|
-
// Errors from the main socket
|
|
354
|
-
// The current transfers are not aborted
|
|
354
|
+
const tftpServer = tftp_1.default.createServer(tftpOptions);
|
|
355
|
+
tftpServer.on('error', function (error) {
|
|
356
|
+
// Errors from the main socket
|
|
357
|
+
// The current transfers are not aborted
|
|
355
358
|
console.error(error);
|
|
356
359
|
});
|
|
357
|
-
tftpServer.on(
|
|
358
|
-
req.on(
|
|
359
|
-
//Error from the request
|
|
360
|
-
//The connection is already closed
|
|
361
|
-
console.error(
|
|
360
|
+
tftpServer.on('request', function (req, res) {
|
|
361
|
+
req.on('error', function (error) {
|
|
362
|
+
// Error from the request
|
|
363
|
+
// The connection is already closed
|
|
364
|
+
console.error('[' + req.stats.remoteAddress + ':' + req.stats.remotePort + '] (' + req.file + ') ' + error.message);
|
|
362
365
|
});
|
|
363
366
|
});
|
|
364
367
|
tftpServer.listen();
|
|
@@ -372,11 +375,11 @@ class Pxe {
|
|
|
372
375
|
if (echo) {
|
|
373
376
|
console.log(cmd);
|
|
374
377
|
}
|
|
375
|
-
await (0,
|
|
378
|
+
await (0, utils_js_1.exec)(cmd, this.echo);
|
|
376
379
|
}
|
|
377
380
|
catch (error) {
|
|
378
381
|
console.log(`Error: ${error}`);
|
|
379
|
-
await
|
|
382
|
+
await utils_js_2.default.pressKeyToExit(cmd);
|
|
380
383
|
}
|
|
381
384
|
}
|
|
382
385
|
}
|
package/dist/classes/settings.js
CHANGED
|
@@ -5,19 +5,21 @@
|
|
|
5
5
|
* mail: piero.proietti@gmail.com
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const tslib_1 = require("tslib");
|
|
10
12
|
// packages
|
|
11
|
-
const node_fs_1 =
|
|
12
|
-
const node_os_1 =
|
|
13
|
-
const js_yaml_1 =
|
|
14
|
-
const shelljs_1 =
|
|
15
|
-
const chalk_1 =
|
|
13
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
14
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
15
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
16
|
+
const shelljs_1 = __importDefault(require("shelljs"));
|
|
17
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
16
18
|
const pjson = require('../../package.json');
|
|
17
19
|
// classes
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
const utils_js_1 = __importDefault(require("./utils.js"));
|
|
21
|
+
const distro_js_1 = __importDefault(require("./distro.js"));
|
|
22
|
+
const pacman_js_1 = __importDefault(require("./pacman.js"));
|
|
21
23
|
const config_file = '/etc/penguins-eggs.d/eggs.yaml';
|
|
22
24
|
/**
|
|
23
25
|
* Setting
|
|
@@ -45,9 +47,9 @@ class Settings {
|
|
|
45
47
|
this.app.mail = 'piero.proietti@gmail.com';
|
|
46
48
|
this.app.name = pjson.name;
|
|
47
49
|
this.app.version = pjson.version;
|
|
48
|
-
this.isLive =
|
|
49
|
-
this.i686 =
|
|
50
|
-
this.distro = new
|
|
50
|
+
this.isLive = utils_js_1.default.isLive();
|
|
51
|
+
this.i686 = utils_js_1.default.isi686();
|
|
52
|
+
this.distro = new distro_js_1.default(this.remix);
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
55
|
*
|
|
@@ -83,11 +85,11 @@ class Settings {
|
|
|
83
85
|
if (this.config.snapshot_basename === '') {
|
|
84
86
|
this.config.snapshot_basename = node_os_1.default.hostname();
|
|
85
87
|
}
|
|
86
|
-
if (this.config.make_efi && !
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (this.config.make_efi && !pacman_js_1.default.isUefi()) {
|
|
89
|
+
utils_js_1.default.error('You choose to create an UEFI image, but miss to install grub-efi-amd64-bin package.');
|
|
90
|
+
utils_js_1.default.error('Please install it before to create an UEFI image:');
|
|
91
|
+
utils_js_1.default.warning('sudo apt install grub-efi-amd64-bin');
|
|
92
|
+
utils_js_1.default.error('or edit /etc/penguins-eggs.d/eggs.yaml and set the valuer of make_efi = false');
|
|
91
93
|
this.config.make_efi = false;
|
|
92
94
|
}
|
|
93
95
|
this.kernel_image = this.config.vmlinuz;
|
|
@@ -153,16 +155,16 @@ class Settings {
|
|
|
153
155
|
console.log(`locale default: ${this.config.locales_default}`);
|
|
154
156
|
// console.log(`ssh_pass: ${this.config.ssh_pass}`)
|
|
155
157
|
if (this.config.make_efi) {
|
|
156
|
-
if (!
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
if (!pacman_js_1.default.isUefi()) {
|
|
159
|
+
utils_js_1.default.error('You choose to create an UEFI image, but miss to install grub-efi-amd64-bin package.');
|
|
160
|
+
utils_js_1.default.error('Please install it before to create an UEFI image:');
|
|
161
|
+
utils_js_1.default.warning('sudo apt install grub-efi-amd64-bin');
|
|
160
162
|
this.config.make_efi = false;
|
|
161
163
|
}
|
|
162
|
-
else if (!
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
else if (!pacman_js_1.default.packageIsInstalled('dosfstools')) {
|
|
165
|
+
utils_js_1.default.error('You choose to create an UEFI image, but miss to install dosfstools package.');
|
|
166
|
+
utils_js_1.default.error('Please install it before to create an UEFI image:');
|
|
167
|
+
utils_js_1.default.warning('sudo apt install dosfstools');
|
|
166
168
|
this.config.make_efi = false;
|
|
167
169
|
}
|
|
168
170
|
}
|
|
@@ -181,16 +183,16 @@ class Settings {
|
|
|
181
183
|
*/
|
|
182
184
|
const gb = 1048576;
|
|
183
185
|
let spaceAvailable = 0;
|
|
184
|
-
if (!
|
|
185
|
-
console.log(`Disk space used: ${Math.round((
|
|
186
|
+
if (!utils_js_1.default.isLive()) {
|
|
187
|
+
console.log(`Disk space used: ${Math.round((utils_js_1.default.getUsedSpace() / gb) * 10) / 10} GB`);
|
|
186
188
|
}
|
|
187
189
|
spaceAvailable = Number(shelljs_1.default
|
|
188
190
|
.exec(`df "${path}" | /usr/bin/awk 'NR==2 {print $4}'`, {
|
|
189
|
-
silent: true
|
|
191
|
+
silent: true,
|
|
190
192
|
})
|
|
191
193
|
.stdout.trim());
|
|
192
194
|
console.log(`Space available: ${Math.round((spaceAvailable / gb) * 10) / 10} GB`);
|
|
193
|
-
console.log(`There are ${
|
|
195
|
+
console.log(`There are ${utils_js_1.default.getSnapshotCount(this.config.snapshot_dir)} snapshots taking ${Math.round((utils_js_1.default.getSnapshotSize() / gb) * 10) / 10} GB of disk space.`);
|
|
194
196
|
console.log();
|
|
195
197
|
if (spaceAvailable > gb * 3) {
|
|
196
198
|
console.log(chalk_1.default.cyanBright('The free space should be sufficient to hold the'));
|
|
@@ -209,9 +211,9 @@ class Settings {
|
|
|
209
211
|
* @param theme
|
|
210
212
|
*/
|
|
211
213
|
async loadRemix(basename = '', theme = '') {
|
|
212
|
-
this.remix.versionNumber =
|
|
213
|
-
this.remix.kernel =
|
|
214
|
-
this.remix.branding = theme === '' ? 'eggs' : this.remix.branding = theme.
|
|
214
|
+
this.remix.versionNumber = utils_js_1.default.getPackageVersion();
|
|
215
|
+
this.remix.kernel = utils_js_1.default.kernelVersion();
|
|
216
|
+
this.remix.branding = theme === '' ? 'eggs' : this.remix.branding = theme.slice(Math.max(0, theme.lastIndexOf('/') + 1));
|
|
215
217
|
this.remix.name = this.config.snapshot_basename;
|
|
216
218
|
let name = this.config.snapshot_prefix + this.config.snapshot_basename;
|
|
217
219
|
name = name.replace(/-/g, ' ').replace('egg of ', '');
|