penguins-eggs 9.2.6 → 9.2.9
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 -0
- package/README.md +34 -31
- package/conf/distros/kinetic/README.md +41 -0
- package/conf/tools.yaml +1 -1
- package/{lib → dist}/classes/bleach.js +0 -0
- package/{lib → dist}/classes/compressors.js +0 -0
- package/{lib → dist}/classes/daddy.js +0 -0
- package/{lib → dist}/classes/distro.js +14 -30
- package/{lib → dist}/classes/family/archlinux.js +0 -0
- package/{lib → dist}/classes/family/debian.js +0 -0
- package/{lib → dist}/classes/family/fedora.js +0 -0
- package/{lib → dist}/classes/family/suse.js +0 -0
- package/{lib → dist}/classes/incubation/branding.js +0 -0
- package/{lib → dist}/classes/incubation/distros/bionic.js +0 -0
- package/{lib → dist}/classes/incubation/distros/buster.js +0 -0
- package/{lib → dist}/classes/incubation/distros/focal.js +0 -0
- package/{lib → dist}/classes/incubation/distros/jessie.js +0 -0
- package/{lib → dist}/classes/incubation/distros/rolling.js +0 -0
- package/{lib → dist}/classes/incubation/fisherman-helper/displaymanager.js +0 -0
- package/{lib → dist}/classes/incubation/fisherman-helper/packages.js +0 -0
- package/{lib → dist}/classes/incubation/fisherman.js +0 -0
- package/{lib → dist}/classes/incubation/incubator.js +9 -19
- package/{lib → dist}/classes/incubation/installer.js +0 -0
- package/{lib → dist}/classes/initrd.js +0 -0
- package/{lib → dist}/classes/keyboards.js +0 -0
- package/{lib → dist}/classes/locales.js +0 -0
- package/{lib → dist}/classes/n8.js +0 -0
- package/dist/classes/network.js +99 -0
- package/{lib → dist}/classes/ovary.js +0 -0
- package/{lib → dist}/classes/pacman.js +16 -1
- package/{lib → dist}/classes/pve-live.js +0 -0
- package/dist/classes/pxe.js +337 -0
- package/{lib → dist}/classes/settings.js +0 -0
- package/{lib → dist}/classes/sources_list.js +0 -0
- package/{lib → dist}/classes/systemctl.js +0 -0
- package/{lib → dist}/classes/tailor.js +0 -0
- package/{lib → dist}/classes/tools.js +0 -0
- package/{lib → dist}/classes/users.js +0 -0
- package/{lib → dist}/classes/utils.js +82 -17
- package/{lib → dist}/classes/xdg.js +24 -26
- package/{lib → dist}/classes/yolk.js +0 -0
- package/{lib → dist}/commands/adapt.js +0 -0
- package/{lib → dist}/commands/analyze.js +0 -0
- package/{lib → dist}/commands/calamares.js +0 -0
- package/{lib → dist}/commands/config.js +0 -0
- package/dist/commands/cuckoo.js +63 -0
- package/{lib → dist}/commands/dad.js +0 -0
- package/{lib → dist}/commands/export/deb.js +0 -0
- package/{lib → dist}/commands/export/docs.js +0 -0
- package/{lib → dist}/commands/export/iso.js +0 -0
- package/{lib → dist}/commands/install.js +26 -5
- package/{lib → dist}/commands/kill.js +0 -0
- package/{lib → dist}/commands/mom.js +0 -0
- package/{lib → dist}/commands/produce.js +0 -0
- package/{lib → dist}/commands/status.js +0 -0
- package/{lib → dist}/commands/syncfrom.js +0 -0
- package/{lib → dist}/commands/syncto.js +0 -0
- package/{lib → dist}/commands/tools/clean.js +0 -0
- package/{lib → dist}/commands/tools/skel.js +0 -0
- package/{lib → dist}/commands/tools/stat.js +0 -0
- package/{lib → dist}/commands/tools/yolk.js +0 -0
- package/{lib → dist}/commands/update.js +0 -0
- package/{lib → dist}/commands/wardrobe/get.js +0 -0
- package/{lib → dist}/commands/wardrobe/ironing.js +0 -0
- package/{lib → dist}/commands/wardrobe/list.js +0 -0
- package/{lib → dist}/commands/wardrobe/show.js +0 -0
- package/{lib → dist}/commands/wardrobe/wear.js +0 -0
- package/{lib → dist}/components/elements/information.js +0 -0
- package/{lib → dist}/components/elements/steps.js +0 -0
- package/{lib → dist}/components/elements/title.js +0 -0
- package/{lib → dist}/components/finished.js +0 -0
- package/{lib → dist}/components/install.js +0 -0
- package/{lib → dist}/components/keyboard.js +0 -0
- package/{lib → dist}/components/location.js +0 -0
- package/{lib → dist}/components/network.js +0 -0
- package/{lib → dist}/components/partitions.js +0 -0
- package/{lib → dist}/components/summary.js +2 -2
- package/{lib → dist}/components/users.js +0 -0
- package/{lib → dist}/components/welcome.js +0 -0
- package/dist/dhcpd/dhcpd.js +222 -0
- package/dist/dhcpd/index.js +7 -0
- package/dist/dhcpd/packet/converters.js +377 -0
- package/dist/dhcpd/packet/options.js +2 -0
- package/dist/dhcpd/packet/types.js +2 -0
- package/dist/dhcpd/packet.js +251 -0
- package/dist/dhcpd/proxy.js +152 -0
- package/dist/dhcpd/server.js +152 -0
- package/dist/dhcpd/sprintf.js +170 -0
- package/dist/dhcpd/utils.js +190 -0
- package/{lib → dist}/index.js +0 -0
- package/{lib → dist}/interfaces/i-addons.js +0 -0
- package/{lib → dist}/interfaces/i-analyze.js +0 -0
- package/{lib → dist}/interfaces/i-app.js +0 -0
- package/{lib → dist}/interfaces/i-branding.js +0 -0
- package/{lib → dist}/interfaces/i-config-tools.js +0 -0
- package/{lib → dist}/interfaces/i-devices.js +0 -0
- package/{lib → dist}/interfaces/i-distro.js +0 -0
- package/{lib → dist}/interfaces/i-drive-list.js +0 -0
- package/{lib → dist}/interfaces/i-eggs-config.js +0 -0
- package/{lib → dist}/interfaces/i-exec.js +0 -0
- package/{lib → dist}/interfaces/i-initrd.js +0 -0
- package/{lib → dist}/interfaces/i-install.js +0 -0
- package/{lib → dist}/interfaces/i-installer.js +0 -0
- package/{lib → dist}/interfaces/i-krill-config.js +0 -0
- package/{lib → dist}/interfaces/i-krill.js +0 -0
- package/{lib → dist}/interfaces/i-materia.js +0 -0
- package/{lib → dist}/interfaces/i-net.js +0 -0
- package/{lib → dist}/interfaces/i-packages.js +0 -0
- package/{lib → dist}/interfaces/i-partitions.js +0 -0
- package/{lib/interfaces/i-remix.js → dist/interfaces/i-pxe-options.js} +0 -0
- package/{lib/interfaces/i-settings.js → dist/interfaces/i-remix.js} +0 -0
- package/{lib/interfaces/i-user.js → dist/interfaces/i-settings.js} +0 -0
- package/{lib/interfaces/i-workdir.js → dist/interfaces/i-user.js} +0 -0
- package/{lib/interfaces/i-xkb-model.js → dist/interfaces/i-workdir.js} +0 -0
- package/{lib/interfaces/index.js → dist/interfaces/i-xkb-model.js} +0 -0
- package/dist/interfaces/index.js +2 -0
- package/{lib → dist}/krill/krill-prepare.js +20 -4
- package/{lib → dist}/krill/krill-sequence.js +64 -62
- package/{lib → dist}/krill/modules/add-user.js +0 -0
- package/{lib → dist}/krill/modules/bootloader-config-ubuntu.js +0 -0
- package/{lib → dist}/krill/modules/bootloader-config.js +1 -1
- package/{lib → dist}/krill/modules/bootloader.js +0 -5
- package/{lib → dist}/krill/modules/change-password.js +0 -0
- package/{lib → dist}/krill/modules/del-live-user.js +0 -0
- package/{lib → dist}/krill/modules/fstab.js +0 -0
- package/{lib → dist}/krill/modules/grubcfg.js +0 -0
- package/{lib → dist}/krill/modules/hostname.js +2 -2
- package/{lib → dist}/krill/modules/initramfs-cfg.js +0 -0
- package/{lib → dist}/krill/modules/initramfs.js +0 -0
- package/{lib → dist}/krill/modules/locale-cfg.js +0 -0
- package/{lib → dist}/krill/modules/locale.js +1 -1
- package/{lib/krill/modules/set-keyboard.js → dist/krill/modules/m-keyboard.js} +7 -3
- package/{lib/krill/modules/set-timezone.js → dist/krill/modules/m-timezone.js} +2 -2
- package/{lib → dist}/krill/modules/machine-id.js +0 -0
- package/{lib → dist}/krill/modules/mkfs.js +0 -0
- package/{lib → dist}/krill/modules/mount-fs.js +0 -0
- package/{lib → dist}/krill/modules/mount-vfs.js +0 -0
- package/{lib → dist}/krill/modules/network-cfg.js +0 -0
- package/{lib → dist}/krill/modules/packages.js +0 -0
- package/{lib → dist}/krill/modules/partition.js +1 -1
- package/{lib → dist}/krill/modules/remove-installer-link.js +0 -0
- package/{lib → dist}/krill/modules/umount.js +0 -0
- package/{lib → dist}/krill/modules/unpackfs.js +0 -0
- package/{lib → dist}/lib/cli-autologin.js +0 -0
- package/{lib → dist}/lib/dependencies.js +0 -0
- package/{lib → dist}/lib/get_address.js +0 -0
- package/{lib → dist}/lib/get_dns.js +0 -0
- package/{lib → dist}/lib/get_domain.js +0 -0
- package/{lib → dist}/lib/get_gateway.js +0 -0
- package/{lib → dist}/lib/get_hostname.js +0 -0
- package/{lib → dist}/lib/get_netmask.js +0 -0
- package/{lib → dist}/lib/get_password.js +0 -0
- package/{lib → dist}/lib/get_root_password.js +0 -0
- package/{lib → dist}/lib/get_userfullname.js +0 -0
- package/{lib → dist}/lib/get_username.js +0 -0
- package/{lib → dist}/lib/select_address_type.js +0 -0
- package/{lib → dist}/lib/select_filesystem_type.js +0 -0
- package/{lib → dist}/lib/select_installation_device.js +0 -0
- package/{lib → dist}/lib/select_installation_mode.js +0 -0
- package/{lib → dist}/lib/select_interface.js +0 -0
- package/{lib → dist}/lib/select_keyboard_layout.js +0 -0
- package/{lib → dist}/lib/select_keyboard_model.js +0 -0
- package/{lib → dist}/lib/select_keyboard_option.js +0 -0
- package/{lib → dist}/lib/select_keyboard_variant.js +0 -0
- package/{lib → dist}/lib/select_languages.js +0 -0
- package/{lib → dist}/lib/select_regions.js +0 -0
- package/{lib → dist}/lib/select_user_swap_choice.js +0 -0
- package/{lib → dist}/lib/select_zones.js +0 -0
- package/{lib → dist}/lib/utils.js +1 -2
- package/ipxe/ipxe.efi +0 -0
- package/package.json +20 -17
- package/scripts/_eggs +11 -7
- package/scripts/eggs.bash +2 -2
- package/lib/classes/bleach.d.ts +0 -40
- package/lib/classes/compressors.d.ts +0 -24
- package/lib/classes/daddy.d.ts +0 -11
- package/lib/classes/distro.d.ts +0 -31
- package/lib/classes/family/archlinux.d.ts +0 -69
- package/lib/classes/family/debian.d.ts +0 -68
- package/lib/classes/family/fedora.d.ts +0 -63
- package/lib/classes/family/suse.d.ts +0 -63
- package/lib/classes/incubation/branding.d.ts +0 -8
- package/lib/classes/incubation/distros/bionic.d.ts +0 -29
- package/lib/classes/incubation/distros/buster.d.ts +0 -31
- package/lib/classes/incubation/distros/focal.d.ts +0 -29
- package/lib/classes/incubation/distros/jessie.d.ts +0 -32
- package/lib/classes/incubation/distros/rolling.d.ts +0 -31
- package/lib/classes/incubation/fisherman-helper/displaymanager.d.ts +0 -7
- package/lib/classes/incubation/fisherman-helper/packages.d.ts +0 -19
- package/lib/classes/incubation/fisherman.d.ts +0 -77
- package/lib/classes/incubation/incubator.d.ts +0 -35
- package/lib/classes/incubation/installer.d.ts +0 -15
- package/lib/classes/initrd.d.ts +0 -42
- package/lib/classes/keyboards.d.ts +0 -43
- package/lib/classes/locales.d.ts +0 -14
- package/lib/classes/n8.d.ts +0 -16
- package/lib/classes/ovary.d.ts +0 -179
- package/lib/classes/pacman.d.ts +0 -164
- package/lib/classes/pve-live.d.ts +0 -42
- package/lib/classes/pxe.d.ts +0 -64
- package/lib/classes/pxe.js +0 -376
- package/lib/classes/settings.d.ts +0 -55
- package/lib/classes/sources_list.d.ts +0 -27
- package/lib/classes/systemctl.d.ts +0 -46
- package/lib/classes/tailor.d.ts +0 -43
- package/lib/classes/tools.d.ts +0 -29
- package/lib/classes/users.d.ts +0 -21
- package/lib/classes/utils.d.ts +0 -299
- package/lib/classes/xdg.d.ts +0 -44
- package/lib/classes/yolk.d.ts +0 -26
- package/lib/commands/adapt.d.ts +0 -9
- package/lib/commands/analyze.d.ts +0 -25
- package/lib/commands/calamares.d.ts +0 -26
- package/lib/commands/config.d.ts +0 -34
- package/lib/commands/cuckoo.d.ts +0 -24
- package/lib/commands/cuckoo.js +0 -70
- package/lib/commands/dad.d.ts +0 -17
- package/lib/commands/export/deb.d.ts +0 -14
- package/lib/commands/export/docs.d.ts +0 -8
- package/lib/commands/export/iso.d.ts +0 -13
- package/lib/commands/install.d.ts +0 -26
- package/lib/commands/kill.d.ts +0 -20
- package/lib/commands/mom.d.ts +0 -14
- package/lib/commands/produce.d.ts +0 -28
- package/lib/commands/status.d.ts +0 -18
- package/lib/commands/syncfrom.d.ts +0 -42
- package/lib/commands/syncto.d.ts +0 -67
- package/lib/commands/tools/clean.d.ts +0 -15
- package/lib/commands/tools/skel.d.ts +0 -17
- package/lib/commands/tools/stat.d.ts +0 -14
- package/lib/commands/tools/yolk.d.ts +0 -23
- package/lib/commands/update.d.ts +0 -46
- package/lib/commands/wardrobe/get.d.ts +0 -17
- package/lib/commands/wardrobe/ironing.d.ts +0 -18
- package/lib/commands/wardrobe/list.d.ts +0 -17
- package/lib/commands/wardrobe/show.d.ts +0 -19
- package/lib/commands/wardrobe/wear.d.ts +0 -21
- package/lib/components/elements/information.d.ts +0 -4
- package/lib/components/elements/steps.d.ts +0 -6
- package/lib/components/elements/title.d.ts +0 -4
- package/lib/components/finished.d.ts +0 -8
- package/lib/components/install.d.ts +0 -8
- package/lib/components/keyboard.d.ts +0 -12
- package/lib/components/location.d.ts +0 -12
- package/lib/components/network.d.ts +0 -12
- package/lib/components/partitions.d.ts +0 -9
- package/lib/components/summary.d.ts +0 -16
- package/lib/components/users.d.ts +0 -20
- package/lib/components/welcome.d.ts +0 -6
- package/lib/index.d.ts +0 -1
- package/lib/interfaces/i-addons.d.ts +0 -8
- package/lib/interfaces/i-analyze.d.ts +0 -13
- package/lib/interfaces/i-app.d.ts +0 -7
- package/lib/interfaces/i-branding.d.ts +0 -29
- package/lib/interfaces/i-config-tools.d.ts +0 -11
- package/lib/interfaces/i-devices.d.ts +0 -13
- package/lib/interfaces/i-distro.d.ts +0 -19
- package/lib/interfaces/i-drive-list.d.ts +0 -29
- package/lib/interfaces/i-eggs-config.d.ts +0 -24
- package/lib/interfaces/i-exec.d.ts +0 -4
- package/lib/interfaces/i-initrd.d.ts +0 -6
- package/lib/interfaces/i-install.d.ts +0 -9
- package/lib/interfaces/i-installer.d.ts +0 -20
- package/lib/interfaces/i-krill-config.d.ts +0 -26
- package/lib/interfaces/i-krill.d.ts +0 -35
- package/lib/interfaces/i-materia.d.ts +0 -36
- package/lib/interfaces/i-net.d.ts +0 -9
- package/lib/interfaces/i-packages.d.ts +0 -10
- package/lib/interfaces/i-partitions.d.ts +0 -9
- package/lib/interfaces/i-remix.d.ts +0 -14
- package/lib/interfaces/i-settings.d.ts +0 -10
- package/lib/interfaces/i-user.d.ts +0 -7
- package/lib/interfaces/i-workdir.d.ts +0 -8
- package/lib/interfaces/i-xkb-model.d.ts +0 -17
- package/lib/interfaces/index.d.ts +0 -17
- package/lib/krill/krill-prepare.d.ts +0 -60
- package/lib/krill/krill-sequence.d.ts +0 -150
- package/lib/krill/modules/add-user.d.ts +0 -15
- package/lib/krill/modules/bootloader-config-arch.d.ts +0 -9
- package/lib/krill/modules/bootloader-config-arch.js +0 -13
- package/lib/krill/modules/bootloader-config-ubuntu.d.ts +0 -9
- package/lib/krill/modules/bootloader-config.d.ts +0 -9
- package/lib/krill/modules/bootloader.d.ts +0 -10
- package/lib/krill/modules/change-password.d.ts +0 -10
- package/lib/krill/modules/del-live-user.d.ts +0 -9
- package/lib/krill/modules/fstab.d.ts +0 -14
- package/lib/krill/modules/grubcfg.d.ts +0 -17
- package/lib/krill/modules/hostname.d.ts +0 -13
- package/lib/krill/modules/initramfs-cfg.d.ts +0 -14
- package/lib/krill/modules/initramfs.d.ts +0 -13
- package/lib/krill/modules/locale-cfg.d.ts +0 -10
- package/lib/krill/modules/locale.d.ts +0 -13
- package/lib/krill/modules/machine-id.d.ts +0 -15
- package/lib/krill/modules/mkfs.d.ts +0 -13
- package/lib/krill/modules/mount-fs.d.ts +0 -17
- package/lib/krill/modules/mount-vfs.d.ts +0 -17
- package/lib/krill/modules/network-cfg.d.ts +0 -19
- package/lib/krill/modules/packages.d.ts +0 -14
- package/lib/krill/modules/partition.d.ts +0 -20
- package/lib/krill/modules/remove-installer-link.d.ts +0 -13
- package/lib/krill/modules/set-keyboard.d.ts +0 -10
- package/lib/krill/modules/set-timezone.d.ts +0 -14
- package/lib/krill/modules/umount.d.ts +0 -14
- package/lib/krill/modules/unpackfs.d.ts +0 -13
- package/lib/lib/cli-autologin.d.ts +0 -27
- package/lib/lib/dependencies.d.ts +0 -49
- package/lib/lib/get_address.d.ts +0 -1
- package/lib/lib/get_dns.d.ts +0 -1
- package/lib/lib/get_domain.d.ts +0 -1
- package/lib/lib/get_gateway.d.ts +0 -1
- package/lib/lib/get_hostname.d.ts +0 -1
- package/lib/lib/get_netmask.d.ts +0 -1
- package/lib/lib/get_password.d.ts +0 -1
- package/lib/lib/get_root_password.d.ts +0 -1
- package/lib/lib/get_userfullname.d.ts +0 -1
- package/lib/lib/get_username.d.ts +0 -1
- package/lib/lib/select_address_type.d.ts +0 -1
- package/lib/lib/select_filesystem_type.d.ts +0 -1
- package/lib/lib/select_installation_device.d.ts +0 -1
- package/lib/lib/select_installation_mode.d.ts +0 -1
- package/lib/lib/select_interface.d.ts +0 -1
- package/lib/lib/select_keyboard_layout.d.ts +0 -4
- package/lib/lib/select_keyboard_model.d.ts +0 -4
- package/lib/lib/select_keyboard_option.d.ts +0 -4
- package/lib/lib/select_keyboard_variant.d.ts +0 -4
- package/lib/lib/select_languages.d.ts +0 -1
- package/lib/lib/select_regions.d.ts +0 -1
- package/lib/lib/select_user_swap_choice.d.ts +0 -1
- package/lib/lib/select_zones.d.ts +0 -1
- package/lib/lib/utils.d.ts +0 -43
|
File without changes
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/**
|
|
5
|
+
* penguins-eggs: pxe.ts
|
|
6
|
+
* author: Piero Proietti
|
|
7
|
+
* mail: piero.proietti@gmail.com
|
|
8
|
+
*/
|
|
9
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
10
|
+
const node_static_1 = tslib_1.__importDefault(require("node-static"));
|
|
11
|
+
const http_1 = tslib_1.__importDefault(require("http"));
|
|
12
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
13
|
+
const utils_1 = tslib_1.__importDefault(require("./utils"));
|
|
14
|
+
const distro_1 = tslib_1.__importDefault(require("./distro"));
|
|
15
|
+
const settings_1 = tslib_1.__importDefault(require("./settings"));
|
|
16
|
+
const utils_2 = require("../lib/utils");
|
|
17
|
+
const tftp = require('tftp');
|
|
18
|
+
const dhcpd = require('../dhcpd/dhcpd');
|
|
19
|
+
/**
|
|
20
|
+
* Pxe:
|
|
21
|
+
*/
|
|
22
|
+
class Pxe {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.verbose = false;
|
|
25
|
+
this.echo = {};
|
|
26
|
+
this.settings = {};
|
|
27
|
+
this.bootLabel = '';
|
|
28
|
+
this.nest = ''; // cuckoo's nest
|
|
29
|
+
this.pxeRoot = '';
|
|
30
|
+
this.eggRoot = '';
|
|
31
|
+
this.vmlinuz = '';
|
|
32
|
+
this.initrd = '';
|
|
33
|
+
this.isos = [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* fertilization()
|
|
37
|
+
*
|
|
38
|
+
* cuckoo's nest
|
|
39
|
+
*/
|
|
40
|
+
async fertilization() {
|
|
41
|
+
this.settings = new settings_1.default();
|
|
42
|
+
await this.settings.load();
|
|
43
|
+
if (utils_1.default.isLive()) {
|
|
44
|
+
this.eggRoot = this.settings.distro.liveMediumPath;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.eggRoot = node_path_1.default.dirname(this.settings.work_dir.path) + '/ovarium/iso/';
|
|
48
|
+
}
|
|
49
|
+
if (!utils_1.default.isLive() && !fs_1.default.existsSync(this.settings.work_dir.path)) {
|
|
50
|
+
console.log('no image available, build an image with: sudo eggs produce');
|
|
51
|
+
process.exit();
|
|
52
|
+
}
|
|
53
|
+
this.nest = '/home/eggs';
|
|
54
|
+
this.pxeRoot = this.nest + '/pxe';
|
|
55
|
+
console.log('nest: ' + this.nest);
|
|
56
|
+
console.log('pxeRoot: ' + this.pxeRoot);
|
|
57
|
+
console.log('eggRoot: ' + this.eggRoot);
|
|
58
|
+
/**
|
|
59
|
+
* se pxeRoot non esiste viene creato
|
|
60
|
+
*/
|
|
61
|
+
if (!fs_1.default.existsSync(this.pxeRoot)) {
|
|
62
|
+
await (0, utils_2.exec)(`mkdir ${this.pxeRoot} -p`);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Ricerca delle uova
|
|
66
|
+
*/
|
|
67
|
+
let isos = [];
|
|
68
|
+
if (!utils_1.default.isLive()) {
|
|
69
|
+
let isos = fs_1.default.readdirSync(this.nest);
|
|
70
|
+
for (const iso of isos) {
|
|
71
|
+
if (node_path_1.default.extname(iso) === ".iso") {
|
|
72
|
+
this.isos.push(iso);
|
|
73
|
+
}
|
|
74
|
+
this.isos = this.isos.sort();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* installed: /home/eggs/ovarium/iso/live
|
|
79
|
+
* live: this.iso/live
|
|
80
|
+
*/
|
|
81
|
+
let pathFiles = this.eggRoot + '/live';
|
|
82
|
+
let files = fs_1.default.readdirSync(pathFiles);
|
|
83
|
+
for (const file of files) {
|
|
84
|
+
if (this.settings.distro.familyId === 'debian') {
|
|
85
|
+
if (node_path_1.default.basename(file).substring(0, 7) === 'vmlinuz') {
|
|
86
|
+
this.vmlinuz = node_path_1.default.basename(file);
|
|
87
|
+
}
|
|
88
|
+
if (node_path_1.default.basename(file).substring(0, 6) === 'initrd') {
|
|
89
|
+
this.initrd = node_path_1.default.basename(file);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (this.settings.distro.familyId === 'archlinux') {
|
|
93
|
+
if (node_path_1.default.basename(file).substring(0, 7) === 'vmlinuz') {
|
|
94
|
+
this.vmlinuz = node_path_1.default.basename(file);
|
|
95
|
+
}
|
|
96
|
+
if (node_path_1.default.basename(file) === 'initramfs-linux.img') {
|
|
97
|
+
this.initrd = node_path_1.default.basename(file);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* bootLabel
|
|
103
|
+
*/
|
|
104
|
+
const a = fs_1.default.readFileSync(this.eggRoot + '/.disk/mkisofs', "utf-8");
|
|
105
|
+
const b = a.substring(a.indexOf('-o ') + 3);
|
|
106
|
+
const c = b.substring(0, b.indexOf(' '));
|
|
107
|
+
this.bootLabel = c.substring(c.lastIndexOf('/') + 1);
|
|
108
|
+
console.log(this.bootLabel);
|
|
109
|
+
console.log(this.vmlinuz);
|
|
110
|
+
console.log(this.initrd);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* build
|
|
114
|
+
*/
|
|
115
|
+
async build() {
|
|
116
|
+
if (fs_1.default.existsSync(this.pxeRoot)) {
|
|
117
|
+
await this.tryCatch(`rm ${this.pxeRoot} -rf`);
|
|
118
|
+
}
|
|
119
|
+
await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
|
|
120
|
+
await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
|
|
121
|
+
await this.tryCatch(`ln -s ${this.eggRoot}/live ${this.pxeRoot}/live`);
|
|
122
|
+
await this.tryCatch(`ln -s ${this.nest}.disk ${this.pxeRoot}/.disk`);
|
|
123
|
+
if (fs_1.default.existsSync(this.eggRoot)) {
|
|
124
|
+
await this.tryCatch(`cp ${this.eggRoot}live/${this.vmlinuz} ${this.pxeRoot}/vmlinuz`);
|
|
125
|
+
await this.tryCatch(`chmod 777 ${this.pxeRoot}/vmlinuz`);
|
|
126
|
+
await this.tryCatch(`cp ${this.eggRoot}live/${this.initrd} ${this.pxeRoot}/initrd`);
|
|
127
|
+
await this.tryCatch(`chmod 777 ${this.pxeRoot}/initrd`);
|
|
128
|
+
}
|
|
129
|
+
// link iso images in pxe
|
|
130
|
+
for (const iso of this.isos) {
|
|
131
|
+
await this.tryCatch(`ln -s ${this.nest}/${iso} ${this.pxeRoot}/${iso}`);
|
|
132
|
+
}
|
|
133
|
+
await this.bios();
|
|
134
|
+
await this.ipxe();
|
|
135
|
+
await this.http();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* configure PXE bios
|
|
139
|
+
*/
|
|
140
|
+
async bios() {
|
|
141
|
+
console.log('creating cuckoo configuration pxe: BIOS');
|
|
142
|
+
await this.tryCatch(`cp ${__dirname}/../../addons/eggs/theme/livecd/isolinux.theme.cfg ${this.pxeRoot}/isolinux.theme.cfg`);
|
|
143
|
+
await this.tryCatch(`cp ${__dirname}/../../addons/eggs/theme/livecd/splash.png ${this.pxeRoot}/splash.png`);
|
|
144
|
+
/**
|
|
145
|
+
* ipxe.efi
|
|
146
|
+
*/
|
|
147
|
+
await this.tryCatch(`ln -s ${__dirname}/../../ipxe/ipxe.efi ${this.pxeRoot}/ipxe.efi`);
|
|
148
|
+
// pxe
|
|
149
|
+
const distro = new distro_1.default();
|
|
150
|
+
await this.tryCatch(`ln -s ${distro.pxelinuxPath}pxelinux.0 ${this.pxeRoot}/pxelinux.0`);
|
|
151
|
+
await this.tryCatch(`ln -s ${distro.pxelinuxPath}lpxelinux.0 ${this.pxeRoot}/lpxelinux.0`);
|
|
152
|
+
// syslinux
|
|
153
|
+
await this.tryCatch(`ln -s ${distro.syslinuxPath}ldlinux.c32 ${this.pxeRoot}/ldlinux.c32`);
|
|
154
|
+
await this.tryCatch(`ln -s ${distro.syslinuxPath}vesamenu.c32 ${this.pxeRoot}/vesamenu.c32`);
|
|
155
|
+
await this.tryCatch(`ln -s ${distro.syslinuxPath}libcom32.c32 ${this.pxeRoot}/libcom32.c32`);
|
|
156
|
+
await this.tryCatch(`ln -s ${distro.syslinuxPath}libutil.c32 ${this.pxeRoot}/libutil.c32`);
|
|
157
|
+
await this.tryCatch(`ln -s ${distro.memdiskPath}memdisk ${this.pxeRoot}/memdisk`);
|
|
158
|
+
await this.tryCatch(`mkdir ${this.pxeRoot}/pxelinux.cfg`);
|
|
159
|
+
let content = ``;
|
|
160
|
+
content += `# eggs: pxelinux.cfg/default\n`;
|
|
161
|
+
content += `# search path for the c32 support libraries (libcom32, libutil etc.)\n`;
|
|
162
|
+
content += `path\n`;
|
|
163
|
+
content += `include isolinux.theme.cfg\n`;
|
|
164
|
+
content += `UI vesamenu.c32\n`;
|
|
165
|
+
content += `\n`;
|
|
166
|
+
content += `menu title cuckoo: when you need a flying PXE server! ${utils_1.default.address()}\n`;
|
|
167
|
+
content += `PROMPT 0\n`;
|
|
168
|
+
content += `TIMEOUT 0\n`;
|
|
169
|
+
content += `\n`;
|
|
170
|
+
content += `label egg\n`;
|
|
171
|
+
content += `menu label ${this.bootLabel}\n`;
|
|
172
|
+
let clid = this.settings.distro.codenameLikeId;
|
|
173
|
+
if (clid === 'bionic' || clid === 'stretch' || clid === 'jessie') {
|
|
174
|
+
content += `kernel vmlinuz\n`;
|
|
175
|
+
content += `append initrd=initrd boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs\n`;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
content += `kernel http://${utils_1.default.address()}/vmlinuz\n`;
|
|
179
|
+
content += `append initrd=http://${utils_1.default.address()}/initrd boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs\n`;
|
|
180
|
+
}
|
|
181
|
+
content += `SYSAPPEND 3\n`;
|
|
182
|
+
content += `\n`;
|
|
183
|
+
if (this.isos.length > 0) {
|
|
184
|
+
content += `menu separator\n`;
|
|
185
|
+
for (const iso of this.isos) {
|
|
186
|
+
content += `\n`;
|
|
187
|
+
content += `label ${iso}\n`;
|
|
188
|
+
content += `menu label ${iso}\n`;
|
|
189
|
+
content += `kernel http://${utils_1.default.address()}/memdisk\n`;
|
|
190
|
+
content += `initrd http://${utils_1.default.address()}/${iso}\n`;
|
|
191
|
+
content += `append iso raw\n`;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
let file = `${this.pxeRoot}/pxelinux.cfg/default`;
|
|
195
|
+
fs_1.default.writeFileSync(file, content);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
*
|
|
199
|
+
*/
|
|
200
|
+
async ipxe() {
|
|
201
|
+
console.log('creating cuckoo configuration pxe: UEFI');
|
|
202
|
+
let content = "#!ipxe\n";
|
|
203
|
+
content += `dhcp\n`;
|
|
204
|
+
content += `set net0/ip=dhcp\n`;
|
|
205
|
+
content += `console --picture http://${utils_1.default.address()}/splash.png -x 1024 -y 768\n`;
|
|
206
|
+
content += "goto start ||\n";
|
|
207
|
+
content += "\n";
|
|
208
|
+
content += ':start\n';
|
|
209
|
+
content += `set server_root http://${utils_1.default.address()}:80/\n`;
|
|
210
|
+
const serverRootVars = '${server_root}';
|
|
211
|
+
content += `menu cuckoo: when you need a flying PXE server! ${utils_1.default.address()}\n`;
|
|
212
|
+
content += 'item --gap boot from ovarium\n';
|
|
213
|
+
content += `item egg-menu \${space} ${this.bootLabel.replaceAll('.iso', '')}\n\n`;
|
|
214
|
+
if (this.isos.length > 0) {
|
|
215
|
+
content += 'item --gap boot iso images\n';
|
|
216
|
+
for (const iso of this.isos) {
|
|
217
|
+
const menu = iso;
|
|
218
|
+
const label = menu;
|
|
219
|
+
content += `item ${menu} \${space} ${label}\n\n`;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
content += 'item --gap boot from internet\n';
|
|
223
|
+
content += `item netboot \${space} netboot\n`;
|
|
224
|
+
content += 'choose target || goto start\n';
|
|
225
|
+
content += 'goto ${target}\n';
|
|
226
|
+
content += '\n';
|
|
227
|
+
content += `:egg-menu\n`;
|
|
228
|
+
content += `kernel http://${utils_1.default.address()}/vmlinuz\n`;
|
|
229
|
+
content += `initrd http://${utils_1.default.address()}/initrd\n`;
|
|
230
|
+
/**
|
|
231
|
+
* CORRECT:
|
|
232
|
+
* content += `imgargs vmlinuz fetch=http://${Utils.address()}/live/filesystem.squashfs boot=live dhcp initrd=initrd ro\n`
|
|
233
|
+
*/
|
|
234
|
+
content += `imgargs vmlinuz fetch=http://${utils_1.default.address()}/live/filesystem.squashfs boot=live dhcp initrd=initrd ro\n`;
|
|
235
|
+
content += `sleep 10\n`;
|
|
236
|
+
content += `boot || goto start\n\n`;
|
|
237
|
+
if (this.isos.length > 0) {
|
|
238
|
+
for (const iso of this.isos) {
|
|
239
|
+
const menu = iso.replace('.iso', '');
|
|
240
|
+
content += `:${menu}\n`;
|
|
241
|
+
content += `sanboot ${serverRootVars}/${iso}\n`;
|
|
242
|
+
content += `boot || goto start\n\n`;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* netboot.xyz
|
|
247
|
+
*/
|
|
248
|
+
content += `:netboot\n`;
|
|
249
|
+
content += `ifopen net0\n`;
|
|
250
|
+
content += `set conn_type https\n`;
|
|
251
|
+
content += `chain --autofree https://boot.netboot.xyz/menu.ipxe || echo HTTPS failed... attempting HTTP...\n`;
|
|
252
|
+
content += `set conn_type http\n`;
|
|
253
|
+
content += `chain --autofree http://boot.netboot.xyz/menu.ipxe || echo HTTP failed, localbooting...\n`;
|
|
254
|
+
content += `goto start\n\n`;
|
|
255
|
+
let file = `${this.pxeRoot}/autoexec.ipxe`;
|
|
256
|
+
fs_1.default.writeFileSync(file, content);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* configure PXE http server
|
|
260
|
+
*/
|
|
261
|
+
async http() {
|
|
262
|
+
console.log('creating cuckoo configuration: PXE html');
|
|
263
|
+
let file = `${this.pxeRoot}/index.html`;
|
|
264
|
+
let content = ``;
|
|
265
|
+
content += `<html><title>Penguin's eggs PXE server</title>`;
|
|
266
|
+
content += `<div style="background-image:url('/splash.png');background-repeat:no-repeat;width: 640;height:480;padding:5px;border:1px solid black;">`;
|
|
267
|
+
content += `<h1>Cucko PXE server</h1>`;
|
|
268
|
+
content += `<body>address: <a href=http://${utils_1.default.address()}>${utils_1.default.address()}</a><br/>`;
|
|
269
|
+
if (!utils_1.default.isLive()) {
|
|
270
|
+
content += `Serving:<li>`;
|
|
271
|
+
for (const iso of this.isos) {
|
|
272
|
+
content += `<ul><a href='http://${utils_1.default.address()}/${iso}'>${iso}</a></ul>`;
|
|
273
|
+
}
|
|
274
|
+
content += `</li>`;
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
content += `started from live iso image<br/>`;
|
|
278
|
+
}
|
|
279
|
+
content += `source: <a href='https://github.com/pieroproietti/penguins-eggs'>https://github.com/pieroproietti/penguins-eggs</a><br/>`;
|
|
280
|
+
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/>`;
|
|
281
|
+
content += `discuss: <a href='https://t.me/penguins_eggs'>Telegram group<br/></body</html>`;
|
|
282
|
+
fs_1.default.writeFileSync(file, content);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
*
|
|
286
|
+
* @param dhcpOptions
|
|
287
|
+
*/
|
|
288
|
+
dhcpStart(dhcpOptions) {
|
|
289
|
+
let dhcpdProxy = new dhcpd(dhcpOptions);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* start http server for images
|
|
293
|
+
*
|
|
294
|
+
*/
|
|
295
|
+
async httpStart() {
|
|
296
|
+
const port = 80;
|
|
297
|
+
const httpRoot = this.pxeRoot + "/";
|
|
298
|
+
console.log(`http listening: 0.0.0.0:` + port);
|
|
299
|
+
var file = new (node_static_1.default.Server)(httpRoot);
|
|
300
|
+
http_1.default.createServer(function (req, res) {
|
|
301
|
+
file.serve(req, res);
|
|
302
|
+
}).listen(port);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* start tftp
|
|
306
|
+
*/
|
|
307
|
+
async tftpStart(tftpOptions) {
|
|
308
|
+
let tftpServer = tftp.createServer(tftpOptions);
|
|
309
|
+
tftpServer.on("error", function (error) {
|
|
310
|
+
// Errors from the main socket
|
|
311
|
+
// The current transfers are not aborted
|
|
312
|
+
console.error(error);
|
|
313
|
+
});
|
|
314
|
+
tftpServer.on("request", function (req, res) {
|
|
315
|
+
req.on("error", function (error) {
|
|
316
|
+
//Error from the request
|
|
317
|
+
//The connection is already closed
|
|
318
|
+
console.error("[" + req.stats.remoteAddress + ":" + req.stats.remotePort + "] (" + req.file + ") " + error.message);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
tftpServer.listen();
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
*
|
|
325
|
+
* @param cmd
|
|
326
|
+
*/
|
|
327
|
+
async tryCatch(cmd = '') {
|
|
328
|
+
try {
|
|
329
|
+
await (0, utils_2.exec)(cmd, this.echo);
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
console.log(`Error: ${error}`);
|
|
333
|
+
await utils_1.default.pressKeyToExit(cmd);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
exports.default = Pxe;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -18,6 +18,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
|
18
18
|
const pacman_1 = tslib_1.__importDefault(require("./pacman"));
|
|
19
19
|
// import { green, whiteBright } from 'chalk'
|
|
20
20
|
const child_process_1 = require("child_process");
|
|
21
|
+
const netmask_1 = require("netmask");
|
|
21
22
|
const distro_1 = tslib_1.__importDefault(require("./distro"));
|
|
22
23
|
const pjson = require('../../package.json');
|
|
23
24
|
/**
|
|
@@ -554,35 +555,99 @@ class Utils {
|
|
|
554
555
|
}
|
|
555
556
|
/**
|
|
556
557
|
* address
|
|
558
|
+
* ip a | grep -w inet |grep -v 127.0.0.1| awk '{print $2}' | cut -d "/" -f 1
|
|
559
|
+
* ifconfig | grep -w inet |grep -v 127.0.0.1| awk '{print $2}' | cut -d ":" -f 2`
|
|
560
|
+
*
|
|
557
561
|
*/
|
|
558
562
|
static address() {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
563
|
+
const interfaces = os_1.default.networkInterfaces();
|
|
564
|
+
let address = '';
|
|
565
|
+
if (interfaces !== undefined) {
|
|
566
|
+
for (const devName in interfaces) {
|
|
567
|
+
const iface = interfaces[devName];
|
|
568
|
+
if (iface !== undefined) {
|
|
569
|
+
for (const alias of iface) {
|
|
570
|
+
if (alias.family === 'IPv4' &&
|
|
571
|
+
alias.address !== '127.0.0.1' &&
|
|
572
|
+
!alias.internal) {
|
|
573
|
+
// take just the first!
|
|
574
|
+
if (address === '') {
|
|
575
|
+
address = alias.address;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return address;
|
|
583
|
+
//return shx.exec(`ip a | grep -w inet |grep -v 127.0.0.1| awk '{print $2}' | cut -d "/" -f 1`, { silent: true }).stdout.trim()
|
|
565
584
|
}
|
|
566
585
|
/**
|
|
567
586
|
* netmask
|
|
587
|
+
* ip a | grep -w inet |grep -v 127.0.0.1| awk '{print $2}' | cut -d "/" -f 2
|
|
588
|
+
* ifconfig | grep -w inet |grep -v 127.0.0.1| awk '{print $4}' | cut -d ":" -f 2
|
|
568
589
|
*/
|
|
569
590
|
static netmask() {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
591
|
+
const interfaces = os_1.default.networkInterfaces();
|
|
592
|
+
let netmask = '';
|
|
593
|
+
if (interfaces !== undefined) {
|
|
594
|
+
for (const devName in interfaces) {
|
|
595
|
+
const iface = interfaces[devName];
|
|
596
|
+
if (iface !== undefined) {
|
|
597
|
+
for (const alias of iface) {
|
|
598
|
+
if (alias.family === 'IPv4' &&
|
|
599
|
+
alias.address !== '127.0.0.1' &&
|
|
600
|
+
!alias.internal) {
|
|
601
|
+
// take just the first!
|
|
602
|
+
if (netmask === '') {
|
|
603
|
+
netmask = alias.netmask;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return netmask;
|
|
611
|
+
// return shx.exec(`ip a | grep -w inet |grep -v 127.0.0.1| awk '{print $2}' | cut -d "/" -f 2`, { silent: true }).stdout.trim()
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
*
|
|
615
|
+
* @returns 192.169.1.2/24
|
|
616
|
+
*/
|
|
617
|
+
static cidr() {
|
|
618
|
+
const interfaces = os_1.default.networkInterfaces();
|
|
619
|
+
let cidr = '';
|
|
620
|
+
if (interfaces !== undefined) {
|
|
621
|
+
for (const devName in interfaces) {
|
|
622
|
+
const iface = interfaces[devName];
|
|
623
|
+
if (iface !== undefined) {
|
|
624
|
+
for (const alias of iface) {
|
|
625
|
+
if (alias.family === 'IPv4' &&
|
|
626
|
+
alias.address !== '127.0.0.1' &&
|
|
627
|
+
!alias.internal) {
|
|
628
|
+
// take just the first!
|
|
629
|
+
if (cidr === '') {
|
|
630
|
+
if (alias.cidr !== null) {
|
|
631
|
+
cidr = alias.cidr;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return cidr;
|
|
575
640
|
}
|
|
576
641
|
/**
|
|
577
642
|
*
|
|
578
643
|
* @returns
|
|
579
|
-
|
|
644
|
+
* ip a | grep -w inet |grep -v 127.0.0.1| awk '{print $4}'
|
|
645
|
+
* ifconfig | grep -w inet |grep -v 127.0.0.1| awk '{print $6}' | cut -d ":" -f 2
|
|
646
|
+
*/
|
|
580
647
|
static broadcast() {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
*/
|
|
585
|
-
return shelljs_1.default.exec(`ip a | grep -w inet |grep -v 127.0.0.1| awk '{print $4}'`, { silent: true }).stdout.trim();
|
|
648
|
+
let n = new netmask_1.Netmask(Utils.cidr());
|
|
649
|
+
return n.broadcast;
|
|
650
|
+
// return shx.exec(`ip a | grep -w inet |grep -v 127.0.0.1| awk '{print $4}'`, { silent: true }).stdout.trim()
|
|
586
651
|
}
|
|
587
652
|
/**
|
|
588
653
|
* @returns dns
|
|
@@ -89,13 +89,15 @@ class Xdg {
|
|
|
89
89
|
* LIGHTDM
|
|
90
90
|
*/
|
|
91
91
|
if (pacman_1.default.packageIsInstalled('lightdm')) {
|
|
92
|
-
let
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
let dc = `${chroot}/etc/lightdm/`;
|
|
93
|
+
let files = node_fs_1.default.readdirSync(dc);
|
|
94
|
+
for (const elem of files) {
|
|
95
|
+
const curFile = dc + elem;
|
|
96
|
+
let content = node_fs_1.default.readFileSync(curFile, 'utf8');
|
|
97
|
+
let find = `[Seat:*]`;
|
|
98
|
+
if (content.includes(find)) {
|
|
99
|
+
shelljs_1.default.sed('-i', `autologin-user=${olduser}`, `autologin-user=${newuser}`, curFile);
|
|
100
|
+
}
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
/**
|
|
@@ -103,25 +105,23 @@ class Xdg {
|
|
|
103
105
|
*/
|
|
104
106
|
if (pacman_1.default.packageIsInstalled('sddm')) {
|
|
105
107
|
let sddmChanged = false;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
sddmChanged = true;
|
|
113
|
-
}
|
|
108
|
+
let curFile = `${chroot}/etc/sddm.conf`;
|
|
109
|
+
let content = node_fs_1.default.readFileSync(curFile, 'utf8');
|
|
110
|
+
let find = `[Autologin]`;
|
|
111
|
+
if (content.includes(find)) {
|
|
112
|
+
shelljs_1.default.sed('-i', `User=${olduser}`, `User=${newuser}`, curFile);
|
|
113
|
+
sddmChanged = true;
|
|
114
114
|
}
|
|
115
|
-
// Se non l'ho trovato, modifico /etc/sddm.conf.d/autologin.conf
|
|
116
115
|
if (!sddmChanged) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
let dc = `${chroot}/etc/sddm.conf.d/`;
|
|
117
|
+
let files = node_fs_1.default.readdirSync(dc);
|
|
118
|
+
for (const elem of files) {
|
|
119
|
+
const curFile = dc + elem;
|
|
120
|
+
let content = node_fs_1.default.readFileSync(curFile, 'utf8');
|
|
121
|
+
if (content.includes(find)) {
|
|
122
|
+
shelljs_1.default.sed('-i', `User=${olduser}`, `User=${newuser}`, curFile);
|
|
123
|
+
sddmChanged = true;
|
|
124
|
+
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -148,8 +148,6 @@ class Xdg {
|
|
|
148
148
|
}
|
|
149
149
|
const content = `[daemon]\nAutomaticLoginEnable=true\nAutomaticLogin=${newuser}\n`;
|
|
150
150
|
utils_1.default.write(gdmConf, content);
|
|
151
|
-
// shx.sed('-i', 'AutomaticLoginEnable=False', 'AutomaticLoginEnable=True', gdmConf)
|
|
152
|
-
// shx.sed('-i', `AutomaticLogin=${olduser}`, `AutomaticLogin=${newuser}`, gdmConf)
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
153
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* cuckoo: proxy
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
const network_1 = tslib_1.__importDefault(require("../classes/network"));
|
|
9
|
+
const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
|
|
10
|
+
const pxe_1 = tslib_1.__importDefault(require("../classes/pxe"));
|
|
11
|
+
const tftp = require('tftp');
|
|
12
|
+
class Cuckoo extends core_1.Command {
|
|
13
|
+
async run(nest = '/home/eggs') {
|
|
14
|
+
const { args, flags } = await this.parse(Cuckoo);
|
|
15
|
+
utils_1.default.titles(this.id + ' ' + this.argv);
|
|
16
|
+
if (utils_1.default.isRoot()) {
|
|
17
|
+
const pxeRoot = nest + '/pxe';
|
|
18
|
+
const pxe = new pxe_1.default();
|
|
19
|
+
await pxe.fertilization();
|
|
20
|
+
await pxe.build();
|
|
21
|
+
const n = new network_1.default();
|
|
22
|
+
/**
|
|
23
|
+
* service proxy-dhcp
|
|
24
|
+
*/
|
|
25
|
+
let dhcpOptions = {
|
|
26
|
+
subnet: n.cidr,
|
|
27
|
+
host: n.address,
|
|
28
|
+
tftpserver: n.address,
|
|
29
|
+
bios_filename: 'lpxelinux.0',
|
|
30
|
+
efi32_filename: 'ipxe32.efi',
|
|
31
|
+
efi64_filename: 'ipxe.efi'
|
|
32
|
+
};
|
|
33
|
+
pxe.dhcpStart(dhcpOptions);
|
|
34
|
+
/**
|
|
35
|
+
* service tftp
|
|
36
|
+
*/
|
|
37
|
+
let tftpOptions = {
|
|
38
|
+
"host": n.address,
|
|
39
|
+
"port": 69,
|
|
40
|
+
"root": pxeRoot,
|
|
41
|
+
"denyPUT": true
|
|
42
|
+
};
|
|
43
|
+
await pxe.tftpStart(tftpOptions);
|
|
44
|
+
/**
|
|
45
|
+
* service http
|
|
46
|
+
*/
|
|
47
|
+
await pxe.httpStart();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
utils_1.default.useRoot(this.id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = Cuckoo;
|
|
55
|
+
Cuckoo.description = 'PXE start with proxy-dhcp';
|
|
56
|
+
Cuckoo.examples = [
|
|
57
|
+
`$ sudo eggs cuckoo
|
|
58
|
+
start a PXE server with dhcp-proxy (can coexists with a real dhcp server)
|
|
59
|
+
`,
|
|
60
|
+
];
|
|
61
|
+
Cuckoo.flags = {
|
|
62
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
63
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|