penguins-eggs 10.0.24 → 10.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +8 -8
- package/README.md +27 -27
- package/conf/distros/noble/calamares/modules/users.yml +1 -0
- package/conf/distros/rolling/calamares/modules/finished.yml +1 -1
- package/dist/classes/bleach.js +22 -15
- package/dist/{lib → classes}/cli-autologin.d.ts +15 -6
- package/dist/{lib → classes}/cli-autologin.js +82 -36
- package/dist/classes/compressors.d.ts +1 -1
- package/dist/classes/compressors.js +10 -10
- package/dist/classes/daddy.d.ts +6 -6
- package/dist/classes/daddy.js +67 -67
- package/dist/classes/distro.js +206 -202
- package/dist/classes/families/alpine.js +2 -2
- package/dist/classes/incubation/incubator.js +1 -1
- package/dist/classes/keyboards.d.ts +1 -1
- package/dist/classes/keyboards.js +16 -1
- package/dist/classes/locales.js +20 -9
- package/dist/classes/ovary.d.ts +11 -11
- package/dist/classes/ovary.js +109 -93
- package/dist/classes/pacman.js +3 -5
- package/dist/classes/pxe.d.ts +6 -6
- package/dist/classes/pxe.js +42 -42
- package/dist/classes/utils.d.ts +5 -1
- package/dist/classes/utils.js +20 -17
- package/dist/classes/xdg.js +15 -14
- package/dist/classes/yolk.js +1 -1
- package/dist/commands/cuckoo.js +1 -1
- package/dist/commands/dad.d.ts +1 -1
- package/dist/commands/dad.js +5 -7
- package/dist/commands/produce.js +1 -1
- package/dist/commands/syncfrom.d.ts +1 -1
- package/dist/commands/syncfrom.js +1 -1
- package/dist/components/information.js +5 -10
- package/dist/components/summary.js +2 -1
- package/dist/interfaces/i-excludes.d.ts +2 -2
- package/dist/interfaces/i-pxe.d.ts +15 -15
- package/dist/krill/modules/machine-id.js +1 -1
- package/dist/krill/modules/network-cfg.js +1 -1
- package/dist/krill/modules/packages.js +22 -0
- package/dist/krill/sequence.d.ts +1 -1
- package/dist/krill/sequence.js +3 -3
- package/dracut/README.md +84 -0
- package/dracut/dracut.conf +3 -0
- package/dracut/dracut.conf.d/90overlayfs.conf +5 -0
- package/dracut/dracut.conf.d/99custom.conf +4 -0
- package/dracut/install-dracut-99custom +1 -0
- package/dracut/usr/lib/dracut/modules.d/99custom/init-live.sh +4 -0
- package/dracut/usr/lib/dracut/modules.d/99custom/module-setup.sh +15 -0
- package/dracut/usr/lib/dracut/modules.d/99custom/mount-live.sh +25 -0
- package/manpages/doc/man/eggs.1.gz +0 -0
- package/manpages/doc/man/eggs.html +22 -28
- package/mkinitfs/README.md +46 -0
- package/mkinitfs/live.conf +2 -0
- package/mkinitfs/machine-id-gen.sh +3 -0
- package/mkinitfs/sidecar.sh +40 -0
- package/package.json +7 -5
package/dist/classes/locales.js
CHANGED
|
@@ -40,7 +40,12 @@ export default class Locales {
|
|
|
40
40
|
if (result.code === 0) {
|
|
41
41
|
const lines = result.data.split('\n');
|
|
42
42
|
for (const line of lines) {
|
|
43
|
-
|
|
43
|
+
if (distro.familyId === 'alpine') {
|
|
44
|
+
enabledLocales.push(line.replaceAll('"', '').replaceAll("'", '').trim() + '.UTF-8');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
enabledLocales.push(line.replaceAll('"', '').replaceAll("'", '').trim());
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
return enabledLocales;
|
|
@@ -51,14 +56,20 @@ export default class Locales {
|
|
|
51
56
|
async getSupported() {
|
|
52
57
|
const distro = new Distro();
|
|
53
58
|
let supporteds = [];
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
switch (distro.familyId) {
|
|
60
|
+
case 'alpine': {
|
|
61
|
+
supporteds = await this.getEnabled();
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case 'debian': {
|
|
65
|
+
supporteds = fs.readFileSync('/usr/share/i18n/SUPPORTED', 'utf8').split('\n');
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case 'archlinux': {
|
|
69
|
+
supporteds = (await exec('localectl list-locales', { capture: true, echo: false, ignore: false })).data.split('\n');
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
// No default
|
|
62
73
|
}
|
|
63
74
|
const elements = [];
|
|
64
75
|
for (const elem of supporteds) {
|
package/dist/classes/ovary.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
8
|
import { IAddons, IExcludes } from '../interfaces/index.js';
|
|
9
|
-
import CliAutologin from '
|
|
9
|
+
import CliAutologin from './cli-autologin.js';
|
|
10
10
|
import Incubator from './incubation/incubator.js';
|
|
11
11
|
import Settings from './settings.js';
|
|
12
12
|
import Users from './users.js';
|
|
@@ -20,16 +20,16 @@ export default class Ovary {
|
|
|
20
20
|
cryptedclone: boolean;
|
|
21
21
|
echo: {};
|
|
22
22
|
familyId: string;
|
|
23
|
+
genisoimage: boolean;
|
|
23
24
|
incubator: Incubator;
|
|
24
25
|
nest: string;
|
|
25
26
|
settings: Settings;
|
|
26
27
|
snapshot_basename: string;
|
|
27
28
|
snapshot_prefix: string;
|
|
28
29
|
theme: string;
|
|
29
|
-
volid: string;
|
|
30
30
|
toNull: string;
|
|
31
|
-
genisoimage: boolean;
|
|
32
31
|
verbose: boolean;
|
|
32
|
+
volid: string;
|
|
33
33
|
/**
|
|
34
34
|
* Add or remove exclusion
|
|
35
35
|
* @param add {boolean} true = add, false remove
|
|
@@ -86,14 +86,6 @@ export default class Ovary {
|
|
|
86
86
|
* initrdAlpine()
|
|
87
87
|
*/
|
|
88
88
|
initrdAlpine(): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* initrdFedora()
|
|
91
|
-
*/
|
|
92
|
-
initrdFedora(): Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* initrdSuse()
|
|
95
|
-
*/
|
|
96
|
-
initrdSuse(): Promise<void>;
|
|
97
89
|
/**
|
|
98
90
|
* initrdArch()
|
|
99
91
|
* necessita di echoYes
|
|
@@ -105,6 +97,14 @@ export default class Ovary {
|
|
|
105
97
|
* We must upgrade to initrdCreate for Debian/Ubuntu
|
|
106
98
|
*/
|
|
107
99
|
initrdDebian(verbose?: boolean): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* initrdFedora()
|
|
102
|
+
*/
|
|
103
|
+
initrdFedora(): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* initrdSuse()
|
|
106
|
+
*/
|
|
107
|
+
initrdSuse(): Promise<void>;
|
|
108
108
|
/**
|
|
109
109
|
* async isolinux
|
|
110
110
|
*/
|
package/dist/classes/ovary.js
CHANGED
|
@@ -16,10 +16,10 @@ import { access } from 'node:fs/promises';
|
|
|
16
16
|
import os from 'node:os';
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import shx from 'shelljs';
|
|
19
|
-
import CliAutologin from '../lib/cli-autologin.js';
|
|
20
19
|
// libraries
|
|
21
20
|
import { exec } from '../lib/utils.js';
|
|
22
21
|
import Bleach from './bleach.js';
|
|
22
|
+
import CliAutologin from './cli-autologin.js';
|
|
23
23
|
import { displaymanager } from './incubation/fisherman-helper/displaymanager.js';
|
|
24
24
|
import Incubator from './incubation/incubator.js';
|
|
25
25
|
import N8 from './n8.js';
|
|
@@ -44,16 +44,16 @@ export default class Ovary {
|
|
|
44
44
|
cryptedclone = false;
|
|
45
45
|
echo = {};
|
|
46
46
|
familyId = '';
|
|
47
|
+
genisoimage = false;
|
|
47
48
|
incubator = {};
|
|
48
49
|
nest = '';
|
|
49
50
|
settings = {};
|
|
50
51
|
snapshot_basename = '';
|
|
51
52
|
snapshot_prefix = '';
|
|
52
53
|
theme = '';
|
|
53
|
-
volid = '';
|
|
54
54
|
toNull = '';
|
|
55
|
-
genisoimage = false;
|
|
56
55
|
verbose = false;
|
|
56
|
+
volid = '';
|
|
57
57
|
/**
|
|
58
58
|
* Add or remove exclusion
|
|
59
59
|
* @param add {boolean} true = add, false remove
|
|
@@ -198,8 +198,12 @@ export default class Ovary {
|
|
|
198
198
|
ignore: false
|
|
199
199
|
});
|
|
200
200
|
const users = result.data.split('\n');
|
|
201
|
+
let deluser = 'deluser';
|
|
202
|
+
if (this.familyId === 'archlinux') {
|
|
203
|
+
deluser = 'userdel';
|
|
204
|
+
}
|
|
201
205
|
for (let i = 0; i < users.length - 1; i++) {
|
|
202
|
-
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} deluser ${users[i]}`, this.verbose));
|
|
206
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} ${deluser} ${users[i]}`, this.verbose));
|
|
203
207
|
}
|
|
204
208
|
}
|
|
205
209
|
/**
|
|
@@ -223,22 +227,28 @@ export default class Ovary {
|
|
|
223
227
|
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', this.verbose));
|
|
224
228
|
// da problemi con il mount sshfs
|
|
225
229
|
cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' chown ' + this.settings.config.user_opt + ':users' + ' /home/' + this.settings.config.user_opt + ' -R', this.verbose));
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
230
|
+
switch (this.familyId) {
|
|
231
|
+
case 'debian': {
|
|
232
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sudo ${this.settings.config.user_opt}`, this.verbose));
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case 'alpine': {
|
|
236
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG cdrom ${this.settings.config.user_opt}`, this.verbose));
|
|
237
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG games ${this.settings.config.user_opt}`, this.verbose));
|
|
238
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG input ${this.settings.config.user_opt}`, this.verbose));
|
|
239
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG users ${this.settings.config.user_opt}`, this.verbose));
|
|
240
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG video ${this.settings.config.user_opt}`, this.verbose));
|
|
241
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, this.verbose));
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
case 'archlinux': {
|
|
245
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} gpasswd -a ${this.settings.config.user_opt} wheel`, this.verbose));
|
|
246
|
+
// check or create group: autologin
|
|
247
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} getent group autologin || chroot ${this.settings.work_dir.merged} groupadd autologin`, this.verbose));
|
|
248
|
+
cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} gpasswd -a ${this.settings.config.user_opt} autologin`, this.verbose));
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
// No default
|
|
242
252
|
}
|
|
243
253
|
/**
|
|
244
254
|
* educaandos and others themes
|
|
@@ -704,7 +714,7 @@ export default class Ovary {
|
|
|
704
714
|
*/
|
|
705
715
|
async initrdAlpine() {
|
|
706
716
|
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} Alpine on ISO/live`);
|
|
707
|
-
|
|
717
|
+
const initrdImg = 'initramfs-lts';
|
|
708
718
|
// dracut
|
|
709
719
|
// const pathConf = path.resolve(__dirname, `../../dracut/dracut.conf.d`)
|
|
710
720
|
// await exec(`dracut --confdir ${pathConf} ${this.settings.iso_work}live/${initrdImg}`, Utils.setEcho(true))
|
|
@@ -714,25 +724,6 @@ export default class Ovary {
|
|
|
714
724
|
const sidecars = path.resolve(__dirname, `../../mkinitfs/*.sh`);
|
|
715
725
|
await exec(`cp ${sidecars} ${this.settings.iso_work}live/`);
|
|
716
726
|
}
|
|
717
|
-
/**
|
|
718
|
-
* initrdFedora()
|
|
719
|
-
*/
|
|
720
|
-
async initrdFedora() {
|
|
721
|
-
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} Fedora on ISO/live`);
|
|
722
|
-
// dracut
|
|
723
|
-
const kernelVersion = shx.exec('uname -r', { silent: true }).stdout.trim();
|
|
724
|
-
const initrdImg = `initramfs-${kernelVersion}`;
|
|
725
|
-
const pathConf = path.resolve(__dirname, `../../dracut/dracut.conf.d`);
|
|
726
|
-
await exec(`dracut --confdir ${pathConf} ${this.settings.iso_work}live/${initrdImg}`, Utils.setEcho(true));
|
|
727
|
-
//await exec(`cp /boot/initramfs-*.img ${this.settings.iso_work}/live/`, this.echo)
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* initrdSuse()
|
|
731
|
-
*/
|
|
732
|
-
async initrdSuse() {
|
|
733
|
-
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} Fedora on ISO/live`);
|
|
734
|
-
await exec(`cp /boot/initrd-* ${this.settings.iso_work}/live/`, this.echo);
|
|
735
|
-
}
|
|
736
727
|
/**
|
|
737
728
|
* initrdArch()
|
|
738
729
|
* necessita di echoYes
|
|
@@ -769,6 +760,25 @@ export default class Ovary {
|
|
|
769
760
|
await exec('mv /etc/crypttab.saved /etc/crypttab', this.echo);
|
|
770
761
|
}
|
|
771
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* initrdFedora()
|
|
765
|
+
*/
|
|
766
|
+
async initrdFedora() {
|
|
767
|
+
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} Fedora on ISO/live`);
|
|
768
|
+
// dracut
|
|
769
|
+
const kernelVersion = shx.exec('uname -r', { silent: true }).stdout.trim();
|
|
770
|
+
const initrdImg = `initramfs-${kernelVersion}`;
|
|
771
|
+
const pathConf = path.resolve(__dirname, `../../dracut/dracut.conf.d`);
|
|
772
|
+
await exec(`dracut --confdir ${pathConf} ${this.settings.iso_work}live/${initrdImg}`, Utils.setEcho(true));
|
|
773
|
+
// await exec(`cp /boot/initramfs-*.img ${this.settings.iso_work}/live/`, this.echo)
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* initrdSuse()
|
|
777
|
+
*/
|
|
778
|
+
async initrdSuse() {
|
|
779
|
+
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} Fedora on ISO/live`);
|
|
780
|
+
await exec(`cp /boot/initrd-* ${this.settings.iso_work}/live/`, this.echo);
|
|
781
|
+
}
|
|
772
782
|
/**
|
|
773
783
|
* async isolinux
|
|
774
784
|
*/
|
|
@@ -1293,8 +1303,8 @@ export default class Ovary {
|
|
|
1293
1303
|
if (this.verbose) {
|
|
1294
1304
|
console.log('Ovary: mergedAndOverlay');
|
|
1295
1305
|
}
|
|
1296
|
-
//
|
|
1297
|
-
const mountDirs = ['etc', 'usr', 'var'];
|
|
1306
|
+
// agginto bin per autologin su Alpine
|
|
1307
|
+
const mountDirs = ['bin', 'etc', 'usr', 'var'];
|
|
1298
1308
|
let mountDir = '';
|
|
1299
1309
|
let overlay = false;
|
|
1300
1310
|
for (mountDir of mountDirs) {
|
|
@@ -1405,42 +1415,40 @@ export default class Ovary {
|
|
|
1405
1415
|
/**
|
|
1406
1416
|
* exclude.list
|
|
1407
1417
|
*/
|
|
1408
|
-
if (!excludes.static
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
excludeVar = fs.readFileSync(`${excludeListTemplateDir}var.list`, 'utf8');
|
|
1428
|
-
}
|
|
1429
|
-
if (excludes.homes) {
|
|
1430
|
-
excludeHomes = fs.readFileSync(`${excludeListTemplateDir}homes.list`, 'utf8');
|
|
1431
|
-
}
|
|
1432
|
-
if (excludes.home) {
|
|
1433
|
-
excludeHome = `home/${await Utils.getPrimaryUser()}/*`;
|
|
1434
|
-
}
|
|
1435
|
-
const view = {
|
|
1436
|
-
usr_list: excludeUsr,
|
|
1437
|
-
var_list: excludeVar,
|
|
1438
|
-
homes_list: excludeHomes,
|
|
1439
|
-
home_list: excludeHome,
|
|
1440
|
-
};
|
|
1441
|
-
const template = fs.readFileSync(excludeListTemplate, 'utf8');
|
|
1442
|
-
fs.writeFileSync(this.settings.config.snapshot_excludes, mustache.render(template, view));
|
|
1418
|
+
if (!excludes.static && /**
|
|
1419
|
+
* create exclude.list if not exists
|
|
1420
|
+
*/
|
|
1421
|
+
!fs.existsSync('/etc/penguins-eggs/exclude.list')) {
|
|
1422
|
+
const excludeListTemplateDir = '/etc/penguins-eggs.d/exclude.list.d/';
|
|
1423
|
+
const excludeListTemplate = excludeListTemplateDir + 'master.list';
|
|
1424
|
+
if (!fs.existsSync(excludeListTemplate)) {
|
|
1425
|
+
Utils.warning('Cannot find: ' + excludeListTemplate);
|
|
1426
|
+
process.exit(1);
|
|
1427
|
+
}
|
|
1428
|
+
let excludeUsr = '';
|
|
1429
|
+
let excludeVar = '';
|
|
1430
|
+
let excludeHomes = '';
|
|
1431
|
+
let excludeHome = '';
|
|
1432
|
+
if (excludes.usr) {
|
|
1433
|
+
excludeUsr = fs.readFileSync(`${excludeListTemplateDir}usr.list`, 'utf8');
|
|
1434
|
+
}
|
|
1435
|
+
if (excludes.var) {
|
|
1436
|
+
excludeVar = fs.readFileSync(`${excludeListTemplateDir}var.list`, 'utf8');
|
|
1443
1437
|
}
|
|
1438
|
+
if (excludes.homes) {
|
|
1439
|
+
excludeHomes = fs.readFileSync(`${excludeListTemplateDir}homes.list`, 'utf8');
|
|
1440
|
+
}
|
|
1441
|
+
if (excludes.home) {
|
|
1442
|
+
excludeHome = `home/${await Utils.getPrimaryUser()}/*`;
|
|
1443
|
+
}
|
|
1444
|
+
const view = {
|
|
1445
|
+
home_list: excludeHome,
|
|
1446
|
+
homes_list: excludeHomes,
|
|
1447
|
+
usr_list: excludeUsr,
|
|
1448
|
+
var_list: excludeVar,
|
|
1449
|
+
};
|
|
1450
|
+
const template = fs.readFileSync(excludeListTemplate, 'utf8');
|
|
1451
|
+
fs.writeFileSync(this.settings.config.snapshot_excludes, mustache.render(template, view));
|
|
1444
1452
|
}
|
|
1445
1453
|
/**
|
|
1446
1454
|
* NOTE: reCreate = false
|
|
@@ -1464,20 +1472,28 @@ export default class Ovary {
|
|
|
1464
1472
|
* we need different initfs
|
|
1465
1473
|
* for different families
|
|
1466
1474
|
*/
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1475
|
+
switch (this.familyId) {
|
|
1476
|
+
case 'archlinux': {
|
|
1477
|
+
await this.initrdArch();
|
|
1478
|
+
break;
|
|
1479
|
+
}
|
|
1480
|
+
case 'alpine': {
|
|
1481
|
+
await this.initrdAlpine();
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
case 'fedora': {
|
|
1485
|
+
await this.initrdFedora();
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
case 'suse': {
|
|
1489
|
+
await this.initrdSuse();
|
|
1490
|
+
break;
|
|
1491
|
+
}
|
|
1492
|
+
case 'debian': {
|
|
1493
|
+
await this.initrdDebian();
|
|
1494
|
+
break;
|
|
1495
|
+
}
|
|
1496
|
+
// No default
|
|
1481
1497
|
}
|
|
1482
1498
|
if (this.settings.config.make_efi) {
|
|
1483
1499
|
await this.makeEfi(this.theme);
|
|
@@ -1500,10 +1516,10 @@ export default class Ovary {
|
|
|
1500
1516
|
}
|
|
1501
1517
|
}
|
|
1502
1518
|
else {
|
|
1503
|
-
this.cliAutologin.
|
|
1519
|
+
this.cliAutologin.add(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);
|
|
1504
1520
|
}
|
|
1505
1521
|
// Here we are forcing alwats cliAutologin
|
|
1506
|
-
this.cliAutologin.
|
|
1522
|
+
// this.cliAutologin.add(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)
|
|
1507
1523
|
}
|
|
1508
1524
|
await this.editLiveFs(clone, cryptedclone);
|
|
1509
1525
|
mksquashfsCmd = await this.makeSquashfs(scriptOnly, unsecure);
|
package/dist/classes/pacman.js
CHANGED
|
@@ -12,10 +12,10 @@ import path from 'node:path';
|
|
|
12
12
|
import shx from 'shelljs';
|
|
13
13
|
import { exec } from '../lib/utils.js';
|
|
14
14
|
import Distro from './distro.js';
|
|
15
|
+
import Alpine from './families/alpine.js';
|
|
15
16
|
import Archlinux from './families/archlinux.js';
|
|
16
17
|
import Debian from './families/debian.js';
|
|
17
18
|
import Fedora from './families/fedora.js';
|
|
18
|
-
import Alpine from './families/alpine.js';
|
|
19
19
|
import Settings from './settings.js';
|
|
20
20
|
import Utils from './utils.js';
|
|
21
21
|
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
@@ -532,10 +532,8 @@ export default class Pacman {
|
|
|
532
532
|
installed = true;
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
else if (this.distro().familyId === 'alpine') {
|
|
536
|
-
|
|
537
|
-
installed = true;
|
|
538
|
-
}
|
|
535
|
+
else if (this.distro().familyId === 'alpine' && Alpine.packageIsInstalled('xorg-server')) {
|
|
536
|
+
installed = true;
|
|
539
537
|
}
|
|
540
538
|
return installed;
|
|
541
539
|
}
|
package/dist/classes/pxe.d.ts
CHANGED
|
@@ -27,12 +27,6 @@ export default class Pxe {
|
|
|
27
27
|
* @param pxeRoot
|
|
28
28
|
*/
|
|
29
29
|
constructor(nest?: string, pxeRoot?: string);
|
|
30
|
-
/**
|
|
31
|
-
* fertilization()
|
|
32
|
-
*
|
|
33
|
-
* cuckoo's nest
|
|
34
|
-
*/
|
|
35
|
-
fertilization(): Promise<void>;
|
|
36
30
|
/**
|
|
37
31
|
* build
|
|
38
32
|
*/
|
|
@@ -42,6 +36,12 @@ export default class Pxe {
|
|
|
42
36
|
* @param dhcpOptions
|
|
43
37
|
*/
|
|
44
38
|
dhcpStart(dhcpOptions: IDhcpOptions): void;
|
|
39
|
+
/**
|
|
40
|
+
* fertilization()
|
|
41
|
+
*
|
|
42
|
+
* cuckoo's nest
|
|
43
|
+
*/
|
|
44
|
+
fertilization(): Promise<void>;
|
|
45
45
|
/**
|
|
46
46
|
* start http server for images
|
|
47
47
|
*
|
package/dist/classes/pxe.js
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* email: piero.proietti@gmail.com
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
|
-
import { dhcpd } from 'node-proxy-dhcpd';
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
import tftp from 'tftp';
|
|
11
8
|
import fs from 'node:fs';
|
|
12
9
|
import http from 'node:http';
|
|
13
10
|
import path from 'node:path';
|
|
11
|
+
import { dhcpd } from 'node-proxy-dhcpd';
|
|
14
12
|
import nodeStatic from 'node-static';
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import tftp from 'tftp';
|
|
15
15
|
import { exec } from '../lib/utils.js';
|
|
16
16
|
import Distro from './distro.js';
|
|
17
17
|
import Settings from './settings.js';
|
|
@@ -41,6 +41,44 @@ export default class Pxe {
|
|
|
41
41
|
this.nest = nest;
|
|
42
42
|
this.pxeRoot = pxeRoot;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* build
|
|
46
|
+
*/
|
|
47
|
+
async build() {
|
|
48
|
+
if (fs.existsSync(this.pxeRoot)) {
|
|
49
|
+
await this.tryCatch(`rm ${this.pxeRoot} -rf`);
|
|
50
|
+
}
|
|
51
|
+
await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
|
|
52
|
+
await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
|
|
53
|
+
await this.tryCatch(`ln -s ${this.eggRoot}live ${this.pxeRoot}/live`);
|
|
54
|
+
await this.tryCatch(`ln -s ${this.nest}.disk ${this.pxeRoot}/.disk`);
|
|
55
|
+
if (this.settings.distro.distroId === 'ManjaroLinux') {
|
|
56
|
+
await this.tryCatch(`ln -s ${this.eggRoot}manjaro ${this.pxeRoot}/manjaro`);
|
|
57
|
+
}
|
|
58
|
+
else if (this.settings.distro.distroId === 'Arch' || this.settings.distro.distroId === 'RebornOS') {
|
|
59
|
+
await this.tryCatch(`ln -s ${this.eggRoot}arch ${this.pxeRoot}/arch`);
|
|
60
|
+
}
|
|
61
|
+
if (fs.existsSync(this.eggRoot)) {
|
|
62
|
+
await this.tryCatch(`cp ${this.eggRoot}live/${this.vmlinuz} ${this.pxeRoot}/vmlinuz`, true);
|
|
63
|
+
await this.tryCatch(`chmod 777 ${this.pxeRoot}/vmlinuz`);
|
|
64
|
+
await this.tryCatch(`cp ${this.eggRoot}live/${this.initrdImg} ${this.pxeRoot}/initrd`, true);
|
|
65
|
+
await this.tryCatch(`chmod 777 ${this.pxeRoot}/initrd`);
|
|
66
|
+
}
|
|
67
|
+
// link iso images in pxe
|
|
68
|
+
for (const iso of this.isos) {
|
|
69
|
+
await this.tryCatch(`ln -s ${this.nest}/${iso} ${this.pxeRoot}/${iso}`);
|
|
70
|
+
}
|
|
71
|
+
await this.bios();
|
|
72
|
+
await this.ipxe();
|
|
73
|
+
await this.http();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @param dhcpOptions
|
|
78
|
+
*/
|
|
79
|
+
dhcpStart(dhcpOptions) {
|
|
80
|
+
new dhcpd(dhcpOptions);
|
|
81
|
+
}
|
|
44
82
|
/**
|
|
45
83
|
* fertilization()
|
|
46
84
|
*
|
|
@@ -134,44 +172,6 @@ export default class Pxe {
|
|
|
134
172
|
console.log(`vmlinuz: ${this.vmlinuz}`);
|
|
135
173
|
console.log(`initrd: ${this.initrdImg}`);
|
|
136
174
|
}
|
|
137
|
-
/**
|
|
138
|
-
* build
|
|
139
|
-
*/
|
|
140
|
-
async build() {
|
|
141
|
-
if (fs.existsSync(this.pxeRoot)) {
|
|
142
|
-
await this.tryCatch(`rm ${this.pxeRoot} -rf`);
|
|
143
|
-
}
|
|
144
|
-
await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
|
|
145
|
-
await this.tryCatch(`mkdir ${this.pxeRoot} -p`);
|
|
146
|
-
await this.tryCatch(`ln -s ${this.eggRoot}live ${this.pxeRoot}/live`);
|
|
147
|
-
await this.tryCatch(`ln -s ${this.nest}.disk ${this.pxeRoot}/.disk`);
|
|
148
|
-
if (this.settings.distro.distroId === 'ManjaroLinux') {
|
|
149
|
-
await this.tryCatch(`ln -s ${this.eggRoot}manjaro ${this.pxeRoot}/manjaro`);
|
|
150
|
-
}
|
|
151
|
-
else if (this.settings.distro.distroId === 'Arch' || this.settings.distro.distroId === 'RebornOS') {
|
|
152
|
-
await this.tryCatch(`ln -s ${this.eggRoot}arch ${this.pxeRoot}/arch`);
|
|
153
|
-
}
|
|
154
|
-
if (fs.existsSync(this.eggRoot)) {
|
|
155
|
-
await this.tryCatch(`cp ${this.eggRoot}live/${this.vmlinuz} ${this.pxeRoot}/vmlinuz`, true);
|
|
156
|
-
await this.tryCatch(`chmod 777 ${this.pxeRoot}/vmlinuz`);
|
|
157
|
-
await this.tryCatch(`cp ${this.eggRoot}live/${this.initrdImg} ${this.pxeRoot}/initrd`, true);
|
|
158
|
-
await this.tryCatch(`chmod 777 ${this.pxeRoot}/initrd`);
|
|
159
|
-
}
|
|
160
|
-
// link iso images in pxe
|
|
161
|
-
for (const iso of this.isos) {
|
|
162
|
-
await this.tryCatch(`ln -s ${this.nest}/${iso} ${this.pxeRoot}/${iso}`);
|
|
163
|
-
}
|
|
164
|
-
await this.bios();
|
|
165
|
-
await this.ipxe();
|
|
166
|
-
await this.http();
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
*
|
|
170
|
-
* @param dhcpOptions
|
|
171
|
-
*/
|
|
172
|
-
dhcpStart(dhcpOptions) {
|
|
173
|
-
new dhcpd(dhcpOptions);
|
|
174
|
-
}
|
|
175
175
|
/**
|
|
176
176
|
* start http server for images
|
|
177
177
|
*
|
|
@@ -181,7 +181,7 @@ export default class Pxe {
|
|
|
181
181
|
const httpRoot = this.pxeRoot + '/';
|
|
182
182
|
console.log('http root: ' + httpRoot);
|
|
183
183
|
console.log('http listening: 0.0.0.0:' + port);
|
|
184
|
-
//const file = new nodeStatic.Server(httpRoot, { followSymlinks: true })
|
|
184
|
+
// const file = new nodeStatic.Server(httpRoot, { followSymlinks: true })
|
|
185
185
|
const file = new nodeStatic.Server(httpRoot);
|
|
186
186
|
http
|
|
187
187
|
.createServer((req, res) => {
|
package/dist/classes/utils.d.ts
CHANGED
|
@@ -43,8 +43,12 @@ export default class Utils {
|
|
|
43
43
|
*
|
|
44
44
|
* @returns
|
|
45
45
|
*/
|
|
46
|
-
static isSysvinit(): boolean;
|
|
47
46
|
static isOpenRc(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
static isSysvinit(): boolean;
|
|
48
52
|
/**
|
|
49
53
|
* ricava path per vmlinuz
|
|
50
54
|
* Normalmente cerca BOOT_IMAGE
|
package/dist/classes/utils.js
CHANGED
|
@@ -11,8 +11,8 @@ import dns from 'dns';
|
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import os from 'os';
|
|
13
13
|
import inquirer from 'inquirer';
|
|
14
|
+
import { execSync, spawnSync } from 'child_process';
|
|
14
15
|
import chalk from 'chalk';
|
|
15
|
-
import { spawnSync } from 'child_process';
|
|
16
16
|
import { Netmask } from 'netmask';
|
|
17
17
|
import Distro from './distro.js';
|
|
18
18
|
// pjson
|
|
@@ -81,30 +81,33 @@ export default class Utils {
|
|
|
81
81
|
*/
|
|
82
82
|
static isSystemd() {
|
|
83
83
|
const checkFile = '/tmp/checksystemd';
|
|
84
|
-
|
|
84
|
+
execSync(`cat /proc/1/comm >${checkFile}`);
|
|
85
85
|
const isSystemd = fs.readFileSync(checkFile).includes('systemd');
|
|
86
|
-
|
|
86
|
+
execSync(`rm ${checkFile}`);
|
|
87
87
|
return isSystemd;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
static isOpenRc() {
|
|
94
|
+
const checkFile = '/tmp/checkinit';
|
|
95
|
+
execSync(`command -v openrc >${checkFile} 2>&1`);
|
|
96
|
+
const isOpenrc = fs.readFileSync(checkFile).includes('openrc');
|
|
97
|
+
execSync(`rm ${checkFile}`);
|
|
98
|
+
return isOpenrc;
|
|
99
|
+
}
|
|
89
100
|
/**
|
|
90
101
|
*
|
|
91
102
|
* @returns
|
|
92
103
|
*/
|
|
93
104
|
static isSysvinit() {
|
|
94
105
|
const checkFile = '/tmp/checkinit';
|
|
95
|
-
|
|
106
|
+
execSync(`cat /proc/1/comm >${checkFile}`);
|
|
96
107
|
const isSysvinit = fs.readFileSync(checkFile).includes('init');
|
|
97
|
-
|
|
108
|
+
execSync(`rm ${checkFile}`);
|
|
98
109
|
return isSysvinit;
|
|
99
110
|
}
|
|
100
|
-
static isOpenRc() {
|
|
101
|
-
let isOpenRc = false;
|
|
102
|
-
let distro = new Distro();
|
|
103
|
-
if (distro.familyId === "alpine") {
|
|
104
|
-
isOpenRc = true;
|
|
105
|
-
}
|
|
106
|
-
return isOpenRc;
|
|
107
|
-
}
|
|
108
111
|
/**
|
|
109
112
|
* ricava path per vmlinuz
|
|
110
113
|
* Normalmente cerca BOOT_IMAGE
|
|
@@ -242,7 +245,7 @@ export default class Utils {
|
|
|
242
245
|
primaryUser = execSync('/usr/bin/logname 2>/dev/null', { encoding: 'utf-8' }).trim();
|
|
243
246
|
}
|
|
244
247
|
catch (error) {
|
|
245
|
-
// logname failed, so we continue with other methods
|
|
248
|
+
// console.log("logname failed, so we continue with other methods")
|
|
246
249
|
}
|
|
247
250
|
if (primaryUser === 'root') {
|
|
248
251
|
primaryUser = '';
|
|
@@ -254,7 +257,7 @@ export default class Utils {
|
|
|
254
257
|
primaryUser = execSync('echo $DOAS_USER', { encoding: 'utf-8' }).trim();
|
|
255
258
|
}
|
|
256
259
|
catch (error) {
|
|
257
|
-
// doas is not installed or DOAS_USER is not set, continue with the next method
|
|
260
|
+
// console.log("doas is not installed or DOAS_USER is not set, continue with the next method")
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
263
|
if (primaryUser === '') {
|
|
@@ -263,11 +266,11 @@ export default class Utils {
|
|
|
263
266
|
primaryUser = execSync('echo $SUDO_USER', { encoding: 'utf-8' }).trim();
|
|
264
267
|
}
|
|
265
268
|
catch (error) {
|
|
266
|
-
// SUDO_USER is not set, continue with the next method
|
|
269
|
+
// console.log("SUDO_USER is not set, continue with the next method")
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
272
|
if (primaryUser === '') {
|
|
270
|
-
// Fallback to the USER environment variable
|
|
273
|
+
// console.log("Fallback to the USER environment variable")
|
|
271
274
|
primaryUser = process.env.USER || '';
|
|
272
275
|
}
|
|
273
276
|
if (primaryUser === '') {
|