penguins-eggs 10.0.38 → 10.0.40

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.
@@ -6,18 +6,14 @@
6
6
  * license: MIT
7
7
  */
8
8
  import chalk from 'chalk';
9
- import yaml from 'js-yaml';
10
9
  import fs from 'node:fs';
11
- // pjson
12
- import { createRequire } from 'node:module';
10
+ import yaml from 'js-yaml';
13
11
  import path from 'node:path';
14
12
  import { exec } from '../lib/utils.js';
15
13
  import Distro from './distro.js';
16
14
  import Pacman from './pacman.js';
17
15
  import SourcesList from './sources_list.js';
18
16
  import Utils from './utils.js';
19
- const require = createRequire(import.meta.url);
20
- const pjson = require('../../package.json');
21
17
  /**
22
18
  *
23
19
  */
@@ -26,8 +22,10 @@ export default class Tailor {
26
22
  category = 'costume';
27
23
  costume = '';
28
24
  echo = {};
25
+ toNull = ' > /dev/null 2>&1';
29
26
  verbose = false;
30
27
  wardrobe = '';
28
+ log = '';
31
29
  /**
32
30
  * @param wardrobe
33
31
  * @param costume
@@ -35,98 +33,24 @@ export default class Tailor {
35
33
  constructor(costume, category = 'costume') {
36
34
  this.costume = costume;
37
35
  this.wardrobe = path.dirname(path.dirname(costume));
36
+ this.log = path.dirname(this.wardrobe) + "/wardrobe.log";
38
37
  this.category = category;
39
38
  }
40
39
  /**
41
40
  *
42
- * @param packages
43
- * @param verbose
44
- * @param section
45
- * @returns
46
41
  */
47
- async helperExists(packages, verbose = false, section = '') {
48
- const packages_we_want = '/tmp/packages_we_want';
49
- const packages_not_exists = '/tmp/packages_not_exists';
50
- const packages_exists = '/tmp/packages_exists';
51
- await exec(`rm -f ${packages_we_want}`);
52
- await exec(`rm -f ${packages_not_exists}`);
53
- await exec(`rm -f ${packages_exists}`);
54
- /**
55
- * packages_we_want
56
- */
57
- let content = '';
58
- packages.sort();
59
- for (const elem of packages) {
60
- if (!Pacman.packageIsInstalled(elem)) {
61
- content += elem + '\n';
62
- }
63
- }
64
- fs.writeFileSync(packages_we_want, content, 'utf-8');
65
- /**
66
- * packages_exists
67
- */
68
- const distro = new Distro();
69
- await (distro.familyId === 'debian' ? exec(`apt-cache --no-generate pkgnames | sort | comm -12 - ${packages_we_want} > ${packages_exists}`) : exec(`pacman -S --list | awk '{print $2}' | sort | comm -12 - ${packages_we_want} > ${packages_exists}`));
70
- /**
71
- * packages_not_exists
72
- */
42
+ async prepare(verbose = true, no_accessories = false, no_firmwares = false) {
73
43
  if (verbose) {
74
- await (distro.familyId === 'debian' ? exec(`apt-cache --no-generate pkgnames | sort | comm -13 - ${packages_we_want} > ${packages_not_exists}`) : exec(`pacman -S --list | awk '{print $2}' | sort | comm -13 - ${packages_we_want} > ${packages_not_exists}`));
75
- const not_exist_packages = fs.readFileSync(packages_not_exists, 'utf8').split('\n');
76
- if (not_exist_packages.length > 1) {
77
- // Una riga c'è sempre
78
- let content = '';
79
- // for (const elem of not_exist_packages) {
80
- for (let i = 0; i < not_exist_packages.length - 1; i++) {
81
- content += `- ${not_exist_packages[i]}\n`;
82
- }
83
- this.titles('tailor');
84
- console.log('Following packages from ' + chalk.cyan(this.materials.name) + ' section: ' + chalk.cyan(section) + ', was not found:');
85
- console.log(content);
86
- Utils.pressKeyToExit('Press a key to continue...');
87
- }
44
+ this.verbose = true;
45
+ this.toNull = '';
88
46
  }
89
- return fs.readFileSync(packages_exists, 'utf8').split('\n');
90
- }
91
- /**
92
- * - check if every package if installed
93
- * - if find any packages to install, install it
94
- */
95
- async helperInstall(packages, comment = 'packages', cmd = 'apt-get install -yqq ') {
96
- if (packages[0] !== null) {
97
- const elements = [];
98
- let strElements = '';
99
- for (const elem of packages) {
100
- elements.push(elem);
101
- cmd += ` ${elem}`;
102
- strElements += `, ${elem}`;
103
- }
104
- if (elements.length > 0) {
105
- let step = `installing ${comment}: `;
106
- if (!this.verbose) {
107
- step += strElements.slice(2);
108
- }
109
- /**
110
- * prova 3 volte
111
- */
112
- const limit = 3;
113
- for (let tempts = 1; tempts < limit; tempts++) {
114
- this.titles(step);
115
- Utils.warning(`tempts ${tempts} of ${limit}`);
116
- if (await tryCheckSuccess(cmd, this.echo)) {
117
- break;
118
- }
119
- }
120
- }
121
- }
122
- }
123
- /**
124
- *
125
- */
126
- async prepare(verbose = true, no_accessories = false, no_firmwares = false) {
127
- this.verbose = verbose;
128
47
  this.echo = Utils.setEcho(verbose);
129
48
  Utils.warning(`preparing ${this.costume}`);
49
+ if (!fs.existsSync(this.log)) {
50
+ fs.writeFileSync(this.log, "# eggs wardrobe wear\n\n");
51
+ }
52
+ fs.appendFileSync(this.log, `## ${this.costume}\n`);
53
+ fs.appendFileSync(this.log, `Packages not found:\n`);
130
54
  /**
131
55
  * check curl presence
132
56
  */
@@ -204,15 +128,28 @@ export default class Tailor {
204
128
  }
205
129
  break;
206
130
  }
207
- // No default
208
- }
131
+ case 'Fedora': {
132
+ tailorList = `${this.costume}/fedora.yml`;
133
+ if (!fs.existsSync(tailorList)) {
134
+ tailorList = `${this.costume}/debian.yml`;
135
+ if (!fs.existsSync(tailorList)) {
136
+ console.log(`no costume definition found compatible Fedora`);
137
+ process.exit();
138
+ }
139
+ }
140
+ break;
141
+ }
142
+ } // end analyze
143
+ /**
144
+ * find materials
145
+ */
209
146
  if (fs.existsSync(tailorList)) {
210
147
  this.materials = yaml.load(fs.readFileSync(tailorList, 'utf8'));
211
148
  }
