penguins-eggs 9.0.16 → 9.0.25
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 +43 -22
- package/addons/templates/grub.template +2 -0
- package/addons/{blissos → waydroid}/theme/applications/install-debian.desktop +0 -0
- package/addons/{blissos → waydroid}/theme/artwork/install-debian.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/branding.desc +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/languages.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/show.qml +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/slide1.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/slide2.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/slide3.png +0 -0
- package/addons/{blissos/theme/calamares/branding/blissos-logo.png → waydroid/theme/calamares/branding/waydroid-logo.png} +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/welcome.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/modules/partition.yml +0 -0
- package/addons/{blissos → waydroid}/theme/livecd/grub.theme.cfg +1 -1
- package/addons/{blissos → waydroid}/theme/livecd/isolinux.theme.cfg +1 -1
- package/addons/{blissos → waydroid}/theme/livecd/splash.png +0 -0
- package/lib/classes/incubation/incubator.js +5 -0
- package/lib/classes/krill_install.d.ts +48 -25
- package/lib/classes/krill_install.js +456 -185
- package/lib/classes/krill_prepare.d.ts +7 -3
- package/lib/classes/krill_prepare.js +35 -14
- package/lib/classes/ovary.js +6 -1
- package/lib/commands/install.d.ts +1 -0
- package/lib/commands/install.js +14 -3
- package/lib/commands/kill.js +1 -1
- package/lib/commands/produce.js +1 -1
- package/lib/components/partitions.d.ts +1 -2
- package/lib/components/partitions.js +1 -4
- package/lib/interfaces/i-devices.d.ts +1 -0
- package/lib/interfaces/i-krill.d.ts +0 -1
- package/lib/lib/cli-autologin.js +8 -3
- package/lib/lib/select_installation_mode.js +1 -1
- package/manpages/doc/man/eggs.html +65 -6
- package/oclif.manifest.json +1 -1
- package/package.json +13 -12
- package/scripts/_eggs +9 -8
- package/scripts/eggs.bash +3 -3
- /package/scripts/{not-used/pve-live.sh → pve-live.sh} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* penguins-eggs:
|
|
3
|
+
* penguins-eggs: krill_install
|
|
4
4
|
*
|
|
5
5
|
* author: Piero Proietti
|
|
6
6
|
* mail: piero.proietti@gmail.com
|
|
@@ -87,9 +87,23 @@ class Hatching {
|
|
|
87
87
|
async install(verbose = false) {
|
|
88
88
|
this.verbose = verbose;
|
|
89
89
|
await this.settings.load();
|
|
90
|
+
// partition
|
|
90
91
|
let percent = 0.0;
|
|
91
92
|
let message = "";
|
|
92
|
-
|
|
93
|
+
let isPartitioned = false;
|
|
94
|
+
message = "Creating partitions";
|
|
95
|
+
percent = 0.00;
|
|
96
|
+
try {
|
|
97
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
98
|
+
isPartitioned = await this.partition();
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
message += JSON.stringify(error);
|
|
102
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
103
|
+
await checkIt(message);
|
|
104
|
+
}
|
|
105
|
+
if (isPartitioned) {
|
|
106
|
+
// formatting
|
|
93
107
|
message = "Formatting file system ";
|
|
94
108
|
percent = 0.01;
|
|
95
109
|
try {
|
|
@@ -99,32 +113,32 @@ class Hatching {
|
|
|
99
113
|
catch (error) {
|
|
100
114
|
message += JSON.stringify(error);
|
|
101
115
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
116
|
+
await checkIt(message);
|
|
102
117
|
}
|
|
103
|
-
//
|
|
104
|
-
// mount
|
|
118
|
+
// mountFs
|
|
105
119
|
message = "Mounting target file system ";
|
|
106
120
|
percent = 0.03;
|
|
107
121
|
try {
|
|
108
122
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
109
|
-
await this.
|
|
123
|
+
await this.mountFs();
|
|
110
124
|
}
|
|
111
125
|
catch (error) {
|
|
112
126
|
message += JSON.stringify(error);
|
|
113
127
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
128
|
+
await checkIt(message);
|
|
114
129
|
}
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
message = "Mounting target file system vfs ";
|
|
130
|
+
// mountVfs
|
|
131
|
+
message = "Mounting on target VFS ";
|
|
118
132
|
percent = 0.06;
|
|
119
133
|
try {
|
|
120
134
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
121
|
-
await this.
|
|
135
|
+
await this.mountVfs();
|
|
122
136
|
}
|
|
123
137
|
catch (error) {
|
|
124
138
|
message += JSON.stringify(error);
|
|
125
139
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
140
|
+
await checkIt(message);
|
|
126
141
|
}
|
|
127
|
-
// await checkIt(message)
|
|
128
142
|
// unpackfs
|
|
129
143
|
message = "Unpacking filesystem ";
|
|
130
144
|
percent = 0.10;
|
|
@@ -135,23 +149,13 @@ class Hatching {
|
|
|
135
149
|
catch (error) {
|
|
136
150
|
message += JSON.stringify(error);
|
|
137
151
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
152
|
+
await checkIt(message);
|
|
138
153
|
}
|
|
139
|
-
// await checkIt(message)
|
|
140
|
-
/*
|
|
141
|
-
message = "Syncronize filesystem "
|
|
142
|
-
percent = 0.35
|
|
143
|
-
try {
|
|
144
|
-
redraw(<Install message={message} percent={percent} spinner={true} />)
|
|
145
|
-
await this.syncfs()
|
|
146
|
-
} catch (error) {
|
|
147
|
-
message += JSON.stringify(error)
|
|
148
|
-
redraw(<Install message={message} percent={percent} />)
|
|
149
|
-
}
|
|
150
|
-
*/
|
|
151
154
|
/**
|
|
152
|
-
* RESTORE USERS DATA
|
|
155
|
+
* IF RESTORE USERS DATA
|
|
153
156
|
*/
|
|
154
157
|
if (fs_1.default.existsSync(this.luksFile)) {
|
|
158
|
+
// restoring users data
|
|
155
159
|
message = "Restore private data from backup ";
|
|
156
160
|
percent = 0.37;
|
|
157
161
|
try {
|
|
@@ -161,8 +165,8 @@ class Hatching {
|
|
|
161
165
|
catch (error) {
|
|
162
166
|
message += JSON.stringify(error);
|
|
163
167
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
168
|
+
await checkIt(message);
|
|
164
169
|
}
|
|
165
|
-
// await checkIt(message)
|
|
166
170
|
}
|
|
167
171
|
// sources-yolk
|
|
168
172
|
message = 'sources-yolk';
|
|
@@ -174,8 +178,21 @@ class Hatching {
|
|
|
174
178
|
catch (error) {
|
|
175
179
|
message += JSON.stringify(error);
|
|
176
180
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
181
|
+
await checkIt(message);
|
|
182
|
+
}
|
|
183
|
+
// machineid
|
|
184
|
+
message = 'machineid';
|
|
185
|
+
percent = 0.41;
|
|
186
|
+
try {
|
|
187
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent, spinner: true }));
|
|
188
|
+
await this.machineId();
|
|
177
189
|
}
|
|
178
|
-
|
|
190
|
+
catch (error) {
|
|
191
|
+
message += JSON.stringify(error);
|
|
192
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
193
|
+
await checkIt(message);
|
|
194
|
+
}
|
|
195
|
+
// timezone
|
|
179
196
|
message = "Setting time zone ";
|
|
180
197
|
percent = 0.43;
|
|
181
198
|
try {
|
|
@@ -185,8 +202,9 @@ class Hatching {
|
|
|
185
202
|
catch (error) {
|
|
186
203
|
message += JSON.stringify(error);
|
|
187
204
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
205
|
+
await checkIt(message);
|
|
188
206
|
}
|
|
189
|
-
//
|
|
207
|
+
// fstab
|
|
190
208
|
message = "Creating fstab ";
|
|
191
209
|
percent = 0.47;
|
|
192
210
|
try {
|
|
@@ -196,8 +214,9 @@ class Hatching {
|
|
|
196
214
|
catch (error) {
|
|
197
215
|
message += JSON.stringify(error);
|
|
198
216
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
217
|
+
await checkIt(message);
|
|
199
218
|
}
|
|
200
|
-
//
|
|
219
|
+
// keyboard
|
|
201
220
|
message = "settings keyboard ";
|
|
202
221
|
percent = 0.48;
|
|
203
222
|
try {
|
|
@@ -206,8 +225,9 @@ class Hatching {
|
|
|
206
225
|
catch (error) {
|
|
207
226
|
message += JSON.stringify(error);
|
|
208
227
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
228
|
+
await checkIt(message);
|
|
209
229
|
}
|
|
210
|
-
//
|
|
230
|
+
// networkcfg
|
|
211
231
|
message = "networkcfg";
|
|
212
232
|
percent = 0.50;
|
|
213
233
|
try {
|
|
@@ -216,8 +236,9 @@ class Hatching {
|
|
|
216
236
|
catch (error) {
|
|
217
237
|
message += JSON.stringify(error);
|
|
218
238
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
239
|
+
await checkIt(message);
|
|
219
240
|
}
|
|
220
|
-
//
|
|
241
|
+
// hostname
|
|
221
242
|
message = "Create hostname ";
|
|
222
243
|
percent = 0.53;
|
|
223
244
|
try {
|
|
@@ -227,8 +248,9 @@ class Hatching {
|
|
|
227
248
|
catch (error) {
|
|
228
249
|
message += JSON.stringify(error);
|
|
229
250
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
251
|
+
await checkIt(message);
|
|
230
252
|
}
|
|
231
|
-
//
|
|
253
|
+
// hosts
|
|
232
254
|
message = "Creating hosts ";
|
|
233
255
|
percent = 0.60;
|
|
234
256
|
try {
|
|
@@ -238,10 +260,11 @@ class Hatching {
|
|
|
238
260
|
catch (error) {
|
|
239
261
|
message += JSON.stringify(error);
|
|
240
262
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
263
|
+
await checkIt(message);
|
|
241
264
|
}
|
|
242
|
-
//
|
|
265
|
+
// bootloader-config
|
|
243
266
|
message = "bootloader-config ";
|
|
244
|
-
percent = 0.
|
|
267
|
+
percent = 0.62;
|
|
245
268
|
try {
|
|
246
269
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
247
270
|
await this.execCalamaresModule('bootloader-config');
|
|
@@ -249,10 +272,23 @@ class Hatching {
|
|
|
249
272
|
catch (error) {
|
|
250
273
|
message += JSON.stringify(error);
|
|
251
274
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
275
|
+
await checkIt(message);
|
|
252
276
|
}
|
|
253
|
-
//
|
|
254
|
-
message = "
|
|
277
|
+
// grubcfg
|
|
278
|
+
message = "grubcfg ";
|
|
255
279
|
percent = 0.63;
|
|
280
|
+
try {
|
|
281
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
282
|
+
await this.grubcfg();
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
message += JSON.stringify(error);
|
|
286
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
287
|
+
await checkIt(message);
|
|
288
|
+
}
|
|
289
|
+
// bootloader
|
|
290
|
+
message = "bootloader ";
|
|
291
|
+
percent = 0.64;
|
|
256
292
|
try {
|
|
257
293
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
258
294
|
await this.bootloader();
|
|
@@ -260,8 +296,9 @@ class Hatching {
|
|
|
260
296
|
catch (error) {
|
|
261
297
|
message += JSON.stringify(error);
|
|
262
298
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
299
|
+
await checkIt(message);
|
|
263
300
|
}
|
|
264
|
-
//
|
|
301
|
+
// initramfsCfg
|
|
265
302
|
message = "initramfs configure";
|
|
266
303
|
percent = 0.65;
|
|
267
304
|
try {
|
|
@@ -271,8 +308,9 @@ class Hatching {
|
|
|
271
308
|
catch (error) {
|
|
272
309
|
message += JSON.stringify(error);
|
|
273
310
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
311
|
+
await checkIt(message);
|
|
274
312
|
}
|
|
275
|
-
//
|
|
313
|
+
// initramfs
|
|
276
314
|
message = "initramfs ";
|
|
277
315
|
percent = 0.67;
|
|
278
316
|
try {
|
|
@@ -282,8 +320,9 @@ class Hatching {
|
|
|
282
320
|
catch (error) {
|
|
283
321
|
message += JSON.stringify(error);
|
|
284
322
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
323
|
+
await checkIt(message);
|
|
285
324
|
}
|
|
286
|
-
//
|
|
325
|
+
// delLiveUser
|
|
287
326
|
message = "Removing user live ";
|
|
288
327
|
percent = 0.70;
|
|
289
328
|
try {
|
|
@@ -293,14 +332,13 @@ class Hatching {
|
|
|
293
332
|
catch (error) {
|
|
294
333
|
message += JSON.stringify(error);
|
|
295
334
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
335
|
+
await checkIt(message);
|
|
296
336
|
}
|
|
297
|
-
// await checkIt(message)
|
|
298
337
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* create user
|
|
338
|
+
* if NOT restore users data
|
|
302
339
|
*/
|
|
303
340
|
if (!fs_1.default.existsSync(this.luksFile)) {
|
|
341
|
+
// addUser
|
|
304
342
|
message = "Adding user ";
|
|
305
343
|
percent = 0.73;
|
|
306
344
|
try {
|
|
@@ -310,20 +348,22 @@ class Hatching {
|
|
|
310
348
|
catch (error) {
|
|
311
349
|
message += JSON.stringify(error);
|
|
312
350
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
351
|
+
await checkIt(message);
|
|
352
|
+
}
|
|
353
|
+
// changePassword
|
|
354
|
+
message = "adding user password ";
|
|
355
|
+
percent = 0.77;
|
|
356
|
+
try {
|
|
357
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
358
|
+
await this.changePassword('root', this.users.rootPassword);
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
message += JSON.stringify(error);
|
|
362
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
363
|
+
await checkIt(message);
|
|
313
364
|
}
|
|
314
|
-
// await checkIt(message)
|
|
315
|
-
}
|
|
316
|
-
message = "adding user password ";
|
|
317
|
-
percent = 0.77;
|
|
318
|
-
try {
|
|
319
|
-
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
320
|
-
await this.changePassword('root', this.users.rootPassword);
|
|
321
|
-
}
|
|
322
|
-
catch (error) {
|
|
323
|
-
message += JSON.stringify(error);
|
|
324
|
-
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
325
365
|
}
|
|
326
|
-
//
|
|
366
|
+
// autologin
|
|
327
367
|
if (pacman_1.default.isInstalledGui()) {
|
|
328
368
|
try {
|
|
329
369
|
message = "autologin GUI";
|
|
@@ -334,6 +374,7 @@ class Hatching {
|
|
|
334
374
|
catch (error) {
|
|
335
375
|
message += JSON.stringify(error);
|
|
336
376
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
377
|
+
await checkIt(message);
|
|
337
378
|
}
|
|
338
379
|
}
|
|
339
380
|
else { // autologin CLI remove DEFAULT
|
|
@@ -346,12 +387,13 @@ class Hatching {
|
|
|
346
387
|
catch (error) {
|
|
347
388
|
message += JSON.stringify(error);
|
|
348
389
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
390
|
+
await checkIt(message);
|
|
349
391
|
}
|
|
350
392
|
}
|
|
351
|
-
//
|
|
393
|
+
// cleanup
|
|
352
394
|
await cliAutologin.msgRemove(`${this.installTarget}/etc/motd`);
|
|
353
395
|
await cliAutologin.msgRemove(`${this.installTarget}/etc/issue`);
|
|
354
|
-
//
|
|
396
|
+
// removeInstaller
|
|
355
397
|
message = "remove installer";
|
|
356
398
|
percent = 0.87;
|
|
357
399
|
try {
|
|
@@ -361,8 +403,9 @@ class Hatching {
|
|
|
361
403
|
catch (error) {
|
|
362
404
|
message += JSON.stringify(error);
|
|
363
405
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
406
|
+
await checkIt(message);
|
|
364
407
|
}
|
|
365
|
-
//
|
|
408
|
+
// sourcesYolkUmount
|
|
366
409
|
message = "sources yolk unmount";
|
|
367
410
|
percent = 0.92;
|
|
368
411
|
try {
|
|
@@ -372,20 +415,33 @@ class Hatching {
|
|
|
372
415
|
catch (error) {
|
|
373
416
|
message += JSON.stringify(error);
|
|
374
417
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
418
|
+
await checkIt(message);
|
|
375
419
|
}
|
|
376
|
-
//
|
|
420
|
+
// umountVfs
|
|
421
|
+
message = "umount VFS";
|
|
422
|
+
percent = 0.95;
|
|
423
|
+
try {
|
|
424
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
425
|
+
await this.umountVfs();
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
message += JSON.stringify(error);
|
|
429
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
430
|
+
await checkIt(message);
|
|
431
|
+
}
|
|
432
|
+
// umount
|
|
377
433
|
message = "umount";
|
|
378
|
-
percent = 0.
|
|
434
|
+
percent = 0.97;
|
|
379
435
|
try {
|
|
380
436
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
381
|
-
await this.
|
|
382
|
-
await this.umount();
|
|
437
|
+
await this.umountFs();
|
|
383
438
|
}
|
|
384
439
|
catch (error) {
|
|
385
440
|
message += JSON.stringify(error);
|
|
386
441
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
442
|
+
await checkIt(message);
|
|
387
443
|
}
|
|
388
|
-
//
|
|
444
|
+
// finished
|
|
389
445
|
message = "finished";
|
|
390
446
|
percent = 100.0;
|
|
391
447
|
try {
|
|
@@ -395,6 +451,7 @@ class Hatching {
|
|
|
395
451
|
catch (error) {
|
|
396
452
|
message += JSON.stringify(error);
|
|
397
453
|
redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent }));
|
|
454
|
+
await checkIt(message);
|
|
398
455
|
}
|
|
399
456
|
}
|
|
400
457
|
}
|
|
@@ -477,6 +534,7 @@ adduser ${name} \
|
|
|
477
534
|
text += 'RESUME=UUID=' + utils_1.default.uuid(this.devices.swap.name);
|
|
478
535
|
}
|
|
479
536
|
utils_1.default.write(file, text);
|
|
537
|
+
//
|
|
480
538
|
}
|
|
481
539
|
/**
|
|
482
540
|
* initramfs()
|
|
@@ -490,8 +548,34 @@ adduser ${name} \
|
|
|
490
548
|
* fstab()
|
|
491
549
|
* @param devices
|
|
492
550
|
*/
|
|
493
|
-
async fstab(installDevice) {
|
|
494
|
-
|
|
551
|
+
async fstab(installDevice, crypted = false) {
|
|
552
|
+
let text = '';
|
|
553
|
+
/**
|
|
554
|
+
* crypttab
|
|
555
|
+
*/
|
|
556
|
+
if (this.partitions.installationMode === 'full-encrypted') {
|
|
557
|
+
const crypttab = this.installTarget + '/etc/crypttab';
|
|
558
|
+
text = ``;
|
|
559
|
+
text += `# /etc/crypttab: mappings for encrypted partitions.\n`;
|
|
560
|
+
text += `#\n`;
|
|
561
|
+
text += `# Each mapped device will be created in /dev/mapper, so your /etc/fstab\n`;
|
|
562
|
+
text += `# should use the /dev/mapper/<name> paths for encrypted devices.\n`;
|
|
563
|
+
text += `#\n`;
|
|
564
|
+
text += `# See crypttab(5) for the supported syntax.\n`;
|
|
565
|
+
text += `#\n`;
|
|
566
|
+
text += `# NOTE: You need not list your root (/) partition here, but it must be set up\n`;
|
|
567
|
+
text += `# beforehand by the initramfs (/etc/mkinitcpio.conf). The same applies\n`;
|
|
568
|
+
text += `# to encrypted swap, which should be set up with mkinitcpio-openswap\n`;
|
|
569
|
+
text += `# for resume support.\n`;
|
|
570
|
+
text += `#\n`;
|
|
571
|
+
text += `# <name> <device> <password> <options>\n`;
|
|
572
|
+
text += `#swap_crypted was ${this.devices.swap.cryptedFrom}\n`;
|
|
573
|
+
text += `swap_crypted UUID=${utils_1.default.uuid(this.devices.swap.cryptedFrom)} none luks,discard\n`;
|
|
574
|
+
text += `#root_crypted was ${this.devices.root.cryptedFrom}\n`;
|
|
575
|
+
text += `root_crypted UUID=${utils_1.default.uuid(this.devices.root.cryptedFrom)} none luks,swap\n`;
|
|
576
|
+
utils_1.default.write(crypttab, text);
|
|
577
|
+
}
|
|
578
|
+
const fstab = this.installTarget + '/etc/fstab';
|
|
495
579
|
let mountOptsRoot = '';
|
|
496
580
|
let mountOptsBoot = '';
|
|
497
581
|
let mountOptsData = ``;
|
|
@@ -511,7 +595,7 @@ adduser ${name} \
|
|
|
511
595
|
mountOptsEfi = 'defaults,noatime 0 2';
|
|
512
596
|
mountOptsSwap = 'defaults,noatime 0 2';
|
|
513
597
|
}
|
|
514
|
-
|
|
598
|
+
text = ``;
|
|
515
599
|
text += `# ${this.devices.root.name} ${this.devices.root.mountPoint} ${this.devices.root.fsType} ${mountOptsRoot}\n`;
|
|
516
600
|
text += `UUID=${utils_1.default.uuid(this.devices.root.name)} ${this.devices.root.mountPoint} ${this.devices.root.fsType} ${mountOptsRoot}\n`;
|
|
517
601
|
if (this.devices.boot.name !== `none`) {
|
|
@@ -528,7 +612,7 @@ adduser ${name} \
|
|
|
528
612
|
}
|
|
529
613
|
text += `# ${this.devices.swap.name} ${this.devices.swap.mountPoint} ${this.devices.swap.fsType} ${mountOptsSwap}\n`;
|
|
530
614
|
text += `UUID=${utils_1.default.uuid(this.devices.swap.name)} ${this.devices.swap.mountPoint} ${this.devices.swap.fsType} ${mountOptsSwap}\n`;
|
|
531
|
-
utils_1.default.write(
|
|
615
|
+
utils_1.default.write(fstab, text);
|
|
532
616
|
}
|
|
533
617
|
/**
|
|
534
618
|
* setKeyboard
|
|
@@ -562,12 +646,15 @@ adduser ${name} \
|
|
|
562
646
|
let content = '# created by eggs\n\n';
|
|
563
647
|
content += 'auto lo\n';
|
|
564
648
|
content += 'iface lo inet loopback\n\n';
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
content += '
|
|
569
|
-
|
|
570
|
-
|
|
649
|
+
// if netplan, don't create entries in /etc/network/interfaces
|
|
650
|
+
if (!pacman_1.default.packageIsInstalled('netplan.io')) {
|
|
651
|
+
content += 'auto ' + this.network.iface + '\n';
|
|
652
|
+
content += 'iface ' + this.network.iface + ' inet ' + this.network.addressType + '\n';
|
|
653
|
+
if (this.network.addressType !== 'dhcp') {
|
|
654
|
+
content += ' address ' + this.network.address + '\n';
|
|
655
|
+
content += ' netmask ' + this.network.netmask + '\n';
|
|
656
|
+
content += ' gateway ' + this.network.gateway + '\n';
|
|
657
|
+
}
|
|
571
658
|
}
|
|
572
659
|
utils_1.default.write(file, content);
|
|
573
660
|
/**
|
|
@@ -730,7 +817,7 @@ adduser ${name} \
|
|
|
730
817
|
/**
|
|
731
818
|
* mount
|
|
732
819
|
*/
|
|
733
|
-
async
|
|
820
|
+
async mountFs() {
|
|
734
821
|
const echo = { echo: false, ignore: false };
|
|
735
822
|
if (!fs_1.default.existsSync(this.installTarget)) {
|
|
736
823
|
await (0, utils_2.exec)(`mkdir ${this.installTarget}` + this.toNull, echo);
|
|
@@ -761,30 +848,30 @@ adduser ${name} \
|
|
|
761
848
|
return true;
|
|
762
849
|
}
|
|
763
850
|
/**
|
|
764
|
-
*
|
|
851
|
+
* umountFs
|
|
765
852
|
*/
|
|
766
|
-
async
|
|
853
|
+
async umountFs() {
|
|
767
854
|
const echo = { echo: false, ignore: false };
|
|
855
|
+
// efi
|
|
768
856
|
if (this.efi) {
|
|
769
|
-
await
|
|
770
|
-
await (0, utils_2.exec)('sleep 1', echo);
|
|
857
|
+
await this.umount(this.devices.efi.name);
|
|
771
858
|
}
|
|
772
859
|
// data
|
|
773
860
|
if (this.devices.data.name !== `none`) {
|
|
774
|
-
await
|
|
861
|
+
await this.umount(this.devices.data.name);
|
|
775
862
|
}
|
|
776
|
-
//
|
|
863
|
+
// boot
|
|
777
864
|
if (this.devices.boot.name !== `none`) {
|
|
778
|
-
await
|
|
865
|
+
await this.umount(this.devices.boot.name);
|
|
779
866
|
}
|
|
780
|
-
|
|
781
|
-
await (
|
|
867
|
+
// root
|
|
868
|
+
await this.umount(this.devices.root.name);
|
|
782
869
|
return true;
|
|
783
870
|
}
|
|
784
871
|
/**
|
|
785
872
|
* mountvfs()
|
|
786
873
|
*/
|
|
787
|
-
async
|
|
874
|
+
async mountVfs() {
|
|
788
875
|
const echo = { echo: true, ignore: true };
|
|
789
876
|
await (0, utils_2.exec)('mkdir ' + this.installTarget + '/dev' + this.toNull);
|
|
790
877
|
await (0, utils_2.exec)('mkdir ' + this.installTarget + '/dev/pts' + this.toNull);
|
|
@@ -795,144 +882,239 @@ adduser ${name} \
|
|
|
795
882
|
await (0, utils_2.exec)(`mount -o bind /dev/pts ${this.installTarget}/dev/pts` + this.toNull, echo);
|
|
796
883
|
await (0, utils_2.exec)(`mount -o bind /proc ${this.installTarget}/proc` + this.toNull, echo);
|
|
797
884
|
await (0, utils_2.exec)(`mount -o bind /sys ${this.installTarget}/sys` + this.toNull, echo);
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
* for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
|
|
802
|
-
* But now (maybe related to efivars/efivarfs changes) this loop skips one very special sub-mountpoint
|
|
803
|
-
* - /sys/firmware/efi/efivars and efibootmgr/grub fails.
|
|
804
|
-
*
|
|
805
|
-
* https://unix.stackexchange.com/questions/91620/efi-variables-are-not-supported-on-this-system
|
|
806
|
-
*/
|
|
807
|
-
await (0, utils_2.exec)(`mount -o bind /sys/firmware/efi/efivars ${this.installTarget}/sys/firmware/efi/efivars` + this.toNull, echo);
|
|
885
|
+
if (this.efi) {
|
|
886
|
+
await (0, utils_2.exec)(`mount -o bind /sys/firmware/efi/efivars ${this.installTarget}/sys/firmware/efi/efivars` + this.toNull, echo);
|
|
887
|
+
}
|
|
808
888
|
await (0, utils_2.exec)(`mount -o bind /run ${this.installTarget}/run` + this.toNull, echo);
|
|
809
889
|
}
|
|
810
890
|
/**
|
|
891
|
+
*
|
|
811
892
|
*/
|
|
812
|
-
async
|
|
893
|
+
async umountVfs() {
|
|
813
894
|
const echo = { echo: false, ignore: false };
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
}
|
|
818
|
-
if (
|
|
819
|
-
await
|
|
820
|
-
await (0, utils_2.exec)('sleep 1', echo);
|
|
821
|
-
}
|
|
822
|
-
if (utils_1.default.isMountpoint(`${this.installTarget}/proc`)) {
|
|
823
|
-
await (0, utils_2.exec)(`umount ${this.installTarget}/proc` + this.toNull, echo);
|
|
824
|
-
await (0, utils_2.exec)('sleep 1', echo);
|
|
825
|
-
}
|
|
826
|
-
if (utils_1.default.isMountpoint(`${this.installTarget}/run`)) {
|
|
827
|
-
await (0, utils_2.exec)(`umount ${this.installTarget}/run` + this.toNull, echo);
|
|
828
|
-
await (0, utils_2.exec)('sleep 1', echo);
|
|
829
|
-
}
|
|
830
|
-
if (utils_1.default.isMountpoint(`${this.installTarget}/sys/fs/fuse/connections`)) {
|
|
831
|
-
await (0, utils_2.exec)(`umount ${this.installTarget}/sys/fs/fuse/connections` + this.toNull, echo);
|
|
832
|
-
await (0, utils_2.exec)('sleep 1', echo);
|
|
833
|
-
}
|
|
834
|
-
if (utils_1.default.isMountpoint(`${this.installTarget}/firmware/efi/efivars`)) {
|
|
835
|
-
await (0, utils_2.exec)(`umount ${this.installTarget}/firmware/efi/efivars` + this.toNull, echo);
|
|
836
|
-
await (0, utils_2.exec)('sleep 1', echo);
|
|
895
|
+
await this.umount(`${this.installTarget}/dev/pts`);
|
|
896
|
+
await this.umount(`${this.installTarget}/dev`);
|
|
897
|
+
await this.umount(`${this.installTarget}/proc`);
|
|
898
|
+
await this.umount(`${this.installTarget}/run`);
|
|
899
|
+
if (this.efi) {
|
|
900
|
+
await this.umount(`${this.installTarget}/sys/firmware/efi/efivars`);
|
|
837
901
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
902
|
+
await this.umount(`${this.installTarget}/sys`);
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
*
|
|
906
|
+
* @param mountpoint
|
|
907
|
+
*/
|
|
908
|
+
async umount(mountPoint = '') {
|
|
909
|
+
const echo = { echo: false, ignore: false };
|
|
910
|
+
let message = 'umount: ' + mountPoint;
|
|
911
|
+
if (utils_1.default.isMountpoint(mountPoint)) {
|
|
912
|
+
try {
|
|
913
|
+
await (0, utils_2.exec)(`umount ${mountPoint}` + this.toNull, echo);
|
|
914
|
+
await (0, utils_2.exec)('sleep 1', echo);
|
|
915
|
+
}
|
|
916
|
+
catch (error) {
|
|
917
|
+
message += +mountPoint + JSON.stringify(error);
|
|
918
|
+
redraw(react_1.default.createElement(install_1.default, { message: message, percent: 1 }));
|
|
919
|
+
await checkIt(message);
|
|
920
|
+
}
|
|
841
921
|
}
|
|
842
922
|
}
|
|
843
923
|
/**
|
|
844
924
|
*
|
|
845
|
-
* @param p
|
|
846
|
-
* @returns
|
|
847
925
|
*/
|
|
848
926
|
async partition() {
|
|
849
|
-
const echo =
|
|
927
|
+
const echo = utils_1.default.setEcho(this.verbose);
|
|
928
|
+
let echoYes = utils_1.default.setEcho(true);
|
|
850
929
|
let retVal = false;
|
|
851
|
-
|
|
852
|
-
|
|
930
|
+
const installDevice = this.partitions.installationDevice;
|
|
931
|
+
const installMode = this.partitions.installationMode;
|
|
932
|
+
await (0, utils_2.exec)(`wipefs -a ${installDevice} ${this.toNull}`, echo);
|
|
933
|
+
if (installMode === 'standard' && !this.efi) {
|
|
853
934
|
/**
|
|
854
|
-
*
|
|
935
|
+
* ===========================================================================================
|
|
936
|
+
* BIOS: working
|
|
937
|
+
* ===========================================================================================
|
|
855
938
|
*/
|
|
856
|
-
await (0, utils_2.exec)(
|
|
857
|
-
await (0, utils_2.exec)(
|
|
858
|
-
await (0, utils_2.exec)(
|
|
859
|
-
await (0, utils_2.exec)(
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
this.devices.
|
|
939
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mklabel msdos`, echo);
|
|
940
|
+
await (0, utils_2.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 1MiB 8192MiB`, echo); //dev/sda1 swap
|
|
941
|
+
await (0, utils_2.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 8192MiB 100%`, echo); //dev/sda2 root
|
|
942
|
+
await (0, utils_2.exec)(`parted ${installDevice} set 1 boot on`, echo);
|
|
943
|
+
await (0, utils_2.exec)(`parted ${installDevice} set 1 esp on`, echo);
|
|
944
|
+
// SWAP
|
|
945
|
+
this.devices.swap.name = `${installDevice}1`;
|
|
946
|
+
this.devices.swap.fsType = 'swap';
|
|
947
|
+
this.devices.swap.mountPoint = 'none';
|
|
948
|
+
// ROOT
|
|
949
|
+
this.devices.root.name = `${installDevice}2`;
|
|
863
950
|
this.devices.root.fsType = 'ext4';
|
|
864
951
|
this.devices.root.mountPoint = '/';
|
|
952
|
+
// BOOT/DATA/EFI
|
|
953
|
+
this.devices.boot.name = `none`;
|
|
865
954
|
this.devices.data.name = `none`;
|
|
866
|
-
this.devices.
|
|
955
|
+
this.devices.efi.name = `none`;
|
|
956
|
+
retVal = true;
|
|
957
|
+
}
|
|
958
|
+
else if (installMode === 'full-encrypted' && !this.efi) {
|
|
959
|
+
/**
|
|
960
|
+
* ===========================================================================================
|
|
961
|
+
* BIOS: full-encrypt:
|
|
962
|
+
* ===========================================================================================
|
|
963
|
+
*/
|
|
964
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mklabel msdos`, echo);
|
|
965
|
+
await (0, utils_2.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 1MiB 512MiB`, echo); // sda1
|
|
966
|
+
await (0, utils_2.exec)(`parted --script --align optimal ${installDevice} mkpart primary linux-swap 512MiB 8704MiB`, echo); // sda2
|
|
967
|
+
await (0, utils_2.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext4 8704MiB 100%`, echo); // sda3
|
|
968
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 boot on`, echo); // sda1
|
|
969
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 esp on`, echo); // sda1
|
|
970
|
+
// BOOT 512M
|
|
971
|
+
this.devices.boot.name = `${installDevice}1`; // 'boot'
|
|
972
|
+
this.devices.boot.fsType = 'ext4';
|
|
973
|
+
this.devices.boot.mountPoint = '/boot';
|
|
974
|
+
// SWAP 8G
|
|
975
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Formatting LUKS ${installDevice}2`, percent: 0 }));
|
|
976
|
+
let crytoSwap = await (0, utils_2.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}2`, echoYes);
|
|
977
|
+
if (crytoSwap.code !== 0) {
|
|
978
|
+
utils_1.default.warning(`Error: ${crytoSwap.code} ${crytoSwap.data}`);
|
|
979
|
+
process.exit(1);
|
|
980
|
+
}
|
|
981
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Opening ${installDevice}2 as swap_crypted`, percent: 0 }));
|
|
982
|
+
let crytoSwapOpen = await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}2 swap_crypted`, echoYes);
|
|
983
|
+
if (crytoSwapOpen.code !== 0) {
|
|
984
|
+
utils_1.default.warning(`Error: ${crytoSwapOpen.code} ${crytoSwapOpen.data}`);
|
|
985
|
+
process.exit(1);
|
|
986
|
+
}
|
|
987
|
+
this.devices.swap.name = '/dev/mapper/swap_crypted';
|
|
988
|
+
this.devices.swap.cryptedFrom = `${installDevice}2`;
|
|
867
989
|
this.devices.swap.fsType = 'swap';
|
|
868
990
|
this.devices.swap.mountPoint = 'none';
|
|
991
|
+
// ROOT
|
|
992
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Formatting LUKS ${installDevice}3`, percent: 0 }));
|
|
993
|
+
let crytoRoot = await (0, utils_2.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}3`, echoYes);
|
|
994
|
+
if (crytoRoot.code !== 0) {
|
|
995
|
+
utils_1.default.warning(`Error: ${crytoRoot.code} ${crytoRoot.data}`);
|
|
996
|
+
process.exit(1);
|
|
997
|
+
}
|
|
998
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Opening ${installDevice}3 as root_crypted`, percent: 0 }));
|
|
999
|
+
let crytoRootOpen = await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}3 root_crypted`, echoYes);
|
|
1000
|
+
if (crytoRootOpen.code !== 0) {
|
|
1001
|
+
utils_1.default.warning(`Error: ${crytoRootOpen.code} ${crytoRootOpen.data}`);
|
|
1002
|
+
process.exit(1);
|
|
1003
|
+
}
|
|
1004
|
+
this.devices.root.name = '/dev/mapper/root_crypted';
|
|
1005
|
+
this.devices.root.cryptedFrom = `${installDevice}3`;
|
|
1006
|
+
this.devices.root.fsType = 'ext4';
|
|
1007
|
+
this.devices.root.mountPoint = '/';
|
|
1008
|
+
// BOOT/DATA/EFI
|
|
1009
|
+
this.devices.data.name = `none`;
|
|
1010
|
+
this.devices.efi.name = `none`;
|
|
869
1011
|
retVal = true;
|
|
870
1012
|
}
|
|
871
|
-
else if (
|
|
1013
|
+
else if (installMode === 'standard' && this.efi) {
|
|
872
1014
|
/**
|
|
873
|
-
*
|
|
1015
|
+
* ===========================================================================================
|
|
1016
|
+
* UEFI: working
|
|
1017
|
+
* ===========================================================================================
|
|
874
1018
|
*/
|
|
875
|
-
await (0, utils_2.exec)(
|
|
876
|
-
await (0, utils_2.exec)(
|
|
877
|
-
await (0, utils_2.exec)(
|
|
878
|
-
|
|
1019
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mklabel gpt`, echo);
|
|
1020
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, echo); // sda1 EFI
|
|
1021
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart swap linux-swap 768MiB 8960MiB`, echo); // sda2 swap
|
|
1022
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart root ext4 8960MiB 100%`, echo); // sda3 root
|
|
1023
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 boot on`, echo); // sda1
|
|
1024
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 esp on`, echo); // sda1
|
|
1025
|
+
this.devices.efi.name = `${installDevice}1`;
|
|
879
1026
|
this.devices.efi.fsType = 'F 32 -I';
|
|
880
1027
|
this.devices.efi.mountPoint = '/boot/efi';
|
|
881
1028
|
this.devices.boot.name = `none`;
|
|
882
|
-
this.devices.
|
|
1029
|
+
this.devices.swap.name = `${installDevice}2`;
|
|
1030
|
+
this.devices.swap.fsType = 'swap';
|
|
1031
|
+
this.devices.root.name = `${installDevice}3`;
|
|
883
1032
|
this.devices.root.fsType = 'ext4';
|
|
884
1033
|
this.devices.root.mountPoint = '/';
|
|
1034
|
+
// BOOT/DATA/EFI
|
|
1035
|
+
this.devices.boot.name = `none`;
|
|
885
1036
|
this.devices.data.name = `none`;
|
|
886
|
-
this.devices.
|
|
887
|
-
this.devices.swap.fsType = 'swap';
|
|
1037
|
+
// this.devices.efi.name = `none`
|
|
888
1038
|
retVal = true;
|
|
1039
|
+
}
|
|
1040
|
+
else if (installMode === 'full-encrypted' && this.efi) {
|
|
889
1041
|
/**
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
* Enter passphrase for /dev/sda: this.partitions.luksPassphrase
|
|
894
|
-
* pv -tpreb /dev/zero | dd of=/dev/mapper/vgeggs bs=128M
|
|
895
|
-
* mkfs.ext4 /dev/mapper/vgeggs
|
|
896
|
-
* cryptsetup luksClose vgeggs
|
|
1042
|
+
* ===========================================================================================
|
|
1043
|
+
* UEFI, full-encrypt: working
|
|
1044
|
+
* ===========================================================================================
|
|
897
1045
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
await (0, utils_2.exec)(`
|
|
901
|
-
await (0, utils_2.exec)(`
|
|
902
|
-
await (0, utils_2.exec)(`
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
this.devices.
|
|
1046
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mklabel gpt`, echo);
|
|
1047
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, echo); // sda1 EFI
|
|
1048
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart boot ext4 256MiB 768MiB`, echo); // sda2 boot
|
|
1049
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart swap linux-swap 768MiB 8960MiB`, echo); // sda3 swap
|
|
1050
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart root ext4 8960MiB 100%`, echo); // sda4 root
|
|
1051
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 boot on`, echo); // sda1
|
|
1052
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 esp on`, echo); // sda1
|
|
1053
|
+
// EFI 256M
|
|
1054
|
+
this.devices.efi.name = `${installDevice}1`; // 'efi'
|
|
1055
|
+
this.devices.efi.fsType = 'F 32 -I';
|
|
1056
|
+
this.devices.efi.mountPoint = '/boot/efi';
|
|
1057
|
+
// BOOT 512M
|
|
1058
|
+
this.devices.boot.name = `${installDevice}2`; // 'boot'
|
|
1059
|
+
this.devices.boot.fsType = 'ext4';
|
|
1060
|
+
this.devices.boot.mountPoint = '/boot';
|
|
1061
|
+
// SWAP 8G
|
|
1062
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Formatting LUKS ${installDevice}3`, percent: 0 }));
|
|
1063
|
+
let crytoSwap = await (0, utils_2.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}3`, echoYes);
|
|
1064
|
+
if (crytoSwap.code !== 0) {
|
|
1065
|
+
utils_1.default.warning(`Error: ${crytoSwap.code} ${crytoSwap.data}`);
|
|
1066
|
+
process.exit(1);
|
|
1067
|
+
}
|
|
1068
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Opening ${installDevice}3 as swap_crypted`, percent: 0 }));
|
|
1069
|
+
let crytoSwapOpen = await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}3 swap_crypted`, echoYes);
|
|
1070
|
+
if (crytoSwapOpen.code !== 0) {
|
|
1071
|
+
utils_1.default.warning(`Error: ${crytoSwapOpen.code} ${crytoSwapOpen.data}`);
|
|
1072
|
+
process.exit(1);
|
|
1073
|
+
}
|
|
1074
|
+
this.devices.swap.name = '/dev/mapper/swap_crypted';
|
|
1075
|
+
this.devices.swap.cryptedFrom = `${installDevice}3`;
|
|
1076
|
+
this.devices.swap.fsType = 'swap';
|
|
1077
|
+
this.devices.swap.mountPoint = 'none';
|
|
1078
|
+
// ROOT
|
|
1079
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Formatting LUKS ${installDevice}4`, percent: 0 }));
|
|
1080
|
+
let crytoRoot = await (0, utils_2.exec)(`cryptsetup -y -v luksFormat --type luks2 ${installDevice}4`, echoYes);
|
|
1081
|
+
if (crytoRoot.code !== 0) {
|
|
1082
|
+
utils_1.default.warning(`Error: ${crytoRoot.code} ${crytoRoot.data}`);
|
|
1083
|
+
process.exit(1);
|
|
1084
|
+
}
|
|
1085
|
+
redraw(react_1.default.createElement(install_1.default, { message: `Opening ${installDevice}4 as root_crypted`, percent: 0 }));
|
|
1086
|
+
let crytoRootOpen = await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${installDevice}4 root_crypted`, echoYes);
|
|
1087
|
+
if (crytoRootOpen.code !== 0) {
|
|
1088
|
+
utils_1.default.warning(`Error: ${crytoRootOpen.code} ${crytoRootOpen.data}`);
|
|
1089
|
+
process.exit(1);
|
|
1090
|
+
}
|
|
1091
|
+
this.devices.root.name = '/dev/mapper/root_crypted';
|
|
1092
|
+
this.devices.root.cryptedFrom = `${installDevice}4`;
|
|
1093
|
+
this.devices.root.fsType = 'ext4';
|
|
907
1094
|
this.devices.root.mountPoint = '/';
|
|
1095
|
+
// BOOT/DATA/EFI
|
|
1096
|
+
// this.devices.boot.name = `none`
|
|
908
1097
|
this.devices.data.name = `none`;
|
|
909
|
-
this.devices.
|
|
910
|
-
this.devices.swap.fsType = 'none';
|
|
911
|
-
this.devices.swap.mountPoint = 'none';
|
|
1098
|
+
// this.devices.efi.name = `none`
|
|
912
1099
|
retVal = true;
|
|
913
1100
|
}
|
|
914
|
-
else if (
|
|
1101
|
+
else if (installMode === 'lvm2' && !this.efi) {
|
|
915
1102
|
/**
|
|
916
|
-
*
|
|
1103
|
+
* ===========================================================================================
|
|
1104
|
+
* PROXMOX VE: BIOS and lvm2
|
|
1105
|
+
* ===========================================================================================
|
|
917
1106
|
*/
|
|
918
|
-
await (0, utils_2.exec)(`parted --script ${
|
|
1107
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mklabel msdos`);
|
|
919
1108
|
// Creo partizioni
|
|
920
|
-
await (0, utils_2.exec)(`parted --script ${
|
|
921
|
-
await (0, utils_2.exec)(`parted --script --align optimal ${
|
|
922
|
-
await (0, utils_2.exec)(`parted --script
|
|
923
|
-
await (0, utils_2.exec)(`parted --script ${
|
|
924
|
-
|
|
925
|
-
const lvmPartname =
|
|
926
|
-
const
|
|
927
|
-
const
|
|
928
|
-
//
|
|
929
|
-
// Viene limitata fino ad un massimo di 100 GB
|
|
930
|
-
const lvmSwapSize = 4 * 1024;
|
|
931
|
-
let lvmRootSize = lvmSize / 8;
|
|
932
|
-
if (lvmRootSize < 20480) {
|
|
933
|
-
lvmRootSize = 20480;
|
|
934
|
-
}
|
|
935
|
-
const lvmDataSize = lvmSize - lvmRootSize - lvmSwapSize;
|
|
1109
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart primary ext2 1 512`); // sda1
|
|
1110
|
+
await (0, utils_2.exec)(`parted --script --align optimal ${installDevice} mkpart primary ext2 512 100%`); // sda2
|
|
1111
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 boot on`, echo); // sda1
|
|
1112
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 2 lvm on`, echo); // sda2
|
|
1113
|
+
const lvmPartInfo = await this.lvmPartInfo(installDevice);
|
|
1114
|
+
const lvmPartname = lvmPartInfo[0];
|
|
1115
|
+
const lvmSwapSize = lvmPartInfo[1];
|
|
1116
|
+
const lvmRootSize = lvmPartInfo[2];
|
|
1117
|
+
//const lvmDataSize = lvmPartInfo[3]
|
|
936
1118
|
await (0, utils_2.exec)(`pvcreate /dev/${lvmPartname}`);
|
|
937
1119
|
await (0, utils_2.exec)(`vgcreate pve /dev/${lvmPartname}`);
|
|
938
1120
|
await (0, utils_2.exec)(`vgchange -an`);
|
|
@@ -941,7 +1123,7 @@ adduser ${name} \
|
|
|
941
1123
|
await (0, utils_2.exec)(`lvcreate -l 100%FREE -ndata pve`);
|
|
942
1124
|
await (0, utils_2.exec)(`vgchange -a y pve`);
|
|
943
1125
|
this.devices.efi.name = `none`;
|
|
944
|
-
this.devices.boot.name = `${
|
|
1126
|
+
this.devices.boot.name = `${installDevice}1`;
|
|
945
1127
|
this.devices.root.fsType = 'ext2';
|
|
946
1128
|
this.devices.root.mountPoint = '/boot';
|
|
947
1129
|
this.devices.root.name = `/dev/pve/root`;
|
|
@@ -955,13 +1137,64 @@ adduser ${name} \
|
|
|
955
1137
|
}
|
|
956
1138
|
else if (this.partitions.installationMode === 'lvm2' && this.efi) {
|
|
957
1139
|
/**
|
|
958
|
-
*
|
|
1140
|
+
* ===========================================================================================
|
|
1141
|
+
* PROXMOX VE: lvm2 and UEFI
|
|
1142
|
+
* ===========================================================================================
|
|
959
1143
|
*/
|
|
960
|
-
|
|
961
|
-
|
|
1144
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mklabel gpt`, echo);
|
|
1145
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart efi fat32 34s 256MiB`, echo); // sda1 EFI
|
|
1146
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart boot ext2 256MiB 768MiB`, echo); // sda2 boot
|
|
1147
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} mkpart lvm ext4 768MiB 100%`, echo); // sda3 lmv2
|
|
1148
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 boot on`, echo); // sda1
|
|
1149
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 1 esp on`, echo); // sda1
|
|
1150
|
+
await (0, utils_2.exec)(`parted --script ${installDevice} set 3 lvm on`); // sda3
|
|
1151
|
+
const lvmPartInfo = await this.lvmPartInfo(installDevice);
|
|
1152
|
+
const lvmPartname = lvmPartInfo[0];
|
|
1153
|
+
const lvmSwapSize = lvmPartInfo[1];
|
|
1154
|
+
const lvmRootSize = lvmPartInfo[2];
|
|
1155
|
+
//const lvmDataSize = lvmPartInfo[3]
|
|
1156
|
+
await (0, utils_2.exec)(`pvcreate /dev/${lvmPartname}`);
|
|
1157
|
+
await (0, utils_2.exec)(`vgcreate pve /dev/${lvmPartname}`);
|
|
1158
|
+
await (0, utils_2.exec)(`vgchange -an`);
|
|
1159
|
+
await (0, utils_2.exec)(`lvcreate -L ${lvmSwapSize} -nswap pve`);
|
|
1160
|
+
await (0, utils_2.exec)(`lvcreate -L ${lvmRootSize} -nroot pve`);
|
|
1161
|
+
await (0, utils_2.exec)(`lvcreate -l 100%FREE -ndata pve`);
|
|
1162
|
+
await (0, utils_2.exec)(`vgchange -a y pve`);
|
|
1163
|
+
this.devices.efi.name = `${installDevice}1`;
|
|
1164
|
+
this.devices.efi.fsType = 'F 32 -I';
|
|
1165
|
+
this.devices.efi.mountPoint = '/boot/efi';
|
|
1166
|
+
this.devices.boot.name = `${installDevice}2`;
|
|
1167
|
+
this.devices.boot.fsType = 'ext4';
|
|
1168
|
+
this.devices.boot.mountPoint = '/boot';
|
|
1169
|
+
this.devices.root.name = `/dev/pve/root`;
|
|
1170
|
+
this.devices.root.fsType = 'ext4';
|
|
1171
|
+
this.devices.root.mountPoint = '/';
|
|
1172
|
+
this.devices.data.name = `/dev/pve/data`;
|
|
1173
|
+
this.devices.data.fsType = 'ext4';
|
|
1174
|
+
this.devices.data.mountPoint = '/var/lib/vz';
|
|
1175
|
+
this.devices.swap.name = `/dev/pve/swap`;
|
|
1176
|
+
retVal = true;
|
|
962
1177
|
}
|
|
963
1178
|
return retVal;
|
|
964
1179
|
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Return lvmPartname, lvmSwapSize, lvmRootSize
|
|
1182
|
+
*/
|
|
1183
|
+
async lvmPartInfo(installDevice = '/dev/sda') {
|
|
1184
|
+
//
|
|
1185
|
+
// Partizione LVM
|
|
1186
|
+
const lvmPartname = shx.exec(`fdisk ${installDevice} -l | grep LVM | awk '{print $1}' | cut -d "/" -f3`).stdout.trim();
|
|
1187
|
+
const lvmByteSize = Number(shx.exec(`cat /proc/partitions | grep ${lvmPartname}| awk '{print $3}' | grep "[0-9]"`).stdout.trim());
|
|
1188
|
+
const lvmSize = lvmByteSize / 1024;
|
|
1189
|
+
// La partizione di root viene posta ad 1/4 della partizione LVM, limite max 100 GB
|
|
1190
|
+
const lvmSwapSize = 8192;
|
|
1191
|
+
let lvmRootSize = lvmSize / 8;
|
|
1192
|
+
if (lvmRootSize < 20480) {
|
|
1193
|
+
lvmRootSize = 20480;
|
|
1194
|
+
}
|
|
1195
|
+
const lvmDataSize = lvmSize - lvmRootSize - lvmSwapSize;
|
|
1196
|
+
return [lvmPartname, lvmSwapSize, lvmRootSize, lvmDataSize];
|
|
1197
|
+
}
|
|
965
1198
|
/**
|
|
966
1199
|
* isRotational
|
|
967
1200
|
* @param device
|
|
@@ -1079,6 +1312,42 @@ adduser ${name} \
|
|
|
1079
1312
|
console.log('cmd: ' + cmd + ' error: ' + error);
|
|
1080
1313
|
}
|
|
1081
1314
|
}
|
|
1315
|
+
/**
|
|
1316
|
+
* grubcfg
|
|
1317
|
+
* - open /etc/default/grub
|
|
1318
|
+
* - find GRUB_CMDLINE_LINUX_DEFAULT=
|
|
1319
|
+
* - replace with GRUB_CMDLINE_LINUX_DEFAULT=
|
|
1320
|
+
* 's/GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE_LINUX_DEFAULT=/g'
|
|
1321
|
+
*/
|
|
1322
|
+
grubcfg() {
|
|
1323
|
+
let file = `${this.installTarget}/etc/default/grub`;
|
|
1324
|
+
let content = '';
|
|
1325
|
+
const grubs = fs_1.default.readFileSync(file, 'utf-8').split('\n');
|
|
1326
|
+
for (let i = 0; i < grubs.length; i++) {
|
|
1327
|
+
if (grubs[i].includes('GRUB_CMDLINE_LINUX_DEFAULT=')) {
|
|
1328
|
+
if (this.partitions.installationMode === 'full-encrypted') {
|
|
1329
|
+
grubs[i] = `GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=${utils_1.default.uuid(this.devices.swap.name)}"`;
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
grubs[i] = `GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=${utils_1.default.uuid(this.devices.swap.name)}"`;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
content += grubs[i] + '\n';
|
|
1336
|
+
}
|
|
1337
|
+
fs_1.default.writeFileSync(file, content, 'utf-8');
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* On Ubuntu
|
|
1341
|
+
* /etc/machine-id must exist to be re-created
|
|
1342
|
+
* https://unix.stackexchange.com/questions/402999/is-it-ok-to-change-etc-machine-id
|
|
1343
|
+
*/
|
|
1344
|
+
async machineId() {
|
|
1345
|
+
let file = `${this.installTarget}/etc/machine-id`;
|
|
1346
|
+
if (fs_1.default.existsSync(file)) {
|
|
1347
|
+
await (0, utils_2.exec)(`rm ${file}`);
|
|
1348
|
+
}
|
|
1349
|
+
await (0, utils_2.exec)(`touch ${file}`);
|
|
1350
|
+
}
|
|
1082
1351
|
/**
|
|
1083
1352
|
* only show the result
|
|
1084
1353
|
*/
|
|
@@ -1107,5 +1376,7 @@ function redraw(elem) {
|
|
|
1107
1376
|
* @param message
|
|
1108
1377
|
*/
|
|
1109
1378
|
async function checkIt(message) {
|
|
1110
|
-
|
|
1379
|
+
utils_1.default.error('Krill Installer generated an error, the installation process will end now');
|
|
1380
|
+
console.log('Press a key to exit...');
|
|
1381
|
+
require('child_process').spawnSync('read _ ', { shell: true, stdio: [0, 1, 2] });
|
|
1111
1382
|
}
|