penguins-eggs 9.3.29 → 9.3.30
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 +22 -22
- package/dist/classes/daddy.js +25 -25
- package/dist/classes/family/archlinux.js +16 -16
- package/dist/classes/family/debian.js +23 -23
- package/dist/classes/family/fedora.js +14 -14
- package/dist/classes/family/suse.js +14 -14
- package/dist/classes/incubation/distros/bionic.js +5 -4
- package/dist/classes/incubation/distros/buster.js +5 -4
- package/dist/classes/incubation/distros/focal.js +5 -4
- package/dist/classes/incubation/distros/jessie.js +2 -2
- package/dist/classes/incubation/distros/rolling.js +6 -4
- package/dist/classes/incubation/fisherman-helper/displaymanager.js +2 -2
- package/dist/classes/incubation/fisherman-helper/packages.js +6 -6
- package/dist/classes/incubation/fisherman.js +13 -17
- package/dist/classes/incubation/incubator.js +26 -25
- package/dist/classes/incubation/installer.js +5 -5
- package/dist/classes/keyboards.js +5 -5
- package/dist/classes/locales.js +6 -6
- package/dist/classes/n8.js +1 -1
- package/dist/classes/network.js +6 -0
- package/dist/classes/ovary.js +202 -204
- package/dist/classes/pacman.js +121 -121
- package/dist/classes/pve-live.js +2 -2
- package/dist/classes/pxe.js +32 -32
- package/dist/classes/settings.js +24 -24
- package/dist/classes/sources_list.js +8 -8
- package/dist/classes/systemctl.js +11 -11
- package/dist/classes/tailor.js +57 -57
- package/dist/classes/tools.js +2 -2
- package/dist/classes/users.js +2 -2
- package/dist/classes/utils.js +12 -12
- package/dist/classes/xdg.js +38 -38
- package/dist/classes/yolk.js +27 -27
- package/dist/commands/adapt.js +9 -9
- package/dist/commands/analyze.js +10 -10
- package/dist/commands/calamares.js +19 -19
- package/dist/commands/config.js +67 -67
- package/dist/commands/cuckoo.js +8 -8
- package/dist/commands/dad.js +8 -8
- package/dist/commands/export/deb.js +9 -9
- package/dist/commands/export/iso.js +8 -8
- package/dist/commands/install.js +8 -8
- package/dist/commands/kill.js +11 -11
- package/dist/commands/mom.js +5 -5
- package/dist/commands/produce.js +15 -15
- package/dist/commands/status.js +2 -2
- package/dist/commands/syncfrom.js +34 -34
- package/dist/commands/syncto.js +42 -42
- package/dist/commands/tools/clean.js +7 -7
- package/dist/commands/tools/ppa.js +17 -17
- package/dist/commands/tools/skel.js +11 -11
- package/dist/commands/tools/stat.js +2 -2
- package/dist/commands/tools/yolk.js +6 -6
- package/dist/commands/update.js +21 -21
- package/dist/commands/wardrobe/get.js +7 -7
- package/dist/commands/wardrobe/list.js +5 -5
- package/dist/commands/wardrobe/show.js +6 -6
- package/dist/commands/wardrobe/wear.js +10 -10
- package/dist/components/elements/information.js +16 -16
- package/dist/components/finished.js +4 -4
- package/dist/components/install.js +4 -4
- package/dist/components/keyboard.js +4 -4
- package/dist/components/location.js +4 -4
- package/dist/components/network.js +4 -4
- package/dist/components/partitions.js +4 -4
- package/dist/components/summary.js +4 -4
- package/dist/components/users.js +4 -4
- package/dist/components/welcome.js +4 -4
- package/dist/krill/krill-prepare.js +84 -84
- package/dist/krill/krill-sequence.js +140 -140
- package/dist/krill/modules/add-user.js +6 -6
- package/dist/krill/modules/bootloader-config-ubuntu.js +21 -21
- package/dist/krill/modules/bootloader.js +6 -6
- package/dist/krill/modules/change-password.js +2 -2
- package/dist/krill/modules/del-live-user.js +5 -5
- package/dist/krill/modules/fstab.js +10 -10
- package/dist/krill/modules/grubcfg.js +3 -3
- package/dist/krill/modules/initramfs-cfg.js +3 -3
- package/dist/krill/modules/initramfs.js +9 -9
- package/dist/krill/modules/locale.js +4 -4
- package/dist/krill/modules/m-keyboard.js +9 -9
- package/dist/krill/modules/m-timezone.js +3 -3
- package/dist/krill/modules/machine-id.js +3 -3
- package/dist/krill/modules/mkfs.js +6 -6
- package/dist/krill/modules/mount-fs.js +13 -13
- package/dist/krill/modules/mount-vfs.js +12 -12
- package/dist/krill/modules/network-cfg.js +5 -5
- package/dist/krill/modules/packages.js +10 -10
- package/dist/krill/modules/partition.js +69 -69
- package/dist/krill/modules/umount.js +6 -6
- package/dist/krill/modules/unpackfs.js +4 -4
- package/dist/lib/cli-autologin.js +12 -12
- package/dist/lib/select_keyboard_layout.js +2 -2
- package/dist/lib/select_keyboard_model.js +2 -2
- package/dist/lib/select_keyboard_option.js +2 -2
- package/dist/lib/select_keyboard_variant.js +2 -2
- package/dist/lib/select_languages.js +2 -2
- package/package.json +1 -1
package/dist/classes/pxe.js
CHANGED
|
@@ -8,14 +8,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
* author: Piero Proietti
|
|
9
9
|
* mail: piero.proietti@gmail.com
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const utils_1 = require("../lib/utils");
|
|
12
|
+
const distro_1 = __importDefault(require("./distro"));
|
|
13
13
|
const fs_1 = __importDefault(require("fs"));
|
|
14
14
|
const http_1 = __importDefault(require("http"));
|
|
15
15
|
const node_static_1 = __importDefault(require("node-static"));
|
|
16
16
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const settings_1 = __importDefault(require("./settings"));
|
|
18
|
+
const utils_2 = __importDefault(require("./utils"));
|
|
19
19
|
const tftp_1 = __importDefault(require("tftp"));
|
|
20
20
|
// @ts-ignore
|
|
21
21
|
const etrick_1 = __importDefault(require("etrick"));
|
|
@@ -41,20 +41,20 @@ class Pxe {
|
|
|
41
41
|
* cuckoo's nest
|
|
42
42
|
*/
|
|
43
43
|
async fertilization() {
|
|
44
|
-
this.settings = new
|
|
44
|
+
this.settings = new settings_1.default();
|
|
45
45
|
await this.settings.load();
|
|
46
|
-
if (
|
|
46
|
+
if (utils_2.default.isLive()) {
|
|
47
47
|
this.eggRoot = this.settings.distro.liveMediumPath;
|
|
48
48
|
if (this.settings.distro.distroId === 'Arch' || this.settings.distro.distroId === 'RebornOS') {
|
|
49
49
|
this.eggRoot = '/run/archiso/bootmnt/';
|
|
50
|
-
await (0,
|
|
51
|
-
await (0,
|
|
50
|
+
await (0, utils_1.exec)(`mkdir ${this.eggRoot} -p`);
|
|
51
|
+
await (0, utils_1.exec)(`mount /dev/sr0 ${this.eggRoot}`);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
this.eggRoot = node_path_1.default.dirname(this.settings.work_dir.path) + '/ovarium/iso/';
|
|
56
56
|
}
|
|
57
|
-
if (!
|
|
57
|
+
if (!utils_2.default.isLive() && !fs_1.default.existsSync(this.settings.work_dir.path)) {
|
|
58
58
|
console.log('no image available, build an image with: sudo eggs produce');
|
|
59
59
|
process.exit();
|
|
60
60
|
}
|
|
@@ -64,13 +64,13 @@ class Pxe {
|
|
|
64
64
|
* se pxeRoot non esiste viene creato
|
|
65
65
|
*/
|
|
66
66
|
if (!fs_1.default.existsSync(this.pxeRoot)) {
|
|
67
|
-
await (0,
|
|
67
|
+
await (0, utils_1.exec)(`mkdir ${this.pxeRoot} -p`);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Ricerca delle uova
|
|
71
71
|
*/
|
|
72
72
|
const isos = [];
|
|
73
|
-
if (!
|
|
73
|
+
if (!utils_2.default.isLive()) {
|
|
74
74
|
const isos = fs_1.default.readdirSync(this.nest);
|
|
75
75
|
for (const iso of isos) {
|
|
76
76
|
if (node_path_1.default.extname(iso) === '.iso') {
|
|
@@ -160,7 +160,7 @@ class Pxe {
|
|
|
160
160
|
*/
|
|
161
161
|
await this.tryCatch(`ln -s ${__dirname}/../../ipxe/ipxe.efi ${this.pxeRoot}/ipxe.efi`);
|
|
162
162
|
// pxe
|
|
163
|
-
const distro = new
|
|
163
|
+
const distro = new distro_1.default();
|
|
164
164
|
await this.tryCatch(`ln -s ${distro.pxelinuxPath}pxelinux.0 ${this.pxeRoot}/pxelinux.0`);
|
|
165
165
|
await this.tryCatch(`ln -s ${distro.pxelinuxPath}lpxelinux.0 ${this.pxeRoot}/lpxelinux.0`);
|
|
166
166
|
// syslinux
|
|
@@ -177,7 +177,7 @@ class Pxe {
|
|
|
177
177
|
content += 'include isolinux.theme.cfg\n';
|
|
178
178
|
content += 'UI vesamenu.c32\n';
|
|
179
179
|
content += '\n';
|
|
180
|
-
content += `menu title cuckoo: when you need a flying PXE server! ${
|
|
180
|
+
content += `menu title cuckoo: when you need a flying PXE server! ${utils_2.default.address()}\n`;
|
|
181
181
|
content += 'PROMPT 0\n';
|
|
182
182
|
content += 'TIMEOUT 200\n';
|
|
183
183
|
content += '\n';
|
|
@@ -190,11 +190,11 @@ class Pxe {
|
|
|
190
190
|
const clid = this.settings.distro.codenameLikeId;
|
|
191
191
|
if (clid === 'bionic' || clid === 'stretch' || clid === 'jessie') {
|
|
192
192
|
content += 'kernel vmlinuz\n';
|
|
193
|
-
content += `append initrd=initrd boot=live config noswap noprompt fetch=http://${
|
|
193
|
+
content += `append initrd=initrd boot=live config noswap noprompt fetch=http://${utils_2.default.address()}/live/filesystem.squashfs\n`;
|
|
194
194
|
}
|
|
195
195
|
else {
|
|
196
|
-
content += `kernel http://${
|
|
197
|
-
content += `append initrd=http://${
|
|
196
|
+
content += `kernel http://${utils_2.default.address()}/vmlinuz\n`;
|
|
197
|
+
content += `append initrd=http://${utils_2.default.address()}/initrd boot=live config noswap noprompt fetch=http://${utils_2.default.address()}/live/filesystem.squashfs\n`;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
else if (distro.familyId === 'archlinux') {
|
|
@@ -205,8 +205,8 @@ class Pxe {
|
|
|
205
205
|
if (distro.codenameId === 'Qonos' || distro.codenameId === 'Ruah' || distro.codenameId === 'Sikaris') {
|
|
206
206
|
tool = 'miso';
|
|
207
207
|
}
|
|
208
|
-
content += `kernel http://${
|
|
209
|
-
content += `append initrd=http://${
|
|
208
|
+
content += `kernel http://${utils_2.default.address()}/vmlinuz\n`;
|
|
209
|
+
content += `append initrd=http://${utils_2.default.address()}/initrd boot=live config noswap noprompt ${tool}_http_srv=http://${utils_2.default.address()}/\n`;
|
|
210
210
|
content += 'sysappend 3\n';
|
|
211
211
|
content += '\n';
|
|
212
212
|
}
|
|
@@ -216,8 +216,8 @@ class Pxe {
|
|
|
216
216
|
content += '\n';
|
|
217
217
|
content += `label ${iso}\n`;
|
|
218
218
|
content += `menu label ${iso}\n`;
|
|
219
|
-
content += `kernel http://${
|
|
220
|
-
content += `initrd http://${
|
|
219
|
+
content += `kernel http://${utils_2.default.address()}/memdisk\n`;
|
|
220
|
+
content += `initrd http://${utils_2.default.address()}/${iso}\n`;
|
|
221
221
|
content += 'append iso raw sysappend 3\n';
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -232,13 +232,13 @@ class Pxe {
|
|
|
232
232
|
let content = '#!ipxe\n';
|
|
233
233
|
content += 'dhcp\n';
|
|
234
234
|
content += 'set net0/ip=dhcp\n';
|
|
235
|
-
content += `console --picture http://${
|
|
235
|
+
content += `console --picture http://${utils_2.default.address()}/splash.png -x 1024 -y 768\n`;
|
|
236
236
|
content += 'goto start ||\n';
|
|
237
237
|
content += '\n';
|
|
238
238
|
content += ':start\n';
|
|
239
|
-
content += `set server_root http://${
|
|
239
|
+
content += `set server_root http://${utils_2.default.address()}:80/\n`;
|
|
240
240
|
const serverRootVars = '${server_root}';
|
|
241
|
-
content += `menu cuckoo: when you need a flying PXE server! ${
|
|
241
|
+
content += `menu cuckoo: when you need a flying PXE server! ${utils_2.default.address()}\n`;
|
|
242
242
|
content += 'item --gap boot from ovarium\n';
|
|
243
243
|
content += `item egg-menu \${space} ${this.bootLabel.replaceAll('.iso', '')}\n\n`;
|
|
244
244
|
if (this.isos.length > 0) {
|
|
@@ -255,8 +255,8 @@ class Pxe {
|
|
|
255
255
|
content += 'goto ${target}\n';
|
|
256
256
|
content += '\n';
|
|
257
257
|
content += ':egg-menu\n';
|
|
258
|
-
content += `kernel http://${
|
|
259
|
-
content += `initrd http://${
|
|
258
|
+
content += `kernel http://${utils_2.default.address()}/vmlinuz\n`;
|
|
259
|
+
content += `initrd http://${utils_2.default.address()}/initrd\n`;
|
|
260
260
|
/**
|
|
261
261
|
* CORRECT:
|
|
262
262
|
* content += `imgargs vmlinuz fetch=http://${Utils.address()}/live/filesystem.squashfs boot=live dhcp initrd=initrd ro\n`
|
|
@@ -265,7 +265,7 @@ class Pxe {
|
|
|
265
265
|
/**
|
|
266
266
|
* DEBIAN
|
|
267
267
|
*/
|
|
268
|
-
content += `imgargs vmlinuz fetch=http://${
|
|
268
|
+
content += `imgargs vmlinuz fetch=http://${utils_2.default.address()}/live/filesystem.squashfs boot=live dhcp initrd=initrd ro\n`;
|
|
269
269
|
}
|
|
270
270
|
else if (this.settings.distro.familyId === 'archlinux') {
|
|
271
271
|
/**
|
|
@@ -275,7 +275,7 @@ class Pxe {
|
|
|
275
275
|
if (this.settings.distro.codenameId === 'Qonos' || this.settings.distro.codenameId === 'Ruah' || this.settings.distro.codenameId === 'Sikaris') {
|
|
276
276
|
tool = 'miso';
|
|
277
277
|
}
|
|
278
|
-
content += `imgargs vmlinuz ${tool}_http_srv=http://${
|
|
278
|
+
content += `imgargs vmlinuz ${tool}_http_srv=http://${utils_2.default.address()}/ boot=live dhcp initrd=initrd ro\n`;
|
|
279
279
|
// content += 'ipappend 3\n'
|
|
280
280
|
}
|
|
281
281
|
content += 'sleep 5\n';
|
|
@@ -311,11 +311,11 @@ class Pxe {
|
|
|
311
311
|
content += '<html><title>Penguin\'s eggs PXE server</title>';
|
|
312
312
|
content += '<div style="background-image:url(\'/splash.png\');background-repeat:no-repeat;width: 640;height:480;padding:5px;border:1px solid black;">';
|
|
313
313
|
content += '<h1>Cucko PXE server</h1>';
|
|
314
|
-
content += `<body>address: <a href=http://${
|
|
315
|
-
if (!
|
|
314
|
+
content += `<body>address: <a href=http://${utils_2.default.address()}>${utils_2.default.address()}</a><br/>`;
|
|
315
|
+
if (!utils_2.default.isLive()) {
|
|
316
316
|
content += 'Serving:<li>';
|
|
317
317
|
for (const iso of this.isos) {
|
|
318
|
-
content += `<ul><a href='http://${
|
|
318
|
+
content += `<ul><a href='http://${utils_2.default.address()}/${iso}'>${iso}</a></ul>`;
|
|
319
319
|
}
|
|
320
320
|
content += '</li>';
|
|
321
321
|
}
|
|
@@ -375,11 +375,11 @@ class Pxe {
|
|
|
375
375
|
if (echo) {
|
|
376
376
|
console.log(cmd);
|
|
377
377
|
}
|
|
378
|
-
await (0,
|
|
378
|
+
await (0, utils_1.exec)(cmd, this.echo);
|
|
379
379
|
}
|
|
380
380
|
catch (error) {
|
|
381
381
|
console.log(`Error: ${error}`);
|
|
382
|
-
await
|
|
382
|
+
await utils_2.default.pressKeyToExit(cmd);
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
package/dist/classes/settings.js
CHANGED
|
@@ -17,9 +17,9 @@ const shelljs_1 = __importDefault(require("shelljs"));
|
|
|
17
17
|
const chalk_1 = __importDefault(require("chalk"));
|
|
18
18
|
const pjson = require('../../package.json');
|
|
19
19
|
// classes
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
20
|
+
const utils_1 = __importDefault(require("./utils"));
|
|
21
|
+
const distro_1 = __importDefault(require("./distro"));
|
|
22
|
+
const pacman_1 = __importDefault(require("./pacman"));
|
|
23
23
|
const config_file = '/etc/penguins-eggs.d/eggs.yaml';
|
|
24
24
|
/**
|
|
25
25
|
* Setting
|
|
@@ -47,9 +47,9 @@ class Settings {
|
|
|
47
47
|
this.app.mail = 'piero.proietti@gmail.com';
|
|
48
48
|
this.app.name = pjson.name;
|
|
49
49
|
this.app.version = pjson.version;
|
|
50
|
-
this.isLive =
|
|
51
|
-
this.i686 =
|
|
52
|
-
this.distro = new
|
|
50
|
+
this.isLive = utils_1.default.isLive();
|
|
51
|
+
this.i686 = utils_1.default.isi686();
|
|
52
|
+
this.distro = new distro_1.default(this.remix);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
*
|
|
@@ -85,11 +85,11 @@ class Settings {
|
|
|
85
85
|
if (this.config.snapshot_basename === '') {
|
|
86
86
|
this.config.snapshot_basename = node_os_1.default.hostname();
|
|
87
87
|
}
|
|
88
|
-
if (this.config.make_efi && !
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
if (this.config.make_efi && !pacman_1.default.isUefi()) {
|
|
89
|
+
utils_1.default.error('You choose to create an UEFI image, but miss to install grub-efi-amd64-bin package.');
|
|
90
|
+
utils_1.default.error('Please install it before to create an UEFI image:');
|
|
91
|
+
utils_1.default.warning('sudo apt install grub-efi-amd64-bin');
|
|
92
|
+
utils_1.default.error('or edit /etc/penguins-eggs.d/eggs.yaml and set the valuer of make_efi = false');
|
|
93
93
|
this.config.make_efi = false;
|
|
94
94
|
}
|
|
95
95
|
this.kernel_image = this.config.vmlinuz;
|
|
@@ -155,16 +155,16 @@ class Settings {
|
|
|
155
155
|
console.log(`locale default: ${this.config.locales_default}`);
|
|
156
156
|
// console.log(`ssh_pass: ${this.config.ssh_pass}`)
|
|
157
157
|
if (this.config.make_efi) {
|
|
158
|
-
if (!
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
if (!pacman_1.default.isUefi()) {
|
|
159
|
+
utils_1.default.error('You choose to create an UEFI image, but miss to install grub-efi-amd64-bin package.');
|
|
160
|
+
utils_1.default.error('Please install it before to create an UEFI image:');
|
|
161
|
+
utils_1.default.warning('sudo apt install grub-efi-amd64-bin');
|
|
162
162
|
this.config.make_efi = false;
|
|
163
163
|
}
|
|
164
|
-
else if (!
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
else if (!pacman_1.default.packageIsInstalled('dosfstools')) {
|
|
165
|
+
utils_1.default.error('You choose to create an UEFI image, but miss to install dosfstools package.');
|
|
166
|
+
utils_1.default.error('Please install it before to create an UEFI image:');
|
|
167
|
+
utils_1.default.warning('sudo apt install dosfstools');
|
|
168
168
|
this.config.make_efi = false;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
@@ -183,8 +183,8 @@ class Settings {
|
|
|
183
183
|
*/
|
|
184
184
|
const gb = 1048576;
|
|
185
185
|
let spaceAvailable = 0;
|
|
186
|
-
if (!
|
|
187
|
-
console.log(`Disk space used: ${Math.round((
|
|
186
|
+
if (!utils_1.default.isLive()) {
|
|
187
|
+
console.log(`Disk space used: ${Math.round((utils_1.default.getUsedSpace() / gb) * 10) / 10} GB`);
|
|
188
188
|
}
|
|
189
189
|
spaceAvailable = Number(shelljs_1.default
|
|
190
190
|
.exec(`df "${path}" | /usr/bin/awk 'NR==2 {print $4}'`, {
|
|
@@ -192,7 +192,7 @@ class Settings {
|
|
|
192
192
|
})
|
|
193
193
|
.stdout.trim());
|
|
194
194
|
console.log(`Space available: ${Math.round((spaceAvailable / gb) * 10) / 10} GB`);
|
|
195
|
-
console.log(`There are ${
|
|
195
|
+
console.log(`There are ${utils_1.default.getSnapshotCount(this.config.snapshot_dir)} snapshots taking ${Math.round((utils_1.default.getSnapshotSize() / gb) * 10) / 10} GB of disk space.`);
|
|
196
196
|
console.log();
|
|
197
197
|
if (spaceAvailable > gb * 3) {
|
|
198
198
|
console.log(chalk_1.default.cyanBright('The free space should be sufficient to hold the'));
|
|
@@ -211,8 +211,8 @@ class Settings {
|
|
|
211
211
|
* @param theme
|
|
212
212
|
*/
|
|
213
213
|
async loadRemix(basename = '', theme = '') {
|
|
214
|
-
this.remix.versionNumber =
|
|
215
|
-
this.remix.kernel =
|
|
214
|
+
this.remix.versionNumber = utils_1.default.getPackageVersion();
|
|
215
|
+
this.remix.kernel = utils_1.default.kernelVersion();
|
|
216
216
|
this.remix.branding = theme === '' ? 'eggs' : this.remix.branding = theme.slice(Math.max(0, theme.lastIndexOf('/') + 1));
|
|
217
217
|
this.remix.name = this.config.snapshot_basename;
|
|
218
218
|
let name = this.config.snapshot_prefix + this.config.snapshot_basename;
|
|
@@ -10,9 +10,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
13
|
+
const utils_1 = __importDefault(require("./utils"));
|
|
14
|
+
const utils_2 = require("../lib/utils");
|
|
15
|
+
const distro_1 = __importDefault(require("./distro"));
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
@@ -28,7 +28,7 @@ class SourcesList {
|
|
|
28
28
|
*/
|
|
29
29
|
let checked = true;
|
|
30
30
|
checked = false;
|
|
31
|
-
const distro = new
|
|
31
|
+
const distro = new distro_1.default();
|
|
32
32
|
for (const distribution of distributions) {
|
|
33
33
|
if (distribution.includes(distro.codenameLikeId)) {
|
|
34
34
|
checked = true;
|
|
@@ -58,10 +58,10 @@ class SourcesList {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
if (checked) {
|
|
61
|
-
|
|
61
|
+
utils_1.default.warning('repositories checked');
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
|
|
64
|
+
utils_1.default.pressKeyToExit('component warning, check your /etc/apt/sources.list', true);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
return checked;
|
|
@@ -71,12 +71,12 @@ class SourcesList {
|
|
|
71
71
|
*/
|
|
72
72
|
async get() {
|
|
73
73
|
let universalSourcesList = '/etc/apt/sources.list';
|
|
74
|
-
const distro = new
|
|
74
|
+
const distro = new distro_1.default();
|
|
75
75
|
if (distro.distroId === 'Linuxmint') {
|
|
76
76
|
universalSourcesList = '/etc/apt/sources.list.d/official-package-repositories.list';
|
|
77
77
|
}
|
|
78
78
|
// deb uri distribution [component1] [component2] [...]
|
|
79
|
-
const checkRepos = await (0,
|
|
79
|
+
const checkRepos = await (0, utils_2.exec)(`grep "deb http"<${universalSourcesList}`, { echo: false, capture: true });
|
|
80
80
|
let tmp = [];
|
|
81
81
|
if (checkRepos.code === 0) {
|
|
82
82
|
tmp = checkRepos.data.split('\n');
|
|
@@ -11,24 +11,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const utils_1 = require("../lib/utils");
|
|
15
|
+
const utils_2 = __importDefault(require("./utils"));
|
|
16
16
|
class SistemdCtl {
|
|
17
17
|
constructor(verbose = false) {
|
|
18
18
|
this.echo = {};
|
|
19
|
-
this.echo =
|
|
19
|
+
this.echo = utils_2.default.setEcho(verbose);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
24
|
async reload(service) {
|
|
25
|
-
await (0,
|
|
25
|
+
await (0, utils_1.exec)(`systemctl reload ${service}`, this.echo);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
30
|
async disable(service, chroot = '/', report = false) {
|
|
31
|
-
await (0,
|
|
31
|
+
await (0, utils_1.exec)(`chroot ${chroot}} systemctl disable ${service}`, this.echo);
|
|
32
32
|
if (report) {
|
|
33
33
|
console.log(`systemctl: disabled ${service} on ${chroot}`);
|
|
34
34
|
}
|
|
@@ -37,25 +37,25 @@ class SistemdCtl {
|
|
|
37
37
|
*
|
|
38
38
|
*/
|
|
39
39
|
async enable(service) {
|
|
40
|
-
await (0,
|
|
40
|
+
await (0, utils_1.exec)(`systemctl enable ${service}`, this.echo);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
*
|
|
44
44
|
*/
|
|
45
45
|
async restart(service) {
|
|
46
|
-
await (0,
|
|
46
|
+
await (0, utils_1.exec)(`systemctl restart ${service}`, this.echo);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
*
|
|
50
50
|
*/
|
|
51
51
|
async start(service) {
|
|
52
|
-
await (0,
|
|
52
|
+
await (0, utils_1.exec)(`systemctl start ${service}`, this.echo);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
*
|
|
56
56
|
*/
|
|
57
57
|
async stop(service) {
|
|
58
|
-
await (0,
|
|
58
|
+
await (0, utils_1.exec)(`systemctl stop ${service}`, this.echo);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
*
|
|
@@ -64,7 +64,7 @@ class SistemdCtl {
|
|
|
64
64
|
*/
|
|
65
65
|
async isActive(service) {
|
|
66
66
|
return new Promise((resolve, reject) => {
|
|
67
|
-
(0,
|
|
67
|
+
(0, utils_1.exec)(`systemctl is-active ${service}`, this.echo)
|
|
68
68
|
.then(result => {
|
|
69
69
|
resolve(!result.data.includes('inactive'));
|
|
70
70
|
})
|
|
@@ -78,7 +78,7 @@ class SistemdCtl {
|
|
|
78
78
|
*/
|
|
79
79
|
async isEnabled(service) {
|
|
80
80
|
return new Promise((resolve, reject) => {
|
|
81
|
-
(0,
|
|
81
|
+
(0, utils_1.exec)(`systemctl is-enabled ${service}`, this.echo)
|
|
82
82
|
.then(result => {
|
|
83
83
|
resolve(result.data.includes('enabled'));
|
|
84
84
|
})
|