penguins-eggs 9.3.27 → 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/dist/classes/bleach.js +26 -24
- package/dist/classes/compressors.js +4 -2
- package/dist/classes/daddy.js +30 -28
- package/dist/classes/distro.js +7 -5
- package/dist/classes/family/archlinux.js +21 -19
- package/dist/classes/family/debian.js +28 -26
- package/dist/classes/family/fedora.js +19 -17
- package/dist/classes/family/suse.js +19 -17
- package/dist/classes/incubation/branding.js +4 -2
- 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 +5 -3
- package/dist/classes/incubation/distros/rolling.js +5 -3
- package/dist/classes/incubation/fisherman-helper/displaymanager.js +5 -3
- package/dist/classes/incubation/fisherman-helper/packages.js +9 -7
- package/dist/classes/incubation/fisherman.js +14 -12
- package/dist/classes/incubation/incubator.js +30 -28
- package/dist/classes/incubation/installer.js +8 -6
- package/dist/classes/initrd.js +5 -3
- package/dist/classes/keyboards.js +9 -7
- package/dist/classes/locales.js +10 -8
- package/dist/classes/n8.js +4 -2
- package/dist/classes/network.js +4 -2
- package/dist/classes/ovary.js +214 -211
- package/dist/classes/pacman.js +127 -125
- package/dist/classes/pve-live.js +7 -5
- package/dist/classes/pxe.js +66 -63
- package/dist/classes/settings.js +32 -30
- package/dist/classes/sources_list.js +12 -10
- package/dist/classes/systemctl.js +14 -12
- package/dist/classes/tailor.js +64 -62
- package/dist/classes/tools.js +7 -5
- package/dist/classes/users.js +6 -4
- package/dist/classes/utils.js +22 -20
- package/dist/classes/xdg.js +44 -42
- package/dist/classes/yolk.js +32 -30
- package/dist/commands/adapt.js +12 -10
- package/dist/commands/analyze.js +15 -13
- package/dist/commands/calamares.js +22 -20
- package/dist/commands/config.js +71 -69
- package/dist/commands/cuckoo.js +11 -9
- package/dist/commands/dad.js +12 -10
- package/dist/commands/export/deb.js +12 -10
- package/dist/commands/export/iso.js +11 -9
- package/dist/commands/install.js +16 -14
- package/dist/commands/kill.js +14 -12
- package/dist/commands/mom.js +9 -7
- package/dist/commands/produce.js +21 -19
- package/dist/commands/status.js +5 -3
- package/dist/commands/syncfrom.js +39 -37
- package/dist/commands/syncto.js +47 -45
- package/dist/commands/tools/clean.js +10 -8
- package/dist/commands/tools/ppa.js +21 -19
- package/dist/commands/tools/skel.js +15 -13
- package/dist/commands/tools/stat.js +7 -5
- package/dist/commands/tools/yolk.js +11 -9
- package/dist/commands/update.js +25 -23
- package/dist/commands/wardrobe/get.js +10 -8
- package/dist/commands/wardrobe/list.js +12 -10
- package/dist/commands/wardrobe/show.js +13 -11
- package/dist/commands/wardrobe/wear.js +16 -14
- 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/krill/krill-prepare.js +92 -90
- package/dist/krill/krill-sequence.js +148 -145
- package/dist/krill/modules/add-user.js +9 -7
- package/dist/krill/modules/bootloader-config-ubuntu.js +24 -22
- package/dist/krill/modules/bootloader.js +9 -7
- 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 +14 -12
- package/dist/krill/modules/grubcfg.js +7 -5
- package/dist/krill/modules/hostname.js +4 -2
- package/dist/krill/modules/initramfs-cfg.js +6 -4
- package/dist/krill/modules/initramfs.js +13 -11
- package/dist/krill/modules/locale-cfg.js +4 -2
- package/dist/krill/modules/locale.js +7 -5
- package/dist/krill/modules/m-keyboard.js +13 -11
- package/dist/krill/modules/m-timezone.js +7 -5
- package/dist/krill/modules/machine-id.js +7 -5
- package/dist/krill/modules/mkfs.js +6 -6
- package/dist/krill/modules/mount-fs.js +17 -15
- package/dist/krill/modules/mount-vfs.js +12 -12
- package/dist/krill/modules/network-cfg.js +8 -6
- package/dist/krill/modules/packages.js +15 -13
- package/dist/krill/modules/partition.js +74 -72
- package/dist/krill/modules/remove-installer-link.js +4 -2
- package/dist/krill/modules/umount.js +9 -7
- package/dist/krill/modules/unpackfs.js +7 -5
- package/dist/lib/cli-autologin.js +163 -163
- package/dist/lib/get_address.js +4 -2
- package/dist/lib/get_dns.js +4 -2
- package/dist/lib/get_domain.js +4 -2
- package/dist/lib/get_gateway.js +4 -2
- package/dist/lib/get_hostname.js +4 -2
- package/dist/lib/get_netmask.js +4 -2
- package/dist/lib/get_password.js +4 -2
- package/dist/lib/get_root_password.js +4 -2
- package/dist/lib/get_userfullname.js +4 -2
- package/dist/lib/get_username.js +4 -2
- package/dist/lib/select_address_type.js +4 -2
- package/dist/lib/select_filesystem_type.js +6 -4
- package/dist/lib/select_installation_device.js +5 -3
- package/dist/lib/select_installation_mode.js +4 -2
- package/dist/lib/select_interface.js +4 -2
- package/dist/lib/select_keyboard_layout.js +6 -4
- package/dist/lib/select_keyboard_model.js +6 -4
- package/dist/lib/select_keyboard_option.js +6 -4
- package/dist/lib/select_keyboard_variant.js +6 -4
- package/dist/lib/select_languages.js +6 -4
- package/dist/lib/select_regions.js +4 -2
- package/dist/lib/select_user_swap_choice.js +6 -4
- package/dist/lib/select_zones.js +4 -2
- package/package.json +6 -5
- package/dist/types/etrick.js +0 -1
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 fs_1 =
|
|
12
|
-
const http_1 =
|
|
13
|
-
const node_static_1 =
|
|
14
|
-
const node_path_1 =
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const tftp_1 =
|
|
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,36 +41,36 @@ 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
|
-
|
|
70
|
+
* Ricerca delle uova
|
|
71
|
+
*/
|
|
69
72
|
const isos = [];
|
|
70
|
-
if (!
|
|
73
|
+
if (!utils_js_2.default.isLive()) {
|
|
71
74
|
const isos = fs_1.default.readdirSync(this.nest);
|
|
72
75
|
for (const iso of isos) {
|
|
73
76
|
if (node_path_1.default.extname(iso) === '.iso') {
|
|
@@ -77,9 +80,9 @@ class Pxe {
|
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
* installed: /home/eggs/ovarium/iso/live
|
|
84
|
+
* live: this.iso/live
|
|
85
|
+
*/
|
|
83
86
|
const pathFiles = this.eggRoot + 'live';
|
|
84
87
|
const files = fs_1.default.readdirSync(pathFiles);
|
|
85
88
|
for (const file of files) {
|
|
@@ -101,8 +104,8 @@ class Pxe {
|
|
|
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
111
|
const a = fs_1.default.readFileSync(this.eggRoot + '/.disk/mkisofs', 'utf-8');
|
|
@@ -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
|
|
@@ -174,7 +177,7 @@ class Pxe {
|
|
|
174
177
|
content += 'include isolinux.theme.cfg\n';
|
|
175
178
|
content += 'UI vesamenu.c32\n';
|
|
176
179
|
content += '\n';
|
|
177
|
-
content += `menu title cuckoo: when you need a flying PXE server! ${
|
|
180
|
+
content += `menu title cuckoo: when you need a flying PXE server! ${utils_js_2.default.address()}\n`;
|
|
178
181
|
content += 'PROMPT 0\n';
|
|
179
182
|
content += 'TIMEOUT 200\n';
|
|
180
183
|
content += '\n';
|
|
@@ -182,28 +185,28 @@ class Pxe {
|
|
|
182
185
|
content += `menu label ${this.bootLabel.replace('.iso', '')}\n`;
|
|
183
186
|
if (this.settings.distro.familyId === 'debian') {
|
|
184
187
|
/**
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
* DEBIAN
|
|
189
|
+
*/
|
|
187
190
|
const clid = this.settings.distro.codenameLikeId;
|
|
188
191
|
if (clid === 'bionic' || clid === 'stretch' || clid === 'jessie') {
|
|
189
192
|
content += 'kernel vmlinuz\n';
|
|
190
|
-
content += `append initrd=initrd boot=live config noswap noprompt fetch=http://${
|
|
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://${
|
|
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`;
|
|
207
210
|
content += 'sysappend 3\n';
|
|
208
211
|
content += '\n';
|
|
209
212
|
}
|
|
@@ -213,8 +216,8 @@ class Pxe {
|
|
|
213
216
|
content += '\n';
|
|
214
217
|
content += `label ${iso}\n`;
|
|
215
218
|
content += `menu label ${iso}\n`;
|
|
216
|
-
content += `kernel http://${
|
|
217
|
-
content += `initrd http://${
|
|
219
|
+
content += `kernel http://${utils_js_2.default.address()}/memdisk\n`;
|
|
220
|
+
content += `initrd http://${utils_js_2.default.address()}/${iso}\n`;
|
|
218
221
|
content += 'append iso raw sysappend 3\n';
|
|
219
222
|
}
|
|
220
223
|
}
|
|
@@ -229,13 +232,13 @@ class Pxe {
|
|
|
229
232
|
let content = '#!ipxe\n';
|
|
230
233
|
content += 'dhcp\n';
|
|
231
234
|
content += 'set net0/ip=dhcp\n';
|
|
232
|
-
content += `console --picture http://${
|
|
235
|
+
content += `console --picture http://${utils_js_2.default.address()}/splash.png -x 1024 -y 768\n`;
|
|
233
236
|
content += 'goto start ||\n';
|
|
234
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) {
|
|
@@ -252,27 +255,27 @@ class Pxe {
|
|
|
252
255
|
content += 'goto ${target}\n';
|
|
253
256
|
content += '\n';
|
|
254
257
|
content += ':egg-menu\n';
|
|
255
|
-
content += `kernel http://${
|
|
256
|
-
content += `initrd http://${
|
|
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://${
|
|
278
|
+
content += `imgargs vmlinuz ${tool}_http_srv=http://${utils_js_2.default.address()}/ boot=live dhcp initrd=initrd ro\n`;
|
|
276
279
|
// content += 'ipappend 3\n'
|
|
277
280
|
}
|
|
278
281
|
content += 'sleep 5\n';
|
|
@@ -286,8 +289,8 @@ class Pxe {
|
|
|
286
289
|
}
|
|
287
290
|
}
|
|
288
291
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
292
|
+
* netboot.xyz
|
|
293
|
+
*/
|
|
291
294
|
content += ':netboot\n';
|
|
292
295
|
content += 'ifopen net0\n';
|
|
293
296
|
content += 'set conn_type https\n';
|
|
@@ -308,11 +311,11 @@ class Pxe {
|
|
|
308
311
|
content += '<html><title>Penguin\'s eggs PXE server</title>';
|
|
309
312
|
content += '<div style="background-image:url(\'/splash.png\');background-repeat:no-repeat;width: 640;height:480;padding:5px;border:1px solid black;">';
|
|
310
313
|
content += '<h1>Cucko PXE server</h1>';
|
|
311
|
-
content += `<body>address: <a href=http://${
|
|
312
|
-
if (!
|
|
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()) {
|
|
313
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
320
|
content += '</li>';
|
|
318
321
|
}
|
|
@@ -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,8 +183,8 @@ 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}'`, {
|
|
@@ -190,7 +192,7 @@ class Settings {
|
|
|
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,8 +211,8 @@ 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.versionNumber = utils_js_1.default.getPackageVersion();
|
|
215
|
+
this.remix.kernel = utils_js_1.default.kernelVersion();
|
|
214
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;
|
|
@@ -5,12 +5,14 @@
|
|
|
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
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const distro_1 = tslib_1.__importDefault(require("./distro"));
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
const utils_js_1 = __importDefault(require("./utils.js"));
|
|
14
|
+
const utils_js_2 = require("../lib/utils.js");
|
|
15
|
+
const distro_js_1 = __importDefault(require("./distro.js"));
|
|
14
16
|
/**
|
|
15
17
|
*
|
|
16
18
|
*/
|
|
@@ -26,7 +28,7 @@ class SourcesList {
|
|
|
26
28
|
*/
|
|
27
29
|
let checked = true;
|
|
28
30
|
checked = false;
|
|
29
|
-
const distro = new
|
|
31
|
+
const distro = new distro_js_1.default();
|
|
30
32
|
for (const distribution of distributions) {
|
|
31
33
|
if (distribution.includes(distro.codenameLikeId)) {
|
|
32
34
|
checked = true;
|
|
@@ -56,10 +58,10 @@ class SourcesList {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
if (checked) {
|
|
59
|
-
|
|
61
|
+
utils_js_1.default.warning('repositories checked');
|
|
60
62
|
}
|
|
61
63
|
else {
|
|
62
|
-
|
|
64
|
+
utils_js_1.default.pressKeyToExit('component warning, check your /etc/apt/sources.list', true);
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
return checked;
|
|
@@ -69,12 +71,12 @@ class SourcesList {
|
|
|
69
71
|
*/
|
|
70
72
|
async get() {
|
|
71
73
|
let universalSourcesList = '/etc/apt/sources.list';
|
|
72
|
-
const distro = new
|
|
74
|
+
const distro = new distro_js_1.default();
|
|
73
75
|
if (distro.distroId === 'Linuxmint') {
|
|
74
76
|
universalSourcesList = '/etc/apt/sources.list.d/official-package-repositories.list';
|
|
75
77
|
}
|
|
76
78
|
// deb uri distribution [component1] [component2] [...]
|
|
77
|
-
const checkRepos = await (0,
|
|
79
|
+
const checkRepos = await (0, utils_js_2.exec)(`grep "deb http"<${universalSourcesList}`, { echo: false, capture: true });
|
|
78
80
|
let tmp = [];
|
|
79
81
|
if (checkRepos.code === 0) {
|
|
80
82
|
tmp = checkRepos.data.split('\n');
|
|
@@ -7,26 +7,28 @@
|
|
|
7
7
|
* gestione systemd
|
|
8
8
|
* Presa da https://github.com/VolantisDev/node-systemctl
|
|
9
9
|
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
10
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const utils_2 = tslib_1.__importDefault(require("./utils"));
|
|
14
|
+
const utils_js_1 = require("../lib/utils.js");
|
|
15
|
+
const utils_js_2 = __importDefault(require("./utils.js"));
|
|
14
16
|
class SistemdCtl {
|
|
15
17
|
constructor(verbose = false) {
|
|
16
18
|
this.echo = {};
|
|
17
|
-
this.echo =
|
|
19
|
+
this.echo = utils_js_2.default.setEcho(verbose);
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
*
|
|
21
23
|
*/
|
|
22
24
|
async reload(service) {
|
|
23
|
-
await (0,
|
|
25
|
+
await (0, utils_js_1.exec)(`systemctl reload ${service}`, this.echo);
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
*
|
|
27
29
|
*/
|
|
28
30
|
async disable(service, chroot = '/', report = false) {
|
|
29
|
-
await (0,
|
|
31
|
+
await (0, utils_js_1.exec)(`chroot ${chroot}} systemctl disable ${service}`, this.echo);
|
|
30
32
|
if (report) {
|
|
31
33
|
console.log(`systemctl: disabled ${service} on ${chroot}`);
|
|
32
34
|
}
|
|
@@ -35,25 +37,25 @@ class SistemdCtl {
|
|
|
35
37
|
*
|
|
36
38
|
*/
|
|
37
39
|
async enable(service) {
|
|
38
|
-
await (0,
|
|
40
|
+
await (0, utils_js_1.exec)(`systemctl enable ${service}`, this.echo);
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
*
|
|
42
44
|
*/
|
|
43
45
|
async restart(service) {
|
|
44
|
-
await (0,
|
|
46
|
+
await (0, utils_js_1.exec)(`systemctl restart ${service}`, this.echo);
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
49
|
*
|
|
48
50
|
*/
|
|
49
51
|
async start(service) {
|
|
50
|
-
await (0,
|
|
52
|
+
await (0, utils_js_1.exec)(`systemctl start ${service}`, this.echo);
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
55
|
*
|
|
54
56
|
*/
|
|
55
57
|
async stop(service) {
|
|
56
|
-
await (0,
|
|
58
|
+
await (0, utils_js_1.exec)(`systemctl stop ${service}`, this.echo);
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
59
61
|
*
|
|
@@ -62,7 +64,7 @@ class SistemdCtl {
|
|
|
62
64
|
*/
|
|
63
65
|
async isActive(service) {
|
|
64
66
|
return new Promise((resolve, reject) => {
|
|
65
|
-
(0,
|
|
67
|
+
(0, utils_js_1.exec)(`systemctl is-active ${service}`, this.echo)
|
|
66
68
|
.then(result => {
|
|
67
69
|
resolve(!result.data.includes('inactive'));
|
|
68
70
|
})
|
|
@@ -76,7 +78,7 @@ class SistemdCtl {
|
|
|
76
78
|
*/
|
|
77
79
|
async isEnabled(service) {
|
|
78
80
|
return new Promise((resolve, reject) => {
|
|
79
|
-
(0,
|
|
81
|
+
(0, utils_js_1.exec)(`systemctl is-enabled ${service}`, this.echo)
|
|
80
82
|
.then(result => {
|
|
81
83
|
resolve(result.data.includes('enabled'));
|
|
82
84
|
})
|