penguins-eggs 9.2.4 → 9.2.6

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/README.md CHANGED
@@ -45,8 +45,8 @@ You can read more on the [blog](https://penguins-eggs.net/2021/11/02/distros-tha
45
45
 
46
46
  # Features
47
47
 
48
- ## helper: mom and dad
49
- I've added two lightweight assistants integrated with eggs: mom and dad. While mom is a bash script with whiptail - and guides the user to the various commands and documentation, dad started as a short way to create isos. All you have to do is type **sudo eggs dad** and follow simple instructions. You can also shortcut the way to reset the configuration **sudo dad -c** or - even faster - reset the configuration, load defaults, kill created isos: simply type **sudo eggs dad -d** and you will immediately be able to produce the egg in the default /home/eggs nest.
48
+ ## cuckoo (PXE server)
49
+ The cuckoo lays its eggs in the nests of other birds, and the eggs are hatched by the latter. Similarly eggs can start a self-configuring PXE service to allow you to boot and install your iso on third party networked computers. Command cuckoo can be used either to deploy a newly created iso on an installed system or by live booting the iso itself.
50
50
 
51
51
  ## backup/clone
52
52
 
@@ -56,21 +56,21 @@ We have two methods to save in the live system all our data: clone and backup.
56
56
 
57
57
  ```eggs produces --fast --backup``` saves our data within the generated iso using a LUKS volume. Our data will NOT be visible in the live system but can be reinstalled automatically with krill installer. Even having the generated image available, our data will be protected by the LUKS passphrase.
58
58
 
59
- * ```eggs produce``` just users accounts and homes.
59
+ * ```eggs produce``` this is the default: all private data are removed on the live.
60
60
  * ```eggs produce --clone``` include all users data UNCRYPTED directly on the live.
61
61
  * ```eggs produce --backup``` include all users data CRYPTED on a LUKS volume inside the iso.
62
62
 
63
- **NOTE:**
64
- Using ```sudo eggs install``` will automaticaly restore your CRYPTED backup automatically. Of course the original passphrase will be request.
65
-
66
- ## cuckoo
67
- The cuckoo lays its eggs in the nests of other birds, and the eggs are hatched by the latter. Similarly eggs can start a self-configuring PXE service to allow you to boot and install your iso on third party networked computers. Command cuckoo can be used either to deploy a newly created iso on an installed system or by live booting the iso itself.
63
+ Using ```sudo eggs install --cli``` will automaticaly restore your CRYPTED backup automatically during the installation.
68
64
 
69
65
  ## yolk
70
66
  yolk - so called staying on the subject of eggs - is a local repository included in the livecd that contains a minimum of indispensable packages during installation. Thanks to yolk, you can safely install your system without the need of an active internet connection. Yolk, It is used only for Debian families and derivated.
71
67
 
72
- ## krill installer
73
- eggs include a CLI installer named krill, this let you to produce and install servers configurations. krill use a nice TUI interface using the same, configuration created by eggs for [calamares](calamares.io). This lead to have "about the same" experience installing, from old distros to new ones and for GUI and CLI. It's possible with krill to do unattended installations, simply add ```--unattended``` flag and the values in ```/etc/penguins-eggs.d/krill.yaml``` will be used for installation.
68
+ ## GUI calamares or TUI krill installer
69
+ eggs include a TUI installer named krill, this let you to produce and install servers configurations. krill use a nice TUI interface using the same, configuration created by eggs for [calamares](calamares.io). This lead to have "about the same" experience installing, from old distros to new ones and for GUI and CLI. It's possible with krill to do unattended installations, simply add ```--unattended``` flag and the values in ```/etc/penguins-eggs.d/krill.yaml``` will be used for installation.
70
+
71
+ ## helper: mom and dad
72
+ I've added two lightweight assistants integrated with eggs: mom and dad. While mom is a bash script with whiptail - and guides the user to the various commands and documentation, dad started as a short way to create isos. All you have to do is type **sudo eggs dad** and follow simple instructions. You can also shortcut the way to reset the configuration **sudo dad -c** or - even faster - reset the configuration, load defaults, kill created isos: simply type **sudo eggs dad -d** and you will immediately be able to produce the egg in the default /home/eggs nest.
73
+
74
74
 
75
75
  ## addons and themes
76
76
  Addons are used mostly to let third parties to develop extensions. Note that currently we have an extension for the theme that includes both branding calamares, link and installer icon. In addition, also as an addon has been developed choose between GUI or CLI installation, adapt the video resolution, link to remote support, etc.
@@ -197,7 +197,7 @@ DESCRIPTION
197
197
  adapt monitor resolution for VM only
198
198
  ```
199
199
 
200
- _See code: [src/commands/adapt.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/adapt.ts)_
200
+ _See code: [src/commands/adapt.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/adapt.ts)_
201
201
 
202
202
  ## `eggs analyze`
203
203
 
@@ -218,7 +218,7 @@ EXAMPLES
218
218
  $ sudo eggs analyze
219
219
  ```
220
220
 
221
- _See code: [src/commands/analyze.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/analyze.ts)_
221
+ _See code: [src/commands/analyze.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/analyze.ts)_
222
222
 
223
223
  ## `eggs autocomplete [SHELL]`
224
224
 
@@ -276,7 +276,7 @@ EXAMPLES
276
276
  install calamares and create it's configuration's files
277
277
  ```
278
278
 
279
- _See code: [src/commands/calamares.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/calamares.ts)_
279
+ _See code: [src/commands/calamares.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/calamares.ts)_
280
280
 
281
281
  ## `eggs config`
282
282
 
@@ -300,7 +300,7 @@ EXAMPLES
300
300
  Configure and install prerequisites deb packages to run it
301
301
  ```
302
302
 
303
- _See code: [src/commands/config.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/config.ts)_
303
+ _See code: [src/commands/config.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/config.ts)_
304
304
 
305
305
  ## `eggs cuckoo`
306
306
 
@@ -308,11 +308,11 @@ cuckoo start a PXE boot server serving the live image
308
308
 
309
309
  ```
310
310
  USAGE
311
- $ eggs cuckoo [-f] [-h] [-v]
311
+ $ eggs cuckoo [-r] [-h] [-v]
312
312
 
313
313
  FLAGS
314
- -f, --full
315
314
  -h, --help Show CLI help.
315
+ -r, --real start a real dhcp server
316
316
  -v, --verbose verbose
317
317
 
318
318
  DESCRIPTION
@@ -323,7 +323,7 @@ EXAMPLES
323
323
  start a PXE boot server
324
324
  ```
325
325
 
326
- _See code: [src/commands/cuckoo.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/cuckoo.ts)_
326
+ _See code: [src/commands/cuckoo.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/cuckoo.ts)_
327
327
 
328
328
  ## `eggs dad`
329
329
 
@@ -343,7 +343,7 @@ DESCRIPTION
343
343
  ask help from daddy - configuration helper
344
344
  ```
345
345
 
346
- _See code: [src/commands/dad.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/dad.ts)_
346
+ _See code: [src/commands/dad.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/dad.ts)_
347
347
 
348
348
  ## `eggs export deb`
349
349
 
@@ -424,10 +424,11 @@ command-line system installer - the egg became a penguin!
424
424
 
425
425
  ```
426
426
  USAGE
427
- $ eggs install [-u] [-k] [-p] [-h] [-v]
427
+ $ eggs install [-u] [-i] [-k] [-p] [-h] [-v]
428
428
 
429
429
  FLAGS
430
430
  -h, --help Show CLI help.
431
+ -i, --ip add ip to hostname
431
432
  -k, --crypted crypted CLI installation
432
433
  -p, --pve Proxmox VE install
433
434
  -u, --unattended unattended CLI installation
@@ -441,7 +442,7 @@ EXAMPLES
441
442
  Install the system using krill installer
442
443
  ```
443
444
 
444
- _See code: [src/commands/install.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/install.ts)_
445
+ _See code: [src/commands/install.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/install.ts)_
445
446
 
446
447
  ## `eggs kill`
447
448
 
@@ -463,7 +464,7 @@ EXAMPLES
463
464
  kill the eggs/free the nest
464
465
  ```
465
466
 
466
- _See code: [src/commands/kill.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/kill.ts)_
467
+ _See code: [src/commands/kill.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/kill.ts)_
467
468
 
468
469
  ## `eggs mom`
469
470
 
@@ -480,7 +481,7 @@ DESCRIPTION
480
481
  ask for mommy - gui helper
481
482
  ```
482
483
 
483
- _See code: [src/commands/mom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/mom.ts)_
484
+ _See code: [src/commands/mom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/mom.ts)_
484
485
 
485
486
  ## `eggs produce`
486
487
 
@@ -542,7 +543,7 @@ EXAMPLES
542
543
  in /home/eggs/ovarium and you can customize all you need
543
544
  ```
544
545
 
545
- _See code: [src/commands/produce.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/produce.ts)_
546
+ _See code: [src/commands/produce.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/produce.ts)_
546
547
 
547
548
  ## `eggs status`
548
549
 
@@ -560,7 +561,7 @@ DESCRIPTION
560
561
  informations about eggs status
561
562
  ```
562
563
 
563
- _See code: [src/commands/status.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/status.ts)_
564
+ _See code: [src/commands/status.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/status.ts)_
564
565
 
565
566
  ## `eggs syncfrom`
566
567
 
@@ -584,7 +585,7 @@ EXAMPLES
584
585
  $ sudo eggs restore
585
586
  ```
586
587
 
587
- _See code: [src/commands/syncfrom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/syncfrom.ts)_
588
+ _See code: [src/commands/syncfrom.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/syncfrom.ts)_
588
589
 
589
590
  ## `eggs syncto`
590
591
 
@@ -607,7 +608,7 @@ EXAMPLES
607
608
  $ sudo eggs syncto
608
609
  ```
609
610
 
610
- _See code: [src/commands/syncto.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/syncto.ts)_
611
+ _See code: [src/commands/syncto.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/syncto.ts)_
611
612
 
612
613
  ## `eggs tools clean`
613
614
 
@@ -702,7 +703,7 @@ EXAMPLES
702
703
  update/upgrade the penguin's eggs tool
703
704
  ```
704
705
 
705
- _See code: [src/commands/update.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.4/src/commands/update.ts)_
706
+ _See code: [src/commands/update.ts](https://github.com/pieroproietti/penguins-eggs/blob/v9.2.6/src/commands/update.ts)_
706
707
 
707
708
  ## `eggs version`
708
709
 
@@ -1,8 +1,46 @@
1
- # Debian buster, Debian bullseye, Devuan beowulf
2
- # settings
1
+ # Debian jessie, stretch
3
2
  ---
4
3
  # "local" is LIBDIR/calamares/modules with settings in SHARE/calamares/modules
5
- modules-search: [local, /usr/lib/calamares/modules]
4
+ modules-search: [ local, /usr/lib/calamares/modules ]
5
+
6
+ # If this is set to true, Calamares refers to itself as a "setup program"
7
+ # rather than an "installer". Defaults to the value of dont-chroot, but
8
+ # Calamares will complain if this is not explicitly set.
9
+ oem-setup: false
10
+
11
+ # If this is set to true, the "Cancel" button will be disabled entirely.
12
+ # The button is also hidden from view.
13
+ #
14
+ # This can be useful if when e.g. Calamares is used as a post-install
15
+ # configuration tool and you require the user to go through all the
16
+ # configuration steps.
17
+ #
18
+ # Default is false, but Calamares will complain if this is not explicitly set.
19
+ #
20
+ # YAML: boolean.
21
+ disable-cancel: false
22
+
23
+ # If this is set to true, the "Cancel" button will be disabled once
24
+ # you start the 'Installation', meaning there won't be a way to cancel
25
+ # the Installation until it has finished or installation has failed.
26
+ #
27
+ # Default is false, but Calamares will complain if this is not explicitly set.
28
+ #
29
+ # YAML: boolean.
30
+ disable-cancel-during-exec: false
31
+
32
+ # If this is set to true, then once the end of the sequence has
33
+ # been reached, the quit (done) button is clicked automatically
34
+ # and Calamares will close. Default is false: the user will see
35
+ # that the end of installation has been reached, and that things are ok.
36
+ #
37
+ #
38
+ quit-at-end: false
39
+
40
+ instances:
41
+ - id: cleanup
42
+ module: shellprocess
43
+ config: shellprocess_cleanup.conf
6
44
 
7
45
  sequence:
8
46
  # Phase 1 - prepare.
@@ -14,7 +52,7 @@ sequence:
14
52
  - locale
15
53
  - keyboard
16
54
  - partition
17
- - users
55
+ {{createUsers}}users
18
56
  - summary
19
57
 
20
58
  # Phase 2 - install.
@@ -27,17 +65,18 @@ sequence:
27
65
  - partition
28
66
  - mount
29
67
  - unpackfs
68
+ # dpkg-unsafe-io
30
69
  - sources-yolk
31
- {{s}}machineid
70
+ {{hasSystemd}}machineid
32
71
  - fstab
33
72
  - locale
34
73
  - keyboard
35
74
  - localecfg
36
- - users
37
- - displaymanager
75
+ {{createUsers}}users
76
+ {{hasDisplaymanager}}displaymanager
38
77
  - networkcfg
39
78
  - hwclock
40
- {{s}}services-systemd
79
+ {{hasSystemd}}services-systemd
41
80
  - bootloader-config
42
81
  - grubcfg
43
82
  - bootloader
@@ -46,6 +85,7 @@ sequence:
46
85
  - plymouthcfg
47
86
  - initramfscfg
48
87
  - initramfs
88
+ # dpkg-unsafe-io-undo
49
89
  - removeuser
50
90
  - sources-yolk-unmount
51
91
  - cleanup
@@ -88,4 +128,3 @@ prompt-install: false
88
128
  #
89
129
  # YAML: boolean.
90
130
  dont-chroot: false
91
-
@@ -120,6 +120,7 @@ class Distro {
120
120
  this.distroLike = 'Debian';
121
121
  this.codenameLikeId = 'jessie';
122
122
  this.liveMediumPath = '/lib/live/mount/medium/';
123
+ this.isCalamaresAvailable = false;
123
124
  break;
124
125
  }
125
126
  case 'stretch': {
@@ -127,6 +128,7 @@ class Distro {
127
128
  this.distroLike = 'Debian';
128
129
  this.codenameLikeId = 'stretch';
129
130
  this.liveMediumPath = '/lib/live/mount/medium/';
131
+ this.isCalamaresAvailable = false;
130
132
  break;
131
133
  }
132
134
  case 'buster': {
@@ -30,7 +30,7 @@ class Jessie {
30
30
  this.distro = distro;
31
31
  this.user_opt = user_opt;
32
32
  this.verbose = verbose;
33
- this.release = release;
33
+ this.release = release; // nel senso di --final
34
34
  }
35
35
  /**
36
36
  *
@@ -18,8 +18,8 @@ class Fisherman {
18
18
  constructor(distro, installer, verbose = false) {
19
19
  this.installer = {};
20
20
  this.verbose = false;
21
- this.installer = installer;
22
21
  this.distro = distro;
22
+ this.installer = installer;
23
23
  this.verbose = verbose;
24
24
  }
25
25
  /**
@@ -11,32 +11,54 @@ export default class Pxe {
11
11
  verbose: boolean;
12
12
  echo: {};
13
13
  settings: Settings;
14
- mainLabel: string;
14
+ bootLabel: string;
15
15
  pxeRoot: string;
16
16
  isoRoot: string;
17
- isos: string[];
18
17
  vmlinuz: string;
19
18
  initrd: string;
19
+ isos: string[];
20
20
  /**
21
21
  * fertilization()
22
22
  */
23
23
  fertilization(): Promise<void>;
24
24
  /**
25
- * structure
25
+ * build
26
26
  */
27
- structure(): Promise<void>;
27
+ build(): Promise<void>;
28
+ /**
29
+ * configure PXE bios
30
+ */
31
+ bios(): Promise<void>;
32
+ /**
33
+ * configure PXE UEFI
34
+ */
35
+ uefi(): Promise<void>;
36
+ /**
37
+ * configure PXE html
38
+ */
39
+ html(): Promise<void>;
28
40
  /**
29
41
  *
42
+ * @param real
30
43
  */
31
- dnsMasq(full?: boolean): Promise<void>;
44
+ dhcp(real?: boolean, dnsmasq?: boolean): Promise<void>;
32
45
  /**
33
- *
34
- * @param cmd
35
- */
36
- tryCatch(cmd?: string): Promise<void>;
46
+ *
47
+ */
48
+ private nodeDhcp;
49
+ /**
50
+ *
51
+ * @param real
52
+ */
53
+ private dnsmasq;
37
54
  /**
38
55
  * start http server for images
39
56
  *
40
57
  */
41
58
  httpStart(): Promise<void>;
59
+ /**
60
+ *
61
+ * @param cmd
62
+ */
63
+ tryCatch(cmd?: string): Promise<void>;
42
64
  }
@@ -6,16 +6,14 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const tslib_1 = require("tslib");
9
- const os_1 = tslib_1.__importDefault(require("os"));
10
9
  const fs_1 = tslib_1.__importDefault(require("fs"));
11
10
  const netmask_1 = require("netmask");
11
+ const node_static_1 = tslib_1.__importDefault(require("node-static"));
12
+ const http_1 = tslib_1.__importDefault(require("http"));
13
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
12
14
  const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
13
15
  const settings_1 = tslib_1.__importDefault(require("../classes/settings"));
14
- const http_1 = tslib_1.__importDefault(require("http"));
15
- const node_static_1 = tslib_1.__importDefault(require("node-static"));
16
16
  const utils_2 = require("../lib/utils");
17
- const node_path_1 = tslib_1.__importDefault(require("node:path"));
18
- const distro_1 = tslib_1.__importDefault(require("./distro"));
19
17
  /**
20
18
  * Pxe:
21
19
  */
@@ -24,12 +22,12 @@ class Pxe {
24
22
  this.verbose = false;
25
23
  this.echo = {};
26
24
  this.settings = {};
27
- this.mainLabel = '';
25
+ this.bootLabel = '';
28
26
  this.pxeRoot = '';
29
27
  this.isoRoot = '';
30
- this.isos = [];
31
28
  this.vmlinuz = '';
32
29
  this.initrd = '';
30
+ this.isos = [];
33
31
  }
34
32
  /**
35
33
  * fertilization()
@@ -83,29 +81,45 @@ class Pxe {
83
81
  /**
84
82
  * bootLabel
85
83
  */
86
- this.mainLabel = this.settings.config.snapshot_prefix + utils_1.default.getVolid(os_1.default.hostname());
84
+ const a = fs_1.default.readFileSync(this.isoRoot + '/.disk/mkisofs', "utf-8");
85
+ const b = a.substring(a.indexOf('-o ') + 3);
86
+ const c = b.substring(0, b.indexOf(' '));
87
+ this.bootLabel = c.substring(c.lastIndexOf('/') + 1);
87
88
  }
88
89
  /**
89
- * structure
90
+ * build
90
91
  */
91
- async structure() {
92
+ async build() {
92
93
  if (fs_1.default.existsSync(this.pxeRoot)) {
93
94
  await this.tryCatch(`rm ${this.pxeRoot} -rf`);
94
95
  }
95
96
  let cmd = `mkdir -p ${this.pxeRoot}`;
96
97
  await this.tryCatch(cmd);
97
- const distro = new distro_1.default();
98
98
  await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
99
- // boot efi isolinux live .disk
100
- await this.tryCatch(`ln -s ${this.isoRoot}boot ${this.pxeRoot}/boot`);
101
- await this.tryCatch(`ln -s ${this.isoRoot}efi ${this.pxeRoot}/efi`);
102
- await this.tryCatch(`ln -s ${this.isoRoot}isolinux ${this.pxeRoot}/isolinux`);
103
99
  await this.tryCatch(`ln -s ${this.isoRoot}live ${this.pxeRoot}/live`);
104
100
  await this.tryCatch(`ln -s ${this.isoRoot}.disk ${this.pxeRoot}/.disk`);
101
+ // Qua copio vmlinuz e initrd per renderli scrivibili
102
+ await this.tryCatch(`cp ${this.isoRoot}live/${this.vmlinuz} ${this.pxeRoot}/vmlinuz`);
103
+ await this.tryCatch(`chmod 777 ${this.pxeRoot}/vmlinuz`);
104
+ await this.tryCatch(`cp ${this.isoRoot}live/${this.initrd} ${this.pxeRoot}/initrd`);
105
+ await this.tryCatch(`chmod 777 ${this.pxeRoot}/initrd`);
106
+ // link iso images in pxe
107
+ for (const iso of this.isos) {
108
+ await this.tryCatch(`ln /home/eggs/${iso} ${this.pxeRoot}/${iso}`);
109
+ }
110
+ await this.bios();
111
+ await this.uefi();
112
+ await this.html();
113
+ }
114
+ /**
115
+ * configure PXE bios
116
+ */
117
+ async bios() {
105
118
  // isolinux.theme.cfg, splash.png MUST to be on root
106
119
  await this.tryCatch(`ln -s ${this.isoRoot}isolinux/isolinux.theme.cfg ${this.pxeRoot}/isolinux.theme.cfg`);
107
120
  await this.tryCatch(`ln -s ${this.isoRoot}isolinux/splash.png ${this.pxeRoot}/splash.png`);
108
121
  // pxe
122
+ const distro = this.settings.distro;
109
123
  await this.tryCatch(`ln ${distro.pxelinuxPath}pxelinux.0 ${this.pxeRoot}/pxelinux.0`);
110
124
  await this.tryCatch(`ln ${distro.pxelinuxPath}lpxelinux.0 ${this.pxeRoot}/lpxelinux.0`);
111
125
  // syslinux
@@ -115,10 +129,6 @@ class Pxe {
115
129
  await this.tryCatch(`ln ${distro.syslinuxPath}libutil.c32 ${this.pxeRoot}/libutil.c32`);
116
130
  await this.tryCatch(`ln /usr/lib/syslinux/memdisk ${this.pxeRoot}/memdisk`);
117
131
  await this.tryCatch(`mkdir ${this.pxeRoot}/pxelinux.cfg`);
118
- // link iso images in pxe
119
- for (const iso of this.isos) {
120
- await this.tryCatch(`ln /home/eggs/${iso} ${this.pxeRoot}/${iso}`);
121
- }
122
132
  let content = ``;
123
133
  content += `# eggs: pxelinux.cfg/default\n`;
124
134
  content += `# search path for the c32 support libraries (libcom32, libutil etc.)\n`;
@@ -131,24 +141,106 @@ class Pxe {
131
141
  content += `TIMEOUT 0\n`;
132
142
  content += `\n`;
133
143
  content += `LABEL http\n`;
134
- content += `MENU LABEL ${this.mainLabel}\n`;
144
+ content += `MENU LABEL ${this.bootLabel}\n`;
135
145
  content += `MENU DEFAULT\n`;
136
- content += `KERNEL http://${utils_1.default.address()}/live/${this.vmlinuz}\n`;
137
- content += `APPEND initrd=http://${utils_1.default.address()}/live/${this.initrd} boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs\n`;
146
+ let clid = this.settings.distro.codenameLikeId;
147
+ if (clid === 'bionic' || clid === 'stretch' || clid === 'jessie') {
148
+ content += `KERNEL vmlinuz\n`;
149
+ content += `APPEND initrd=initrd boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs\n`;
150
+ }
151
+ else {
152
+ content += `KERNEL http://${utils_1.default.address()}/vmlinuz\n`;
153
+ content += `APPEND initrd=http://${utils_1.default.address()}/initrd boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs\n`;
154
+ }
138
155
  content += `SYSAPPEND 3\n`;
139
156
  content += `\n`;
140
- content += `MENU SEPARATOR\n`;
141
- for (const iso of this.isos) {
142
- content += `\n`;
143
- content += `LABEL isos\n`;
144
- content += `MENU LABEL ${iso}\n`;
145
- content += `KERNEL memdisk\n`;
146
- content += `APPEND iso initrd=http://${utils_1.default.address()}/${iso}\n`;
157
+ if (this.isos.length > 0) {
158
+ content += `MENU SEPARATOR\n`;
159
+ for (const iso of this.isos) {
160
+ content += `\n`;
161
+ content += `LABEL isos\n`;
162
+ content += `MENU LABEL memdisk ${iso}\n`;
163
+ content += `KERNEL memdisk\n`;
164
+ content += `APPEND iso initrd=http://${utils_1.default.address()}/${iso}\n`;
165
+ }
147
166
  }
148
167
  let file = `${this.pxeRoot}/pxelinux.cfg/default`;
149
168
  fs_1.default.writeFileSync(file, content);
150
- file = `${this.pxeRoot}/index.html`;
151
- content = ``;
169
+ }
170
+ /**
171
+ * configure PXE UEFI
172
+ */
173
+ async uefi() {
174
+ await this.tryCatch(`mkdir ${this.pxeRoot}/grub`);
175
+ if (fs_1.default.existsSync('/usr/share/grub/unicode.pf2')) {
176
+ await this.tryCatch(`ln -s /usr/share/grub/unicode.pf2 ${this.pxeRoot}grub/font.pf2`);
177
+ }
178
+ // Copia spash.png, theme.cfg in /grub
179
+ await this.tryCatch(`ln -s ${this.isoRoot}boot/grub/splash.png ${this.pxeRoot}/grub/splash.png`);
180
+ await this.tryCatch(`ln -s ${this.isoRoot}boot/grub/theme.cfg ${this.pxeRoot}/grub/theme.cfg`);
181
+ // UEFI: /usr/lib/shim/shimx64.efi.signed
182
+ await this.tryCatch(`ln -s /usr/lib/shim/shimx64.efi.signed ${this.pxeRoot}/bootx64.efi`);
183
+ // UEFI: /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed
184
+ await this.tryCatch(`ln -s /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed ${this.pxeRoot}/grubx64.efi`);
185
+ /**
186
+ * creating /grub/grub.cfg
187
+ */
188
+ let grubContent = '';
189
+ grubContent += `set default="0"\n`;
190
+ grubContent += `set timeout=-1\n`;
191
+ grubContent += `\n`;
192
+ grubContent += `if loadfont unicode ; then\n`;
193
+ grubContent += ` set gfxmode=auto\n`;
194
+ grubContent += ` set locale_dir=$prefix/locale\n`;
195
+ grubContent += ` set lang=en_US\n`;
196
+ grubContent += `fi\n`;
197
+ grubContent += `terminal_output gfxterm\n`;
198
+ grubContent += `\n`;
199
+ grubContent += `set menu_color_normal=white/black\n`;
200
+ grubContent += `set menu_color_highlight=black/light-gray\n`;
201
+ grubContent += `if background_color 44,0,30; then\n`;
202
+ grubContent += ` clear\n`;
203
+ grubContent += `fi\n`;
204
+ grubContent += `\n`;
205
+ grubContent += `function gfxmode {\n`;
206
+ grubContent += `\n`;
207
+ grubContent += ` set gfxpayload="${1}"\n`;
208
+ grubContent += ` if [ "${1}" = "keep" ]; then\n`;
209
+ grubContent += ` set vt_handoff=vt.handoff=7\n`;
210
+ grubContent += ` else\n`;
211
+ grubContent += ` set vt_handoff=\n`;
212
+ grubContent += ` fi\n`;
213
+ grubContent += `}\n`;
214
+ grubContent += `set linux_gfx_mode=keep\n`;
215
+ grubContent += `\n`;
216
+ grubContent += `export linux_gfx_mode\n`;
217
+ grubContent += `\n`;
218
+ grubContent += `if loadfont $prefix/font.pf2 ; then\n`;
219
+ grubContent += ` set gfxmode=640x480\n`;
220
+ grubContent += ` insmod efi_gop\n`;
221
+ grubContent += ` insmod efi_uga\n`;
222
+ grubContent += ` insmod video_bochs\n`;
223
+ grubContent += ` insmod video_cirrus\n`;
224
+ grubContent += ` insmod gfxterm\n`;
225
+ grubContent += ` insmod jpeg\n`;
226
+ grubContent += ` insmod png\n`;
227
+ grubContent += ` terminal_output gfxterm\n`;
228
+ grubContent += `fi\n`;
229
+ grubContent += `set theme=/grub/theme.cfg\n`;
230
+ grubContent += `menuentry '${this.bootLabel}' {\n`;
231
+ grubContent += ` gfxmode $linux_gfx_mode\n`;
232
+ grubContent += ` linuxefi vmlinuz boot=live config noswap noprompt fetch=http://${utils_1.default.address()}/live/filesystem.squashfs quiet splash sysappend 0x40000\n`;
233
+ grubContent += ` initrdefi initrd\n`;
234
+ grubContent += `}\n`;
235
+ let grubFile = `${this.pxeRoot}grub/grub.cfg`;
236
+ fs_1.default.writeFileSync(grubFile, grubContent);
237
+ }
238
+ /**
239
+ * configure PXE html
240
+ */
241
+ async html() {
242
+ let file = `${this.pxeRoot}/index.html`;
243
+ let content = ``;
152
244
  content += `<html><title>Penguin's eggs PXE server</title>`;
153
245
  content += `<div style="background-image:url('/splash.png');background-repeat:no-repeat;width: 640;height:480;padding:5px;border:1px solid black;">`;
154
246
  content += `<h1>Penguin's eggs PXE server</h1>`;
@@ -165,11 +257,41 @@ class Pxe {
165
257
  content += `discuss: <a href='https://t.me/penguins_eggs'>Telegram group<br/></body</html>`;
166
258
  fs_1.default.writeFileSync(file, content);
167
259
  }
260
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
261
+ //
262
+ // dncp: actually install and configure dnsmaq
263
+ //
264
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
265
+ /**
266
+ *
267
+ * @param real
268
+ */
269
+ async dhcp(real = false, dnsmasq = true) {
270
+ if (dnsmasq) {
271
+ await this.dnsmasq(real);
272
+ }
273
+ else {
274
+ await this.nodeDhcp(real);
275
+ }
276
+ }
277
+ /**
278
+ *
279
+ */
280
+ async nodeDhcp(real = false) {
281
+ console.log('to do!');
282
+ process.exit();
283
+ }
168
284
  /**
169
285
  *
286
+ * @param real
170
287
  */
171
- async dnsMasq(full = false) {
172
- await (0, utils_2.exec)(`systemctl stop dnsmasq.service`);
288
+ async dnsmasq(real = false) {
289
+ if (utils_1.default.isSystemd()) {
290
+ await (0, utils_2.exec)(`systemctl stop dnsmasq.service`);
291
+ }
292
+ else {
293
+ await (0, utils_2.exec)(`service dnsmasq stop`);
294
+ }
173
295
  let domain = `penguins-eggs.lan`;
174
296
  let n = new netmask_1.Netmask(`${utils_1.default.address()}/${utils_1.default.netmask()}`);
175
297
  let content = ``;
@@ -191,7 +313,8 @@ class Pxe {
191
313
  content += `# boot config for UEFI\n`;
192
314
  content += `dhcp-match=set:efi-x86_64,option:client-arch,7\n`;
193
315
  content += `dhcp-match=set:efi-x86_64,option:client-arch,9\n`;
194
- content += `dhcp-boot=tag:efi-x86_64,lpxelinux.0\n`;
316
+ content += `dhcp-boot=tag:efi-x86_64,/bootx64.efi\n`;
317
+ // Here we are OK Starting grub
195
318
  /**
196
319
  * https://thekelleys.org.uk/dnsmasq/CHANGELOG
197
320
  *
@@ -201,29 +324,27 @@ class Pxe {
201
324
  * interfering with proxy PXE subsystems when it is just
202
325
  * the DHCP server. Thanks to Spencer Clark for spotting this.
203
326
  */
204
- content += `pxe-service=X86PC,"penguin's eggs cuckoo",pxelinux.0\n`;
205
- if (full) {
327
+ const addZero = this.settings.distro.codenameId !== 'jessie';
328
+ if (addZero) {
329
+ content += `pxe-service=X86PC,"penguin's eggs cuckoo",lpxelinux.0\n`;
330
+ }
331
+ else {
332
+ content += `pxe-service=X86PC,"penguin's eggs cuckoo",lpxelinux\n`;
333
+ }
334
+ if (real) {
206
335
  content += `dhcp-range=${await utils_1.default.iface()},${n.first},${n.last},${n.mask},8h\n`;
207
336
  }
208
337
  else {
209
- content += `dhcp-range=${await utils_1.default.iface()},${utils_1.default.address()},proxy,${n.mask},${utils_1.default.broadcast()} # dhcp proxy\n`;
338
+ content += `dhcp-range=${await utils_1.default.iface()},${n.base},proxy,${n.mask},${n.broadcast} # dhcp proxy\n`;
210
339
  }
211
340
  let file = '/etc/dnsmasq.d/cuckoo.conf';
212
341
  fs_1.default.writeFileSync(file, content);
213
342
  // console.log(content)
214
- await (0, utils_2.exec)(`systemctl start dnsmasq.service`);
215
- }
216
- /**
217
- *
218
- * @param cmd
219
- */
220
- async tryCatch(cmd = '') {
221
- try {
222
- await (0, utils_2.exec)(cmd, this.echo);
343
+ if (utils_1.default.isSystemd()) {
344
+ await (0, utils_2.exec)(`systemctl start dnsmasq.service`);
223
345
  }
224
- catch (error) {
225
- console.log(`Error: ${error}`);
226
- await utils_1.default.pressKeyToExit(cmd);
346
+ else {
347
+ await (0, utils_2.exec)(`service dnsmasq start`);
227
348
  }
228
349
  }
229
350
  /**
@@ -238,5 +359,18 @@ class Pxe {
238
359
  file.serve(req, res);
239
360
  }).listen(port);
240
361
  }
362
+ /**
363
+ *
364
+ * @param cmd
365
+ */
366
+ async tryCatch(cmd = '') {
367
+ try {
368
+ await (0, utils_2.exec)(cmd, this.echo);
369
+ }
370
+ catch (error) {
371
+ console.log(`Error: ${error}`);
372
+ await utils_1.default.pressKeyToExit(cmd);
373
+ }
374
+ }
241
375
  }
242
376
  exports.default = Pxe;
@@ -15,7 +15,7 @@ export default class Cuckoo extends Command {
15
15
  work_dir: IWorkDir;
16
16
  static description: string;
17
17
  static flags: {
18
- full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
+ real: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
19
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
20
20
  verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
21
  };
@@ -28,7 +28,7 @@ class Cuckoo extends core_1.Command {
28
28
  const { flags } = await this.parse(Cuckoo);
29
29
  let verbose = flags.verbose;
30
30
  const echo = utils_1.default.setEcho(verbose);
31
- let full = flags.full;
31
+ let real = flags.real;
32
32
  const distro = new distro_1.default();
33
33
  if (distro.familyId === 'debian') {
34
34
  if (utils_1.default.isRoot()) {
@@ -47,8 +47,9 @@ class Cuckoo extends core_1.Command {
47
47
  }
48
48
  const pxe = new pxe_1.default();
49
49
  await pxe.fertilization();
50
- await pxe.structure();
51
- await pxe.dnsMasq(full);
50
+ await pxe.build();
51
+ let dnsmasq = true;
52
+ await pxe.dhcp(real, dnsmasq);
52
53
  await pxe.httpStart();
53
54
  console.log(`Serving PXE boot, read more at: http://${utils_1.default.address()}`);
54
55
  console.log(`CTRL-c to quit`);
@@ -62,7 +63,7 @@ class Cuckoo extends core_1.Command {
62
63
  exports.default = Cuckoo;
63
64
  Cuckoo.description = 'cuckoo start a PXE boot server serving the live image';
64
65
  Cuckoo.flags = {
65
- full: core_1.Flags.boolean({ char: 'f' }),
66
+ real: core_1.Flags.boolean({ char: 'r', description: 'start a real dhcp server' }),
66
67
  help: core_1.Flags.help({ char: 'h' }),
67
68
  verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
68
69
  };
@@ -11,6 +11,7 @@ import { Command } from '@oclif/core';
11
11
  export default class Install extends Command {
12
12
  static flags: {
13
13
  unattended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
+ ip: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
15
  crypted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
16
  pve: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
17
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
@@ -21,6 +21,7 @@ class Install extends core_1.Command {
21
21
  utils_1.default.titles(this.id + ' ' + this.argv);
22
22
  const { flags } = await this.parse(Install);
23
23
  let unattended = flags.unattended;
24
+ let ip = flags.ip;
24
25
  let crypted = flags.crypted;
25
26
  let pve = flags.pve;
26
27
  if (pve) {
@@ -30,7 +31,7 @@ class Install extends core_1.Command {
30
31
  if (utils_1.default.isRoot()) {
31
32
  if (utils_1.default.isLive()) {
32
33
  const krill = new krill_prepare_1.default();
33
- await krill.prepare(unattended, crypted, pve, verbose);
34
+ await krill.prepare(unattended, ip, crypted, pve, verbose);
34
35
  }
35
36
  else {
36
37
  utils_1.default.warning('You are in an installed system!');
@@ -44,6 +45,7 @@ class Install extends core_1.Command {
44
45
  exports.default = Install;
45
46
  Install.flags = {
46
47
  unattended: core_1.Flags.boolean({ char: 'u', description: 'unattended CLI installation' }),
48
+ ip: core_1.Flags.boolean({ char: 'i', description: 'add ip to hostname' }),
47
49
  crypted: core_1.Flags.boolean({ char: 'k', description: 'crypted CLI installation' }),
48
50
  pve: core_1.Flags.boolean({ char: 'p', description: 'Proxmox VE install' }),
49
51
  help: core_1.Flags.help({ char: 'h' }),
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name = 'calamares' oppure 'krill'
3
- * configuration = '/etc/calamares/' oppure '/etc/penguins-eggs.d/krill/'
3
+ * configuration = '/etc/calamares/' o '/etc/penguins-eggs.d/krill/'
4
4
  * modules = configuration + 'modules/'
5
5
  * modulesMultiarch = '/usr/lib/' + arch-linux-gnu + '/' + installer + '/'
6
6
  *
@@ -20,7 +20,7 @@ export default class Krill {
20
20
  /**
21
21
  * @param cryped
22
22
  */
23
- prepare(unattended?: boolean, cryped?: boolean, pve?: boolean, verbose?: boolean): Promise<void>;
23
+ prepare(unattended?: boolean, ip?: boolean, cryped?: boolean, pve?: boolean, verbose?: boolean): Promise<void>;
24
24
  /**
25
25
  * WELCOME
26
26
  */
@@ -79,7 +79,7 @@ class Krill {
79
79
  /**
80
80
  * @param cryped
81
81
  */
82
- async prepare(unattended = false, cryped = false, pve = false, verbose = false) {
82
+ async prepare(unattended = false, ip = false, cryped = false, pve = false, verbose = false) {
83
83
  /**
84
84
  * Check for disk presence
85
85
  */
@@ -142,6 +142,9 @@ class Krill {
142
142
  if (hostname === '') {
143
143
  hostname = shelljs_1.default.exec('cat /etc/hostname').trim();
144
144
  }
145
+ if (ip) {
146
+ hostname = 'ip-' + utils_1.default.address().replaceAll('.', '-');
147
+ }
145
148
  oUsers = {
146
149
  name: this.krillConfig.name,
147
150
  fullname: this.krillConfig.fullname,
@@ -434,13 +437,13 @@ class Krill {
434
437
  let summaryElem;
435
438
  let message = "";
436
439
  if (unattended) {
437
- message = "Unattended installation will start in 30 seconds, press CTRL-C to abort!";
440
+ message = "Unattended installation will start in 5 seconds, press CTRL-C to abort!";
438
441
  }
439
442
  while (true) {
440
443
  summaryElem = react_1.default.createElement(summary_1.default, { name: users.name, password: users.password, rootPassword: users.rootPassword, hostname: users.hostname, region: location.region, zone: location.zone, language: location.language, keyboardModel: keyboard.keyboardModel, keyboardLayout: keyboard.keyboardLayout, installationDevice: partitions.installationDevice, message: message });
441
444
  if (unattended) {
442
445
  redraw(summaryElem);
443
- await sleep(30000);
446
+ await sleep(5000);
444
447
  break;
445
448
  }
446
449
  else if (await confirm(summaryElem, "Confirm Summary datas?")) {
@@ -71,7 +71,6 @@ import setTimezone from './modules/set-timezone';
71
71
  import umount from './modules/umount';
72
72
  import mkfs from './modules/mkfs';
73
73
  import hostname from './modules/hostname';
74
- import hosts from './modules/hosts';
75
74
  /**
76
75
  * hatching: installazione o cova!!!
77
76
  */
@@ -104,7 +103,6 @@ export default class Sequence {
104
103
  umount: typeof umount;
105
104
  mkfs: typeof mkfs;
106
105
  hostname: typeof hostname;
107
- hosts: typeof hosts;
108
106
  installer: IInstaller;
109
107
  installTarget: string;
110
108
  verbose: boolean;
@@ -129,6 +127,7 @@ export default class Sequence {
129
127
  luksDevice: string;
130
128
  luksMountpoint: string;
131
129
  personalFile: string;
130
+ unattended: boolean;
132
131
  /**
133
132
  * constructor
134
133
  */
@@ -147,5 +146,5 @@ export default class Sequence {
147
146
  /**
148
147
  * only show the result
149
148
  */
150
- finished(unattended?: boolean): Promise<void>;
149
+ finished(): Promise<void>;
151
150
  }
@@ -60,7 +60,6 @@ const set_timezone_1 = tslib_1.__importDefault(require("./modules/set-timezone")
60
60
  const umount_1 = tslib_1.__importDefault(require("./modules/umount"));
61
61
  const mkfs_1 = tslib_1.__importDefault(require("./modules/mkfs"));
62
62
  const hostname_1 = tslib_1.__importDefault(require("./modules/hostname"));
63
- const hosts_1 = tslib_1.__importDefault(require("./modules/hosts"));
64
63
  /**
65
64
  * hatching: installazione o cova!!!
66
65
  */
@@ -108,7 +107,6 @@ class Sequence {
108
107
  this.umount = umount_1.default;
109
108
  this.mkfs = mkfs_1.default;
110
109
  this.hostname = hostname_1.default;
111
- this.hosts = hosts_1.default;
112
110
  this.installer = {};
113
111
  this.installTarget = '/tmp/calamares-krill-root';
114
112
  this.verbose = false;
@@ -133,6 +131,7 @@ class Sequence {
133
131
  this.luksDevice = '';
134
132
  this.luksMountpoint = '';
135
133
  this.personalFile = '';
134
+ this.unattended = false;
136
135
  this.installer = (0, installer_1.installer)();
137
136
  this.settings = new settings_1.default();
138
137
  this.language = location.language;
@@ -166,6 +165,7 @@ class Sequence {
166
165
  * @returns
167
166
  */
168
167
  async install(unattended = false, verbose = false) {
168
+ this.unattended = unattended;
169
169
  this.verbose = verbose;
170
170
  this.echo = utils_1.default.setEcho(this.verbose);
171
171
  if (this.verbose) {
@@ -322,16 +322,6 @@ class Sequence {
322
322
  catch (error) {
323
323
  await utils_1.default.pressKeyToExit(JSON.stringify(error));
324
324
  }
325
- // hosts
326
- message = "Creating hosts ";
327
- percent = 0.60;
328
- try {
329
- await redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
330
- await this.hosts();
331
- }
332
- catch (error) {
333
- await utils_1.default.pressKeyToExit(JSON.stringify(error));
334
- }
335
325
  // bootloader-config
336
326
  message = "bootloader-config ";
337
327
  percent = 0.62;
@@ -502,7 +492,7 @@ class Sequence {
502
492
  percent = 100.0;
503
493
  try {
504
494
  await redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
505
- await this.finished(unattended);
495
+ await this.finished();
506
496
  }
507
497
  catch (error) {
508
498
  await utils_1.default.pressKeyToExit(JSON.stringify(error));
@@ -526,9 +516,9 @@ class Sequence {
526
516
  /**
527
517
  * only show the result
528
518
  */
529
- async finished(unattended = false) {
519
+ async finished() {
530
520
  await redraw(react_1.default.createElement(finished_1.default, { installationDevice: this.partitions.installationDevice, hostName: this.users.hostname, userName: this.users.name }));
531
- if (!unattended) {
521
+ if (!this.unattended) {
532
522
  utils_1.default.pressKeyToExit('Press a key to reboot...');
533
523
  }
534
524
  shelljs_1.default.exec('reboot');
@@ -8,11 +8,41 @@
8
8
  * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- const utils_1 = require("../../lib/utils");
11
+ const tslib_1 = require("tslib");
12
+ const fs_1 = tslib_1.__importDefault(require("fs"));
12
13
  /**
13
14
  * hostname
14
15
  */
15
16
  async function hostname() {
16
- await (0, utils_1.exec)(`echo ${this.installTarget + '/etc/hostname'} > ${this.users.hostname} `, this.echo);
17
+ let hostname = this.users.hostname;
18
+ /**
19
+ * hostname
20
+ */
21
+ {
22
+ let file = this.installTarget + '/etc/hostname';
23
+ let text = hostname;
24
+ fs_1.default.writeFileSync(file, text);
25
+ }
26
+ /**
27
+ * hosts
28
+ */
29
+ {
30
+ let file = this.installTarget + '/etc/hosts';
31
+ let text = '127.0.0.1 localhost localhost.localdomain\n';
32
+ if (this.network.addressType === 'static') {
33
+ text += `${this.network.address} ${hostname} pvelocalhost\n`;
34
+ }
35
+ else {
36
+ text += `127.0.1.1 ${hostname} \n`;
37
+ }
38
+ text += `# The following lines are desirable for IPv6 capable hosts\n`;
39
+ text += `:: 1 ip6 - localhost ip6 - loopback\n`;
40
+ text += `fe00:: 0 ip6 - localnet\n`;
41
+ text += `ff00:: 0 ip6 - mcastprefix\n`;
42
+ text += `ff02:: 1 ip6 - allnodes\n`;
43
+ text += `ff02:: 2 ip6 - allrouters\n`;
44
+ text += `ff02:: 3 ip6 - allhosts\n`;
45
+ fs_1.default.writeFileSync(file, text);
46
+ }
17
47
  }
18
48
  exports.default = hostname;
@@ -13,8 +13,7 @@ const tslib_1 = require("tslib");
13
13
  const utils_1 = require("../../lib/utils");
14
14
  const utils_2 = tslib_1.__importDefault(require("../../classes/utils"));
15
15
  const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
16
- // import React from 'react';
17
- // import { render, RenderOptions } from 'ink'
16
+ const os_1 = tslib_1.__importDefault(require("os"));
18
17
  /**
19
18
  *
20
19
  * @param this
@@ -33,6 +32,18 @@ async function partition() {
33
32
  p = 'p';
34
33
  }
35
34
  const installMode = this.partitions.installationMode;
35
+ let swapSize = Math.round(os_1.default.totalmem() / 1073741824) * 1024;
36
+ if (this.partitions.userSwapChoice === 'none') {
37
+ swapSize = 0;
38
+ }
39
+ else if (this.partitions.userSwapChoice === 'small') {
40
+ }
41
+ else if (this.partitions.userSwapChoice === 'suspend') {
42
+ swapSize *= 2;
43
+ }
44
+ else if (this.partitions.userSwapChoice === 'file') {
45
+ swapSize = 0;
46
+ }
36
47
  if (installMode === 'standard' && !this.efi) {
37
48
  /**
38
49
  * ===========================================================================================
@@ -40,8 +51,8 @@ async function partition() {
40
51
  * ===========================================================================================
41
52
  */
42
53
  await (0, utils_1.exec)(`parted --script ${installDevice} mklabel msdos`, this.echo);
43
- await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 1MiB 8192MiB`, this.echo); //dev/sda1 swap
44
- await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 8192MiB 100%`, this.echo); //dev/sda2 root
54
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 1MiB ${swapSize + 1}MiB`, this.echo); //dev/sda1 swap
55
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 ${swapSize + 1}MiB 100%`, this.echo); //dev/sda2 root
45
56
  await (0, utils_1.exec)(`parted ${installDevice} set 1 boot on`, this.echo);
46
57
  await (0, utils_1.exec)(`parted ${installDevice} set 1 esp on`, this.echo);
47
58
  // SWAP
@@ -65,9 +76,9 @@ async function partition() {
65
76
  * ===========================================================================================
66
77
  */
67
78
  await (0, utils_1.exec)(`parted --script ${installDevice} mklabel msdos`, this.echo);
68
- await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 1MiB 512MiB`, this.echo); // sda1
69
- await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 512MiB 8704MiB`, this.echo); // sda2
70
- await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 8704MiB 100%`, this.echo); // sda3
79
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 1MiB 512MiB`, this.echo); // sda1
80
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 512MiB ${swapSize + 512}MiB`, this.echo); // sda2
81
+ await (0, utils_1.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 ${swapSize + 512}MiB 100%`, this.echo); // sda3
71
82
  await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
72
83
  await (0, utils_1.exec)(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
73
84
  // BOOT 512M
@@ -120,9 +131,9 @@ async function partition() {
120
131
  * ===========================================================================================
121
132
  */
122
133
  await (0, utils_1.exec)(`parted --script ${installDevice} mklabel gpt`, this.echo);
123
- await (0, utils_1.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
124
- await (0, utils_1.exec)(`parted --script ${installDevice} mkpart swap linux-swap 768MiB 8960MiB`, this.echo); // sda2 swap
125
- await (0, utils_1.exec)(`parted --script ${installDevice} mkpart root ext4 8960MiB 100%`, this.echo); // sda3 root
134
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
135
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart swap linux-swap 256MiB ${swapSize + 256}Mib`, this.echo); // sda2 swap
136
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart root ext4 ${swapSize + 256}MiB 100%`, this.echo); // sda3 root
126
137
  await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
127
138
  await (0, utils_1.exec)(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
128
139
  this.devices.efi.name = `${installDevice}${p}1`;
@@ -147,10 +158,10 @@ async function partition() {
147
158
  * ===========================================================================================
148
159
  */
149
160
  await (0, utils_1.exec)(`parted --script ${installDevice} mklabel gpt`, this.echo);
150
- await (0, utils_1.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
151
- await (0, utils_1.exec)(`parted --script ${installDevice} mkpart boot ext4 256MiB 768MiB`, this.echo); // sda2 boot
152
- await (0, utils_1.exec)(`parted --script ${installDevice} mkpart swap linux-swap 768MiB 8960MiB`, this.echo); // sda3 swap
153
- await (0, utils_1.exec)(`parted --script ${installDevice} mkpart root ext4 8960MiB 100%`, this.echo); // sda4 root
161
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, this.echo); // sda1 EFI
162
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart boot ext4 256MiB 768MiB`, this.echo); // sda2 boot
163
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart swap linux-swap 768MiB ${swapSize + 768}MiB`, this.echo); // sda3 swap
164
+ await (0, utils_1.exec)(`parted --script ${installDevice} mkpart root ext4 ${swapSize + 768}MiB 100%`, this.echo); // sda4 root
154
165
  await (0, utils_1.exec)(`parted --script ${installDevice} set 1 boot on`, this.echo); // sda1
155
166
  await (0, utils_1.exec)(`parted --script ${installDevice} set 1 esp on`, this.echo); // sda1
156
167
  // EFI 256M
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  const tslib_1 = require("tslib");
12
12
  const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
13
13
  const utils_2 = require("../../lib/utils");
14
+ const fs_1 = tslib_1.__importDefault(require("fs"));
14
15
  async function setKeyboard() {
15
16
  /**
16
17
  * influence: - /etc/default/keyboard (x11)
@@ -63,7 +64,10 @@ async function setKeyboard() {
63
64
  content += ` MatchIsKeyboard "on"\n`;
64
65
  content += ` Option "XkbLayout" "` + this.keyboardLayout + `"\n`;
65
66
  content += `EndSection\n`;
66
- utils_1.default.write(this.installTarget + '/etc/X11/xorg.conf.d/00-keyboard.conf', content);
67
+ // Not always exist /etc/X11/xorg.conf.d
68
+ if (fs_1.default.existsSync(`this.installTarget + '/etc/X11/xorg.conf.d`)) {
69
+ utils_1.default.write(this.installTarget + '/etc/X11/xorg.conf.d/00-keyboard.conf', content);
70
+ }
67
71
  }
68
72
  }
69
73
  exports.default = setKeyboard;
@@ -110,7 +110,7 @@ exports.remove = remove;
110
110
  */
111
111
  async function addMotd(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
112
112
  const fileMotd = `${chroot}/etc/motd`;
113
- let installer = 'sudo eggs krill';
113
+ let installer = 'sudo eggs install';
114
114
  if (pacman_1.default.packageIsInstalled('calamares')) {
115
115
  if (pacman_1.default.packageIsInstalled('plasma-desktop')) {
116
116
  installer = 'startplasma-wayland to run GUI and launch calamares, or from terminal sudo eggs krill -c';
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.2.4",
4
+ "version": "9.2.6",
5
5
  "author": "Piero Proietti @pieroproietti",
6
6
  "bin": {
7
7
  "eggs": "bin/run"
package/scripts/_eggs CHANGED
@@ -11,7 +11,7 @@ _eggs () {
11
11
  "analyze:analyze for syncto"
12
12
  "calamares:calamares or install or configure it"
13
13
  "config:Configure and install prerequisites deb packages to run it"
14
- "cuckoo:cuckoo start a boot server on the LAN sharing iso on the nest"
14
+ "cuckoo:cuckoo start a PXE boot server serving the live image"
15
15
  "dad:ask help from daddy - configuration helper"
16
16
  "export\:deb:export deb/docs/iso to the destination host"
17
17
  "export\:docs:remove and export docType documentation of the sources in the destination host"
@@ -33,8 +33,8 @@ _eggs () {
33
33
  "wardrobe\:list:list costumes and accessoires in wardrobe"
34
34
  "wardrobe\:show:show costumes/accessories in wardrobe"
35
35
  "wardrobe\:wear:wear costume/accessories from wardrobe"
36
- "help:Display help for <%= config.bin %>."
37
36
  "autocomplete:display autocomplete installation instructions"
37
+ "help:Display help for <%= config.bin %>."
38
38
  "version:"
39
39
  )
40
40
 
@@ -76,7 +76,8 @@ config)
76
76
 
77
77
  cuckoo)
78
78
  _command_flags=(
79
- "--help[Show CLI help.]"
79
+ "--real[start a real dhcp server]"
80
+ "--help[Show CLI help.]"
80
81
  "--verbose[verbose]"
81
82
  )
82
83
  ;;
@@ -263,15 +264,15 @@ wardrobe:wear)
263
264
  )
264
265
  ;;
265
266
 
266
- help)
267
+ autocomplete)
267
268
  _command_flags=(
268
- "--nested-commands[Include all nested commands in the output.]"
269
+ "--refresh-cache[Refresh cache (ignores displaying instructions)]"
269
270
  )
270
271
  ;;
271
272
 
272
- autocomplete)
273
+ help)
273
274
  _command_flags=(
274
- "--refresh-cache[Refresh cache (ignores displaying instructions)]"
275
+ "--nested-commands[Include all nested commands in the output.]"
275
276
  )
276
277
  ;;
277
278
 
package/scripts/eggs.bash CHANGED
@@ -15,7 +15,7 @@ adapt --verbose --help
15
15
  analyze --help --verbose
16
16
  calamares --help --verbose --install --release --remove --theme
17
17
  config --nointeractive --clean --help --verbose
18
- cuckoo --help --verbose
18
+ cuckoo --real --help --verbose
19
19
  dad --help --clean --default --verbose
20
20
  export:deb --help --clean --amd64 --i386 --armel --arm64 --all
21
21
  export:docs --help
@@ -37,8 +37,8 @@ wardrobe:ironing --wardrobe --verbose --help
37
37
  wardrobe:list --verbose --help
38
38
  wardrobe:show --wardrobe --json --verbose --help
39
39
  wardrobe:wear --wardrobe --no_accessories --no_firmwares --silent --verbose --help
40
- help --nested-commands
41
40
  autocomplete --refresh-cache
41
+ help --nested-commands
42
42
  version --json --verbose
43
43
  "
44
44
 
@@ -0,0 +1,39 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ # Sets up a tftp server to netboot x86_64 systems over UEFI.
6
+ # Works on Ubuntu 13.10 and later.
7
+
8
+ # change to the root of your tftp server
9
+ TFTPROOT=/var/lib/tftpboot
10
+
11
+ # needed for unpacking the shim-signed source package
12
+ apt-get install dpkg-dev
13
+
14
+ tmpdir=$(mktemp -d)
15
+
16
+ cleanup () {
17
+ if [ -n "$tmpdir" ]; then
18
+ rm -rf "$tmpdir"
19
+ fi
20
+ }
21
+
22
+ trap cleanup EXIT HUP INT QUIT PIPE TERM
23
+
24
+ cd "$tmpdir"
25
+ apt-get source shim-signed
26
+ cp shim-signed-*/shim.efi.signed "$TFTPROOT"/bootx64.efi
27
+
28
+ cd "$TFTPROOT"
29
+
30
+ wget -O grubx64.efi http://archive.ubuntu.com/ubuntu/dists/saucy/main/uefi/grub2-amd64/current/grubnetx64.efi.signed
31
+
32
+ # Unfortunately the unicode font is assembled by the grub2 package at
33
+ # build-time, so we can't grab it from the source; and we have no persistent
34
+ # URL for it since that changes with each version number; so try to install
35
+ # it (which should be a no-op on x86 anyway) and copy the contents.
36
+ apt-get install grub-common
37
+ mkdir -p grub/fonts
38
+ cp /usr/share/grub/unicode.pf2 grub/fonts
39
+
@@ -1,14 +0,0 @@
1
- /**
2
- * krill: module hosts
3
- *
4
- * author: Piero Proietti
5
- * mail: piero.proietti@gmail.com
6
- *
7
- * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
8
- */
9
- import Sequence from '../krill-sequence';
10
- /**
11
- * hosts
12
- * @param this
13
- */
14
- export default function hosts(this: Sequence): Promise<void>;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /**
3
- * krill: module hosts
4
- *
5
- * author: Piero Proietti
6
- * mail: piero.proietti@gmail.com
7
- *
8
- * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const tslib_1 = require("tslib");
12
- const fs_1 = tslib_1.__importDefault(require("fs"));
13
- /**
14
- * hosts
15
- * @param this
16
- */
17
- async function hosts() {
18
- const file = this.installTarget + '/etc/hosts';
19
- let text = '127.0.0.1 localhost localhost.localdomain\n';
20
- if (this.network.addressType === 'static') {
21
- text += `${this.network.address} ${this.users.hostname} pvelocalhost\n`;
22
- }
23
- else {
24
- text += `127.0.1.1 ${this.users.hostname} \n`;
25
- }
26
- text += `# The following lines are desirable for IPv6 capable hosts\n`;
27
- text += `:: 1 ip6 - localhost ip6 - loopback\n`;
28
- text += `fe00:: 0 ip6 - localnet\n`;
29
- text += `ff00:: 0 ip6 - mcastprefix\n`;
30
- text += `ff02:: 1 ip6 - allnodes\n`;
31
- text += `ff02:: 2 ip6 - allrouters\n`;
32
- text += `ff02:: 3 ip6 - allhosts\n`;
33
- fs_1.default.writeFileSync(file, text);
34
- }
35
- exports.default = hosts;