penguins-eggs 25.10.30 → 25.11.8
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 +4 -4
- package/README.md +770 -3
- package/addons/eggs/adapt/applications/eggs-adapt.desktop +0 -0
- package/addons/eggs/pve/applications/eggs-pve.desktop +0 -0
- package/addons/eggs/rsupport/applications/eggs-rsupport.desktop +0 -0
- package/addons/eggs/theme/applications/install-system.desktop +0 -0
- package/assets/calamares/install-system.sh +0 -0
- package/assets/penguins-eggs.desktop +0 -0
- package/assets/penguins-krill.desktop +0 -0
- package/assets/penguins-links-add.desktop +0 -0
- package/assets/penguins-live-installer.desktop +0 -0
- package/bin/dev.js +0 -0
- package/conf/distros/alpine/calamares/calamares-modules/machineid-openrc/machineid-openrc.sh +0 -0
- package/conf/distros/alpine/calamares/modules/packages.mustache +1 -0
- package/conf/distros/alpine/calamares/modules/removeuser.mustache +2 -14
- package/conf/distros/alpine/calamares/modules/unpackfs.mustache +2 -2
- package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
- package/conf/distros/buster/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +0 -0
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
- package/conf/distros/buster/calamares/modules/shellprocess@boot_deploy.yml +1 -16
- package/conf/distros/fedora/calamares/calamares-modules/bootloaderspecification/bootloaderspecification.sh +0 -0
- package/conf/distros/noble/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
- package/conf/distros/noble/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
- package/conf/distros/noble/calamares/libexec/calamares-aptsources.sh +0 -0
- package/conf/distros/noble/calamares/libexec/calamares-l10n-helper.sh +0 -0
- package/conf/distros/noble/calamares/libexec/calamares-logs-helper.sh +1 -1
- package/conf/distros/noble/calamares/libexec/calamares-nomodeset.sh +0 -0
- package/conf/distros/noble/calamares/modules/shellprocess@boot_deploy.yml +1 -11
- package/conf/distros/noble/calamares/modules/shellprocess@logs.yml +1 -1
- package/conf/distros/opensuse/calamares/calamares-modules/bootloaderspecification/bootloaderspecification.sh +0 -0
- package/conf/distros/opensuse/calamares/settings.yml +0 -0
- package/conf/distros/opensuse/calamares/zstd2lzo.sh +0 -0
- package/conf/distros/trixie/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
- package/conf/distros/trixie/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +0 -0
- package/conf/distros/trixie/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
- package/conf/distros/trixie/calamares/modules/shellprocess@boot_deploy.yml +2 -10
- package/conf/init/unattended.sh +0 -0
- package/dist/classes/cli-autologin.d.ts +1 -39
- package/dist/classes/cli-autologin.js +85 -110
- package/dist/classes/daddy.d.ts +30 -12
- package/dist/classes/daddy.js +166 -137
- package/dist/classes/distro-hossein.d.ts +52 -0
- package/dist/classes/distro-hossein.js +239 -0
- package/dist/classes/diversions.d.ts +3 -37
- package/dist/classes/diversions.js +72 -103
- package/dist/classes/incubation/fisherman.d.ts +5 -0
- package/dist/classes/incubation/fisherman.js +21 -1
- package/dist/classes/incubation/incubator.d/noble.js +6 -2
- package/dist/classes/incubation/incubator.js +2 -3
- package/dist/classes/keyboards.d.ts +11 -30
- package/dist/classes/keyboards.js +100 -251
- package/dist/classes/ovary.d/initrd.js +2 -7
- package/dist/classes/pacman.js +7 -9
- package/dist/commands/tools/repo.js +198 -31
- package/dist/krill/classes/sequence.d/unpackfs.js +3 -2
- package/dracut/create-symlink +0 -0
- package/dracut/export +0 -0
- package/dracut/export-dracut-analysis +0 -0
- package/dracut/export-dracut-log +0 -0
- package/dracut/mkisofs +0 -0
- package/dracut/modules.d/00debug-shell/debug-hook.sh +0 -0
- package/dracut/modules.d/00debug-shell/module-setup.sh +0 -0
- package/dracut/modules.d/90block/block-cmdline.sh +0 -0
- package/dracut/modules.d/90block/module-setup.sh +0 -0
- package/dracut/modules.d/95iso-scan/iso-scan-fallback.sh +0 -0
- package/dracut/modules.d/95iso-scan/iso-scan.sh +0 -0
- package/dracut/modules.d/95iso-scan/module-setup.sh +0 -0
- package/dracut/modules.d/95luks-loop/luks-loop.sh +0 -0
- package/dracut/modules.d/95luks-loop/module-setup.sh +0 -0
- package/dracut/renew-initramfs +0 -0
- package/dracut/sbin2bin +0 -0
- package/dracut/update-dracut-conf-d +0 -0
- package/dracut/update-dracut-modules +0 -0
- package/eui/eui-autostart-cinnamon.desktop +0 -0
- package/eui/eui-autostart-xfce.desktop +0 -0
- package/eui/eui-create-image.sh +0 -0
- package/eui/eui-start.sh +0 -0
- package/package.json +130 -124
- package/perrisbrewery/scripts/postinst +0 -0
- package/perrisbrewery/scripts/postrm +0 -0
- package/perrisbrewery/scripts/preinst +0 -0
- package/perrisbrewery/scripts/prerm +0 -0
- package/perrisbrewery/template/dependencies.yaml +7 -6
- package/scripts/99clean +0 -0
- package/scripts/adapt.sh +0 -0
- package/scripts/boot-encrypted-root.sh +0 -0
- package/scripts/bros/waydroid-helper.sh +0 -0
- package/scripts/lsb_release +0 -0
- package/scripts/mom.sh +0 -0
- package/scripts/mount-encrypted-home.sh +0 -0
- package/scripts/pve-live.service +0 -0
- package/scripts/pve-live.sh +0 -0
- package/scripts/resy +0 -0
- package/conf/distros/focal/calamares/calamares-modules/.keepit +0 -0
- package/conf/distros/focal/calamares/calamares-modules/cleanup/cleanup.sh +0 -20
- package/conf/distros/focal/calamares/calamares-modules/cleanup/module.yml +0 -9
- package/conf/distros/focal/calamares/calamares-modules/sources-yolk/module.yml +0 -8
- package/conf/distros/focal/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -50
- package/conf/distros/focal/calamares/calamares-modules/sources-yolk-undo/module.yml +0 -8
- package/conf/distros/focal/calamares/modules/after_bootloader_context.yml +0 -19
- package/conf/distros/focal/calamares/modules/automirror.yml +0 -6
- package/conf/distros/focal/calamares/modules/before_bootloader_context.yml +0 -19
- package/conf/distros/focal/calamares/modules/before_bootloader_mkdirs_context.yml +0 -11
- package/conf/distros/focal/calamares/modules/bootloader.yml +0 -34
- package/conf/distros/focal/calamares/modules/displaymanager.yml +0 -12
- package/conf/distros/focal/calamares/modules/finished.yml +0 -4
- package/conf/distros/focal/calamares/modules/fstab.yml +0 -13
- package/conf/distros/focal/calamares/modules/grubcfg.yml +0 -5
- package/conf/distros/focal/calamares/modules/locale.yml +0 -9
- package/conf/distros/focal/calamares/modules/machineid.yml +0 -9
- package/conf/distros/focal/calamares/modules/mount.yml +0 -41
- package/conf/distros/focal/calamares/modules/packages.mustache +0 -5
- package/conf/distros/focal/calamares/modules/partition.yml +0 -10
- package/conf/distros/focal/calamares/modules/removeuser.mustache +0 -3
- package/conf/distros/focal/calamares/modules/shellprocess_add386arch.yml +0 -6
- package/conf/distros/focal/calamares/modules/shellprocess_bug-LP#1829805.yml +0 -5
- package/conf/distros/focal/calamares/modules/shellprocess_logs.yml +0 -6
- package/conf/distros/focal/calamares/modules/unpackfs.mustache +0 -6
- package/conf/distros/focal/calamares/modules/users.yml +0 -19
- package/conf/distros/focal/calamares/modules/welcome.yml +0 -26
- package/conf/distros/focal/calamares/settings.yml +0 -72
- package/dist/classes/incubation/incubator.d/focal.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/focal.js +0 -85
package/dist/classes/daddy.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ./src/classes/daddy.ts
|
|
3
|
-
* penguins-eggs v.25.7.x /
|
|
4
|
-
* author: Piero Proietti
|
|
5
|
-
* email: piero.proietti@gmail.com
|
|
3
|
+
* penguins-eggs v.25.7.x / ECMAScript 2020
|
|
4
|
+
* author: Piero Proietti (modified by Hossein Seilani)
|
|
6
5
|
* license: MIT
|
|
7
6
|
*/
|
|
8
7
|
import chalk from 'chalk';
|
|
9
8
|
import inquirer from 'inquirer';
|
|
10
9
|
import yaml from 'js-yaml';
|
|
11
|
-
import fs from 'node:fs';
|
|
12
|
-
// _dirname
|
|
10
|
+
import fs from 'node:fs/promises';
|
|
13
11
|
import path from 'node:path';
|
|
14
12
|
import { exec } from '../lib/utils.js';
|
|
15
|
-
// We need to remove .js extension from import
|
|
16
13
|
import Pacman from '../classes/pacman.js';
|
|
17
14
|
import Settings from '../classes/settings.js';
|
|
18
15
|
import Utils from '../classes/utils.js';
|
|
@@ -20,159 +17,191 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
|
20
17
|
export default class Daddy {
|
|
21
18
|
settings = {};
|
|
22
19
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
20
|
+
* [CHANGE 1] Modular, type-safe, interactive configuration editor
|
|
21
|
+
* This method asks the user for LiveCD parameters using inquirer and returns
|
|
22
|
+
* a fully typed IEggsConfig object. It replaces the older JSON.stringify/parse approach.
|
|
26
23
|
*/
|
|
27
|
-
async editConfig(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
async editConfig(config) {
|
|
25
|
+
console.log(chalk.cyan('Edit and save Live system parameters\n'));
|
|
26
|
+
// Determine default compression option
|
|
27
|
+
let compressionOpt;
|
|
28
|
+
switch (config.compression) {
|
|
29
|
+
case 'xz':
|
|
30
|
+
compressionOpt = 1;
|
|
31
|
+
break;
|
|
32
|
+
case 'xz -Xbcj x86':
|
|
33
|
+
compressionOpt = 2;
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
compressionOpt = 0;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
// Provide a default snapshot prefix if empty
|
|
40
|
+
if (!config.snapshot_prefix) {
|
|
41
|
+
config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId);
|
|
34
42
|
}
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
/**
|
|
44
|
+
* // Define type-safe inquirer questions
|
|
45
|
+
* const questions: inquirer.QuestionCollection<IEggsConfig> = [
|
|
46
|
+
*/
|
|
47
|
+
const questions = [
|
|
48
|
+
{
|
|
49
|
+
type: 'input',
|
|
50
|
+
name: 'snapshot_prefix',
|
|
51
|
+
message: 'LiveCD iso prefix: ',
|
|
52
|
+
default: config.snapshot_prefix,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'input',
|
|
56
|
+
name: 'snapshot_basename',
|
|
57
|
+
message: 'LiveCD iso basename: ',
|
|
58
|
+
default: config.snapshot_basename,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'input',
|
|
62
|
+
name: 'user_opt',
|
|
63
|
+
message: 'LiveCD user:',
|
|
64
|
+
default: config.user_opt,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'input',
|
|
68
|
+
name: 'user_opt_passwd',
|
|
69
|
+
message: 'LiveCD user password:',
|
|
70
|
+
default: config.user_opt_passwd,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'input',
|
|
74
|
+
name: 'root_passwd',
|
|
75
|
+
message: 'LiveCD root password:',
|
|
76
|
+
default: config.root_passwd,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'list',
|
|
80
|
+
name: 'compression',
|
|
81
|
+
message: 'LiveCD compression: ',
|
|
82
|
+
choices: ['fast', 'max'],
|
|
83
|
+
default: compressionOpt,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
try {
|
|
87
|
+
// Prompt the user and return the typed config object
|
|
88
|
+
const answers = await inquirer.prompt(questions);
|
|
89
|
+
return answers;
|
|
37
90
|
}
|
|
38
|
-
|
|
39
|
-
|
|
91
|
+
catch (err) {
|
|
92
|
+
console.error(chalk.red('Error editing configuration:'), err);
|
|
93
|
+
throw err;
|
|
40
94
|
}
|
|
41
|
-
return new Promise((resolve) => {
|
|
42
|
-
const questions = [
|
|
43
|
-
{
|
|
44
|
-
default: c.snapshot_prefix,
|
|
45
|
-
message: 'LiveCD iso prefix: ',
|
|
46
|
-
name: 'snapshot_prefix',
|
|
47
|
-
type: 'input'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
default: c.snapshot_basename,
|
|
51
|
-
message: 'LiveCD iso basename: ',
|
|
52
|
-
name: 'snapshot_basename',
|
|
53
|
-
type: 'input'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
default: c.user_opt,
|
|
57
|
-
message: 'LiveCD user:',
|
|
58
|
-
name: 'user_opt',
|
|
59
|
-
type: 'input'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
default: c.user_opt_passwd,
|
|
63
|
-
message: 'LiveCD user password: ',
|
|
64
|
-
name: 'user_opt_passwd',
|
|
65
|
-
type: 'input'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
default: c.root_passwd,
|
|
69
|
-
message: 'LiveCD root password: ',
|
|
70
|
-
name: 'root_passwd',
|
|
71
|
-
type: 'input'
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
choices: ['fast', 'max'],
|
|
75
|
-
default: compressionOpt,
|
|
76
|
-
message: 'LiveCD compression: ',
|
|
77
|
-
name: 'compression',
|
|
78
|
-
type: 'list'
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
|
-
inquirer.prompt(questions).then((options) => {
|
|
82
|
-
resolve(JSON.stringify(options));
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
95
|
}
|
|
86
96
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
97
|
+
* [CHANGE 2] Central method to manage environment, configuration and save
|
|
98
|
+
* This method is modular, type-safe, and handles:
|
|
99
|
+
* - Pacman and distro templates check
|
|
100
|
+
* - Load, reset, or apply custom configuration
|
|
101
|
+
* - Save configuration to disk
|
|
102
|
+
* - Provide clear guidance to the user
|
|
92
103
|
*/
|
|
93
104
|
async helpMe(reset = false, isCustom = false, fileCustom = '', verbose = false) {
|
|
94
|
-
|
|
95
|
-
|
|
105
|
+
try {
|
|
106
|
+
if (isCustom)
|
|
107
|
+
console.log('Using custom file:', fileCustom);
|
|
108
|
+
// Step 1: Check system prerequisites
|
|
109
|
+
await this.checkPacman(verbose);
|
|
110
|
+
// Step 2: Load settings
|
|
111
|
+
this.settings = new Settings();
|
|
112
|
+
const loaded = await this.settings.load();
|
|
113
|
+
let config = loaded ? this.settings.config : {};
|
|
114
|
+
// Step 3: Apply reset or custom configuration
|
|
115
|
+
if (reset || isCustom) {
|
|
116
|
+
await this.applyResetOrCustomConfig(config, isCustom, fileCustom);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
config = await this.editConfig(config);
|
|
120
|
+
}
|
|
121
|
+
// Step 4: Save final configuration
|
|
122
|
+
await this.settings.save(config);
|
|
123
|
+
// Step 5: Display help messages
|
|
124
|
+
this.displayFinalHelp();
|
|
96
125
|
}
|
|
97
|
-
|
|
126
|
+
catch (err) {
|
|
127
|
+
console.error(chalk.red('An error occurred in helpMe:'), err);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Check and install Pacman configuration and templates if missing
|
|
132
|
+
*/
|
|
133
|
+
async checkPacman(verbose) {
|
|
98
134
|
if (!Pacman.configurationCheck()) {
|
|
99
|
-
console.log('- creating configuration
|
|
135
|
+
console.log('- creating configuration directory...');
|
|
100
136
|
await Pacman.configurationInstall(verbose);
|
|
101
137
|
}
|
|
102
|
-
// Templates
|
|
103
138
|
if (!Pacman.distroTemplateCheck()) {
|
|
104
|
-
console.log('- distro template
|
|
139
|
+
console.log('- installing distro template...');
|
|
105
140
|
await Pacman.distroTemplateInstall(verbose);
|
|
106
141
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Pacman.isInstalledGui() &&
|
|
110
|
-
Pacman.isCalamaresAvailable()) {
|
|
111
|
-
console.log('- this is a GUI system, calamares is available, but NOT installed');
|
|
142
|
+
if (!Pacman.calamaresExists() && Pacman.isInstalledGui() && Pacman.isCalamaresAvailable()) {
|
|
143
|
+
console.log('- GUI system detected, calamares is available but not installed.');
|
|
112
144
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (fstype === 'ext4') {
|
|
125
|
-
fstype = '';
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
// btrfs-, etc
|
|
129
|
-
fstype += '-';
|
|
130
|
-
}
|
|
131
|
-
// excluded now
|
|
132
|
-
fstype = '';
|
|
133
|
-
config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId) + fstype;
|
|
134
|
-
}
|
|
135
|
-
jsonConf = JSON.stringify(config);
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
jsonConf = await this.editConfig(config);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Apply reset or custom configuration
|
|
148
|
+
*/
|
|
149
|
+
async applyResetOrCustomConfig(config, isCustom, fileCustom) {
|
|
150
|
+
// Reset snapshot prefix if empty
|
|
151
|
+
if (!config.snapshot_prefix) {
|
|
152
|
+
let fstype = '';
|
|
153
|
+
try {
|
|
154
|
+
const { data } = await exec(`findmnt -n -o FSTYPE /`, { capture: true });
|
|
155
|
+
fstype = data.trim() === 'ext4' ? '' : `${data.trim()}-`;
|
|
139
156
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const conf = fs.readFileSync(fileCustom, 'utf8');
|
|
143
|
-
const confCustom = yaml.load(conf);
|
|
144
|
-
config.snapshot_basename = confCustom.snapshot_basename;
|
|
145
|
-
config.snapshot_prefix = confCustom.snapshot_prefix;
|
|
146
|
-
config.user_opt = confCustom.user_opt;
|
|
147
|
-
config.user_opt_passwd = confCustom.user_opt_passwd;
|
|
148
|
-
config.root_passwd = confCustom.root_passwd;
|
|
149
|
-
config.theme = confCustom.theme;
|
|
150
|
-
jsonConf = JSON.stringify(config);
|
|
157
|
+
catch (err) {
|
|
158
|
+
console.warn('Unable to detect FSTYPE:', err);
|
|
151
159
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
config
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
config.snapshot_prefix = Utils.snapshotPrefix(this.settings.distro.distroId, this.settings.distro.codenameId) + fstype;
|
|
161
|
+
}
|
|
162
|
+
// Apply custom YAML if needed
|
|
163
|
+
if (isCustom && fileCustom) {
|
|
164
|
+
await this.applyCustomYAML(config, fileCustom);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Load and apply a custom YAML configuration
|
|
169
|
+
* [CHANGE 3] Async reading of file and type-safe parsing
|
|
170
|
+
*/
|
|
171
|
+
async applyCustomYAML(config, fileCustom) {
|
|
172
|
+
try {
|
|
173
|
+
const conf = await fs.readFile(fileCustom, 'utf8');
|
|
174
|
+
const confCustom = yaml.load(conf);
|
|
175
|
+
// Safely copy fields from YAML to config
|
|
176
|
+
config.snapshot_basename = confCustom.snapshot_basename ?? config.snapshot_basename;
|
|
177
|
+
config.snapshot_prefix = confCustom.snapshot_prefix ?? config.snapshot_prefix;
|
|
178
|
+
config.user_opt = confCustom.user_opt ?? config.user_opt;
|
|
179
|
+
config.user_opt_passwd = confCustom.user_opt_passwd ?? config.user_opt_passwd;
|
|
180
|
+
config.root_passwd = confCustom.root_passwd ?? config.root_passwd;
|
|
181
|
+
config.theme = confCustom.theme ?? config.theme;
|
|
161
182
|
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
console.error(chalk.red('Failed to load custom YAML config:'), err);
|
|
185
|
+
throw err;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Display final guidance and tips to the user
|
|
190
|
+
* [CHANGE 4] Modular, clear, user-friendly messages
|
|
191
|
+
*/
|
|
192
|
+
displayFinalHelp() {
|
|
162
193
|
console.log();
|
|
163
194
|
console.log(chalk.cyan('Your configuration was saved on: /etc/penguins-eggs.d'));
|
|
195
|
+
console.log(chalk.cyan('You can create a clean ISO with: ') + chalk.white('sudo eggs produce'));
|
|
196
|
+
console.log(chalk.cyan('Or a full personal clone: ') + chalk.white('sudo eggs produce --clone'));
|
|
164
197
|
console.log();
|
|
165
|
-
console.log(chalk.cyan(
|
|
166
|
-
console.log(chalk.cyan(
|
|
167
|
-
console.log();
|
|
168
|
-
console.log(chalk.cyan(
|
|
169
|
-
console.log(chalk.
|
|
170
|
-
console.log(chalk.cyan(
|
|
171
|
-
console.log(chalk.white(
|
|
172
|
-
console.log(chalk.cyan(`- then, mount remote space:`));
|
|
173
|
-
console.log(chalk.white(`sudo sshfs -o allow_other root@192.168.1.2:/zfs/iso /home/eggs/.mnt`));
|
|
174
|
-
console.log(chalk.cyan('- or, mount a local partition:'));
|
|
175
|
-
console.log(chalk.white(`sudo mount /dev/sdx1 /home/eggs/.mnt`));
|
|
198
|
+
console.log(chalk.cyan('If you don’t have enough space to remaster, you can mount remote or local space:'));
|
|
199
|
+
console.log(chalk.cyan('- Create a hidden mountpoint under the nest:'));
|
|
200
|
+
console.log(chalk.white('sudo mkdir /home/eggs/.mnt -p'));
|
|
201
|
+
console.log(chalk.cyan('- Mount remote space:'));
|
|
202
|
+
console.log(chalk.white('sudo sshfs -o allow_other root@192.168.1.2:/zfs/iso /home/eggs/.mnt'));
|
|
203
|
+
console.log(chalk.cyan('- Or mount a local partition:'));
|
|
204
|
+
console.log(chalk.white('sudo mount /dev/sdx1 /home/eggs/.mnt'));
|
|
176
205
|
console.log();
|
|
177
206
|
console.log(chalk.cyan('More help? ') + chalk.white('eggs mom'));
|
|
178
207
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* penguins-eggs
|
|
3
|
+
* class: distro.ts
|
|
4
|
+
* author: Piero Proietti (modified by Hossein Seilani)
|
|
5
|
+
* license: MIT
|
|
6
|
+
*
|
|
7
|
+
* FINAL VERSION WITH EXPLAINED COMMENTS AND NEW CHANGE TAGS
|
|
8
|
+
*/
|
|
9
|
+
import { IDistro } from '../interfaces/index.js';
|
|
10
|
+
declare class Distro implements IDistro {
|
|
11
|
+
bugReportUrl: string;
|
|
12
|
+
codenameId: string;
|
|
13
|
+
distroUniqueId: string;
|
|
14
|
+
distroId: string;
|
|
15
|
+
distroLike: string;
|
|
16
|
+
familyId: string;
|
|
17
|
+
homeUrl: string;
|
|
18
|
+
isCalamaresAvailable: boolean;
|
|
19
|
+
liveMediumPath: string;
|
|
20
|
+
releaseId: string;
|
|
21
|
+
squashfs: string;
|
|
22
|
+
supportUrl: string;
|
|
23
|
+
syslinuxPath: string;
|
|
24
|
+
usrLibPath: string;
|
|
25
|
+
constructor();
|
|
26
|
+
/**
|
|
27
|
+
* NEW CHANGE6: Modular configuration for main distro types like Alpine, Fedora-family, etc.
|
|
28
|
+
* This simplifies the constructor and keeps distro-specific logic isolated.
|
|
29
|
+
*/
|
|
30
|
+
private configureDistro;
|
|
31
|
+
/**
|
|
32
|
+
* NEW CHANGE12: Map Debian, Ubuntu, Devuan codenames to proper IDs and paths
|
|
33
|
+
* This avoids long if/else chains and allows easier future updates.
|
|
34
|
+
*/
|
|
35
|
+
private debianFamily;
|
|
36
|
+
/**
|
|
37
|
+
* NEW CHANGE15: Async derivative detection from YAML files
|
|
38
|
+
* This allows future-proofing and easy updates for new distros.
|
|
39
|
+
*/
|
|
40
|
+
private detectDerivatives;
|
|
41
|
+
/**
|
|
42
|
+
* NEW CHANGE16: Apply family-specific paths for usrLibPath, squashfs, and liveMediumPath
|
|
43
|
+
* Handles Debian, openSUSE, Manjaro and derivatives consistently.
|
|
44
|
+
*/
|
|
45
|
+
private applyFamilySpecificPaths;
|
|
46
|
+
/**
|
|
47
|
+
* NEW CHANGE17: Load custom HOME, SUPPORT, BUG_REPORT URLs from /etc/os-release
|
|
48
|
+
* Allows overrides of default URLs for user-friendly experience.
|
|
49
|
+
*/
|
|
50
|
+
private loadOSReleaseUrls;
|
|
51
|
+
}
|
|
52
|
+
export default Distro;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* penguins-eggs
|
|
3
|
+
* class: distro.ts
|
|
4
|
+
* author: Piero Proietti (modified by Hossein Seilani)
|
|
5
|
+
* license: MIT
|
|
6
|
+
*
|
|
7
|
+
* FINAL VERSION WITH EXPLAINED COMMENTS AND NEW CHANGE TAGS
|
|
8
|
+
*/
|
|
9
|
+
import yaml from 'js-yaml';
|
|
10
|
+
import fs from 'node:fs/promises';
|
|
11
|
+
import fsSync from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import shell from 'shelljs';
|
|
14
|
+
import Utils from './utils.js';
|
|
15
|
+
import Diversions from './diversions.js';
|
|
16
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
17
|
+
class Distro {
|
|
18
|
+
// NEW CHANGE 1: Added default values for all main distro properties to ensure proper initialization.
|
|
19
|
+
// This prevents undefined values in later logic and standardizes URLs and paths.
|
|
20
|
+
bugReportUrl = 'https://github.com-pieroproietti/penguins-eggs/issue';
|
|
21
|
+
codenameId = '';
|
|
22
|
+
distroUniqueId = '';
|
|
23
|
+
distroId = '';
|
|
24
|
+
distroLike = '';
|
|
25
|
+
familyId = 'debian';
|
|
26
|
+
homeUrl = 'https://penguins-eggs.net';
|
|
27
|
+
isCalamaresAvailable = true;
|
|
28
|
+
liveMediumPath = '/run/live/medium/';
|
|
29
|
+
releaseId = '';
|
|
30
|
+
squashfs = 'live/filesystem.squashfs';
|
|
31
|
+
supportUrl = 'https://penguins-eggs.net';
|
|
32
|
+
syslinuxPath = path.resolve(__dirname, `../../syslinux`);
|
|
33
|
+
usrLibPath = '/usr/lib';
|
|
34
|
+
constructor() {
|
|
35
|
+
// NEW CHANGE2: Initialize OS info using Utils.getOsRelease()
|
|
36
|
+
// This ensures the distroId, codenameId, and releaseId are set early for proper logic.
|
|
37
|
+
const osInfo = Utils.getOsRelease();
|
|
38
|
+
this.distroId = osInfo.ID;
|
|
39
|
+
this.codenameId = osInfo.VERSION_CODENAME;
|
|
40
|
+
this.releaseId = osInfo.VERSION_ID;
|
|
41
|
+
// NEW CHANGE3: Normalize special distro names to handle edge cases like Debian sid
|
|
42
|
+
// or custom Biglinux/Bigcommunity derivatives to maintain consistency.
|
|
43
|
+
if (this.distroId === 'Debian' && this.codenameId === 'sid')
|
|
44
|
+
this.codenameId = 'trixie';
|
|
45
|
+
if (this.distroId.includes('Biglinux'))
|
|
46
|
+
this.distroId = 'Biglinux';
|
|
47
|
+
if (this.distroId.includes('Bigcommunity'))
|
|
48
|
+
this.distroId = 'Bigcommunity';
|
|
49
|
+
// NEW CHANGE4: Modularize distro configuration for better readability and maintenance
|
|
50
|
+
this.configureDistro();
|
|
51
|
+
this.applyFamilySpecificPaths();
|
|
52
|
+
// NEW CHANGE5: Load URLs from /etc/os-release to override defaults if available
|
|
53
|
+
this.loadOSReleaseUrls();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* NEW CHANGE6: Modular configuration for main distro types like Alpine, Fedora-family, etc.
|
|
57
|
+
* This simplifies the constructor and keeps distro-specific logic isolated.
|
|
58
|
+
*/
|
|
59
|
+
configureDistro() {
|
|
60
|
+
// NEW CHANGE7: Handle Alpine specific paths and properties
|
|
61
|
+
if (this.distroId === 'Alpine') {
|
|
62
|
+
this.familyId = 'alpine';
|
|
63
|
+
this.distroLike = 'Alpine';
|
|
64
|
+
this.codenameId = 'rolling';
|
|
65
|
+
this.distroUniqueId = this.familyId;
|
|
66
|
+
this.liveMediumPath = '/mnt/';
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Arch
|
|
71
|
+
*/
|
|
72
|
+
if (this.codenameId === 'rolling' || this.codenameId === 'n/a') {
|
|
73
|
+
this.familyId = 'archlinux';
|
|
74
|
+
this.distroLike = 'Arch';
|
|
75
|
+
this.codenameId = 'rolling';
|
|
76
|
+
this.distroUniqueId = 'archlinux';
|
|
77
|
+
this.liveMediumPath = '/run/archiso/bootmnt/';
|
|
78
|
+
this.squashfs = `arch/x86_64/airootfs.sfs`;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// NEW CHANGE8: Consolidated Fedora-family detection for multiple derivatives
|
|
82
|
+
const fedoraDistros = ['Almalinux', 'Fedora', 'Nobara', 'Rhel', 'Rocky'];
|
|
83
|
+
if (fedoraDistros.includes(this.distroId)) {
|
|
84
|
+
this.familyId = 'fedora';
|
|
85
|
+
this.distroLike = 'Fedora';
|
|
86
|
+
this.codenameId = 'rolling';
|
|
87
|
+
this.distroUniqueId = this.familyId;
|
|
88
|
+
this.liveMediumPath = '/run/initramfs/live/';
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// NEW CHANGE9: Openmamba specific properties
|
|
92
|
+
if (this.distroId === 'Openmamba') {
|
|
93
|
+
this.familyId = 'openmamba';
|
|
94
|
+
this.distroLike = 'Openmamba';
|
|
95
|
+
this.codenameId = 'rolling';
|
|
96
|
+
this.distroUniqueId = this.familyId;
|
|
97
|
+
this.liveMediumPath = '/run/initramfs/live/';
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// NEW CHANGE10: OpenSUSE specific properties
|
|
101
|
+
if (this.distroId.includes('Opensuse')) {
|
|
102
|
+
this.familyId = 'opensuse';
|
|
103
|
+
this.distroLike = 'Opensuse';
|
|
104
|
+
this.codenameId = 'rolling';
|
|
105
|
+
this.distroUniqueId = this.familyId;
|
|
106
|
+
this.liveMediumPath = '/run/initramfs/live/';
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// NEW CHANGE11: Handle Debian/Ubuntu/Devuan and their derivatives
|
|
110
|
+
this.debianFamily();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* NEW CHANGE12: Map Debian, Ubuntu, Devuan codenames to proper IDs and paths
|
|
114
|
+
* This avoids long if/else chains and allows easier future updates.
|
|
115
|
+
*/
|
|
116
|
+
debianFamily() {
|
|
117
|
+
const mapping = {
|
|
118
|
+
jessie: { distroLike: 'Debian', uniqueId: 'jessie', livePath: '/lib/live/mount/medium/', calamares: false },
|
|
119
|
+
stretch: { distroLike: 'Debian', uniqueId: 'stretch', livePath: '/lib/live/mount/medium/', calamares: false },
|
|
120
|
+
buster: { distroLike: 'Debian', uniqueId: 'buster' },
|
|
121
|
+
bullseye: { distroLike: 'Debian', uniqueId: 'bullseye' },
|
|
122
|
+
bookworm: { distroLike: 'Debian', uniqueId: 'bookworm' },
|
|
123
|
+
trixie: { distroLike: 'Debian', uniqueId: 'trixie' },
|
|
124
|
+
forky: { distroLike: 'Debian', uniqueId: 'forky' },
|
|
125
|
+
beowulf: { distroLike: 'Devuan', uniqueId: 'beowulf' },
|
|
126
|
+
chimaera: { distroLike: 'Devuan', uniqueId: 'chimaera' },
|
|
127
|
+
daedalus: { distroLike: 'Devuan', uniqueId: 'daedalus' },
|
|
128
|
+
excalibur: { distroLike: 'Devuan', uniqueId: 'excalibur' },
|
|
129
|
+
bionic: { distroLike: 'Ubuntu', uniqueId: 'bionic', livePath: '/lib/live/mount/medium/' },
|
|
130
|
+
focal: { distroLike: 'Ubuntu', uniqueId: 'focal' },
|
|
131
|
+
jammy: { distroLike: 'Ubuntu', uniqueId: 'jammy' },
|
|
132
|
+
noble: { distroLike: 'Ubuntu', uniqueId: 'noble' },
|
|
133
|
+
devel: { distroLike: 'Ubuntu', uniqueId: 'devel' },
|
|
134
|
+
};
|
|
135
|
+
// NEW CHANGE13: Apply mapping if codename exists
|
|
136
|
+
const cfg = mapping[this.codenameId];
|
|
137
|
+
if (cfg) {
|
|
138
|
+
this.familyId = "debian";
|
|
139
|
+
this.distroLike = cfg.distroLike;
|
|
140
|
+
this.distroUniqueId = cfg.uniqueId;
|
|
141
|
+
if (cfg.livePath !== undefined)
|
|
142
|
+
this.liveMediumPath = cfg.livePath;
|
|
143
|
+
if (cfg.calamares !== undefined)
|
|
144
|
+
this.isCalamaresAvailable = cfg.calamares;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// NEW CHANGE14: Detect derivatives if not in mapping
|
|
148
|
+
this.detectDerivatives();
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* NEW CHANGE15: Async derivative detection from YAML files
|
|
152
|
+
* This allows future-proofing and easy updates for new distros.
|
|
153
|
+
*/
|
|
154
|
+
async detectDerivatives() {
|
|
155
|
+
let archDebianDerivatives = path.resolve(__dirname, '../../conf/derivatives.yaml');
|
|
156
|
+
if (fsSync.existsSync('/etc/penguins-eggs.d/derivatives.yaml')) {
|
|
157
|
+
archDebianDerivatives = '/etc/penguins-eggs.d/derivatives.yaml';
|
|
158
|
+
}
|
|
159
|
+
let found = false;
|
|
160
|
+
if (fsSync.existsSync(archDebianDerivatives)) {
|
|
161
|
+
const content = await fs.readFile(archDebianDerivatives, 'utf8');
|
|
162
|
+
const distros = yaml.load(content);
|
|
163
|
+
for (const distro of distros) {
|
|
164
|
+
if (distro.ids !== undefined) {
|
|
165
|
+
for (let n = 0; n < distro.ids.length; n++) {
|
|
166
|
+
if (this.codenameId === distro.ids[n]) {
|
|
167
|
+
found = true;
|
|
168
|
+
this.distroLike = distro.distroLike;
|
|
169
|
+
this.distroUniqueId = distro.id;
|
|
170
|
+
this.familyId = distro.family;
|
|
171
|
+
found = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!found) {
|
|
178
|
+
let fedoraDerivatives = path.resolve(__dirname, '../../conf/derivatives_fedora.yaml');
|
|
179
|
+
if (fsSync.existsSync('/etc/penguins-eggs.d/derivatives_fedora.yaml')) {
|
|
180
|
+
fedoraDerivatives = '/etc/penguins-eggs.d/derivatives_fedora.yaml';
|
|
181
|
+
}
|
|
182
|
+
const content = fsSync.readFileSync(fedoraDerivatives, 'utf8');
|
|
183
|
+
const elem = yaml.load(content);
|
|
184
|
+
if (elem.includes(this.distroId)) {
|
|
185
|
+
this.familyId = 'fedora';
|
|
186
|
+
this.distroLike = 'Fedora';
|
|
187
|
+
this.codenameId = 'rolling';
|
|
188
|
+
this.distroUniqueId = this.familyId;
|
|
189
|
+
this.liveMediumPath = '/run/initramfs/live/';
|
|
190
|
+
found = true;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (!found) {
|
|
194
|
+
console.warn(`This distro ${this.distroId}/${this.codenameId} is not yet recognized!`);
|
|
195
|
+
console.warn('Edit derivatives.yaml and run: sudo eggs dad -d to re-configure.');
|
|
196
|
+
process.exit(0);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* NEW CHANGE16: Apply family-specific paths for usrLibPath, squashfs, and liveMediumPath
|
|
201
|
+
* Handles Debian, openSUSE, Manjaro and derivatives consistently.
|
|
202
|
+
*/
|
|
203
|
+
applyFamilySpecificPaths() {
|
|
204
|
+
if (this.familyId === 'archlinux') {
|
|
205
|
+
if (Diversions.isManjaroBased(this.distroId)) {
|
|
206
|
+
this.liveMediumPath = '/run/miso/bootmnt/';
|
|
207
|
+
this.squashfs = 'manjaro/x86_64/livefs.sfs';
|
|
208
|
+
this.codenameId = shell.exec('lsb_release -cs', { silent: true }).stdout.toString().trim();
|
|
209
|
+
this.distroUniqueId = 'manjaro';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else if (this.familyId === 'debian') {
|
|
213
|
+
this.usrLibPath = '/usr/lib/' + Utils.usrLibPath();
|
|
214
|
+
}
|
|
215
|
+
else if (this.familyId === 'opensuse') {
|
|
216
|
+
this.usrLibPath = '/usr/lib64/';
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* NEW CHANGE17: Load custom HOME, SUPPORT, BUG_REPORT URLs from /etc/os-release
|
|
221
|
+
* Allows overrides of default URLs for user-friendly experience.
|
|
222
|
+
*/
|
|
223
|
+
loadOSReleaseUrls() {
|
|
224
|
+
const os_release = '/etc/os-release';
|
|
225
|
+
if (!fsSync.existsSync(os_release))
|
|
226
|
+
return;
|
|
227
|
+
const data = fsSync.readFileSync(os_release, 'utf8');
|
|
228
|
+
const lines = data.split('\n');
|
|
229
|
+
for (const line of lines) {
|
|
230
|
+
if (line.startsWith('HOME_URL='))
|
|
231
|
+
this.homeUrl = line.slice('HOME_URL='.length).replace(/"/g, '');
|
|
232
|
+
if (line.startsWith('SUPPORT_URL='))
|
|
233
|
+
this.supportUrl = line.slice('SUPPORT_URL='.length).replace(/"/g, '');
|
|
234
|
+
if (line.startsWith('BUG_REPORT_URL='))
|
|
235
|
+
this.bugReportUrl = line.slice('BUG_REPORT_URL='.length).replace(/"/g, '');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
export default Distro;
|