penguins-eggs 9.3.26 → 9.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +1 -1
- package/conf/derivatives.yaml +7 -0
- package/dist/classes/compressors.js +3 -3
- package/dist/classes/daddy.js +8 -8
- package/dist/classes/distro.js +23 -22
- package/dist/classes/family/archlinux.js +1 -1
- package/dist/classes/family/debian.js +5 -5
- package/dist/classes/incubation/branding.js +4 -4
- package/dist/classes/incubation/distros/jessie.js +1 -1
- package/dist/classes/incubation/distros/rolling.js +4 -4
- package/dist/classes/incubation/fisherman-helper/packages.js +8 -8
- package/dist/classes/incubation/fisherman.js +5 -7
- package/dist/classes/incubation/incubator.js +7 -7
- package/dist/classes/keyboards.js +16 -16
- package/dist/classes/locales.js +9 -9
- package/dist/classes/network.js +5 -7
- package/dist/classes/ovary.js +80 -84
- package/dist/classes/pacman.js +2 -4
- package/dist/classes/pxe.js +131 -131
- package/dist/classes/settings.js +2 -2
- package/dist/classes/sources_list.js +20 -22
- package/dist/classes/systemctl.js +2 -2
- package/dist/classes/tailor.js +216 -225
- package/dist/classes/users.js +24 -24
- package/dist/classes/xdg.js +17 -17
- package/dist/classes/yolk.js +2 -4
- package/dist/commands/adapt.js +2 -2
- package/dist/commands/analyze.js +34 -3
- package/dist/commands/calamares.js +6 -6
- package/dist/commands/config.js +8 -12
- package/dist/commands/cuckoo.js +8 -8
- package/dist/commands/dad.js +4 -4
- package/dist/commands/export/deb.js +7 -7
- package/dist/commands/export/iso.js +6 -6
- package/dist/commands/install.js +15 -15
- package/dist/commands/kill.js +3 -3
- package/dist/commands/mom.js +2 -2
- package/dist/commands/produce.js +9 -9
- package/dist/commands/status.js +2 -2
- package/dist/commands/syncfrom.js +11 -13
- package/dist/commands/syncto.js +36 -41
- package/dist/commands/tools/clean.js +3 -3
- package/dist/commands/tools/ppa.js +10 -10
- package/dist/commands/tools/skel.js +3 -3
- package/dist/commands/tools/stat.js +5 -5
- package/dist/commands/tools/yolk.js +2 -2
- package/dist/commands/update.js +4 -4
- package/dist/commands/wardrobe/get.js +5 -5
- package/dist/commands/wardrobe/list.js +13 -13
- package/dist/commands/wardrobe/show.js +12 -12
- package/dist/commands/wardrobe/wear.js +8 -8
- package/dist/interfaces/i-packages.js +1 -1
- package/dist/interfaces/i-pxe.js +39 -0
- package/dist/krill/modules/add-user.js +2 -2
- package/dist/krill/modules/bootloader-config-ubuntu.js +1 -1
- package/dist/krill/modules/bootloader.js +2 -2
- package/dist/krill/modules/fstab.js +21 -21
- package/dist/krill/modules/grubcfg.js +1 -1
- package/dist/krill/modules/hostname.js +15 -15
- package/dist/krill/modules/initramfs.js +4 -4
- package/dist/krill/modules/locale-cfg.js +8 -8
- package/dist/krill/modules/locale.js +6 -6
- package/dist/krill/modules/m-keyboard.js +20 -20
- package/dist/krill/modules/machine-id.js +1 -1
- package/dist/krill/modules/mkfs.js +1 -1
- package/dist/krill/modules/mount-fs.js +7 -9
- package/dist/krill/modules/network-cfg.js +15 -17
- package/dist/krill/modules/packages.js +6 -6
- package/dist/krill/modules/partition.js +91 -84
- package/dist/krill/modules/remove-installer-link.js +1 -1
- package/dist/krill/modules/unpackfs.js +1 -1
- package/dist/lib/cli-autologin.js +7 -7
- package/dist/lib/dependencies.js +10 -10
- package/dist/lib/get_address.js +2 -2
- package/dist/lib/get_dns.js +2 -2
- package/dist/lib/get_domain.js +2 -2
- package/dist/lib/get_gateway.js +2 -2
- package/dist/lib/get_hostname.js +2 -2
- package/dist/lib/get_netmask.js +2 -2
- package/dist/lib/get_password.js +4 -4
- package/dist/lib/get_root_password.js +3 -3
- package/dist/lib/get_userfullname.js +2 -2
- package/dist/lib/get_username.js +2 -2
- package/dist/lib/select_address_type.js +2 -2
- package/dist/lib/select_filesystem_type.js +2 -2
- package/dist/lib/select_installation_device.js +2 -2
- package/dist/lib/select_installation_mode.js +2 -2
- package/dist/lib/select_interface.js +2 -2
- package/dist/lib/select_keyboard_layout.js +4 -4
- package/dist/lib/select_keyboard_model.js +4 -4
- package/dist/lib/select_keyboard_option.js +4 -4
- package/dist/lib/select_keyboard_variant.js +4 -4
- package/dist/lib/select_languages.js +3 -3
- package/dist/lib/select_regions.js +2 -2
- package/dist/lib/select_user_swap_choice.js +2 -2
- package/dist/lib/select_zones.js +8 -8
- package/dist/lib/utils.js +3 -3
- package/dist/types/etrick.js +1 -0
- package/package.json +8 -2
- package/dist/dhcpd/dhcpd.js +0 -222
- package/dist/dhcpd/index.js +0 -7
- package/dist/dhcpd/packet/converters.js +0 -377
- package/dist/dhcpd/packet/options.js +0 -2
- package/dist/dhcpd/packet/types.js +0 -2
- package/dist/dhcpd/packet.js +0 -251
- package/dist/dhcpd/proxy.js +0 -152
- package/dist/dhcpd/server.js +0 -152
- package/dist/dhcpd/sprintf.js +0 -170
- package/dist/dhcpd/utils.js +0 -190
- package/dist/interfaces/i-pxe-options.js +0 -2
|
@@ -9,8 +9,8 @@ async function selectInstallationMode() {
|
|
|
9
9
|
type: 'list',
|
|
10
10
|
name: 'installationMode',
|
|
11
11
|
message: 'Select the installation mode: ',
|
|
12
|
-
choices: modes
|
|
13
|
-
}
|
|
12
|
+
choices: modes,
|
|
13
|
+
},
|
|
14
14
|
];
|
|
15
15
|
return new Promise(function (resolve) {
|
|
16
16
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -12,8 +12,8 @@ async function selectInterface(iface = 'eth0', ifaces) {
|
|
|
12
12
|
name: 'option',
|
|
13
13
|
message: 'Select interface: ',
|
|
14
14
|
choices: ifaces,
|
|
15
|
-
default: iface
|
|
16
|
-
}
|
|
15
|
+
default: iface,
|
|
16
|
+
},
|
|
17
17
|
];
|
|
18
18
|
return new Promise(function (resolve) {
|
|
19
19
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -9,8 +9,8 @@ const tslib_1 = require("tslib");
|
|
|
9
9
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
10
10
|
const keyboards_1 = tslib_1.__importDefault(require("../classes/keyboards"));
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
14
|
async function selectKeyboardLayout(selected = '') {
|
|
15
15
|
const keyboards = new keyboards_1.default();
|
|
16
16
|
const layouts = keyboards.getLayouts();
|
|
@@ -24,8 +24,8 @@ async function selectKeyboardLayout(selected = '') {
|
|
|
24
24
|
name: 'layout',
|
|
25
25
|
message: 'Select layout: ',
|
|
26
26
|
choices: supported,
|
|
27
|
-
default: selected
|
|
28
|
-
}
|
|
27
|
+
default: selected,
|
|
28
|
+
},
|
|
29
29
|
];
|
|
30
30
|
return new Promise(function (resolve) {
|
|
31
31
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -9,8 +9,8 @@ const tslib_1 = require("tslib");
|
|
|
9
9
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
10
10
|
const keyboards_1 = tslib_1.__importDefault(require("../classes/keyboards"));
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
14
|
async function selectKeyboardModel(selected = '') {
|
|
15
15
|
const keyboards = new keyboards_1.default();
|
|
16
16
|
const models = keyboards.getModels();
|
|
@@ -24,8 +24,8 @@ async function selectKeyboardModel(selected = '') {
|
|
|
24
24
|
name: 'model',
|
|
25
25
|
message: 'Select model: ',
|
|
26
26
|
choices: supported,
|
|
27
|
-
default: selected
|
|
28
|
-
}
|
|
27
|
+
default: selected,
|
|
28
|
+
},
|
|
29
29
|
];
|
|
30
30
|
return new Promise(function (resolve) {
|
|
31
31
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -9,8 +9,8 @@ const tslib_1 = require("tslib");
|
|
|
9
9
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
10
10
|
const keyboards_1 = tslib_1.__importDefault(require("../classes/keyboards"));
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* selectKeyboardOption
|
|
13
|
+
*/
|
|
14
14
|
async function selectKeyboardOption(selected = '') {
|
|
15
15
|
const keyboards = new keyboards_1.default();
|
|
16
16
|
const options = keyboards.getOptions();
|
|
@@ -24,8 +24,8 @@ async function selectKeyboardOption(selected = '') {
|
|
|
24
24
|
name: 'option',
|
|
25
25
|
message: 'Select option: ',
|
|
26
26
|
choices: supported,
|
|
27
|
-
default: selected
|
|
28
|
-
}
|
|
27
|
+
default: selected,
|
|
28
|
+
},
|
|
29
29
|
];
|
|
30
30
|
return new Promise(function (resolve) {
|
|
31
31
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -9,8 +9,8 @@ const tslib_1 = require("tslib");
|
|
|
9
9
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
10
10
|
const keyboards_1 = tslib_1.__importDefault(require("../classes/keyboards"));
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
14
|
async function selectKeyboardVariant(keyboardLayout = '') {
|
|
15
15
|
const keyboards = new keyboards_1.default();
|
|
16
16
|
const variants = keyboards.getVariants(keyboardLayout);
|
|
@@ -25,8 +25,8 @@ async function selectKeyboardVariant(keyboardLayout = '') {
|
|
|
25
25
|
name: 'variant',
|
|
26
26
|
message: 'Select variant: ',
|
|
27
27
|
choices: supported,
|
|
28
|
-
default: ''
|
|
29
|
-
}
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
30
|
];
|
|
31
31
|
return new Promise(function (resolve) {
|
|
32
32
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -6,7 +6,7 @@ const tslib_1 = require("tslib");
|
|
|
6
6
|
*/
|
|
7
7
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
8
|
const locales_1 = tslib_1.__importDefault(require("../classes/locales"));
|
|
9
|
-
async function selectLanguages(selectedLanguage =
|
|
9
|
+
async function selectLanguages(selectedLanguage = '') {
|
|
10
10
|
const locales = new locales_1.default();
|
|
11
11
|
const supported = await locales.getSupported();
|
|
12
12
|
const selected = selectedLanguage;
|
|
@@ -16,8 +16,8 @@ async function selectLanguages(selectedLanguage = "") {
|
|
|
16
16
|
name: 'language',
|
|
17
17
|
message: 'Select language: ',
|
|
18
18
|
choices: supported,
|
|
19
|
-
default: selected
|
|
20
|
-
}
|
|
19
|
+
default: selected,
|
|
20
|
+
},
|
|
21
21
|
];
|
|
22
22
|
return new Promise(function (resolve) {
|
|
23
23
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -9,8 +9,8 @@ async function selectRegions(selected = '') {
|
|
|
9
9
|
name: 'region',
|
|
10
10
|
message: 'Select your region: ',
|
|
11
11
|
choices: ['Atlantic', 'Africa', 'America', 'Antarctica', 'Artic', 'Australia', 'Europe', 'India', 'Europe', 'Pacific'],
|
|
12
|
-
default: selected
|
|
13
|
-
}
|
|
12
|
+
default: selected,
|
|
13
|
+
},
|
|
14
14
|
];
|
|
15
15
|
return new Promise(function (resolve) {
|
|
16
16
|
inquirer_1.default.prompt(questions).then(function (options) {
|
|
@@ -19,8 +19,8 @@ async function selectUserSwapChoice() {
|
|
|
19
19
|
name: 'userSwapChoices',
|
|
20
20
|
message: 'Select the swap choice',
|
|
21
21
|
choices: partitions.userSwapChoices,
|
|
22
|
-
default: partitions.initialSwapChoice
|
|
23
|
-
}
|
|
22
|
+
default: partitions.initialSwapChoice,
|
|
23
|
+
},
|
|
24
24
|
];
|
|
25
25
|
return new Promise(function (resolve) {
|
|
26
26
|
inquirer_1.default.prompt(questions).then(function (options) {
|
package/dist/lib/select_zones.js
CHANGED
|
@@ -57,7 +57,7 @@ async function selectRegions(region = '') {
|
|
|
57
57
|
'Timbuktu',
|
|
58
58
|
'Tripoli',
|
|
59
59
|
'Tunis',
|
|
60
|
-
'Windhoek'
|
|
60
|
+
'Windhoek',
|
|
61
61
|
];
|
|
62
62
|
const america = [
|
|
63
63
|
'Adak',
|
|
@@ -215,7 +215,7 @@ async function selectRegions(region = '') {
|
|
|
215
215
|
'Whitehorse',
|
|
216
216
|
'Winnipeg',
|
|
217
217
|
'Yakutat',
|
|
218
|
-
'Yellowknife'
|
|
218
|
+
'Yellowknife',
|
|
219
219
|
];
|
|
220
220
|
const antartica = ['Casey', 'Davis', 'DumontDUrville', 'Macquarie', 'Mawson', 'McMurdo', 'Palmer', 'Rothera', 'Syowa', 'Troll', 'Vostok'];
|
|
221
221
|
const australia = ['Adelaide', 'Brisbane', 'Broken_Hill', 'Canberra', 'Currie', 'Darwin', 'Eucla', 'Hobart', 'Lindeman', 'Lord_Howe', 'Melbourne', 'Perth', 'Sydney', 'Yancowinna'];
|
|
@@ -310,7 +310,7 @@ async function selectRegions(region = '') {
|
|
|
310
310
|
'Yakutsk',
|
|
311
311
|
'Yangon',
|
|
312
312
|
'Yekaterinburg',
|
|
313
|
-
'Yerevan'
|
|
313
|
+
'Yerevan',
|
|
314
314
|
];
|
|
315
315
|
const atlantic = ['Azores', 'Bermuda', 'Canary', 'Cape_Verde', 'Faroe', 'Jan_Mayen', 'Madeira', 'Reykjavik', 'South_Georgia', 'St_Helena', 'Stanley'];
|
|
316
316
|
const europe = [
|
|
@@ -373,7 +373,7 @@ async function selectRegions(region = '') {
|
|
|
373
373
|
'Warsaw',
|
|
374
374
|
'Zagreb',
|
|
375
375
|
'Zaporozhye',
|
|
376
|
-
'Zurich'
|
|
376
|
+
'Zurich',
|
|
377
377
|
];
|
|
378
378
|
const indian = ['Antananarivo', 'Chagos', 'Christmas', 'Cocos', 'Comoro', 'Kerguelen', 'Mahe', 'Maldives', 'Mauritius', 'Mayotte', 'Reunion'];
|
|
379
379
|
const pacific = [
|
|
@@ -419,7 +419,7 @@ async function selectRegions(region = '') {
|
|
|
419
419
|
'Truk',
|
|
420
420
|
'Wake',
|
|
421
421
|
'Wallis',
|
|
422
|
-
'Yap'
|
|
422
|
+
'Yap',
|
|
423
423
|
];
|
|
424
424
|
const us = ['Alaska', 'Aleutian', 'Arizona', 'Central', 'Eastern', 'Hawaii', 'Indiana-Starke', 'Michigan', 'Mountain', 'Pacific', 'Samoa'];
|
|
425
425
|
const etc = [
|
|
@@ -457,7 +457,7 @@ async function selectRegions(region = '') {
|
|
|
457
457
|
'UCT',
|
|
458
458
|
'UTC',
|
|
459
459
|
'Universal',
|
|
460
|
-
'Zulu'
|
|
460
|
+
'Zulu',
|
|
461
461
|
];
|
|
462
462
|
let zone = [];
|
|
463
463
|
switch (region) {
|
|
@@ -504,8 +504,8 @@ async function selectRegions(region = '') {
|
|
|
504
504
|
type: 'list',
|
|
505
505
|
name: 'zone',
|
|
506
506
|
message: 'Please select the city or region corresponding to your time zone: ',
|
|
507
|
-
choices: zone
|
|
508
|
-
}
|
|
507
|
+
choices: zone,
|
|
508
|
+
},
|
|
509
509
|
];
|
|
510
510
|
return new Promise(function (resolve) {
|
|
511
511
|
inquirer_1.default.prompt(questions).then(function (options) {
|
package/dist/lib/utils.js
CHANGED
|
@@ -37,7 +37,7 @@ async function exec(command, { echo = false, ignore = false, capture = false } =
|
|
|
37
37
|
console.log(command);
|
|
38
38
|
}
|
|
39
39
|
const child = (0, child_process_1.spawn)('bash', ['-c', command], {
|
|
40
|
-
stdio: ignore ? 'ignore' : capture ? 'pipe' : 'inherit'
|
|
40
|
+
stdio: ignore ? 'ignore' : (capture ? 'pipe' : 'inherit'),
|
|
41
41
|
});
|
|
42
42
|
// const spawn = require('child_process').spawn
|
|
43
43
|
// child.stdout.on('data', (data: string) => {
|
|
@@ -51,8 +51,8 @@ async function exec(command, { echo = false, ignore = false, capture = false } =
|
|
|
51
51
|
child.on('error', function (error) {
|
|
52
52
|
reject({ code: 1, error: error });
|
|
53
53
|
});
|
|
54
|
-
// The 'exit' event is emitted after the child process ends. If the process exited, code is the final exit code of the process,
|
|
55
|
-
// otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null.
|
|
54
|
+
// The 'exit' event is emitted after the child process ends. If the process exited, code is the final exit code of the process,
|
|
55
|
+
// otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null.
|
|
56
56
|
// One of the two will always be non-null.
|
|
57
57
|
child.on('exit', (code) => {
|
|
58
58
|
resolve({ code: code, data: stdout });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "penguins-eggs",
|
|
3
3
|
"description": "Perri's Brewery edition: remaster your system and distribuite it",
|
|
4
|
-
"version": "9.3.
|
|
4
|
+
"version": "9.3.27",
|
|
5
5
|
"author": "Piero Proietti @pieroproietti",
|
|
6
6
|
"bin": {
|
|
7
7
|
"eggs": "bin/run"
|
|
@@ -25,8 +25,10 @@
|
|
|
25
25
|
"mustache": "^4.2.0",
|
|
26
26
|
"netmask": "^2.0.2",
|
|
27
27
|
"node-static": "^0.7.11",
|
|
28
|
+
"etrick": "^0.0.2",
|
|
28
29
|
"react": "^17.0.2",
|
|
29
30
|
"shelljs": "0.8.5",
|
|
31
|
+
"systeminformation": "^5.17.9",
|
|
30
32
|
"tftp": "^0.1.2",
|
|
31
33
|
"tslib": "^2.4.1",
|
|
32
34
|
"typescript": "^4.9.4"
|
|
@@ -84,7 +86,8 @@
|
|
|
84
86
|
"oclif",
|
|
85
87
|
"refracta",
|
|
86
88
|
"remastersys",
|
|
87
|
-
"systemback"
|
|
89
|
+
"systemback",
|
|
90
|
+
"pxe"
|
|
88
91
|
],
|
|
89
92
|
"license": "MIT",
|
|
90
93
|
"main": "./dist/index.js",
|
|
@@ -114,7 +117,10 @@
|
|
|
114
117
|
"docs": "rm docs -rf && npx typedoc src --out docs",
|
|
115
118
|
"lint-and-fix": "eslint . --ext .ts --fix --config .eslintrc",
|
|
116
119
|
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
120
|
+
"manifest": "oclif manifest",
|
|
121
|
+
"readme": "oclif readme",
|
|
117
122
|
"posttest": "eslint . --ext .ts --config .eslintrc",
|
|
123
|
+
"_prepack": "rm dist -rf && tsc -b && oclif manifest && oclif readme",
|
|
118
124
|
"prettier-format": "prettier --config .prettierrc 'src/**/*.ts' --write",
|
|
119
125
|
"tarballs": "oclif pack:tarballs --root=. --targets=linux-x64 --no-xz",
|
|
120
126
|
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
package/dist/dhcpd/dhcpd.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var dhcp_server = require('./server');
|
|
3
|
-
var dhcp_proxy = require('./proxy');
|
|
4
|
-
var netmask = require('netmask').Netmask;
|
|
5
|
-
var ee = require('events').EventEmitter;
|
|
6
|
-
var util = require('util');
|
|
7
|
-
const { file } = require('@oclif/core/lib/parser');
|
|
8
|
-
const { createNoSubstitutionTemplateLiteral } = require('typescript');
|
|
9
|
-
const { json } = require('stream/consumers');
|
|
10
|
-
const BOOTREQUEST = 1, DHCP_MESSAGE_TYPE = 0x35, DHCP_SERVER_ID = 0x36, DHCP_DISCOVER = 1, DHCP_INFORM = 8, DHCP_MINTYPE = DHCP_DISCOVER, DHCP_MAXTYPE = DHCP_INFORM, DHCP_REQUESTED_IP = 0x32, DHCP_HOST_NAME = 0x0c;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param opts
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
class dhcpd {
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param opts
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
constructor(opts) {
|
|
23
|
-
let self = this;
|
|
24
|
-
if (!(self instanceof dhcpd)) {
|
|
25
|
-
return new dhcpd(opts);
|
|
26
|
-
}
|
|
27
|
-
ee.call(self);
|
|
28
|
-
if (opts.subnet) {
|
|
29
|
-
var block = new netmask(opts.subnet);
|
|
30
|
-
if (block) {
|
|
31
|
-
self.network = block.base;
|
|
32
|
-
self.netmask = block.mask;
|
|
33
|
-
self.broadcast = block.broadcast;
|
|
34
|
-
self.host = opts.host;
|
|
35
|
-
self.tftpserver = opts.tftpserver;
|
|
36
|
-
self.bios_filename = opts.bios_filename;
|
|
37
|
-
self.efi32_filename = opts.efi32_filename;
|
|
38
|
-
self.efi64_filename = opts.efi64_filename;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
throw new Error("Unable to read subnet details from '" + opts.subnet + "'");
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
// Listen on port 67 for all the DHCP messages from clients
|
|
45
|
-
self.s = new dhcp_server('udp4', { broadcast: self.broadcast });
|
|
46
|
-
self.s.on('listening', function () {
|
|
47
|
-
var address = self.s.address();
|
|
48
|
-
console.log('server listening: ' + address.address + ':' + address.port);
|
|
49
|
-
});
|
|
50
|
-
self.s.on('discover', self.discover.bind(self));
|
|
51
|
-
self.s.on('request', self.request.bind(self));
|
|
52
|
-
self.s.on('inform', self.inform.bind(self));
|
|
53
|
-
self.s.bind(67, '0.0.0.0');
|
|
54
|
-
// Listen on port 4011 for clients asking for proxy DHCP
|
|
55
|
-
self.p = new dhcp_proxy('udp4', { broadcast: self.broadcast });
|
|
56
|
-
self.p.on('listening', function () {
|
|
57
|
-
var address = self.p.address();
|
|
58
|
-
console.log('proxy listening: ' + address.address + ':' + address.port);
|
|
59
|
-
});
|
|
60
|
-
self.p.on('request', self.proxy_request.bind(self));
|
|
61
|
-
self.p.bind(4011, '0.0.0.0');
|
|
62
|
-
return self;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* @param {*} pkt
|
|
67
|
-
* @returns
|
|
68
|
-
*/
|
|
69
|
-
pre_init(pkt) {
|
|
70
|
-
var self = this;
|
|
71
|
-
// Ignore malformed packets
|
|
72
|
-
if (pkt.hlen != 6)
|
|
73
|
-
return;
|
|
74
|
-
// Ignore if not a BOOTREQUEST
|
|
75
|
-
if (pkt.op != BOOTREQUEST)
|
|
76
|
-
return;
|
|
77
|
-
// Ignore if unknown message type
|
|
78
|
-
var state = _get_option(pkt, DHCP_MESSAGE_TYPE);
|
|
79
|
-
if (state == undefined || state['0'] < DHCP_MINTYPE || state['0'] > DHCP_MAXTYPE)
|
|
80
|
-
return;
|
|
81
|
-
// Ignore if DHCP message is not for us
|
|
82
|
-
var server_id_opt = _get_option(pkt, DHCP_SERVER_ID);
|
|
83
|
-
if (server_id_opt !== undefined && server_id_opt != self.host)
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
* @param {*} pkt
|
|
89
|
-
* @returns
|
|
90
|
-
*/
|
|
91
|
-
discover(pkt) {
|
|
92
|
-
var self = this;
|
|
93
|
-
console.log("Received DHCP DISCOVER");
|
|
94
|
-
if (pkt.options['60'] !== undefined && pkt.options['60'].indexOf('PXEClient') === 0) {
|
|
95
|
-
// Check if we are really being asked for PXE boot information
|
|
96
|
-
// Signal the client that we are a proxy dhcp by sending an OFFER
|
|
97
|
-
var offer = {};
|
|
98
|
-
offer.siaddr = self.host;
|
|
99
|
-
offer.options = {};
|
|
100
|
-
offer.options['60'] = 'PXEClient';
|
|
101
|
-
offer.options['54'] = self.host;
|
|
102
|
-
offer.options['255'] = null;
|
|
103
|
-
self.pre_init(pkt);
|
|
104
|
-
return self.s.offer(pkt, offer);
|
|
105
|
-
}
|
|
106
|
-
else if (pkt.options['60'] !== undefined && pkt.options['60'].indexOf('AAPLBSDPC/i386') === 0) {
|
|
107
|
-
console.log('Mac OS X discovery, ignoring');
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
console.log('Ignoring discovery as it does not seam to be a boot request');
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
*
|
|
117
|
-
* @param {*} pkt
|
|
118
|
-
* @returns
|
|
119
|
-
*/
|
|
120
|
-
request(pkt) {
|
|
121
|
-
var self = this;
|
|
122
|
-
console.log('Ignoring received REQUEST from ' + pkt.chaddr + ' as we are only a proxy');
|
|
123
|
-
return;
|
|
124
|
-
var offer = {};
|
|
125
|
-
offer.siaddr = self.host;
|
|
126
|
-
offer.options = {};
|
|
127
|
-
offer.options['54'] = self.host;
|
|
128
|
-
offer.options['255'] = null;
|
|
129
|
-
self.pre_init(pkt);
|
|
130
|
-
return self.s.ack(pkt, offer);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
*
|
|
134
|
-
* @param {*} pkt
|
|
135
|
-
* @returns
|
|
136
|
-
*/
|
|
137
|
-
inform(pkt) {
|
|
138
|
-
var self = this;
|
|
139
|
-
if (pkt.options['60'] !== undefined && pkt.options['60'].indexOf('AAPLBSDPC/i386') === 0) {
|
|
140
|
-
var offer = {};
|
|
141
|
-
offer.siaddr = self.tftpserver;
|
|
142
|
-
offer.ciaddr = pkt.remote.address;
|
|
143
|
-
offer.options = {};
|
|
144
|
-
offer.options['54'] = self.host;
|
|
145
|
-
offer.options['60'] = 'AAPLBSDPC';
|
|
146
|
-
offer.options['255'] = null;
|
|
147
|
-
if (pkt.options['43'] !== undefined && pkt.options['43'].indexOf('01:01:01') === 0) {
|
|
148
|
-
// Mac OS X client: BSDP list
|
|
149
|
-
offer.options['43'] = '01:01:01:04:02:80:00:07:04:81:00:05:2a:08:04:81:00:05:2a:09:0d:81:00:05:2a:08:69:50:58:45:2d:46:4f:47';
|
|
150
|
-
}
|
|
151
|
-
else if (pkt.options['43'] !== undefined && pkt.options['43'].indexOf('01:01:02') === 0) {
|
|
152
|
-
// Mac OS X client: BSDP select
|
|
153
|
-
offer.options['43'] = '01:01:02:08:04:81:00:05:2a:82:0a:4e:65:74:42:6f:6f:74:30:30:31';
|
|
154
|
-
pkt.fname = self.efi64_filename;
|
|
155
|
-
pkt.sname = '141.62.66.114';
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
console.log('Unknown BSDP request, not answering');
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
return self.p.ack(pkt, offer);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
console.log('INFORM not by a Mac OS client, maybe Windows, ignoring');
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
*
|
|
170
|
-
* @param {*} pkt
|
|
171
|
-
* @returns
|
|
172
|
-
*/
|
|
173
|
-
proxy_request(pkt) {
|
|
174
|
-
var self = this;
|
|
175
|
-
console.log("Received Proxy DHCP REQUEST");
|
|
176
|
-
var offer = {};
|
|
177
|
-
offer.siaddr = self.tftpserver;
|
|
178
|
-
offer.options = {};
|
|
179
|
-
offer.options['54'] = self.host;
|
|
180
|
-
offer.options['255'] = null;
|
|
181
|
-
if (pkt.options['60'] !== undefined) {
|
|
182
|
-
var arch = pkt.options['60'];
|
|
183
|
-
if (arch.indexOf('00009') === 15 || arch.indexOf('00007') === 15) {
|
|
184
|
-
// var next = '192.168.1.17'
|
|
185
|
-
var fname = self.efi64_filename;
|
|
186
|
-
if (pkt.options["77"] === "iPXE") {
|
|
187
|
-
fname = `autoexec.ipxe`;
|
|
188
|
-
}
|
|
189
|
-
pkt.fname = fname;
|
|
190
|
-
// pkt.fname = self.efi_filename // vecchio
|
|
191
|
-
/*
|
|
192
|
-
console.log('====================================')
|
|
193
|
-
console.log('pkt: ' + JSON.stringify(pkt, '', 3))
|
|
194
|
-
console.log('====================================')
|
|
195
|
-
console.log('offer: ' + JSON.stringify(offer, '', 3))
|
|
196
|
-
console.log('====================================')
|
|
197
|
-
*/
|
|
198
|
-
}
|
|
199
|
-
else if (arch.indexOf('00006') === 15) {
|
|
200
|
-
pkt.fname = self.efi32_filename;
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
pkt.fname = self.bios_filename;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return self.p.ack(pkt, offer);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
*
|
|
211
|
-
*/
|
|
212
|
-
util.inherits(dhcpd, ee);
|
|
213
|
-
/**
|
|
214
|
-
*
|
|
215
|
-
* @param {*} pkt
|
|
216
|
-
* @param {*} opt
|
|
217
|
-
* @returns
|
|
218
|
-
*/
|
|
219
|
-
function _get_option(pkt, opt) {
|
|
220
|
-
return (opt in pkt.options) ? pkt.options[opt] : undefined;
|
|
221
|
-
}
|
|
222
|
-
module.exports = dhcpd;
|