212
- else
149
+ else {
213
150
  switch (this.category) {
214
151
  case 'costume': {
215
- this.titles(`${this.category}: ${this.costume}`);
152
+ Utils.titles(`${this.category}: ${this.costume}`);
216
153
  console.log("Tailor's list " + chalk.cyan(tailorList) + ' is not found \non your wardrobe ' + chalk.cyan(this.wardrobe) + '.\n');
217
154
  console.log('Costume will not be installed, operations will abort.\n');
218
155
  Utils.pressKeyToExit();
@@ -220,53 +157,22 @@ export default class Tailor {
220
157
  break;
221
158
  }
222
159
  case 'accessory': {
223
- this.titles(`${this.category}: ${this.costume}`);
160
+ Utils.titles(`${this.category}: ${this.costume}`);
224
161
  console.log("Tailor's list " + chalk.cyan(tailorList) + ' is not found \non your wardrobe ' + chalk.cyan(this.wardrobe) + '.\n');
225
- console.log('Accessory will not be installed, operations will continue.\n');
226
- Utils.pressKeyToExit();
227
- return;
228
- }
229
- case 'try_accessory': {
162
+ console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv');
163
+ console.log('Accessory will not be installed,');
164
+ console.log('operations will continue.');
165
+ console.log('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^');
166
+ sleep(3000);
230
167
  return;
231
168
  }
232
- // No default
233
- }
234
- /**
235
- * distro e sources_list
236
- * vengono definite qua perchè servono a tutti
237
- */
238
- const sources_list = new SourcesList();
239
- let step = '';
240
- if (this.materials.distributions !== undefined) {
241
- step = 'analyzing distribution';
242
- Utils.warning(step);
243
- if (!(await sources_list.distribution(this.materials.distributions))) {
244
- switch (this.category) {
245
- case 'costume': {
246
- this.titles('step');
247
- console.log('Costume ' + chalk.cyan(this.materials.name) + ' is not compatible \nwith your ' + chalk.cyan(distro.distroId + '/' + distro.codenameId) + ' system.\n');
248
- console.log('Costume will not be installed, operations will abort.\n');
249
- Utils.pressKeyToExit();
250
- process.exit();
251
- break;
252
- }
253
- case 'accessory': {
254
- this.titles('step');
255
- console.log('Accessory ' + chalk.cyan(this.materials.name) + ' is not compatible \nwith your ' + chalk.cyan(distro.distroId + '/' + distro.codenameId) + ' system.\n');
256
- console.log('Accessory will not be installed, operations will continue.\n');
257
- Utils.pressKeyToExit();
258
- return;
259
- }
260
- case 'try_accessory': {
261
- return;
262
- }
263
- // No default
264
- }
265
169
  }
266
170
  }
267
171
  /**
268
172
  * sequence
269
173
  */
174
+ const sources_list = new SourcesList();
175
+ let step = '';
270
176
  if (this.materials.sequence !== undefined) {
271
177
  step = 'analyzing sequence';
272
178
  Utils.warning(step);
@@ -329,10 +235,12 @@ export default class Tailor {
329
235
  }
330
236
  case 'alpine': {
331
237
  await exec('apk update', Utils.setEcho(false));
332
- Utils.pressKeyToExit();
333
238
  break;
334
239
  }
335
- // No default
240
+ case 'fedora': {
241
+ await exec('dnf update', Utils.setEcho(false));
242
+ break;
243
+ }
336
244
  }
337
245
  }
338
246
  /**
@@ -355,24 +263,27 @@ export default class Tailor {
355
263
  await exec('apk upgrade', Utils.setEcho(false));
356
264
  break;
357
265
  }
358
- // No default
266
+ case 'fedora': {
267
+ await exec('dnf upgrade', Utils.setEcho(false));
268
+ break;
269
+ }
359
270
  }
360
271
  } // upgrade true
361
272
  } // undefined upgrade
362
273
  } // end sequence/repositories
363
274
  /**
364
- * sequence/preinst
275
+ * sequence/cmds
365
276
  */
366
- if (this.materials.sequence.preinst !== undefined && Array.isArray(this.materials.sequence.preinst)) {
367
- step = 'preinst scripts';
277
+ if (this.materials.sequence.cmds !== undefined && Array.isArray(this.materials.sequence.cmds)) {
278
+ step = 'sequence commands';
368
279
  Utils.warning(step);
369
- for (const script of this.materials.sequence.preinst) {
370
- if (fs.existsSync(`${this.costume}/${script}`)) {
371
- await exec(`${this.costume}/${script} ${this.materials.name}`, Utils.setEcho(true));
280
+ for (const cmd of this.materials.sequence.cmds) {
281
+ if (fs.existsSync(`${this.costume}/${cmd}`)) {
282
+ await exec(`${this.costume}/${cmd} ${this.materials.name}`, Utils.setEcho(true));
372
283
  }
373
284
  else {
374
- // exec script real env
375
- await exec(`${script} ${this.materials.name}`, Utils.setEcho(true));
285
+ // exec cmd real env
286
+ await exec(`${cmd} ${this.materials.name}`, Utils.setEcho(true));
376
287
  }
377
288
  }
378
289
  }
@@ -380,66 +291,25 @@ export default class Tailor {
380
291
  * install packages
381
292
  */
382
293
  if (this.materials.sequence.packages !== undefined) {
383
- switch (distro.familyId) {
384
- case 'debian': {
385
- const packages = await this.helperExists(this.materials.sequence.packages, true, 'packages');
386
- if (packages.length > 1) {
387
- await this.helperInstall(packages);
294
+ const packages = await this.packagesExists(this.materials.sequence.packages);
295
+ if (packages.length > 1) {
296
+ switch (distro.familyId) {
297
+ case 'debian': {
298
+ await this.packagesInstall(packages);
299
+ break;
300
+ }
301
+ case 'archlinux': {
302
+ await this.packagesInstall(this.materials.sequence.packages, 'packages', `pacman -Sy --noconfirm`);
303
+ break;
304
+ }
305
+ case 'alpine': {
306
+ await this.packagesInstall(this.materials.sequence.packages, 'packages', `apk add`);
307
+ break;
308
+ }
309
+ case 'fedora': {
310
+ await this.packagesInstall(this.materials.sequence.packages, 'packages', `dnf install -y`);
311
+ break;
388
312
  }
389
- break;
390
- }
391
- case 'archlinux': {
392
- await this.helperInstall(this.materials.sequence.packages, 'packages', `pacman -Sy --noconfirm`);
393
- break;
394
- }
395
- case 'alpine': {
396
- await this.helperInstall(this.materials.sequence.packages, 'packages', `apk add`);
397
- break;
398
- }
399
- // No default
400
- }
401
- }
402
- if (distro.familyId === 'debian') {
403
- /**
404
- * sequence/packages_no_install_recommends
405
- */
406
- if (this.materials.sequence.packages_no_install_recommends !== undefined) {
407
- const packages_no_install_recommends = await this.helperExists(this.materials.sequence.packages_no_install_recommends, true, 'packages_no_install_recommends');
408
- if (packages_no_install_recommends.length > 1) {
409
- await this.helperInstall(packages_no_install_recommends, 'packages without recommends and suggests', 'apt-get install --no-install-recommends --no-install-suggests -yq ');
410
- }
411
- }
412
- /**
413
- * sequence/try_packages
414
- */
415
- if (this.materials.sequence.try_packages !== undefined) {
416
- const try_packages = await this.helperExists(this.materials.sequence.try_packages, false);
417
- if (try_packages.length > 1) {
418
- await this.helperInstall(try_packages, 'try packages ');
419
- }
420
- }
421
- /**
422
- * sequence/try_packages_no_install_recommends
423
- */
424
- if (this.materials.sequence.try_packages_no_install_recommends !== undefined) {
425
- const try_packages_no_install_recommends = await this.helperExists(this.materials.sequence.try_packages_no_install_recommends, false);
426
- if (try_packages_no_install_recommends.length > 1) {
427
- await this.helperInstall(try_packages_no_install_recommends, 'try packages without recommends and suggests', 'apt-get install --no-install-recommends --no-install-suggests -yq ');
428
- }
429
- }
430
- /**
431
- * sequence/debs
432
- */
433
- if (this.materials.sequence.debs !== undefined && this.materials.sequence.debs) {
434
- step = 'installing local packages';
435
- Utils.warning(step);
436
- let pathDebs = `${this.costume}/debs/${distro.codenameLikeId}`;
437
- if (!fs.existsSync(pathDebs)) {
438
- pathDebs = `${this.costume}/debs`;
439
- }
440
- // if exists pathDebs
441
- if (fs.existsSync(pathDebs)) {
442
- await exec(`dpkg -i ${pathDebs}/*.deb`);
443
313
  }
444
314
  }
445
315
  }
@@ -461,7 +331,6 @@ export default class Tailor {
461
331
  * sequence/accessories
462
332
  */
463
333
  if (!no_accessories) {
464
- // accessories
465
334
  if (this.materials.sequence.accessories !== undefined && Array.isArray(this.materials.sequence.accessories)) {
466
335
  step = 'wearing accessories';
467
336
  for (const elem of this.materials.sequence.accessories) {
@@ -469,80 +338,67 @@ export default class Tailor {
469
338
  continue;
470
339
  }
471
340
  if (elem.slice(0, 2) === './') {
341
+ // local accessory
472
342
  const tailor = new Tailor(`${this.costume}/${elem.slice(2)}`, 'accessory');
473
343
  await tailor.prepare(verbose);
474
344
  }
475
345
  else {
346
+ // global accessory
476
347
  const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`, 'accessory');
477
348
  await tailor.prepare(verbose);
478
349
  }
479
350
  }
480
351
  }
481
- if (distro.familyId === 'debian' && // try_accessories
482
- this.materials.sequence.try_accessories !== undefined &&
483
- Array.isArray(this.materials.sequence.try_accessories)) {
484
- step = 'wearing try_accessories';
485
- for (const elem of this.materials.sequence.try_accessories) {
486
- if ((elem === 'firmwares' || elem === './firmwares') && no_firmwares) {
487
- continue;
488
- }
489
- if (elem.slice(0, 2) === './') {
490
- const tailor = new Tailor(`${this.costume}/${elem.slice(2)}`, 'try_accessory');
491
- await tailor.prepare(verbose);
492
- }
493
- else {
494
- const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`, 'try_accessory');
495
- await tailor.prepare(verbose);
496
- }
497
- }
498
- }
499
352
  } // no-accessories
500
353
  } // end sequence
501
354
  /**
502
355
  * customize
503
356
  */
504
- if (this.materials.customize !== undefined) {
357
+ if (this.materials.finalize !== undefined) {
505
358
  /**
506
- * customize/dirs
359
+ * finalize/customize
507
360
  */
508
- if (this.materials.customize.dirs && fs.existsSync(`/${this.costume}/dirs`)) {
509
- step = 'copying dirs';
361
+ if (this.materials.finalize.customize && fs.existsSync(`/${this.costume}/sysroot`)) {
362
+ step = `finalize/customize: copying ${this.costume}/sysroot/ to /`;
510
363
  Utils.warning(step);
511
- let cmd = `rsync -avx ${this.costume}/dirs/* /`;
364
+ let cmd = `rsync -avx ${this.costume}/sysroot/* / ${this.toNull}`;
512
365
  await exec(cmd, this.echo);
513
- // chown root:root /etc -R
514
- cmd = 'chown root:root /etc/sudoers.d /etc/skel -R';
366
+ // chown
367
+ cmd = `chown root:root /etc/sudoers.d /etc/skel -R`;
515
368
  await exec(cmd, this.echo);
516
369
  /**
517
370
  * Copyng skel in /home/user
518
371
  */
519
- if (fs.existsSync(`${this.costume}/dirs/etc/skel`)) {
372
+ if (fs.existsSync(`${this.costume}/sysroot/etc/skel`)) {
520
373
  const user = await Utils.getPrimaryUser();
521
- step = `copying skel in /home/${user}/`;
374
+ step = `finalize/customize: copying skel in /home/${user}/`;
522
375
  Utils.warning(step);
523
- cmd = `rsync -avx ${this.costume}/dirs/etc/skel/.config /home/${user}/`;
376
+ cmd = `rsync -avx ${this.costume}/sysroot/etc/skel/.config /home/${user}/ ${this.toNull}`;
524
377
  await exec(cmd, this.echo);
525
378
  await exec(`chown ${user}:${user} /home/${user}/ -R`);
526
379
  }
527
380
  }
528
381
  /**
529
- * customize/scripts
382
+ * finalize/cmds
530
383
  */
531
- if (this.materials.customize.scripts !== undefined && Array.isArray(this.materials.customize.scripts)) {
532
- step = 'customize script';
384
+ if (this.materials.finalize.cmds !== undefined && Array.isArray(this.materials.finalize.cmds)) {
385
+ step = 'finalize/commands';
533
386
  Utils.warning(step);
534
- for (const script of this.materials.customize.scripts) {
535
- if (fs.existsSync(`${this.costume}/${script}`)) {
536
- // exec script in costume passing costume-name
537
- await exec(`${this.costume}/${script} ${this.materials.name}`, Utils.setEcho(true));
387
+ for (const cmd of this.materials.finalize.cmds) {
388
+ if (fs.existsSync(`${this.costume}/${cmd}`)) {
389
+ await exec(`${this.costume}/${cmd} ${this.materials.name}`, Utils.setEcho(true));
538
390
  }
539
391
  else {
540
- // exec script real env
541
- await exec(`${script}`, Utils.setEcho(true));
392
+ // exec cmd real env
393
+ await exec(`${cmd}`, Utils.setEcho(true));
542
394
  }
543
395
  }
544
396
  }
545
397
  }
398
+ // show log
399
+ if (fs.existsSync(this.log)) {
400
+ await exec(`cat ${this.log}`);
401
+ }
546
402
  /**
547
403
  * reboot
548
404
  */
@@ -557,15 +413,86 @@ export default class Tailor {
557
413
  }
558
414
  /**
559
415
  *
560
- * @param command
416
+ * @param packages
417
+ * @param verbose
418
+ * @param section
419
+ * @returns
561
420
  */
562
- titles(command = '') {
563
- console.clear();
564
- console.log('');
565
- console.log(' E G G S: the reproductive system of penguins');
566
- console.log('');
567
- console.log(chalk.bgGreen.whiteBright(' ' + pjson.name + ' ') + chalk.bgWhite.blue(" Perri's Brewery edition ") + chalk.bgRed.whiteBright(' ver. ' + pjson.version + ' '));
568
- console.log('wearing: ' + chalk.bgBlack.cyan(this.costume) + ' ' + chalk.bgBlack.white(command) + '\n');
421
+ async packagesExists(wanted) {
422
+ Utils.warning(`checking packages exists ${this.costume}`);
423
+ wanted.sort();
424
+ const distro = new Distro();
425
+ let cmd = "";
426
+ if (distro.familyId === "debian") {
427
+ cmd = `apt-cache --no-generate pkgnames`;
428
+ }
429
+ else if (distro.familyId === "archlinux") {
430
+ cmd = `pacman -S --list | awk '{print $2}'`;
431
+ }
432
+ else if (distro.familyId === "alpine") {
433
+ cmd = `apk search | awk -F'-[0-9]' '{print $1}' | sort -u`;
434
+ }
435
+ else if (distro.familyId === 'fedora') {
436
+ cmd = `dnf list available | awk '{print $1}' | sed 's/\.[^.]*$//'`;
437
+ }
438
+ //available = (await exec(cmd, { capture: true, echo: false, ignore: false })).data.split('\n')
439
+ let available = [];
440
+ available = (await exec(cmd, { capture: true, echo: false, ignore: false })).data.split('\n');
441
+ available.sort();
442
+ let exists = [];
443
+ let not_exists = [];
444
+ for (const elem of wanted) {
445
+ if (available.includes(elem)) {
446
+ exists.push(elem);
447
+ }
448
+ else {
449
+ not_exists.push(elem);
450
+ fs.appendFileSync(this.log, `- ${elem}\n`);
451
+ }
452
+ }
453
+ if (not_exists.length > 0) {
454
+ console.log(`${this.materials.name}, ${not_exists.length} following packages was not found:`);
455
+ for (const elem of not_exists) {
456
+ console.log(`-${elem}`);
457
+ }
458
+ console.log();
459
+ console.log("Wait 3 seconds");
460
+ await sleep(3000);
461
+ }
462
+ return exists;
463
+ }
464
+ /**
465
+ * - check if every package if installed
466
+ * - if find any packages to install, install it
467
+ */
468
+ async packagesInstall(packages, comment = 'packages', cmd = 'apt-get install -yqq ') {
469
+ Utils.warning(`installing existing packages ${this.costume}`);
470
+ if (packages[0] !== null) {
471
+ const elements = [];
472
+ let strElements = '';
473
+ for (const elem of packages) {
474
+ elements.push(elem);
475
+ cmd += ` ${elem}`;
476
+ strElements += `, ${elem}`;
477
+ }
478
+ if (elements.length > 0) {
479
+ let step = `installing ${comment}: `;
480
+ if (!this.verbose) {
481
+ step += strElements.slice(2);
482
+ }
483
+ /**
484
+ * prova 3 volte
485
+ */
486
+ const limit = 3;
487
+ for (let tempts = 1; tempts < limit; tempts++) {
488
+ Utils.titles(step);
489
+ Utils.warning(`tempts ${tempts} of ${limit}`);
490
+ if (await tryCheckSuccess(cmd, this.echo)) {
491
+ break;
492
+ }
493
+ }
494
+ }
495
+ }
569
496
  }
570
497
  }
571
498
  /**
@@ -585,3 +512,13 @@ async function tryCheckSuccess(cmd, echo) {
585
512
  }
586
513
  return success;
587
514
  }
515
+ /**
516
+ *
517
+ * @param ms
518
+ * @returns
519
+ */
520
+ function sleep(ms = 0) {
521
+ return new Promise((resolve) => {
522
+ setTimeout(resolve, ms);
523
+ });
524
+ }
@@ -11,6 +11,7 @@ import fs from 'node:fs';
11
11
  import path from 'node:path';
12
12
  import Tailor from '../../classes/tailor.js';
13
13
  import Utils from '../../classes/utils.js';
14
+ import { exec } from '../../lib/utils.js';
14
15
  /**
15
16
  *
16
17
  */
@@ -68,6 +69,8 @@ export default class Wear extends Command {
68
69
  if (await Utils.customConfirm(`Prepare your costume: ${costume}? Select yes to continue...`)) {
69
70
  if (Utils.isRoot()) {
70
71
  const tailor = new Tailor(costume);
72
+ // delete previous log
73
+ await exec(`rm -f ${path.dirname(wardrobe)}+"/wardrobe.log`);
71
74
  await tailor.prepare(verbose, no_accessories, no_firmwares);
72
75
  }
73
76
  else {
@@ -12,30 +12,25 @@ export interface IRepos {
12
12
  }
13
13
  export interface IMateria {
14
14
  author: string;
15
- customize: {
16
- dirs: boolean;
17
- scripts: string[];
18
- };
19
15
  description: string;
20
16
  distributions: string[];
21
17
  name: string;
22
- reboot: boolean;
23
18
  release: string;
24
19
  sequence: {
25
- accessories: string[];
26
- debs: boolean;
27
- packages: string[];
28
- packages_no_install_recommends: string[];
29
- packages_python: string[];
30
- preinst: string[];
31
20
  repositories: {
32
21
  sources_list: string[];
33
22
  sources_list_d: string[];
34
23
  update: boolean;
35
24
  upgrade: boolean;
36
25
  };
37
- try_accessories: string[];
38
- try_packages: string[];
39
- try_packages_no_install_recommends: string[];
26
+ cmds: string[];
27
+ packages: string[];
28
+ packages_python: string[];
29
+ accessories: string[];
40
30
  };
31
+ finalize: {
32
+ customize: boolean;
33
+ cmds: string[];
34
+ };
35
+ reboot: boolean;
41
36
  }