penguins-eggs 25.11.21 → 25.11.29
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 +53 -41
- package/README.md +146 -64
- package/README.pdf +21400 -3491
- package/addons/eggs/theme/livecd/full.grub.main.cfg +39 -4
- package/addons/eggs/theme/livecd/full.isolinux.main.cfg +47 -4
- package/bin/run.js +11 -0
- package/conf/derivatives.yaml +2 -1
- package/dist/appimage/dependency-manager.d.ts +31 -0
- package/dist/appimage/dependency-manager.js +292 -0
- package/dist/appimage/first-run-check.js +3 -3
- package/dist/bin/run.js +11 -0
- package/dist/classes/cli-autologin.js +1 -1
- package/dist/classes/daddy.js +11 -11
- package/dist/classes/incubation/fisherman-helper/initcpio.d.ts +7 -0
- package/dist/classes/incubation/fisherman-helper/initcpio.js +7 -0
- package/dist/classes/incubation/fisherman.js +0 -2
- package/dist/classes/network.d.ts +1 -1
- package/dist/classes/ovary.d/edit-live-fs.d.ts +1 -1
- package/dist/classes/ovary.d/edit-live-fs.js +129 -93
- package/dist/classes/ovary.d/fertilization.js +1 -1
- package/dist/classes/ovary.d/xorriso-command.js +1 -5
- package/dist/classes/pacman.d.ts +21 -7
- package/dist/classes/pacman.js +53 -32
- package/dist/classes/utils.d.ts +1 -5
- package/dist/classes/utils.js +15 -12
- package/dist/commands/config.js +3 -14
- package/dist/commands/cuckoo.js +1 -1
- package/dist/commands/{setup.d.ts → setup/install.d.ts} +1 -5
- package/dist/commands/setup/install.js +71 -0
- package/dist/commands/setup/purge.d.ts +17 -0
- package/dist/commands/setup/purge.js +71 -0
- package/dist/commands/update.d.ts +15 -0
- package/dist/commands/update.js +74 -6
- package/dist/krill/components/title.js +4 -4
- package/dist/lib/utils.js +0 -19
- package/manpages/doc/man/eggs.1.gz +0 -0
- package/manpages/doc/man/eggs.html +29 -17
- package/package.json +8 -9
- package/scripts/_eggs +35 -7
- package/scripts/eggs.bash +2 -1
- package/dist/appimage/prerequisites.d.ts +0 -34
- package/dist/appimage/prerequisites.js +0 -350
- package/dist/commands/setup.js +0 -90
- package/scripts/appimage-build.sh +0 -152
- package/scripts/appimage-install.sh +0 -43
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ./src/classes/ovary.d/edit-live-fs.ts
|
|
3
|
-
* penguins-eggs v.25.
|
|
3
|
+
* penguins-eggs v.25.11.x / ecmascript 2020
|
|
4
4
|
* author: Piero Proietti
|
|
5
5
|
* email: piero.proietti@gmail.com
|
|
6
6
|
* license: MIT
|
|
@@ -31,17 +31,18 @@ export async function editLiveFs(clone = false) {
|
|
|
31
31
|
if (this.verbose) {
|
|
32
32
|
console.log('Ovary: editLiveFs');
|
|
33
33
|
}
|
|
34
|
+
const workDir = this.settings.work_dir.merged;
|
|
34
35
|
/**
|
|
35
36
|
* /etc/penguins-eggs.d/is_clone file created on live
|
|
36
37
|
*/
|
|
37
38
|
if (clone) {
|
|
38
|
-
await exec(`touch ${
|
|
39
|
+
await exec(`touch ${workDir}/etc/penguins-eggs.d/is_clone`, this.echo);
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* /etc/default/epoptes-client created on live
|
|
42
43
|
*/
|
|
43
44
|
if (Pacman.packageIsInstalled('epoptes')) {
|
|
44
|
-
const file = `${
|
|
45
|
+
const file = `${workDir}/etc/default/epoptes-client`;
|
|
45
46
|
const text = `SERVER=${os.hostname}.local\n`;
|
|
46
47
|
fs.writeFileSync(file, text);
|
|
47
48
|
}
|
|
@@ -52,74 +53,116 @@ export async function editLiveFs(clone = false) {
|
|
|
52
53
|
Utils.write(file, text);
|
|
53
54
|
}
|
|
54
55
|
// Truncate logs, remove archived logs.
|
|
55
|
-
let cmd = `find ${
|
|
56
|
+
let cmd = `find ${workDir}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
|
|
56
57
|
await exec(cmd, this.echo);
|
|
57
|
-
cmd = `find ${
|
|
58
|
+
cmd = `find ${workDir}/var/log/ -type f -exec truncate -s 0 {} \\;`;
|
|
58
59
|
await exec(cmd, this.echo);
|
|
60
|
+
// =========================================================================
|
|
61
|
+
// FIX STRUTTURALE PER DEVUAN/DEBIAN (/var folders)
|
|
62
|
+
// =========================================================================
|
|
63
|
+
// Ricrea le directory essenziali che potrebbero essere state rimosse
|
|
64
|
+
// o che devono esistere vuote per il corretto avvio dei servizi.
|
|
65
|
+
const dirsToCreate = [
|
|
66
|
+
`${workDir}/var/lib/dbus`, // Fondamentale per dbus
|
|
67
|
+
`${workDir}/var/spool/rsyslog`, // Fondamentale per rsyslog
|
|
68
|
+
`${workDir}/var/spool/cron/crontabs` // Fondamentale per cron
|
|
69
|
+
];
|
|
70
|
+
for (const dir of dirsToCreate) {
|
|
71
|
+
if (!fs.existsSync(dir)) {
|
|
72
|
+
await exec(`mkdir -p ${dir}`, this.echo);
|
|
73
|
+
// Assicuriamo permessi corretti (dbus vuole 755 root:root di base)
|
|
74
|
+
await exec(`chmod 755 ${dir}`, this.echo);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// =========================================================================
|
|
78
|
+
// FIX CRITICO PER /var/run e /var/lock
|
|
79
|
+
// =========================================================================
|
|
80
|
+
// Su Debian/Devuan moderni, /var/run DEVE essere un symlink a /run.
|
|
81
|
+
// Se rsync lo ha copiato come directory, D-Bus e altri servizi falliscono.
|
|
82
|
+
const varRun = `${workDir}/var/run`;
|
|
83
|
+
if (fs.existsSync(varRun) && !fs.lstatSync(varRun).isSymbolicLink()) {
|
|
84
|
+
if (this.verbose)
|
|
85
|
+
console.log('Fixing /var/run symlink...');
|
|
86
|
+
await exec(`rm -rf ${varRun}`, this.echo);
|
|
87
|
+
await exec(`ln -s /run ${varRun}`, this.echo);
|
|
88
|
+
}
|
|
89
|
+
const varLock = `${workDir}/var/lock`;
|
|
90
|
+
if (fs.existsSync(varLock) && !fs.lstatSync(varLock).isSymbolicLink()) {
|
|
91
|
+
if (this.verbose)
|
|
92
|
+
console.log('Fixing /var/lock symlink...');
|
|
93
|
+
await exec(`rm -rf ${varLock}`, this.echo);
|
|
94
|
+
await exec(`ln -s /run/lock ${varLock}`, this.echo);
|
|
95
|
+
}
|
|
96
|
+
// =========================================================================
|
|
59
97
|
// Allow all fixed drives to be mounted with pmount
|
|
60
|
-
if (this.settings.config.pmount_fixed && fs.existsSync(`${
|
|
98
|
+
if (this.settings.config.pmount_fixed && fs.existsSync(`${workDir}/etc/pmount.allow`)) {
|
|
61
99
|
// MX aggiunto /etc
|
|
62
|
-
await exec(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${
|
|
100
|
+
await exec(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${workDir}/etc/pmount.allow`, this.echo);
|
|
63
101
|
}
|
|
64
102
|
// Remove obsolete live-config file
|
|
65
|
-
if (fs.existsSync(`${
|
|
66
|
-
await exec(`rm -f ${
|
|
103
|
+
if (fs.existsSync(`${workDir}lib/live/config/1161-openssh-server`)) {
|
|
104
|
+
await exec(`rm -f ${workDir}/lib/live/config/1161-openssh-server`, this.echo);
|
|
67
105
|
}
|
|
68
|
-
if (fs.existsSync(`${
|
|
106
|
+
if (fs.existsSync(`${workDir}/etc/ssh/sshd_config`)) {
|
|
69
107
|
/**
|
|
70
108
|
* enable/disable SSH root/users password login
|
|
71
109
|
*/
|
|
72
|
-
await exec(`sed -i '/PermitRootLogin/d' ${
|
|
73
|
-
await exec(`sed -i '/PasswordAuthentication/d' ${
|
|
110
|
+
await exec(`sed -i '/PermitRootLogin/d' ${workDir}/etc/ssh/sshd_config`);
|
|
111
|
+
await exec(`sed -i '/PasswordAuthentication/d' ${workDir}/etc/ssh/sshd_config`);
|
|
74
112
|
if (this.settings.config.ssh_pass) {
|
|
75
|
-
await exec(`echo 'PasswordAuthentication yes' | tee -a ${
|
|
113
|
+
await exec(`echo 'PasswordAuthentication yes' | tee -a ${workDir}/etc/ssh/sshd_config`, this.echo);
|
|
76
114
|
}
|
|
77
115
|
else {
|
|
78
|
-
await exec(`echo 'PermitRootLogin prohibit-password' | tee -a ${
|
|
79
|
-
await exec(`echo 'PasswordAuthentication no' | tee -a ${
|
|
116
|
+
await exec(`echo 'PermitRootLogin prohibit-password' | tee -a ${workDir}/etc/ssh/sshd_config`, this.echo);
|
|
117
|
+
await exec(`echo 'PasswordAuthentication no' | tee -a ${workDir}/etc/ssh/sshd_config`, this.echo);
|
|
80
118
|
}
|
|
81
119
|
}
|
|
82
|
-
/**
|
|
83
|
-
* ufw --force reset
|
|
84
|
-
*/
|
|
85
|
-
// if (Pacman.packageIsInstalled('ufw')) {
|
|
86
|
-
// await exec('ufw --force reset')
|
|
87
|
-
// }
|
|
88
120
|
/**
|
|
89
121
|
* /etc/fstab should exist, even if it's empty,
|
|
90
122
|
* to prevent error messages at boot
|
|
91
123
|
*/
|
|
92
|
-
await exec(`rm ${
|
|
93
|
-
await exec(`touch ${
|
|
124
|
+
await exec(`rm ${workDir}/etc/fstab`, this.echo);
|
|
125
|
+
await exec(`touch ${workDir}/etc/fstab`, this.echo);
|
|
94
126
|
/**
|
|
95
127
|
* Remove crypttab if exists
|
|
96
128
|
* this is crucial for tpm systems.
|
|
97
129
|
*/
|
|
98
|
-
if (fs.existsSync(`${
|
|
99
|
-
await exec(`rm ${
|
|
130
|
+
if (fs.existsSync(`${workDir}/etc/crypttab`)) {
|
|
131
|
+
await exec(`rm ${workDir}/etc/crypttab`, this.echo);
|
|
100
132
|
}
|
|
133
|
+
// =========================================================================
|
|
134
|
+
// FIX MACHINE-ID (Il colpevole del blocco SysVinit)
|
|
135
|
+
// =========================================================================
|
|
101
136
|
/**
|
|
102
137
|
* Blank out systemd machine id.
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* set up a new unique ID.
|
|
138
|
+
* SU SYSTEMD: File vuoto = rigenerazione.
|
|
139
|
+
* SU SYSVINIT (Devuan): File NON deve esistere o deve essere 0 bytes.
|
|
106
140
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
await exec(`
|
|
110
|
-
|
|
141
|
+
// 1. Pulisci /etc/machine-id
|
|
142
|
+
if (fs.existsSync(`${workDir}/etc/machine-id`)) {
|
|
143
|
+
await exec(`rm ${workDir}/etc/machine-id`, this.echo);
|
|
144
|
+
// Per Systemd serve il file vuoto per fare il bind mount
|
|
145
|
+
// Per Devuan va bene vuoto (lo riempie dbus-uuidgen)
|
|
146
|
+
await exec(`touch ${workDir}/etc/machine-id`, this.echo);
|
|
147
|
+
}
|
|
148
|
+
// 2. Rimuovi /var/lib/dbus/machine-id
|
|
149
|
+
// Questo è il file "vero" per dbus su sistemi non-systemd.
|
|
150
|
+
// Deve sparire per essere rigenerato al boot.
|
|
151
|
+
if (fs.existsSync(`${workDir}/var/lib/dbus/machine-id`)) {
|
|
152
|
+
await exec(`rm ${workDir}/var/lib/dbus/machine-id`, this.echo);
|
|
111
153
|
}
|
|
154
|
+
// =========================================================================
|
|
112
155
|
/**
|
|
113
156
|
* LMDE4: utilizza UbuntuMono16.pf2
|
|
114
157
|
* aggiungo un link a /boot/grub/fonts/UbuntuMono16.pf2
|
|
115
158
|
*/
|
|
116
|
-
if (fs.existsSync(`${
|
|
117
|
-
shx.cp(`${
|
|
159
|
+
if (fs.existsSync(`${workDir}/boot/grub/fonts/unicode.pf2`)) {
|
|
160
|
+
shx.cp(`${workDir}/boot/grub/fonts/unicode.pf2`, `${workDir}/boot/grub/fonts/UbuntuMono16.pf2`);
|
|
118
161
|
}
|
|
119
162
|
/**
|
|
120
163
|
* cleaning /etc/resolv.conf
|
|
121
164
|
*/
|
|
122
|
-
const resolvFile = `${
|
|
165
|
+
const resolvFile = `${workDir}/etc/resolv.conf`;
|
|
123
166
|
shx.rm(resolvFile);
|
|
124
167
|
/**
|
|
125
168
|
* Per tutte le distro systemd
|
|
@@ -134,27 +177,27 @@ export async function editLiveFs(clone = false) {
|
|
|
134
177
|
* systemctl enable 'systemd-resolved.service
|
|
135
178
|
*/
|
|
136
179
|
if (await systemdctl.isEnabled('remote-cryptsetup.target')) {
|
|
137
|
-
await systemdctl.disable('remote-cryptsetup.target',
|
|
180
|
+
await systemdctl.disable('remote-cryptsetup.target', workDir, true);
|
|
138
181
|
}
|
|
139
182
|
if (await systemdctl.isEnabled('speech-dispatcherd.service')) {
|
|
140
|
-
await systemdctl.disable('speech-dispatcherd.service',
|
|
183
|
+
await systemdctl.disable('speech-dispatcherd.service', workDir, true);
|
|
141
184
|
}
|
|
142
185
|
if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service')) {
|
|
143
|
-
await systemdctl.disable('wpa_supplicant-nl80211@.service',
|
|
186
|
+
await systemdctl.disable('wpa_supplicant-nl80211@.service', workDir, true);
|
|
144
187
|
}
|
|
145
188
|
if (await systemdctl.isEnabled('wpa_supplicant@.service')) {
|
|
146
|
-
await systemdctl.disable('wpa_supplicant@.service',
|
|
189
|
+
await systemdctl.disable('wpa_supplicant@.service', workDir, true);
|
|
147
190
|
}
|
|
148
191
|
if (await systemdctl.isEnabled('wpa_supplicant-wired@.service')) {
|
|
149
|
-
await systemdctl.disable('wpa_supplicant-wired@.service',
|
|
192
|
+
await systemdctl.disable('wpa_supplicant-wired@.service', workDir, true);
|
|
150
193
|
}
|
|
151
194
|
/**
|
|
152
195
|
* All systemd distros
|
|
153
196
|
*/
|
|
154
|
-
await exec(`rm -f ${
|
|
155
|
-
await exec(`rm -f ${
|
|
156
|
-
await exec(`rm -f ${
|
|
157
|
-
await exec(`rm -f ${
|
|
197
|
+
await exec(`rm -f ${workDir}/var/lib/wicd/configurations/*`, this.echo);
|
|
198
|
+
await exec(`rm -f ${workDir}/etc/wicd/wireless-settings.conf`, this.echo);
|
|
199
|
+
await exec(`rm -f ${workDir}/etc/NetworkManager/system-connections/*`, this.echo);
|
|
200
|
+
await exec(`rm -f ${workDir}/etc/network/wifi/*`, this.echo);
|
|
158
201
|
/**
|
|
159
202
|
* removing from /etc/network/:
|
|
160
203
|
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
@@ -162,7 +205,7 @@ export async function editLiveFs(clone = false) {
|
|
|
162
205
|
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
163
206
|
let cleanDir = '';
|
|
164
207
|
for (cleanDir of cleanDirs) {
|
|
165
|
-
await exec(`rm -f ${
|
|
208
|
+
await exec(`rm -f ${workDir}/etc/network/${cleanDir}/wpasupplicant`, this.echo);
|
|
166
209
|
}
|
|
167
210
|
}
|
|
168
211
|
/**
|
|
@@ -170,70 +213,63 @@ export async function editLiveFs(clone = false) {
|
|
|
170
213
|
* and netman, so they aren't stealthily included in the snapshot.
|
|
171
214
|
*/
|
|
172
215
|
if (this.familyId === 'debian') {
|
|
173
|
-
if (fs.existsSync(`${
|
|
174
|
-
await exec(`rm -f ${
|
|
175
|
-
Utils.write(`${
|
|
216
|
+
if (fs.existsSync(`${workDir}/etc/network/interfaces`)) {
|
|
217
|
+
await exec(`rm -f ${workDir}/etc/network/interfaces`, this.echo);
|
|
218
|
+
Utils.write(`${workDir}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
176
219
|
}
|
|
177
220
|
/**
|
|
178
221
|
* add some basic files to /dev
|
|
179
222
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/random`)) {
|
|
196
|
-
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, this.echo);
|
|
197
|
-
}
|
|
198
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/urandom`)) {
|
|
199
|
-
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, this.echo);
|
|
200
|
-
}
|
|
201
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`)) {
|
|
202
|
-
await exec(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, this.echo);
|
|
203
|
-
}
|
|
204
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/fd`)) {
|
|
205
|
-
await exec(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, this.echo);
|
|
206
|
-
}
|
|
207
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdin`)) {
|
|
208
|
-
await exec(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, this.echo);
|
|
209
|
-
}
|
|
210
|
-
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdout`)) {
|
|
211
|
-
await exec(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, this.echo);
|
|
223
|
+
// Ho condensato i controlli ripetitivi su mknod per leggibilità
|
|
224
|
+
// Nota: Questo è safe da eseguire, anche se devtmpfs solitamente gestisce tutto.
|
|
225
|
+
const devNodes = [
|
|
226
|
+
{ path: 'console', m: '622', type: 'c', major: 5, minor: 1 },
|
|
227
|
+
{ path: 'null', m: '666', type: 'c', major: 1, minor: 3 },
|
|
228
|
+
{ path: 'zero', m: '666', type: 'c', major: 1, minor: 5 },
|
|
229
|
+
{ path: 'ptmx', m: '666', type: 'c', major: 5, minor: 2 },
|
|
230
|
+
{ path: 'tty', m: '666', type: 'c', major: 5, minor: 0 },
|
|
231
|
+
{ path: 'random', m: '444', type: 'c', major: 1, minor: 8 },
|
|
232
|
+
{ path: 'urandom', m: '444', type: 'c', major: 1, minor: 9 },
|
|
233
|
+
];
|
|
234
|
+
for (const node of devNodes) {
|
|
235
|
+
if (!fs.existsSync(`${workDir}/dev/${node.path}`)) {
|
|
236
|
+
await exec(`mknod -m ${node.m} ${workDir}/dev/${node.path} ${node.type} ${node.major} ${node.minor}`, this.echo);
|
|
237
|
+
}
|
|
212
238
|
}
|
|
213
|
-
if (!fs.existsSync(`${
|
|
214
|
-
await exec(`
|
|
239
|
+
if (!fs.existsSync(`${workDir}/dev/{console,ptmx,tty}`)) {
|
|
240
|
+
await exec(`chown -v root:tty ${workDir}/dev/{console,ptmx,tty}`, this.echo);
|
|
215
241
|
}
|
|
216
|
-
|
|
217
|
-
|
|
242
|
+
// Link simbolici standard
|
|
243
|
+
const links = [
|
|
244
|
+
{ src: '/proc/self/fd', dest: 'fd' },
|
|
245
|
+
{ src: '/proc/self/fd/0', dest: 'stdin' },
|
|
246
|
+
{ src: '/proc/self/fd/1', dest: 'stdout' },
|
|
247
|
+
{ src: '/proc/self/fd/2', dest: 'stderr' },
|
|
248
|
+
{ src: '/proc/kcore', dest: 'core' }
|
|
249
|
+
];
|
|
250
|
+
for (const link of links) {
|
|
251
|
+
if (!fs.existsSync(`${workDir}/dev/${link.dest}`)) {
|
|
252
|
+
await exec(`ln -sv ${link.src} ${workDir}/dev/${link.dest}`, this.echo);
|
|
253
|
+
}
|
|
218
254
|
}
|
|
219
|
-
if (!fs.existsSync(`${
|
|
220
|
-
await exec(`mkdir -v ${
|
|
255
|
+
if (!fs.existsSync(`${workDir}/dev/shm`)) {
|
|
256
|
+
await exec(`mkdir -v ${workDir}/dev/shm`, this.echo);
|
|
221
257
|
}
|
|
222
|
-
if (!fs.existsSync(`${
|
|
223
|
-
await exec(`mkdir -v ${
|
|
258
|
+
if (!fs.existsSync(`${workDir}/dev/pts`)) {
|
|
259
|
+
await exec(`mkdir -v ${workDir}/dev/pts`, this.echo);
|
|
224
260
|
}
|
|
225
|
-
if (!fs.existsSync(`${
|
|
226
|
-
await exec(`chmod 1777 ${
|
|
261
|
+
if (!fs.existsSync(`${workDir}/dev/shm`)) {
|
|
262
|
+
await exec(`chmod 1777 ${workDir}/dev/shm`, this.echo);
|
|
227
263
|
}
|
|
228
264
|
/**
|
|
229
265
|
* creo /tmp
|
|
230
266
|
*/
|
|
231
|
-
if (!fs.existsSync(`${
|
|
232
|
-
await exec(`mkdir ${
|
|
267
|
+
if (!fs.existsSync(`${workDir}/tmp`)) {
|
|
268
|
+
await exec(`mkdir ${workDir}/tmp`, this.echo);
|
|
233
269
|
}
|
|
234
270
|
/**
|
|
235
271
|
* Assegno 1777 a /tmp creava problemi con MXLINUX
|
|
236
272
|
*/
|
|
237
|
-
await exec(`chmod 1777 ${
|
|
273
|
+
await exec(`chmod 1777 ${workDir}/tmp`, this.echo);
|
|
238
274
|
}
|
|
239
275
|
}
|
|
@@ -25,7 +25,7 @@ export async function fertilization(snapshot_prefix = '', snapshot_basename = ''
|
|
|
25
25
|
this.settings = new Settings();
|
|
26
26
|
if (await this.settings.load()) {
|
|
27
27
|
await this.settings.loadRemix(this.theme);
|
|
28
|
-
this.volid = Utils.
|
|
28
|
+
this.volid = Utils.VolidTrim(this.settings.remix.name);
|
|
29
29
|
this.uuid = Utils.uuidGen();
|
|
30
30
|
//this.familyId = this.settings.distro.familyId
|
|
31
31
|
this.nest = this.settings.config.snapshot_mnt;
|
|
@@ -38,13 +38,9 @@ export async function xorrisoCommand(clone = false, homecrypt = false, fullcrypt
|
|
|
38
38
|
}
|
|
39
39
|
// postfix (data)
|
|
40
40
|
const postfix = Utils.getPostfix();
|
|
41
|
-
console.log('prefix:', prefix);
|
|
42
|
-
console.log('prefix:', this.volid);
|
|
43
|
-
console.log('arch:', Utils.uefiArch());
|
|
44
|
-
console.log('typology:', typology);
|
|
45
41
|
console.log('postfix:', postfix);
|
|
46
42
|
this.settings.isoFilename = prefix + this.volid + '_' + Utils.uefiArch() + typology + postfix;
|
|
47
|
-
|
|
43
|
+
console.log('isoFilename:', this.settings.isoFilename);
|
|
48
44
|
const output = this.settings.config.snapshot_mnt + this.settings.isoFilename;
|
|
49
45
|
let command = '';
|
|
50
46
|
// const appid = `-appid "${this.settings.distro.distroId}" `
|
package/dist/classes/pacman.d.ts
CHANGED
|
@@ -15,10 +15,15 @@ export default class Pacman {
|
|
|
15
15
|
distro: IDistro;
|
|
16
16
|
remix: IRemix;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* autocompleteInstall()
|
|
19
19
|
* @param verbose
|
|
20
20
|
*/
|
|
21
|
-
static autocompleteInstall(
|
|
21
|
+
static autocompleteInstall(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* autocompleteRemove
|
|
24
|
+
* @param verbose
|
|
25
|
+
*/
|
|
26
|
+
static autocompleteRemove(verbose?: boolean): Promise<void>;
|
|
22
27
|
/**
|
|
23
28
|
* return true if calamares is installed
|
|
24
29
|
*/
|
|
@@ -52,14 +57,14 @@ export default class Pacman {
|
|
|
52
57
|
* Creazione del file di configurazione /etc/penguins-eggs
|
|
53
58
|
*/
|
|
54
59
|
static configurationInstall(links?: boolean, verbose?: boolean): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Ritorna vero se machine-id è uguale
|
|
57
|
-
*/
|
|
58
|
-
static configurationMachineNew(verbose?: boolean): Promise<boolean>;
|
|
59
60
|
/**
|
|
60
61
|
* Rimozione dei file di configurazione
|
|
61
62
|
*/
|
|
62
63
|
static configurationRemove(verbose?: boolean): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Ritorna vero se machine-id è uguale
|
|
66
|
+
*/
|
|
67
|
+
static configurationMachineNew(verbose?: boolean): Promise<boolean>;
|
|
63
68
|
/**
|
|
64
69
|
*
|
|
65
70
|
* @returns
|
|
@@ -117,7 +122,11 @@ export default class Pacman {
|
|
|
117
122
|
/**
|
|
118
123
|
* Installa manPage
|
|
119
124
|
*/
|
|
120
|
-
static
|
|
125
|
+
static manpageInstall(): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* manpageRemove
|
|
128
|
+
*/
|
|
129
|
+
static manpageRemove(): Promise<void>;
|
|
121
130
|
/**
|
|
122
131
|
*
|
|
123
132
|
* @param debPackage
|
|
@@ -135,5 +144,10 @@ export default class Pacman {
|
|
|
135
144
|
* @param debPackage
|
|
136
145
|
*/
|
|
137
146
|
static packageIsInstalled(packageName: string): boolean;
|
|
147
|
+
/**
|
|
148
|
+
*
|
|
149
|
+
* @param packageNpm
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
138
152
|
static packageNpmLast(packageNpm?: string): Promise<string>;
|
|
139
153
|
}
|
package/dist/classes/pacman.js
CHANGED
|
@@ -33,19 +33,30 @@ export default class Pacman {
|
|
|
33
33
|
distro = {};
|
|
34
34
|
remix = {};
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* autocompleteInstall()
|
|
37
37
|
* @param verbose
|
|
38
38
|
*/
|
|
39
|
-
static async autocompleteInstall(
|
|
39
|
+
static async autocompleteInstall() {
|
|
40
40
|
if (Pacman.packageIsInstalled('bash-completion')) {
|
|
41
41
|
if (fs.existsSync('/usr/share/bash-completion/completions/')) {
|
|
42
42
|
await exec(`cp ${__dirname}/../../scripts/eggs.bash /usr/share/bash-completion/completions/`);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
}
|
|
45
|
+
// Su arch è ok, su debian God know
|
|
46
|
+
if (Pacman.packageIsInstalled('zsh-completions')) {
|
|
47
|
+
if (fs.existsSync('/usr/share/zsh/site-functions')) {
|
|
48
|
+
await exec(`cp ${__dirname}/../../scripts/_eggs /usr/share/zsh/site-functions/`);
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* autocompleteRemove
|
|
54
|
+
* @param verbose
|
|
55
|
+
*/
|
|
56
|
+
static async autocompleteRemove(verbose = false) {
|
|
57
|
+
await exec(`rm -f /usr/share/bash-completion/completions/eggs.bash`);
|
|
58
|
+
await exec(`rm -f /usr/share/zsh/site-functions/._eggs`);
|
|
59
|
+
}
|
|
49
60
|
/**
|
|
50
61
|
* return true if calamares is installed
|
|
51
62
|
*/
|
|
@@ -139,8 +150,6 @@ export default class Pacman {
|
|
|
139
150
|
*/
|
|
140
151
|
static commandIsInstalled(cmd) {
|
|
141
152
|
let installed = false;
|
|
142
|
-
// if (shx.exec(`command -V ${cmd} &>/dev/null`).code == 0) {
|
|
143
|
-
// remove output
|
|
144
153
|
if (shx.exec(`command -V ${cmd} >/dev/null 2>&1`).code == 0) {
|
|
145
154
|
installed = true;
|
|
146
155
|
}
|
|
@@ -222,7 +231,7 @@ export default class Pacman {
|
|
|
222
231
|
execSync(`rm -rf ${init}`);
|
|
223
232
|
}
|
|
224
233
|
execSync(`mkdir -p ${init}`);
|
|
225
|
-
shx.ln('-s', path.resolve(__dirname, '../../addons'), addons)
|
|
234
|
+
// shx.ln('-s', path.resolve(__dirname, '../../addons'), addons)
|
|
226
235
|
shx.cp(path.resolve(__dirname, '../../conf/README.md'), confRoot);
|
|
227
236
|
shx.cp(path.resolve(__dirname, '../../conf/derivatives.yaml'), confRoot);
|
|
228
237
|
shx.cp(path.resolve(__dirname, '../../conf/derivatives_fedora.yaml'), confRoot);
|
|
@@ -240,6 +249,21 @@ export default class Pacman {
|
|
|
240
249
|
shx.cp(path.resolve(__dirname, '../../conf/exclude.list.d/*'), '/etc/penguins-eggs.d/exclude.list.d');
|
|
241
250
|
await this.configurationFresh();
|
|
242
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Rimozione dei file di configurazione
|
|
254
|
+
*/
|
|
255
|
+
static async configurationRemove(verbose = false) {
|
|
256
|
+
const echo = Utils.setEcho(verbose);
|
|
257
|
+
if (fs.existsSync('/etc/penguins-eggs.d')) {
|
|
258
|
+
await exec('rm /etc/penguins-eggs.d -rf', echo);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* No remove calamares more
|
|
262
|
+
*/
|
|
263
|
+
// if (fs.existsSync('/etc/calamares')) {
|
|
264
|
+
// await exec('rm /etc/calamares -rf', echo)
|
|
265
|
+
// }
|
|
266
|
+
}
|
|
243
267
|
/**
|
|
244
268
|
* Ritorna vero se machine-id è uguale
|
|
245
269
|
*/
|
|
@@ -252,18 +276,6 @@ export default class Pacman {
|
|
|
252
276
|
}
|
|
253
277
|
return result;
|
|
254
278
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Rimozione dei file di configurazione
|
|
257
|
-
*/
|
|
258
|
-
static async configurationRemove(verbose = true) {
|
|
259
|
-
const echo = Utils.setEcho(verbose);
|
|
260
|
-
if (fs.existsSync('/etc/penguins-eggs.d')) {
|
|
261
|
-
await exec('rm /etc/penguins-eggs.d -rf', echo);
|
|
262
|
-
}
|
|
263
|
-
if (fs.existsSync('/etc/calamares')) {
|
|
264
|
-
await exec('rm /etc/calamares -rf', echo);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
279
|
/**
|
|
268
280
|
*
|
|
269
281
|
* @returns
|
|
@@ -591,22 +603,26 @@ export default class Pacman {
|
|
|
591
603
|
/**
|
|
592
604
|
* Installa manPage
|
|
593
605
|
*/
|
|
594
|
-
static async
|
|
595
|
-
const
|
|
596
|
-
if (fs.existsSync(
|
|
597
|
-
const
|
|
598
|
-
if (!fs.existsSync(
|
|
599
|
-
exec(`mkdir ${
|
|
600
|
-
}
|
|
601
|
-
exec(`cp ${manPageSrc} ${manPageDest}`);
|
|
602
|
-
if (shx.exec('which mandb', { silent: true }).stdout.trim() !== '') {
|
|
603
|
-
await exec('mandb > /dev/null');
|
|
604
|
-
if (verbose) {
|
|
605
|
-
console.log('manPage eggs installed...');
|
|
606
|
-
}
|
|
606
|
+
static async manpageInstall() {
|
|
607
|
+
const manpageSrc = path.resolve(__dirname, '../../manpages/doc/man/eggs.1.gz');
|
|
608
|
+
if (fs.existsSync(manpageSrc)) {
|
|
609
|
+
const manpageDest = `/usr/share/man/man1`;
|
|
610
|
+
if (!fs.existsSync(manpageDest)) {
|
|
611
|
+
await exec(`mkdir ${manpageDest} -p`);
|
|
607
612
|
}
|
|
613
|
+
await exec(`cp ${manpageSrc} ${manpageDest}`);
|
|
614
|
+
// if (shx.exec('which mandb', { silent: true }).stdout.trim() !== '') {
|
|
615
|
+
// await exec('mandb > /dev/null')
|
|
616
|
+
// }
|
|
608
617
|
}
|
|
609
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* manpageRemove
|
|
621
|
+
*/
|
|
622
|
+
static async manpageRemove() {
|
|
623
|
+
const manpageEggs = `/usr/share/man/man1/eggs.1.gz`;
|
|
624
|
+
await exec(`rm -rf ${manpageEggs}`);
|
|
625
|
+
}
|
|
610
626
|
/**
|
|
611
627
|
*
|
|
612
628
|
* @param debPackage
|
|
@@ -674,6 +690,11 @@ export default class Pacman {
|
|
|
674
690
|
}
|
|
675
691
|
return installed;
|
|
676
692
|
}
|
|
693
|
+
/**
|
|
694
|
+
*
|
|
695
|
+
* @param packageNpm
|
|
696
|
+
* @returns
|
|
697
|
+
*/
|
|
677
698
|
static async packageNpmLast(packageNpm = 'penguins-eggs') {
|
|
678
699
|
return shx.exec('npm show ' + packageNpm + ' version', { silent: true }).stdout.trim();
|
|
679
700
|
}
|
package/dist/classes/utils.d.ts
CHANGED
|
@@ -140,7 +140,7 @@ export default class Utils {
|
|
|
140
140
|
*
|
|
141
141
|
* @param volid
|
|
142
142
|
*/
|
|
143
|
-
static
|
|
143
|
+
static VolidTrim(volid?: string): string;
|
|
144
144
|
/**
|
|
145
145
|
* Return postfix
|
|
146
146
|
* @param basename
|
|
@@ -247,10 +247,6 @@ export default class Utils {
|
|
|
247
247
|
* cidr
|
|
248
248
|
*/
|
|
249
249
|
static cidr(): string;
|
|
250
|
-
/**
|
|
251
|
-
*
|
|
252
|
-
* broadcast
|
|
253
|
-
*/
|
|
254
250
|
static broadcast(): string;
|
|
255
251
|
/**
|
|
256
252
|
* dns
|
package/dist/classes/utils.js
CHANGED
|
@@ -15,8 +15,8 @@ import os from 'os';
|
|
|
15
15
|
import inquirer from 'inquirer';
|
|
16
16
|
import { execSync, spawnSync } from 'child_process';
|
|
17
17
|
import chalk from 'chalk';
|
|
18
|
-
import { Netmask } from 'netmask';
|
|
19
18
|
import Kernel from './utils.d/kernel.js';
|
|
19
|
+
// libraries
|
|
20
20
|
import Distro from './distro.js';
|
|
21
21
|
// pjson
|
|
22
22
|
import { createRequire } from 'module';
|
|
@@ -403,7 +403,7 @@ export default class Utils {
|
|
|
403
403
|
*
|
|
404
404
|
* @param volid
|
|
405
405
|
*/
|
|
406
|
-
static
|
|
406
|
+
static VolidTrim(volid = 'unknown') {
|
|
407
407
|
// // 28 + 4 .iso = 32 lunghezza max di volid
|
|
408
408
|
if (volid.length >= 32) {
|
|
409
409
|
volid = volid.substring(0, 32);
|
|
@@ -714,13 +714,16 @@ export default class Utils {
|
|
|
714
714
|
}
|
|
715
715
|
return cidr;
|
|
716
716
|
}
|
|
717
|
-
/**
|
|
718
|
-
*
|
|
719
|
-
* broadcast
|
|
720
|
-
*/
|
|
721
717
|
static broadcast() {
|
|
722
|
-
|
|
723
|
-
|
|
718
|
+
const netmask = Utils.netmask();
|
|
719
|
+
const ip = Utils.address();
|
|
720
|
+
const ipParts = ip.split('.').map(Number);
|
|
721
|
+
const maskParts = netmask.split('.').map(Number);
|
|
722
|
+
const broadcastParts = ipParts.map((part, index) => {
|
|
723
|
+
// Bitwise OR tra il blocco IP e il blocco Netmask invertito (255 - mask)
|
|
724
|
+
return part | (255 - maskParts[index]);
|
|
725
|
+
});
|
|
726
|
+
return broadcastParts.join('.');
|
|
724
727
|
}
|
|
725
728
|
/**
|
|
726
729
|
* dns
|
|
@@ -877,13 +880,13 @@ export default class Utils {
|
|
|
877
880
|
*/
|
|
878
881
|
static flag() {
|
|
879
882
|
let type = '';
|
|
880
|
-
if (Utils.isAppImage()) {
|
|
881
|
-
type = '
|
|
883
|
+
if (!Utils.isAppImage()) {
|
|
884
|
+
type = 'native';
|
|
882
885
|
}
|
|
883
886
|
let title = `${pjson.name}`;
|
|
884
|
-
let green = ` ${
|
|
887
|
+
let green = ` ${title}`.padEnd(25, " ");
|
|
885
888
|
let white = ` Perri's brewery edition `.padEnd(25, " ");
|
|
886
|
-
let red = ` v${pjson.version} `.padStart(25, " ");
|
|
889
|
+
let red = ` v${pjson.version} ${type} `.padStart(25, " ");
|
|
887
890
|
return chalk.bgGreen.whiteBright(green) +
|
|
888
891
|
chalk.bgWhite.blue(white) +
|
|
889
892
|
chalk.bgRed.whiteBright(red);
|