penguins-eggs 9.0.31 → 9.0.35

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.
@@ -153,12 +153,13 @@ class Hatching {
153
153
  // restoring users data
154
154
  message = "Restore private data from backup ";
155
155
  percent = 0.37;
156
+ let cmd = 'eggs syncfrom --rootdir /tmp/calamares-krill-root/';
156
157
  try {
157
158
  redraw(react_1.default.createElement(install_1.default, { message: message, percent: percent, spinner: true }));
158
- await (0, utils_2.exec)('eggs syncfrom --rootdir /tmp/calamares-krill-root/', this.echo);
159
+ await (0, utils_2.exec)(cmd, utils_1.default.setEcho(true));
159
160
  }
160
161
  catch (error) {
161
- await utils_1.default.pressKeyToExit(JSON.stringify(error));
162
+ await utils_1.default.pressKeyToExit(cmd);
162
163
  }
163
164
  }
164
165
  // sources-yolk
@@ -449,8 +450,21 @@ adduser ${name} \
449
450
  async delLiveUser() {
450
451
  if (utils_1.default.isLive()) {
451
452
  const user = this.settings.config.user_opt;
452
- const cmd = `chroot ${this.installTarget} deluser --remove-home ${user} ${this.toNull}`;
453
- await (0, utils_2.exec)(cmd, this.echo);
453
+ let cmd = `#!/bin/sh\ngetent passwd "${user}" > /dev/null`;
454
+ let userExists = false;
455
+ try {
456
+ await (0, utils_2.exec)(cmd, utils_1.default.setEcho(this.verbose));
457
+ userExists = true;
458
+ }
459
+ catch (error) {
460
+ // console.log(error)
461
+ }
462
+ finally {
463
+ if (userExists) {
464
+ const cmd = `chroot ${this.installTarget} deluser --remove-home ${user} ${this.toNull}`;
465
+ await (0, utils_2.exec)(cmd, this.echo);
466
+ }
467
+ }
454
468
  }
455
469
  }
