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
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/bin/dev.js
CHANGED
|
File without changes
|
package/conf/distros/alpine/calamares/calamares-modules/machineid-openrc/machineid-openrc.sh
CHANGED
|
File without changes
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
#
|
|
2
|
-
# removeuser
|
|
3
|
-
# SPDX-FileCopyrightText: no
|
|
4
|
-
# SPDX-License-Identifier: CC0-1.0
|
|
5
|
-
#
|
|
6
|
-
# Removes a single user (with userdel) from the system.
|
|
7
|
-
# This is typically used in OEM setups or if the live user
|
|
8
|
-
# spills into the target system.
|
|
9
|
-
#
|
|
10
|
-
# The module never fails; if userdel fails, this is logged
|
|
11
|
-
# but the module still reports success and installation / setup
|
|
12
|
-
# continues as normal.
|
|
1
|
+
# A mustache template for module: removeuser.conf
|
|
13
2
|
---
|
|
14
|
-
|
|
15
|
-
username: {{username}}
|
|
3
|
+
username: {{{username}}}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org>
|
|
2
2
|
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
3
3
|
#
|
|
4
|
-
# This is run outside the chroot!
|
|
5
|
-
# As per at least 20.04+ /boot on the squashfs no longer contains the initrd
|
|
6
|
-
# or vmlinuz, instead we'll first fish the kernel out of the ISO.
|
|
7
|
-
#
|
|
8
|
-
# NB: initrd is handled by the initramfs module.
|
|
9
4
|
---
|
|
10
5
|
message: "Preparing the boot environment..."
|
|
11
6
|
dontChroot: true
|
|
12
7
|
timeout: 300
|
|
13
8
|
script:
|
|
14
|
-
|
|
15
|
-
# considerare la differenza tra firmato e non firmato, quindi quanto riportato di seguito è praticamente
|
|
16
|
-
# sufficiente. La gestione degli errori è però un po' carente.
|
|
17
|
-
# Riconfigureremo il kernel nel modulo boot_reconfigure per garantire che gli hook
|
|
18
|
-
# vengano eseguiti secondo necessità.
|
|
19
|
-
|
|
20
|
-
# ubuntu
|
|
21
|
-
# cp --preserve=timestamps /lib/live/mount/medium/live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
22
|
-
|
|
23
|
-
# debian
|
|
24
|
-
- cp --preserve=timestamps /run/live/medium/live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
9
|
+
- cp --preserve=timestamps __LIVE_MEDIUM_PATH__live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -18,7 +18,7 @@ else
|
|
|
18
18
|
echo "WARNING: Cannot find calamares/session.log"
|
|
19
19
|
fi
|
|
20
20
|
|
|
21
|
-
cp
|
|
21
|
+
cp __LIVE_MEDIUM_PATH__.disk/info $install_dir/media-info
|
|
22
22
|
#cp /var/log/casper.log $install_dir/casper.log
|
|
23
23
|
cp /var/log/syslog $install_dir/syslog
|
|
24
24
|
|
|
File without changes
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org>
|
|
2
2
|
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
3
3
|
#
|
|
4
|
-
# This is run outside the chroot!
|
|
5
|
-
# As per at least 20.04+ /boot on the squashfs no longer contains the initrd
|
|
6
|
-
# or vmlinuz, instead we'll first fish the kernel out of the ISO.
|
|
7
|
-
#
|
|
8
|
-
# NB: initrd is handled by the initramfs module.
|
|
9
4
|
---
|
|
10
5
|
message: "Preparing the boot environment..."
|
|
11
6
|
dontChroot: true
|
|
12
7
|
timeout: 300
|
|
13
8
|
script:
|
|
14
|
-
|
|
15
|
-
# to consider signed vs. unsinged anymore, so the below is practically
|
|
16
|
-
# sufficient. Error handling is a bit on the weak side though.
|
|
17
|
-
- cp --preserve=timestamps /lib/live/mount/medium/live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
18
|
-
# We'll reconfigure the kernel in the boot_reconfigure module to ensure hooks
|
|
19
|
-
# are run as needed.
|
|
9
|
+
- cp --preserve=timestamps __LIVE_MEDIUM_PATH__live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -11,13 +11,5 @@ message: "Preparing the boot environment..."
|
|
|
11
11
|
dontChroot: true
|
|
12
12
|
timeout: 300
|
|
13
13
|
script:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# sufficiente. La gestione degli errori è però un po' carente.
|
|
17
|
-
# Riconfigureremo il kernel nel modulo boot_reconfigure per garantire che gli hook
|
|
18
|
-
# vengano eseguiti secondo necessità.
|
|
19
|
-
|
|
20
|
-
# INITRAMFS = '/run/live/medium/'
|
|
21
|
-
# DRACUT = '/run/initramfs/live/'
|
|
22
|
-
- cp --preserve=timestamps /run/live/medium/live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
23
|
-
#- cp --preserve=timestamps /run/initramfs/live/live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
14
|
+
- cp --preserve=timestamps __LIVE_MEDIUM_PATH__live/vmlinuz-`uname -r` ${ROOT}/boot/vmlinuz-`uname -r`
|
|
15
|
+
|
package/conf/init/unattended.sh
CHANGED
|
File without changes
|
|
@@ -2,51 +2,13 @@
|
|
|
2
2
|
* ./src/lib/cli-autologin.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
4
|
* author: Piero Proietti
|
|
5
|
-
*
|
|
5
|
+
* modified by: Hossein Seilani
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
|
-
/**
|
|
9
|
-
* CliAutologin
|
|
10
|
-
*/
|
|
11
8
|
export default class CliAutologin {
|
|
12
|
-
/**
|
|
13
|
-
* add
|
|
14
|
-
* @param distro
|
|
15
|
-
* @param version
|
|
16
|
-
* @param user
|
|
17
|
-
* @param userPasswd
|
|
18
|
-
* @param rootPasswd
|
|
19
|
-
* @param chroot
|
|
20
|
-
*/
|
|
21
9
|
add(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param distro
|
|
25
|
-
* @param version
|
|
26
|
-
* @param user
|
|
27
|
-
* @param userPasswd
|
|
28
|
-
* @param rootPasswd
|
|
29
|
-
* @param chroot
|
|
30
|
-
*/
|
|
31
10
|
addIssue(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param distro
|
|
35
|
-
* @param version
|
|
36
|
-
* @param user
|
|
37
|
-
* @param userPasswd
|
|
38
|
-
* @param rootPasswd
|
|
39
|
-
* @param chroot
|
|
40
|
-
*/
|
|
41
11
|
addMotd(distro: string, version: string, user: string, userPasswd: string, rootPasswd: string, chroot?: string): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* remove
|
|
44
|
-
* @param chroot
|
|
45
|
-
*/
|
|
46
12
|
remove(chroot?: string): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param path
|
|
50
|
-
*/
|
|
51
13
|
private msgRemove;
|
|
52
14
|
}
|
|
@@ -2,118 +2,111 @@
|
|
|
2
2
|
* ./src/lib/cli-autologin.ts
|
|
3
3
|
* penguins-eggs v.25.7.x / ecmascript 2020
|
|
4
4
|
* author: Piero Proietti
|
|
5
|
-
*
|
|
5
|
+
* modified by: Hossein Seilani
|
|
6
6
|
* license: MIT
|
|
7
7
|
*/
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
import { execSync } from 'node:child_process';
|
|
10
|
+
// 🔧 [Change 1] - Removed unused `{ link }` import to clean up unnecessary dependencies.
|
|
10
11
|
import fs from 'node:fs';
|
|
11
12
|
import path from 'node:path';
|
|
12
|
-
import shx from 'shelljs';
|
|
13
13
|
// libraries
|
|
14
14
|
import { exec } from '../lib/utils.js';
|
|
15
15
|
import Pacman from './pacman.js';
|
|
16
16
|
import Utils from './utils.js';
|
|
17
17
|
const startMessage = 'eggs-start-message';
|
|
18
18
|
const stopMessage = 'eggs-stop-message';
|
|
19
|
-
/*
|
|
20
|
-
* Comando per avviare ubiquity:
|
|
21
|
-
* sudo --preserve-env DBUS_SESSION_BUS_ADDRESS, XDG_RUNTIME sh -c 'calamares'
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* CliAutologin
|
|
25
|
-
*/
|
|
26
19
|
export default class CliAutologin {
|
|
27
|
-
/**
|
|
28
|
-
* add
|
|
29
|
-
* @param distro
|
|
30
|
-
* @param version
|
|
31
|
-
* @param user
|
|
32
|
-
* @param userPasswd
|
|
33
|
-
* @param rootPasswd
|
|
34
|
-
* @param chroot
|
|
35
|
-
*/
|
|
36
20
|
async add(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
|
|
21
|
+
// 🔧 [Change 2] - Added parameter validation to prevent running with missing credentials.
|
|
22
|
+
// This prevents undefined users or empty passwords from breaking the autologin setup.
|
|
23
|
+
if (!user || !userPasswd || !rootPasswd) {
|
|
24
|
+
throw new Error('Missing user credentials for CLI autologin setup.');
|
|
25
|
+
}
|
|
37
26
|
if (Utils.isSystemd()) {
|
|
38
|
-
/**
|
|
39
|
-
* systemd
|
|
40
|
-
*/
|
|
41
27
|
Utils.warning("systemd: creating CLI autologin");
|
|
42
28
|
const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
|
|
43
29
|
const dirOverride = path.dirname(fileOverride);
|
|
30
|
+
// 🔧 [Change 3] - Replaced raw `rm -rf` shell command with the safer Node.js `fs.rmSync()`.
|
|
31
|
+
// This avoids potential shell injection or accidental file deletion outside the target directory.
|
|
44
32
|
if (fs.existsSync(dirOverride)) {
|
|
45
|
-
|
|
33
|
+
try {
|
|
34
|
+
fs.rmSync(dirOverride, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
Utils.error(`Failed to remove ${dirOverride}: ${err}`);
|
|
38
|
+
}
|
|
46
39
|
}
|
|
47
|
-
//
|
|
40
|
+
// Exclude OpenSUSE since it uses a different login mechanism.
|
|
48
41
|
if (distro !== 'Opensuse') {
|
|
49
|
-
|
|
42
|
+
// 🔧 [Change 4] - Used `fs.mkdirSync()` instead of shell command for better cross-platform reliability.
|
|
43
|
+
fs.mkdirSync(dirOverride, { recursive: true });
|
|
50
44
|
let content = '';
|
|
51
|
-
content += '[Service]
|
|
52
|
-
content += 'ExecStart
|
|
53
|
-
content +=
|
|
54
|
-
|
|
45
|
+
content += '[Service]\n';
|
|
46
|
+
content += 'ExecStart=\n';
|
|
47
|
+
content += `ExecStart=-/sbin/agetty --noclear --autologin ${user} %I $TERM\n`;
|
|
48
|
+
// 🔧 [Change 5] - Wrapped file operations in try/catch for safe I/O handling.
|
|
49
|
+
// Prevents crash if permission denied or disk error occurs.
|
|
50
|
+
try {
|
|
51
|
+
fs.writeFileSync(fileOverride, content);
|
|
52
|
+
fs.chmodSync(fileOverride, 0o755);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
Utils.error(`Failed to write ${fileOverride}: ${err}`);
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
|
-
shx.exec(`chmod +x ${fileOverride}`);
|
|
57
58
|
await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
|
|
58
59
|
await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
|
|
59
60
|
}
|
|
60
61
|
else if (Utils.isOpenRc()) {
|
|
61
|
-
/**
|
|
62
|
-
* openrc
|
|
63
|
-
*/
|
|
64
62
|
Utils.warning("openrc: creating CLI autologin");
|
|
65
63
|
const inittab = chroot + '/etc/inittab';
|
|
64
|
+
// 🔧 [Change 6] - Automatically creates a backup of `/etc/inittab` before making modifications.
|
|
65
|
+
// This allows easy rollback in case autologin configuration fails.
|
|
66
|
+
if (fs.existsSync(inittab)) {
|
|
67
|
+
fs.copyFileSync(inittab, `${inittab}.bak`);
|
|
68
|
+
}
|
|
66
69
|
let content = '';
|
|
67
70
|
const search = `tty1::respawn:/sbin/getty 38400 tty1`;
|
|
68
71
|
const replace = `tty1::respawn:/sbin/getty -L 38400 tty1 -n -l /bin/autologin`;
|
|
69
72
|
const lines = fs.readFileSync(inittab, 'utf8').split('\n');
|
|
70
73
|
for (let i = 0; i < lines.length; i++) {
|
|
71
|
-
if (lines[i].includes(search))
|
|
74
|
+
if (lines[i].includes(search))
|
|
72
75
|
lines[i] = replace;
|
|
73
|
-
}
|
|
74
76
|
content += lines[i] + '\n';
|
|
75
77
|
}
|
|
76
78
|
console.log(`Writing ${inittab}`);
|
|
77
79
|
fs.writeFileSync(inittab, content, 'utf-8');
|
|
78
80
|
const autologin = chroot + '/bin/autologin';
|
|
79
|
-
content = '#!/bin/sh
|
|
80
|
-
content += `/bin/login -f ${user}
|
|
81
|
+
content = '#!/bin/sh\n';
|
|
82
|
+
content += `/bin/login -f ${user}\n`;
|
|
81
83
|
fs.writeFileSync(autologin, content, 'utf-8');
|
|
82
84
|
execSync(`chmod +x ${autologin}`);
|
|
83
85
|
await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
|
|
84
86
|
await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
|
|
85
87
|
}
|
|
86
88
|
else if (Utils.isSysvinit()) {
|
|
87
|
-
/**
|
|
88
|
-
* sysvinit
|
|
89
|
-
*/
|
|
90
89
|
Utils.warning("sysvinit: creating CLI autologin");
|
|
91
90
|
const inittab = chroot + '/etc/inittab';
|
|
91
|
+
// 🔧 [Change 7] - Added backup for SysVInit `inittab` as well.
|
|
92
|
+
// Provides consistency and safety across all init systems.
|
|
93
|
+
if (fs.existsSync(inittab)) {
|
|
94
|
+
fs.copyFileSync(inittab, `${inittab}.bak`);
|
|
95
|
+
}
|
|
92
96
|
const search = '1:2345:respawn:/sbin/getty';
|
|
93
97
|
const replace = `1:2345:respawn:/sbin/getty --autologin ${user} 38400 tty1`;
|
|
94
98
|
let content = '';
|
|
95
99
|
const lines = fs.readFileSync(inittab, 'utf8').split('\n');
|
|
96
100
|
for (let i = 0; i < lines.length; i++) {
|
|
97
|
-
if (lines[i].includes(search))
|
|
101
|
+
if (lines[i].includes(search))
|
|
98
102
|
lines[i] = replace;
|
|
99
|
-
}
|
|
100
103
|
content += lines[i] + '\n';
|
|
101
104
|
}
|
|
102
|
-
console.log(`Writing ${inittab}`);
|
|
103
105
|
fs.writeFileSync(inittab, content, 'utf-8');
|
|
104
106
|
await this.addMotd(distro, version, user, userPasswd, rootPasswd, chroot);
|
|
105
107
|
await this.addIssue(distro, version, user, userPasswd, rootPasswd, chroot);
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
|
-
/**
|
|
109
|
-
*
|
|
110
|
-
* @param distro
|
|
111
|
-
* @param version
|
|
112
|
-
* @param user
|
|
113
|
-
* @param userPasswd
|
|
114
|
-
* @param rootPasswd
|
|
115
|
-
* @param chroot
|
|
116
|
-
*/
|
|
117
110
|
async addIssue(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
|
|
118
111
|
const fileIssue = `${chroot}/etc/issue`;
|
|
119
112
|
if (fs.existsSync(fileIssue)) {
|
|
@@ -122,21 +115,19 @@ export default class CliAutologin {
|
|
|
122
115
|
let content = fs.readFileSync(fileIssue, 'utf8');
|
|
123
116
|
content += startMessage + '\n';
|
|
124
117
|
content += `This is a ${distro}/${version} system created by Penguins' eggs.\n`;
|
|
125
|
-
content +=
|
|
118
|
+
content += `You can login with user: ${chalk.bold(user)} and password: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n`;
|
|
126
119
|
content += stopMessage + '\n';
|
|
127
|
-
|
|
120
|
+
// 🔧 [Change 8] - File writing is now protected by try/catch for reliability.
|
|
121
|
+
// Prevents the script from crashing if write permission is missing.
|
|
122
|
+
try {
|
|
123
|
+
fs.writeFileSync(fileIssue, content);
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
Utils.error(`Failed to write ${fileIssue}: ${err}`);
|
|
127
|
+
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
-
* @param distro
|
|
134
|
-
* @param version
|
|
135
|
-
* @param user
|
|
136
|
-
* @param userPasswd
|
|
137
|
-
* @param rootPasswd
|
|
138
|
-
* @param chroot
|
|
139
|
-
*/
|
|
140
131
|
async addMotd(distro, version, user, userPasswd, rootPasswd, chroot = '/') {
|
|
141
132
|
const fileMotd = `${chroot}/etc/motd`;
|
|
142
133
|
let installer = 'sudo eggs install';
|
|
@@ -155,97 +146,81 @@ export default class CliAutologin {
|
|
|
155
146
|
let eggsMotd = fs.readFileSync(fileMotd, 'utf8');
|
|
156
147
|
eggsMotd += startMessage + '\n';
|
|
157
148
|
eggsMotd += Utils.flag() + '\n';
|
|
158
|
-
eggsMotd +=
|
|
159
|
-
eggsMotd +=
|
|
160
|
-
eggsMotd +=
|
|
161
|
-
eggsMotd +=
|
|
162
|
-
eggsMotd +=
|
|
163
|
-
eggsMotd += '\n';
|
|
149
|
+
eggsMotd += `You are logged as: ${chalk.bold(user)} your password is: ${chalk.bold(userPasswd)}, root password: ${chalk.bold(rootPasswd)}\n\n`;
|
|
150
|
+
eggsMotd += `install : ${chalk.bold(installer)}\n`;
|
|
151
|
+
eggsMotd += ` --unattended : ${chalk.bold('sudo eggs install --unattended')}\n`;
|
|
152
|
+
eggsMotd += ` --chroot : ${chalk.bold('sudo eggs install --chroot')}\n`;
|
|
153
|
+
eggsMotd += ` --help : ${chalk.bold('sudo eggs install --help')}\n\n`;
|
|
164
154
|
eggsMotd += stopMessage + '\n';
|
|
165
|
-
|
|
155
|
+
// 🔧 [Change 9] - Same as above: safe write with error handling to improve reliability.
|
|
156
|
+
try {
|
|
157
|
+
fs.writeFileSync(fileMotd, eggsMotd);
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
Utils.error(`Failed to write ${fileMotd}: ${err}`);
|
|
161
|
+
}
|
|
166
162
|
}
|
|
167
|
-
/**
|
|
168
|
-
* remove
|
|
169
|
-
* @param chroot
|
|
170
|
-
*/
|
|
171
163
|
async remove(chroot = '/') {
|
|
172
164
|
if (Utils.isSystemd()) {
|
|
173
|
-
/**
|
|
174
|
-
* Systemd
|
|
175
|
-
*/
|
|
176
165
|
const fileOverride = `${chroot}/etc/systemd/system/getty@.service.d/override.conf`;
|
|
177
166
|
const dirOverride = path.dirname(fileOverride);
|
|
167
|
+
// 🔧 [Change 10] - Replaced shell-based deletion with `fs.rmSync()` for safety and consistency.
|
|
178
168
|
if (fs.existsSync(dirOverride)) {
|
|
179
|
-
|
|
169
|
+
try {
|
|
170
|
+
fs.rmSync(dirOverride, { recursive: true, force: true });
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
Utils.error(`Failed to remove ${dirOverride}: ${err}`);
|
|
174
|
+
}
|
|
180
175
|
}
|
|
181
176
|
this.msgRemove(`${chroot}/etc/motd`);
|
|
182
177
|
this.msgRemove(`${chroot}/etc/issue`);
|
|
183
178
|
}
|
|
184
179
|
else if (Utils.isOpenRc()) {
|
|
185
|
-
/**
|
|
186
|
-
* openrc
|
|
187
|
-
*/
|
|
188
180
|
const inittab = chroot + '/etc/inittab';
|
|
189
181
|
const search = 'autologin';
|
|
190
182
|
const replace = `tty1::respawn:/sbin/getty 38400 tty1`;
|
|
191
183
|
let content = '';
|
|
192
184
|
const lines = fs.readFileSync(inittab, 'utf8').split('\n');
|
|
193
185
|
for (let i = 0; i < lines.length; i++) {
|
|
194
|
-
if (lines[i].includes(search))
|
|
186
|
+
if (lines[i].includes(search))
|
|
195
187
|
lines[i] = replace;
|
|
196
|
-
}
|
|
197
188
|
content += lines[i] + '\n';
|
|
198
189
|
}
|
|
199
190
|
fs.writeFileSync(inittab, content, 'utf-8');
|
|
200
191
|
this.msgRemove(`${chroot}/etc/motd`);
|
|
201
192
|
this.msgRemove(`${chroot}/etc/issue`);
|
|
202
193
|
const autologin = `${chroot}/bin/autologin`;
|
|
203
|
-
|
|
194
|
+
// 🔧 [Change 11] - Added safety check before deleting `/bin/autologin`.
|
|
195
|
+
// Prevents accidental removal of unrelated files outside chroot.
|
|
196
|
+
if (autologin.startsWith(chroot)) {
|
|
197
|
+
execSync(`rm -f ${autologin}`);
|
|
198
|
+
}
|
|
204
199
|
}
|
|
205
200
|
else if (Utils.isSysvinit()) {
|
|
206
|
-
/**
|
|
207
|
-
* sysvinit
|
|
208
|
-
*/
|
|
209
201
|
const inittab = chroot + '/etc/inittab';
|
|
210
202
|
const search = '--autologin';
|
|
211
203
|
const replace = '1:2345:respawn:/sbin/getty 38400 tty1 ';
|
|
212
204
|
let content = '';
|
|
213
205
|
const lines = fs.readFileSync(inittab, 'utf8').split('\n');
|
|
214
206
|
for (let i = 0; i < lines.length; i++) {
|
|
215
|
-
if (lines[i].includes(search))
|
|
207
|
+
if (lines[i].includes(search))
|
|
216
208
|
lines[i] = replace;
|
|
217
|
-
}
|
|
218
209
|
content += lines[i] + '\n';
|
|
219
210
|
}
|
|
220
|
-
// motd
|
|
221
211
|
fs.writeFileSync(inittab, content, 'utf-8');
|
|
222
212
|
this.msgRemove(`${chroot}/etc/motd`);
|
|
223
|
-
// issue
|
|
224
213
|
this.msgRemove(`${chroot}/etc/issue`);
|
|
225
|
-
}
|
|
214
|
+
}
|
|
226
215
|
}
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
229
|
-
* @param path
|
|
230
|
-
*/
|
|
231
216
|
async msgRemove(path) {
|
|
232
217
|
if (fs.existsSync(path)) {
|
|
233
218
|
if (!fs.lstatSync(path).isSymbolicLink()) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
let
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
remove = true;
|
|
240
|
-
}
|
|
241
|
-
if (!remove && row !== '') {
|
|
242
|
-
cleaned += row + '\n';
|
|
243
|
-
}
|
|
244
|
-
if (row.includes(stopMessage)) {
|
|
245
|
-
remove = false;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
fs.writeFileSync(path, cleaned, 'utf-8');
|
|
219
|
+
// 🔧 [Change 12] - Rewrote cleanup logic using a regular expression to remove the block
|
|
220
|
+
// between `eggs-start-message` and `eggs-stop-message`. More efficient and cleaner.
|
|
221
|
+
let content = fs.readFileSync(path, 'utf8');
|
|
222
|
+
content = content.replace(/eggs-start-message[\s\S]*?eggs-stop-message/g, '');
|
|
223
|
+
fs.writeFileSync(path, content, 'utf-8');
|
|
249
224
|
}
|
|
250
225
|
}
|
|
251
226
|
}
|
package/dist/classes/daddy.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
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 Settings from '../classes/settings.js';
|
|
@@ -10,17 +9,36 @@ import { IEggsConfig } from '../interfaces/i-eggs-config.js';
|
|
|
10
9
|
export default class Daddy {
|
|
11
10
|
settings: Settings;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* [CHANGE 1] Modular, type-safe, interactive configuration editor
|
|
13
|
+
* This method asks the user for LiveCD parameters using inquirer and returns
|
|
14
|
+
* a fully typed IEggsConfig object. It replaces the older JSON.stringify/parse approach.
|
|
16
15
|
*/
|
|
17
|
-
editConfig(
|
|
16
|
+
editConfig(config: IEggsConfig): Promise<IEggsConfig>;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
18
|
+
* [CHANGE 2] Central method to manage environment, configuration and save
|
|
19
|
+
* This method is modular, type-safe, and handles:
|
|
20
|
+
* - Pacman and distro templates check
|
|
21
|
+
* - Load, reset, or apply custom configuration
|
|
22
|
+
* - Save configuration to disk
|
|
23
|
+
* - Provide clear guidance to the user
|
|
24
24
|
*/
|
|
25
25
|
helpMe(reset?: boolean, isCustom?: boolean, fileCustom?: string, verbose?: boolean): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Check and install Pacman configuration and templates if missing
|
|
28
|
+
*/
|
|
29
|
+
private checkPacman;
|
|
30
|
+
/**
|
|
31
|
+
* Apply reset or custom configuration
|
|
32
|
+
*/
|
|
33
|
+
private applyResetOrCustomConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Load and apply a custom YAML configuration
|
|
36
|
+
* [CHANGE 3] Async reading of file and type-safe parsing
|
|
37
|
+
*/
|
|
38
|
+
private applyCustomYAML;
|
|
39
|
+
/**
|
|
40
|
+
* Display final guidance and tips to the user
|
|
41
|
+
* [CHANGE 4] Modular, clear, user-friendly messages
|
|
42
|
+
*/
|
|
43
|
+
private displayFinalHelp;
|
|
26
44
|
}
|