456
470
  /**
@@ -8,7 +8,6 @@ import Users from './users';
8
8
  export default class Ovary {
9
9
  verbose: boolean;
10
10
  echo: {};
11
- echoYes: {};
12
11
  toNull: string;
13
12
  incubator: Incubator;
14
13
  settings: Settings;
@@ -42,7 +42,6 @@ class Ovary {
42
42
  constructor() {
43
43
  this.verbose = false;
44
44
  this.echo = {};
45
- this.echoYes = {};
46
45
  this.toNull = '';
47
46
  this.incubator = {};
48
47
  this.settings = {};
@@ -84,7 +83,6 @@ class Ovary {
84
83
  async produce(backup = false, scriptOnly = false, yolkRenew = false, release = false, myAddons, verbose = false) {
85
84
  this.verbose = verbose;
86
85
  this.echo = utils_2.default.setEcho(verbose);
87
- this.echoYes = utils_2.default.setEcho(true);
88
86
  if (this.verbose) {
89
87
  this.toNull = ' > /dev/null 2>&1';
90
88
  }
@@ -123,11 +121,15 @@ class Ovary {
123
121
  await bleach.clean(verbose);
124
122
  }
125
123
  if (backup) {
126
- console.log(`eggs will remove all the users from live. Following servers datas will included on a crypted LUKS volume:`);
124
+ console.log(`eggs will remove all users and services data from live. Following datas will included on a crypted LUKS volume:`);
127
125
  const users = await this.usersFill();
128
126
  for (let i = 0; i < users.length; i++) {
129
127
  if (users[i].saveIt) {
130
- console.log(`- user: ${users[i].login.padEnd(16)} \thome: ${users[i].home}`);
128
+ let utype = 'user ';
129
+ if (parseInt(users[i].uid) < 1000) {
130
+ utype = 'service';
131
+ }
132
+ console.log(`- ${utype}: ${users[i].login.padEnd(16)} \thome: ${users[i].home}`);
131
133
  if (users[i].login !== 'root') {
132
134
  this.addRemoveExclusion(true, users[i].home);
133
135
  }
@@ -135,7 +137,7 @@ class Ovary {
135
137
  }
136
138
  }
137
139
  else {
138
- utils_2.default.warning('eggs will remove all the users from live, but servers datas will be included uncrypted');
140
+ utils_2.default.warning('eggs will remove all the users data from live, but all services data will be included uncrypted');
139
141
  }
140
142
  /**
141
143
  * NOTE: reCreate = false
@@ -175,19 +177,19 @@ class Ovary {
175
177
  await this.createXdgAutostart(this.settings.config.theme, myAddons);
176
178
  if ((0, displaymanager_1.displaymanager)() === '') {
177
179
  // If GUI is installed and not Desktop manager
178
- cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.versionId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
179
- cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.versionId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
180
+ cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
181
+ cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
180
182
  }
181
183
  }
182
184
  else {
183
- cliAutologin.addAutologin(this.settings.distro.distroId, this.settings.distro.versionId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
185
+ cliAutologin.addAutologin(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
184
186
  }
185
187
  await this.editLiveFs();
186
188
  await this.makeSquashfs(scriptOnly);
187
189
  await this.uBindLiveFs(); // Lo smonto prima della fase di backup
188
190
  }
189
191
  if (backup) {
190
- await (0, utils_1.exec)('eggs syncto', this.echo);
192
+ await (0, utils_1.exec)('eggs syncto', utils_2.default.setEcho(true));
191
193
  utils_2.default.warning(`moving ${luksFile} in ${this.settings.config.snapshot_dir}ovarium/iso/live`);
192
194
  await (0, utils_1.exec)(`mv ${luksFile} ${this.settings.config.snapshot_dir}ovarium/iso/live`, this.echo);
193
195
  }
@@ -564,7 +566,7 @@ class Ovary {
564
566
  let initrdImg = utils_2.default.initrdImg();
565
567
  initrdImg = initrdImg.substring(initrdImg.lastIndexOf('/') + 1);
566
568
  utils_2.default.warning(`Creating ${initrdImg} in ${this.settings.work_dir.pathIso}/live/`);
567
- await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/manjaro/mkinitcpio.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, this.echoYes);
569
+ await (0, utils_1.exec)(`mkinitcpio -c ${node_path_1.default.resolve(__dirname, '../../mkinitcpio/manjaro/mkinitcpio.conf')} -g ${this.settings.work_dir.pathIso}/live/${initrdImg}`, utils_2.default.setEcho(true));
568
570
  }
569
571
  /**
570
572
  * We must upgrade to initrdCreate for Debian/Ubuntu
@@ -645,7 +647,7 @@ class Ovary {
645
647
  utils_2.default.writeX(`${this.settings.work_dir.path}mksquashfs`, cmd);
646
648
  if (!scriptOnly) {
647
649
  utils_2.default.warning('squashing filesystem: ' + compression);
648
- await (0, utils_1.exec)(cmd, this.echoYes);
650
+ await (0, utils_1.exec)(cmd, utils_2.default.setEcho(true));
649
651
  }
650
652
  }
651
653
  /**
@@ -967,7 +969,7 @@ class Ovary {
967
969
  // pve
968
970
  if (myAddons.pve) {
969
971
  /**
970
- * create service pve-lite
972
+ * create service pve-live
971
973
  */
972
974
  const pve = new pve_live_1.default();
973
975
  pve.create(this.settings.work_dir.merged);
@@ -1088,7 +1090,7 @@ class Ovary {
1088
1090
  const memdiskDir = this.settings.work_dir.path + 'memdiskDir';
1089
1091
  const efiWorkDir = this.settings.efi_work;
1090
1092
  const isoDir = this.settings.work_dir.pathIso;
1091
- const versionLike = this.settings.distro.versionLike;
1093
+ const codenameLikeId = this.settings.distro.codenameLikeId;
1092
1094
  /**
1093
1095
  * il pachetto grub/grub2 DEVE essere presente
1094
1096
  */
@@ -1239,7 +1241,7 @@ class Ovary {
1239
1241
  const grubDest = `${isoDir}/boot/grub/grub.cfg`;
1240
1242
  const template = fs.readFileSync(grubTemplate, 'utf8');
1241
1243
  // let rmModules = ''
1242
- // if (this.settings.distro.versionLike === 'focal') {
1244
+ // if (this.settings.distro.codenameLikeId === 'focal') {
1243
1245
  // rmModules = 'rmmod tpm'
1244
1246
  // }
1245
1247
  const view = {
@@ -1296,9 +1298,9 @@ class Ovary {
1296
1298
  this.settings.isoFilename = prefix + volid + postfix;
1297
1299
  const output = this.settings.config.snapshot_dir + this.settings.isoFilename;
1298
1300
  let command = '';
1299
- const appid = `-appid "${this.settings.distro.distroId}" `;
1300
- const publisher = `-publisher "${this.settings.distro.distroId}/${this.settings.distro.versionId}" `;
1301
- const preparer = '-preparer "prepared by eggs <https://penguins-eggs.net>" ';
1301
+ // const appid = `-appid "${this.settings.distro.distroId}" `
1302
+ // const publisher = `-publisher "${this.settings.distro.distroId}/${this.settings.distro.codenameId}" `
1303
+ // const preparer = '-preparer "prepared by eggs <https://penguins-eggs.net>" '
1302
1304
  let isoHybridMbr = ``;
1303
1305
  if (this.settings.config.make_isohybrid) {
1304
1306
  const isolinuxFile = this.settings.distro.isolinuxPath + 'isohdpfx.bin';
@@ -1356,26 +1358,27 @@ class Ovary {
1356
1358
  * -isohybrid-gpt-basdat
1357
1359
  * isohybrid-apm-hfsplus
1358
1360
  * boot1 CD1
1359
- */
1361
+
1360
1362
  command = `xorriso -as mkisofs \
1361
- -r \
1362
- -checksum_algorithm_iso md5,sha1,sha256,sha512 \
1363
- -V ${volid} \
1364
- -o ${output} \
1365
- -J \
1366
- -joliet-long \
1367
- -cache-inodes \
1368
- ${isoHybridMbr} \
1369
- -b isolinux/isolinux.bin \
1370
- -c isolinux/boot.cat \
1371
- -boot-load-size 4 \
1372
- -boot-info-table \
1373
- -no-emul-boot \
1374
- ${uefi_elToritoAltBoot} \
1375
- ${uefi_e} \
1376
- ${uefi_noEmulBoot} \
1377
- ${uefi_isohybridGptBasdat}
1378
- ${this.settings.work_dir.pathIso}`;
1363
+ -r \
1364
+ -checksum_algorithm_iso md5,sha1,sha256,sha512 \
1365
+ -V ${volid} \
1366
+ -o ${output} \
1367
+ -J \
1368
+ -joliet-long \
1369
+ -cache-inodes \
1370
+ ${isoHybridMbr} \
1371
+ -b isolinux/isolinux.bin \
1372
+ -c isolinux/boot.cat \
1373
+ -boot-load-size 4 \
1374
+ -boot-info-table \
1375
+ -no-emul-boot \
1376
+ ${uefi_elToritoAltBoot} \
1377
+ ${uefi_e} \
1378
+ ${uefi_noEmulBoot} \
1379
+ ${uefi_isohybridGptBasdat}
1380
+ ${this.settings.work_dir.pathIso}`
1381
+ */
1379
1382
  /**
1380
1383
  * how is made in refracta
1381
1384
  *
@@ -1429,7 +1432,7 @@ class Ovary {
1429
1432
  }
1430
1433
  utils_2.default.writeX(`${this.settings.work_dir.path}mkisofs`, cmd);
1431
1434
  if (!scriptOnly) {
1432
- await (0, utils_1.exec)(cmd, this.echo);
1435
+ await (0, utils_1.exec)(cmd, utils_2.default.setEcho(true));
1433
1436
  }
1434
1437
  }
1435
1438
  /**
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { IRemix, IDistro } from '../interfaces';
8
8
  /**
9
- * Utils: general porpourse utils
9
+ * Utils: general porpouse utils
10
10
  * @remarks all the utilities
11
11
  */
12
12
  export default class Pacman {
@@ -22,7 +22,7 @@ const suse_1 = (0, tslib_1.__importDefault)(require("./family/suse"));
22
22
  const config_file = '/etc/penguins-eggs.d/eggs.yaml';
23
23
  const config_tools = '/etc/penguins-eggs.d/tools.yaml';
24
24
  /**
25
- * Utils: general porpourse utils
25
+ * Utils: general porpouse utils
26
26
  * @remarks all the utilities
27
27
  */
28
28
  class Pacman {
@@ -447,8 +447,8 @@ class Pacman {
447
447
  * distroTemplateCheck
448
448
  */
449
449
  static distroTemplateCheck() {
450
- const versionLike = this.distro().versionLike;
451
- return node_fs_1.default.existsSync(`/etc/penguins-eggs.d/distros/${versionLike}`);
450
+ const codenameLikeId = this.distro().codenameLikeId;
451
+ return node_fs_1.default.existsSync(`/etc/penguins-eggs.d/distros/${codenameLikeId}`);
452
452
  }
453
453
  /**
454
454
  *
@@ -459,7 +459,7 @@ class Pacman {
459
459
  }
460
460
  const echo = utils_1.default.setEcho(verbose);
461
461
  const rootPen = utils_1.default.rootPenguin();
462
- await (0, utils_2.exec)(`mkdir /etc/penguins-eggs.d/distros/${this.distro().versionLike}`);
462
+ await (0, utils_2.exec)(`mkdir /etc/penguins-eggs.d/distros/${this.distro().codenameLikeId}`);
463
463
  /**
464
464
  * Debian 10 - Buster: è il master per tutte le distro
465
465
  */
@@ -467,7 +467,7 @@ class Pacman {
467
467
  /**
468
468
  * Debian 8 jessie: eredita grub, isolinux e locales da buster, contiene krill al posto di calamares
469
469
  */
470
- if (this.distro().versionLike === 'jessie') {
470
+ if (this.distro().codenameLikeId === 'jessie') {
471
471
  const dest = '/etc/penguins-eggs.d/distros/jessie';
472
472
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
473
473
  await (0, utils_2.exec)(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
@@ -475,7 +475,7 @@ class Pacman {
475
475
  * Debian 9 stretch: eredita grub, isolinux e locales da buster, contiene krill al posto di calamares
476
476
  */
477
477
  }
478
- else if (this.distro().versionLike === 'stretch') {
478
+ else if (this.distro().codenameLikeId === 'stretch') {
479
479
  const dest = '/etc/penguins-eggs.d/distros/stretch';
480
480
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
481
481
  await (0, utils_2.exec)(`cp -r ${rootPen}/conf/distros/jessie/krill ${dest}/krill`, echo);
@@ -483,7 +483,7 @@ class Pacman {
483
483
  * Debian 10 buster: eredita tutto da buster
484
484
  */
485
485
  }
486
- else if (this.distro().versionLike === 'buster') {
486
+ else if (this.distro().codenameLikeId === 'buster') {
487
487
  const dest = '/etc/penguins-eggs.d/distros/buster';
488
488
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
489
489
  await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
@@ -491,7 +491,7 @@ class Pacman {
491
491
  * Debian 11 bullseye: eredita tutto da buster
492
492
  */
493
493
  }
494
- else if (this.distro().versionLike === 'bullseye') {
494
+ else if (this.distro().codenameLikeId === 'bullseye') {
495
495
  const dest = '/etc/penguins-eggs.d/distros/bullseye';
496
496
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
497
497
  await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
@@ -499,7 +499,7 @@ class Pacman {
499
499
  * Debian 12 bookworm: eredita tutto da buster
500
500
  */
501
501
  }
502
- else if (this.distro().versionLike === 'bookworm') {
502
+ else if (this.distro().codenameLikeId === 'bookworm') {
503
503
  const dest = '/etc/penguins-eggs.d/distros/bookworm';
504
504
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
505
505
  await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
@@ -510,7 +510,7 @@ class Pacman {
510
510
  * Devuan beowulf: eredita tutto da buster
511
511
  */
512
512
  }
513
- else if (this.distro().versionLike === 'beowulf') {
513
+ else if (this.distro().codenameLikeId === 'beowulf') {
514
514
  const dest = '/etc/penguins-eggs.d/distros/beowulf';
515
515
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
516
516
  await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
@@ -518,7 +518,7 @@ class Pacman {
518
518
  * Devuan chimaera: eredita tutto da buster
519
519
  */
520
520
  }
521
- else if (this.distro().versionLike === 'chimaera') {
521
+ else if (this.distro().codenameLikeId === 'chimaera') {
522
522
  const dest = '/etc/penguins-eggs.d/distros/chimaera';
523
523
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
524
524
  await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
@@ -526,7 +526,7 @@ class Pacman {
526
526
  * Devuan daedalus: eredita tutto da buster
527
527
  */
528
528
  }
529
- else if (this.distro().versionLike === 'daedalus') {
529
+ else if (this.distro().codenameLikeId === 'daedalus') {
530
530
  const dest = '/etc/penguins-eggs.d/distros/daedalus';
531
531
  await (0, utils_2.exec)(`cp -r ${buster}/locales ${dest}/locales`, echo);
532
532
  await (0, utils_2.exec)(`cp -r ${buster}/calamares ${dest}/calamares`, echo);
@@ -537,7 +537,7 @@ class Pacman {
537
537
  * Ubuntu 10.04 bionic: eredita da bionic, focal grub ed isolinux, da buster i seguenti
538
538
  */
539
539
  }
540
- else if (this.distro().versionLike === 'bionic') {
540
+ else if (this.distro().codenameLikeId === 'bionic') {
541
541
  const dest = '/etc/penguins-eggs.d/distros/bionic';
542
542
  const bionic = `${rootPen}/conf/distros/bionic/*`;
543
543
  await (0, utils_2.exec)(`cp -r ${bionic} ${dest}`, echo);
@@ -556,7 +556,7 @@ class Pacman {
556
556
  * Ubuntu focal: eredita da focal e buster
557
557
  */
558
558
  }
559
- else if (this.distro().versionLike === 'focal') {
559
+ else if (this.distro().codenameLikeId === 'focal') {
560
560
  const dest = '/etc/penguins-eggs.d/distros/focal';
561
561
  const focal = `${rootPen}/conf/distros/focal/*`;
562
562
  await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
@@ -571,7 +571,7 @@ class Pacman {
571
571
  * Ubuntu 20.10 groovy: eredita da focal e buster
572
572
  */
573
573
  }
574
- else if (this.distro().versionLike === 'groovy') {
574
+ else if (this.distro().codenameLikeId === 'groovy') {
575
575
  const dest = '/etc/penguins-eggs.d/distros/groovy';
576
576
  const focal = `${rootPen}/conf/distros/focal/*`;
577
577
  await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
@@ -586,7 +586,7 @@ class Pacman {
586
586
  * Ubuntu 21.04 hirsute: eredita da focal e buster
587
587
  */
588
588
  }
589
- else if (this.distro().versionLike === 'hirsute') {
589
+ else if (this.distro().codenameLikeId === 'hirsute') {
590
590
  const dest = '/etc/penguins-eggs.d/distros/hirsute';
591
591
  const focal = `${rootPen}/conf/distros/focal/*`;
592
592
  await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
@@ -601,7 +601,7 @@ class Pacman {
601
601
  * Ubuntu 21.10 impish: eredita da focal e buster
602
602
  */
603
603
  }
604
- else if (this.distro().versionLike === 'impish') {
604
+ else if (this.distro().codenameLikeId === 'impish') {
605
605
  const dest = '/etc/penguins-eggs.d/distros/impish';
606
606
  const focal = `${rootPen}/conf/distros/focal/*`;
607
607
  await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
@@ -616,7 +616,7 @@ class Pacman {
616
616
  * Ubuntu 22.04 jammy: eredita da focal e buster
617
617
  */
618
618
  }
619
- else if (this.distro().versionLike === 'jammy') {
619
+ else if (this.distro().codenameLikeId === 'jammy') {
620
620
  const dest = '/etc/penguins-eggs.d/distros/jammy';
621
621
  const focal = `${rootPen}/conf/distros/focal/*`;
622
622
  await (0, utils_2.exec)(`cp -r ${focal} ${dest}`, echo);
@@ -634,7 +634,7 @@ class Pacman {
634
634
  * Fedora 35 ThirtyFive: eredita da ThirtyFive
635
635
  */
636
636
  }
637
- else if (this.distro().versionLike === 'thirtyfive') {
637
+ else if (this.distro().codenameLikeId === 'thirtyfive') {
638
638
  const dest = '/etc/penguins-eggs.d/distros/thirtyfive/';
639
639
  const thirtytive = `${rootPen}/conf/distros/thirtyfive/*`;
640
640
  await (0, utils_2.exec)(`cp -r ${thirtytive} ${dest}`, echo);
@@ -645,7 +645,7 @@ class Pacman {
645
645
  * Endeavour rolling: eredita da rolling
646
646
  */
647
647
  }
648
- else if (this.distro().versionLike === 'rolling') {
648
+ else if (this.distro().codenameLikeId === 'rolling') {
649
649
  const dest = '/etc/penguins-eggs.d/distros/rolling/';
650
650
  const rolling = `${rootPen}/conf/distros/rolling/*`;
651
651
  await (0, utils_2.exec)(`cp -r ${rolling} ${dest}`, echo);
@@ -656,7 +656,7 @@ class Pacman {
656
656
  * openSUSE tumbleweed: eredita da tumbleweed
657
657
  */
658
658
  }
659
- else if (this.distro().versionLike === 'tumbleweed') {
659
+ else if (this.distro().codenameLikeId === 'tumbleweed') {
660
660
  const dest = '/etc/penguins-eggs.d/distros/tumbleweed/';
661
661
  const tumbleweed = `${rootPen}/conf/distros/tumbleweed/*`;
662
662
  await (0, utils_2.exec)(`cp -r ${tumbleweed} ${dest}`, echo);
@@ -17,7 +17,7 @@ const tslib_1 = require("tslib");
17
17
  * This will remove the symbolic link that indicated that the service should be started automatically.
18
18
  */
19
19
  const systemctl_1 = (0, tslib_1.__importDefault)(require("./systemctl"));
20
- const node_path_1 = (0, tslib_1.__importDefault)(require("node:path"));
20
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
21
21
  const shelljs_1 = (0, tslib_1.__importDefault)(require("shelljs"));
22
22
  class PveLive {
23
23
  constructor() {
@@ -44,32 +44,28 @@ class PveLive {
44
44
  *
45
45
  */
46
46
  createScript(root = '/') {
47
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../scripts/pve-live.sh'), root + '/usr/bin/');
47
+ shelljs_1.default.cp(path_1.default.resolve(__dirname, '../../scripts/pve-live.sh'), root + '/usr/bin/');
48
48
  }
49
49
  /**
50
50
  *
51
51
  */
52
52
  createService(root = '/') {
53
- shelljs_1.default.cp(node_path_1.default.resolve(__dirname, '../../scripts/pve-live.service'), root + '/lib/systemd/system/');
53
+ shelljs_1.default.cp(path_1.default.resolve(__dirname, '../../scripts/pve-live.service'), root + '/lib/systemd/system/');
54
54
  }
55
55
  /**
56
56
  *
57
57
  */
58
58
  start() {
59
- this.systemctl.start('lxcfs');
60
- this.systemctl.start('pve-cluster');
61
- this.systemctl.start('pve-firewall');
59
+ this.systemctl.start('pve-live');
60
+ // this.systemctl.start('lxcfs')
61
+ // this.systemctl.start('pve-cluster')
62
+ // this.systemctl.start('pve-firewall')
62
63
  // this.systemctl.start('pve-guests')
63
- this.systemctl.start('pve-ha-crm');
64
- this.systemctl.start('pve-ha-lrm');
64
+ // this.systemctl.start('pve-ha-crm')
65
+ // this.systemctl.start('pve-ha-lrm')
65
66
  }
66
67
  stop() {
67
- this.systemctl.stop('lxcfs');
68
- this.systemctl.stop('pve-cluster');
69
- this.systemctl.stop('pve-firewall');
70
- // this.systemctl.stop('pve-guests')
71
- this.systemctl.stop('pve-ha-crm');
72
- this.systemctl.stop('pve-ha-lrm');
68
+ this.systemctl.start('pve-live');
73
69
  }
74
70
  }
75
71
  exports.default = PveLive;
@@ -12,9 +12,9 @@ export default class Utils {
12
12
  /**
13
13
  * Restituisce il prefisso della iso
14
14
  * @param distroId
15
- * @param versionId
15
+ * @param codenameId
16
16
  */
17
- static snapshotPrefix(distroId: string, versionId: string): string;
17
+ static snapshotPrefix(distroId: string, codenameId: string): string;
18
18
  /**
19
19
  * Controlla se il sistema è avviato con systemd
20
20
  * funziona anche in MX che utilizza systemd
@@ -28,7 +28,10 @@ export default class Utils {
28
28
  static isSysvinit(): boolean;
29
29
  /**
30
30
  * ricava path per vmlinuz
31
- * BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.15.6-200.fc35.x86_64 root=UUID=91cf614e-62a1-464c-904f-38d0a1ceb7a7 ro rootflags=subvol=root rhgb quiet
31
+ * Normalmente cerca BOOT_IMAGE
32
+ * BOOT_IMAGE=/boot/vmlinuz-5.16.0-3-amd64 root=UUID=13768873-d6ba-4ae5-9e14-b5011f5aa31c ro quiet splash resume=UUID=beafb9b4-c429-4e1f-a268-4270b63a14e6
33
+ * se non è presente, come nel caso di Franco, cerca initrd e ricostruisce vmlinuz
34
+ * ro root=UUID=3dc0f202-8ac8-4686-9316-dddcec060c48 initrd=boot\initrd.img-5.15.0-0.bpo.3-amd64 // Conidi
32
35
  */
33
36
  static vmlinuz(): string;
34
37
  /**
@@ -26,10 +26,10 @@ class Utils {
26
26
  /**
27
27
  * Restituisce il prefisso della iso
28
28
  * @param distroId
29
- * @param versionId
29
+ * @param codenameId
30
30
  */
31
- static snapshotPrefix(distroId, versionId) {
32
- let result = 'egg-of-' + distroId.toLowerCase() + '-' + versionId.toLowerCase() + '-';
31
+ static snapshotPrefix(distroId, codenameId) {
32
+ let result = 'egg-of-' + distroId.toLowerCase() + '-' + codenameId.toLowerCase() + '-';
33
33
  result = result.replace(`/`, '-');
34
34
  return result;
35
35
  }
@@ -58,25 +58,43 @@ class Utils {
58
58
  }
59
59
  /**
60
60
  * ricava path per vmlinuz
61
- * BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.15.6-200.fc35.x86_64 root=UUID=91cf614e-62a1-464c-904f-38d0a1ceb7a7 ro rootflags=subvol=root rhgb quiet
61
+ * Normalmente cerca BOOT_IMAGE
62
+ * BOOT_IMAGE=/boot/vmlinuz-5.16.0-3-amd64 root=UUID=13768873-d6ba-4ae5-9e14-b5011f5aa31c ro quiet splash resume=UUID=beafb9b4-c429-4e1f-a268-4270b63a14e6
63
+ * se non è presente, come nel caso di Franco, cerca initrd e ricostruisce vmlinuz
64
+ * ro root=UUID=3dc0f202-8ac8-4686-9316-dddcec060c48 initrd=boot\initrd.img-5.15.0-0.bpo.3-amd64 // Conidi
62
65
  */
63
66
  static vmlinuz() {
64
- const cmdline = fs_1.default.readFileSync('/proc/cmdline', 'utf8');
65
- // start = find BOOT_IMAGE
66
- const start = cmdline.search('BOOT_IMAGE=/') + 11;
67
- // end first space after
68
- const end = cmdline.substring(start).indexOf(' ');
69
- let vmlinux = cmdline.substring(start, start + end);
70
- // btrfs
71
- if (vmlinux.indexOf('@') > 0) {
72
- vmlinux = vmlinux.substring(vmlinux.indexOf(' ') + 1);
67
+ let vmlinuz = '';
68
+ // find vmlinuz in /proc/cmdline
69
+ const cmdline = fs_1.default.readFileSync('/proc/cmdline', 'utf8').split(" ");
70
+ cmdline.forEach(cmd => {
71
+ if (cmd.includes('BOOT_IMAGE')) {
72
+ vmlinuz = cmd.substring(cmd.indexOf('=') + 1);
73
+ }
74
+ });
75
+ // If vmlinuz not found in /proc/cmdline, try to find version in initrd.img
76
+ if (vmlinuz === '') {
77
+ cmdline.forEach(cmd => {
78
+ if (cmd.includes('initrd.img')) {
79
+ vmlinuz = '/boot/vmlinuz' + cmd.substring(cmd.indexOf('initrd.img') + 10);
80
+ }
81
+ });
73
82
  }
74
- if (!fs_1.default.existsSync(vmlinux)) {
75
- if (fs_1.default.existsSync('/boot' + vmlinux)) {
76
- vmlinux = '/boot' + vmlinux;
83
+ // if vmlinuz exist in /boot
84
+ if (!fs_1.default.existsSync(vmlinuz)) {
85
+ if (fs_1.default.existsSync('/boot' + vmlinuz)) {
86
+ vmlinuz = '/boot' + vmlinuz;
77
87
  }
78
88
  }
79
- return vmlinux;
89
+ // if vmlinux don't exist
90
+ if (!fs_1.default.existsSync(vmlinuz)) {
91
+ vmlinuz = '/path/to/vmlinuz';
92
+ }
93
+ // btrfs
94
+ if (vmlinuz.indexOf('@') > 0) {
95
+ vmlinuz = vmlinuz.substring(vmlinuz.indexOf(' ') + 1);
96
+ }
97
+ return vmlinuz;
80
98
  }
81
99
  /**
82
100
  * ricava path per initrdImg