penguins-eggs 10.0.57 → 10.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +8 -1
- package/README.md +35 -34
- package/addons/eggs/theme/livecd/grub.main.full.cfg +0 -6
- package/assets/config.cfg +30 -0
- package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +8 -1
- package/conf/distros/buster/calamares/modules/partition.yml +159 -23
- package/conf/distros/buster/calamares/modules/removeuser.yml +1 -1
- package/conf/exclude.list.d/master.list +1 -0
- package/conf/krill.yaml +8 -0
- package/dist/classes/distro.js +1 -1
- package/dist/classes/incubation/incubator.d/alpine.js +1 -1
- package/dist/classes/incubation/incubator.d/bionic.js +1 -1
- package/dist/classes/incubation/incubator.d/buster.js +1 -1
- package/dist/classes/incubation/incubator.d/noble.js +1 -1
- package/dist/classes/incubation/incubator.d/openmamba.js +1 -1
- package/dist/classes/incubation/incubator.d/opensuse.js +1 -1
- package/dist/classes/incubation/incubator.d/rolling.js +1 -1
- package/dist/classes/ovary.d/bind-live-fs.d.ts +18 -0
- package/dist/classes/ovary.d/bind-live-fs.js +185 -0
- package/dist/classes/ovary.d/bind-vfs.d.ts +17 -0
- package/dist/classes/ovary.d/bind-vfs.js +37 -0
- package/dist/classes/ovary.d/create-xdg-autostart.d.ts +13 -0
- package/dist/classes/ovary.d/create-xdg-autostart.js +194 -0
- package/dist/classes/ovary.d/edit-live-fs.d.ts +19 -0
- package/dist/classes/ovary.d/edit-live-fs.js +249 -0
- package/dist/classes/ovary.d/fertilization.d.ts +12 -0
- package/dist/classes/ovary.d/fertilization.js +46 -0
- package/dist/classes/ovary.d/finished.d.ts +13 -0
- package/dist/classes/ovary.d/finished.js +41 -0
- package/dist/classes/ovary.d/initrd.d.ts +21 -0
- package/dist/classes/ovary.d/initrd.js +72 -0
- package/dist/classes/ovary.d/kernel-copy.d.ts +12 -0
- package/dist/classes/ovary.d/kernel-copy.js +36 -0
- package/dist/classes/ovary.d/live-create-structure.d.ts +12 -0
- package/dist/classes/ovary.d/live-create-structure.js +90 -0
- package/dist/classes/ovary.d/make-dot-disk.d.ts +12 -0
- package/dist/classes/ovary.d/make-dot-disk.js +40 -0
- package/dist/classes/ovary.d/make-efi.d.ts +12 -0
- package/dist/classes/ovary.d/make-efi.js +268 -0
- package/dist/classes/ovary.d/make-iso.d.ts +13 -0
- package/dist/classes/ovary.d/make-iso.js +45 -0
- package/dist/classes/ovary.d/make-squashfs.d.ts +18 -0
- package/dist/classes/ovary.d/make-squashfs.js +117 -0
- package/dist/classes/ovary.d/merged.d.ts +31 -0
- package/dist/classes/ovary.d/merged.js +87 -0
- package/dist/classes/ovary.d/produce.d.ts +23 -0
- package/dist/classes/ovary.d/produce.js +287 -0
- package/dist/classes/ovary.d/rexec.d.ts +13 -0
- package/dist/classes/ovary.d/rexec.js +34 -0
- package/dist/classes/ovary.d/syslinux.d.ts +12 -0
- package/dist/classes/ovary.d/syslinux.js +79 -0
- package/dist/classes/ovary.d/user-create-live.d.ts +14 -0
- package/dist/classes/ovary.d/user-create-live.js +86 -0
- package/dist/classes/ovary.d/users-remove.d.ts +9 -0
- package/dist/classes/ovary.d/users-remove.js +38 -0
- package/dist/classes/ovary.d/xorriso-commend.d.ts +14 -0
- package/dist/classes/ovary.d/xorriso-commend.js +119 -0
- package/dist/classes/ovary.d.ts +46 -167
- package/dist/classes/ovary.js +49 -1818
- package/dist/classes/pacman.d/archlinux.js +2 -1
- package/dist/classes/settings.d.ts +0 -1
- package/dist/classes/settings.js +2 -2
- package/dist/classes/utils.d.ts +6 -5
- package/dist/classes/utils.js +10 -16
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.js +7 -4
- package/dist/commands/kill.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/update.js +3 -3
- package/dist/interfaces/i-luks-passphrase.d.ts +11 -0
- package/dist/interfaces/i-luks-passphrase.js +8 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/{classes → krill/classes}/cfs.js +1 -1
- package/dist/krill/classes/krill_enums.d.ts +24 -0
- package/dist/krill/classes/krill_enums.js +26 -0
- package/dist/krill/classes/prepare.d/confirm.d.ts +5 -0
- package/dist/krill/classes/prepare.d/confirm.js +30 -0
- package/dist/krill/classes/prepare.d/keyboard.d.ts +14 -0
- package/dist/krill/classes/prepare.d/keyboard.js +62 -0
- package/dist/krill/classes/prepare.d/location.d.ts +17 -0
- package/dist/krill/classes/prepare.d/location.js +59 -0
- package/dist/krill/classes/prepare.d/network.d.ts +14 -0
- package/dist/krill/classes/prepare.d/network.js +68 -0
- package/dist/krill/classes/prepare.d/partitions.d.ts +14 -0
- package/dist/krill/classes/prepare.d/partitions.js +86 -0
- package/dist/krill/classes/prepare.d/summary.d.ts +15 -0
- package/dist/krill/classes/prepare.d/summary.js +69 -0
- package/dist/krill/classes/prepare.d/users.d.ts +6 -0
- package/dist/krill/classes/prepare.d/users.js +63 -0
- package/dist/krill/classes/prepare.d/welcome.d.ts +6 -0
- package/dist/krill/classes/prepare.d/welcome.js +30 -0
- package/dist/krill/{prepare.d.ts → classes/prepare.d.ts} +21 -35
- package/dist/krill/classes/prepare.js +314 -0
- package/dist/krill/{modules/add-user.js → classes/sequence.d/add_user.js} +1 -1
- package/dist/krill/{modules → classes/sequence.d}/bootloader.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/bootloader.js +3 -3
- package/dist/krill/{modules/bootloader-config.js → classes/sequence.d/bootloader_config.js} +2 -2
- package/dist/krill/{modules/change-password.js → classes/sequence.d/change_password.js} +1 -1
- package/dist/krill/{modules/del-live-user.js → classes/sequence.d/del_live_user.js} +2 -2
- package/dist/krill/{modules → classes/sequence.d}/fstab.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/fstab.js +75 -14
- package/dist/krill/{modules → classes/sequence.d}/grubcfg.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/grubcfg.js +6 -2
- package/dist/krill/{modules → classes/sequence.d}/hostname.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/initramfs.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/initramfs.js +2 -2
- package/dist/krill/classes/sequence.d/initramfs_cfg.js +35 -0
- package/dist/krill/{modules → classes/sequence.d}/locale.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/locale.js +2 -2
- package/dist/krill/{modules/m-keyboard.js → classes/sequence.d/m_keyboard.js} +2 -2
- package/dist/krill/{modules/machine-id.js → classes/sequence.d/machine_id.js} +2 -2
- package/dist/krill/{modules → classes/sequence.d}/mkfs.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/mkfs.js +24 -2
- package/dist/krill/{modules/mount-fs.js → classes/sequence.d/mount_fs.js} +9 -3
- package/dist/krill/{modules/mount-vfs.js → classes/sequence.d/mount_vfs.js} +1 -1
- package/dist/krill/{modules/network-cfg.js → classes/sequence.d/network_cfg.js} +15 -6
- package/dist/krill/{modules → classes/sequence.d}/packages.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/packages.js +3 -3
- package/dist/krill/{modules/partition.d.ts → classes/sequence.d/partition.d/bios_luks.d.ts} +4 -7
- package/dist/krill/classes/sequence.d/partition.d/bios_luks.js +73 -0
- package/dist/krill/classes/sequence.d/partition.d/bios_standard.d.ts +17 -0
- package/dist/krill/classes/sequence.d/partition.d/bios_standard.js +36 -0
- package/dist/krill/classes/sequence.d/partition.d/uefi_luks.d.ts +17 -0
- package/dist/krill/classes/sequence.d/partition.d/uefi_luks.js +78 -0
- package/dist/krill/classes/sequence.d/partition.d/uefi_standard.d.ts +10 -0
- package/dist/krill/classes/sequence.d/partition.d/uefi_standard.js +32 -0
- package/dist/krill/classes/sequence.d/partition.d.ts +14 -0
- package/dist/krill/classes/sequence.d/partition.js +84 -0
- package/dist/krill/{modules → classes/sequence.d}/umount.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/umount.js +2 -2
- package/dist/krill/{modules → classes/sequence.d}/unpackfs.d.ts +1 -1
- package/dist/krill/{modules → classes/sequence.d}/unpackfs.js +2 -2
- package/dist/krill/{sequence.d.ts → classes/sequence.d.ts} +40 -58
- package/dist/krill/{sequence.js → classes/sequence.js} +43 -32
- package/dist/{components → krill/components}/information.js +3 -3
- package/dist/{components → krill/components}/keyboard.js +1 -1
- package/dist/{components → krill/components}/location.js +1 -1
- package/dist/{components → krill/components}/network.js +1 -1
- package/dist/{components → krill/components}/partitions.d.ts +4 -2
- package/dist/{components → krill/components}/partitions.js +36 -20
- package/dist/{components → krill/components}/summary.d.ts +2 -1
- package/dist/{components → krill/components}/summary.js +2 -6
- package/dist/{components → krill/components}/title.js +1 -1
- package/dist/{components → krill/components}/users.js +1 -1
- package/dist/{components → krill/components}/welcome.js +1 -1
- package/dist/{interfaces/i-krill.d.ts → krill/interfaces/i_krill.d.ts} +3 -1
- package/dist/{interfaces/i-krill-config.d.ts → krill/interfaces/i_krill_config.d.ts} +3 -1
- package/dist/krill/lib/get_luks_passphrase.d.ts +8 -0
- package/dist/krill/lib/get_luks_passphrase.js +40 -0
- package/dist/{lib → krill/lib}/kill_me_softly.js +2 -2
- package/dist/{lib → krill/lib}/select_filesystem_type.js +2 -9
- package/dist/{lib → krill/lib}/select_installation_device.js +10 -4
- package/dist/{lib → krill/lib}/select_installation_mode.d.ts +2 -1
- package/dist/{lib → krill/lib}/select_installation_mode.js +2 -1
- package/dist/{lib → krill/lib}/select_keyboard_layout.js +1 -1
- package/dist/{lib → krill/lib}/select_keyboard_model.js +1 -1
- package/dist/{lib → krill/lib}/select_keyboard_option.js +1 -1
- package/dist/{lib → krill/lib}/select_keyboard_variant.js +1 -1
- package/dist/{lib → krill/lib}/select_languages.js +1 -1
- package/dist/krill/lib/select_replaced_partition.d.ts +8 -0
- package/dist/krill/lib/select_replaced_partition.js +31 -0
- package/dist/{lib → krill/lib}/select_user_swap_choice.d.ts +2 -1
- package/dist/{lib → krill/lib}/select_user_swap_choice.js +4 -3
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.js +8 -0
- package/package.json +25 -24
- package/scripts/_eggs +7 -5
- package/scripts/eggs.bash +3 -3
- package/dist/krill/modules/initramfs-cfg.js +0 -22
- package/dist/krill/modules/partition.js +0 -345
- package/dist/krill/prepare.js +0 -626
- /package/dist/{index-old.d.ts → index_old.d.ts} +0 -0
- /package/dist/{index-old.js → index_old.js} +0 -0
- /package/dist/{classes → krill/classes}/cfs.d.ts +0 -0
- /package/dist/krill/{modules/add-user.d.ts → classes/sequence.d/add_user.d.ts} +0 -0
- /package/dist/krill/{modules/bootloader-config.d.ts → classes/sequence.d/bootloader_config.d.ts} +0 -0
- /package/dist/krill/{modules/change-password.d.ts → classes/sequence.d/change_password.d.ts} +0 -0
- /package/dist/krill/{modules/del-live-user.d.ts → classes/sequence.d/del_live_user.d.ts} +0 -0
- /package/dist/krill/{modules → classes/sequence.d}/hostname.js +0 -0
- /package/dist/krill/{modules/initramfs-cfg.d.ts → classes/sequence.d/initramfs_cfg.d.ts} +0 -0
- /package/dist/krill/{modules/locale-cfg.d.ts → classes/sequence.d/locale_cfg.d.ts} +0 -0
- /package/dist/krill/{modules/locale-cfg.js → classes/sequence.d/locale_cfg.js} +0 -0
- /package/dist/krill/{modules/m-keyboard.d.ts → classes/sequence.d/m_keyboard.d.ts} +0 -0
- /package/dist/krill/{modules/machine-id.d.ts → classes/sequence.d/machine_id.d.ts} +0 -0
- /package/dist/krill/{modules/mount-fs.d.ts → classes/sequence.d/mount_fs.d.ts} +0 -0
- /package/dist/krill/{modules/mount-vfs.d.ts → classes/sequence.d/mount_vfs.d.ts} +0 -0
- /package/dist/krill/{modules/network-cfg.d.ts → classes/sequence.d/network_cfg.d.ts} +0 -0
- /package/dist/krill/{modules/remove-installer-link.d.ts → classes/sequence.d/remove_installer_link.d.ts} +0 -0
- /package/dist/krill/{modules/remove-installer-link.js → classes/sequence.d/remove_installer_link.js} +0 -0
- /package/dist/{components → krill/components}/finished.d.ts +0 -0
- /package/dist/{components → krill/components}/finished.js +0 -0
- /package/dist/{components → krill/components}/information.d.ts +0 -0
- /package/dist/{components → krill/components}/install.d.ts +0 -0
- /package/dist/{components → krill/components}/install.js +0 -0
- /package/dist/{components → krill/components}/keyboard.d.ts +0 -0
- /package/dist/{components → krill/components}/location.d.ts +0 -0
- /package/dist/{components → krill/components}/network.d.ts +0 -0
- /package/dist/{components → krill/components}/steps.d.ts +0 -0
- /package/dist/{components → krill/components}/steps.js +0 -0
- /package/dist/{components → krill/components}/title.d.ts +0 -0
- /package/dist/{components → krill/components}/users.d.ts +0 -0
- /package/dist/{components → krill/components}/welcome.d.ts +0 -0
- /package/dist/{interfaces/i-krill.js → krill/interfaces/i_krill.js} +0 -0
- /package/dist/{interfaces/i-krill-config.js → krill/interfaces/i_krill_config.js} +0 -0
- /package/dist/{lib → krill/lib}/get_address.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_address.js +0 -0
- /package/dist/{lib → krill/lib}/get_dns.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_dns.js +0 -0
- /package/dist/{lib → krill/lib}/get_domain.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_domain.js +0 -0
- /package/dist/{lib → krill/lib}/get_gateway.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_gateway.js +0 -0
- /package/dist/{lib → krill/lib}/get_hostname.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_hostname.js +0 -0
- /package/dist/{lib → krill/lib}/get_netmask.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_netmask.js +0 -0
- /package/dist/{lib → krill/lib}/get_password.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_password.js +0 -0
- /package/dist/{lib → krill/lib}/get_userfullname.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_userfullname.js +0 -0
- /package/dist/{lib → krill/lib}/get_username.d.ts +0 -0
- /package/dist/{lib → krill/lib}/get_username.js +0 -0
- /package/dist/{lib → krill/lib}/kill_me_softly.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_address_type.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_address_type.js +0 -0
- /package/dist/{lib → krill/lib}/select_filesystem_type.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_installation_device.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_interface.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_interface.js +0 -0
- /package/dist/{lib → krill/lib}/select_keyboard_layout.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_keyboard_model.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_keyboard_option.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_keyboard_variant.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_languages.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_regions.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_regions.js +0 -0
- /package/dist/{lib → krill/lib}/select_zones.d.ts +0 -0
- /package/dist/{lib → krill/lib}/select_zones.js +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/edit-live-fs.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
// packages
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import os from 'os';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import shx from 'shelljs';
|
|
13
|
+
import Utils from '../utils.js';
|
|
14
|
+
import Pacman from '../pacman.js';
|
|
15
|
+
import Systemctl from '../systemctl.js';
|
|
16
|
+
import { exec } from '../../lib/utils.js';
|
|
17
|
+
// _dirname
|
|
18
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
19
|
+
/**
|
|
20
|
+
* editLiveFs
|
|
21
|
+
* - Truncate logs, remove archived log
|
|
22
|
+
* - Allow all fixed drives to be mounted with pmount
|
|
23
|
+
* - Enable or disable password login trhough ssh for users (not root)
|
|
24
|
+
* - Create an empty /etc/fstab
|
|
25
|
+
* - Blanck /etc/machine-id
|
|
26
|
+
* - Add some basic files to /dev
|
|
27
|
+
* - Clear configs from /etc/network/interfaces, wicd and NetworkManager and netman
|
|
28
|
+
*/
|
|
29
|
+
export async function editLiveFs(clone = false, cryptedclone = false) {
|
|
30
|
+
if (this.verbose) {
|
|
31
|
+
console.log('Ovary: editLiveFs');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* /etc/penguins-eggs.d/is_clone file created on live
|
|
35
|
+
*/
|
|
36
|
+
if (clone) {
|
|
37
|
+
await exec(`touch ${this.settings.work_dir.merged}/etc/penguins-eggs.d/is_clone`, this.echo);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* /etc/penguins-eggs.d/is_crypted_clone file created on live
|
|
41
|
+
*/
|
|
42
|
+
if (cryptedclone) {
|
|
43
|
+
await exec(`touch ${this.settings.work_dir.merged}/etc/penguins-eggs.d/is_crypted_clone`, this.echo);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* /etc/default/epoptes-client created on live
|
|
47
|
+
*/
|
|
48
|
+
if (Pacman.packageIsInstalled('epoptes')) {
|
|
49
|
+
const file = `${this.settings.work_dir.merged}/etc/default/epoptes-client`;
|
|
50
|
+
const text = `SERVER=${os.hostname}.local\n`;
|
|
51
|
+
fs.writeFileSync(file, text);
|
|
52
|
+
}
|
|
53
|
+
if (this.familyId === 'debian') {
|
|
54
|
+
// Aggiungo UMASK=0077 in /etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf
|
|
55
|
+
const text = 'UMASK=0077\n';
|
|
56
|
+
const file = '/etc/initramfs-tools/conf.d/eggs-safe-initramfs.conf';
|
|
57
|
+
Utils.write(file, text);
|
|
58
|
+
}
|
|
59
|
+
// Truncate logs, remove archived logs.
|
|
60
|
+
let cmd = `find ${this.settings.work_dir.merged}/var/log -name "*gz" -print0 | xargs -0r rm -f`;
|
|
61
|
+
await exec(cmd, this.echo);
|
|
62
|
+
cmd = `find ${this.settings.work_dir.merged}/var/log/ -type f -exec truncate -s 0 {} \\;`;
|
|
63
|
+
await exec(cmd, this.echo);
|
|
64
|
+
// Allow all fixed drives to be mounted with pmount
|
|
65
|
+
if (this.settings.config.pmount_fixed && fs.existsSync(`${this.settings.work_dir.merged}/etc/pmount.allow`)) {
|
|
66
|
+
// MX aggiunto /etc
|
|
67
|
+
await exec(`sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' ${this.settings.work_dir.merged}/etc/pmount.allow`, this.echo);
|
|
68
|
+
}
|
|
69
|
+
// Remove obsolete live-config file
|
|
70
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}lib/live/config/1161-openssh-server`)) {
|
|
71
|
+
await exec(`rm -f ${this.settings.work_dir.merged}/lib/live/config/1161-openssh-server`, this.echo);
|
|
72
|
+
}
|
|
73
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/ssh/sshd_config`)) {
|
|
74
|
+
/**
|
|
75
|
+
* enable/disable SSH root/users password login
|
|
76
|
+
*/
|
|
77
|
+
await exec(`sed -i '/PermitRootLogin/d' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`);
|
|
78
|
+
await exec(`sed -i '/PasswordAuthentication/d' ${this.settings.work_dir.merged}/etc/ssh/sshd_config`);
|
|
79
|
+
if (this.settings.config.ssh_pass) {
|
|
80
|
+
await exec(`echo 'PasswordAuthentication yes' | tee -a ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
await exec(`echo 'PermitRootLogin prohibit-password' | tee -a ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
84
|
+
await exec(`echo 'PasswordAuthentication no' | tee -a ${this.settings.work_dir.merged}/etc/ssh/sshd_config`, this.echo);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* ufw --force reset
|
|
89
|
+
*/
|
|
90
|
+
// if (Pacman.packageIsInstalled('ufw')) {
|
|
91
|
+
// await exec('ufw --force reset')
|
|
92
|
+
// }
|
|
93
|
+
/**
|
|
94
|
+
* /etc/fstab should exist, even if it's empty,
|
|
95
|
+
* to prevent error messages at boot
|
|
96
|
+
*/
|
|
97
|
+
await exec(`rm ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
98
|
+
await exec(`touch ${this.settings.work_dir.merged}/etc/fstab`, this.echo);
|
|
99
|
+
/**
|
|
100
|
+
* Remove crypttab if exists
|
|
101
|
+
* this is crucial for tpm systems.
|
|
102
|
+
*/
|
|
103
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/crypttab`)) {
|
|
104
|
+
await exec(`rm ${this.settings.work_dir.merged}/etc/crypttab`, this.echo);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Blank out systemd machine id.
|
|
108
|
+
* If it does not exist, systemd-journald will fail,
|
|
109
|
+
* but if it exists and is empty, systemd will automatically
|
|
110
|
+
* set up a new unique ID.
|
|
111
|
+
*/
|
|
112
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/machine-id`)) {
|
|
113
|
+
await exec(`rm ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
114
|
+
await exec(`touch ${this.settings.work_dir.merged}/etc/machine-id`, this.echo);
|
|
115
|
+
Utils.write(`${this.settings.work_dir.merged}/etc/machine-id`, ':');
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* LMDE4: utilizza UbuntuMono16.pf2
|
|
119
|
+
* aggiungo un link a /boot/grub/fonts/UbuntuMono16.pf2
|
|
120
|
+
*/
|
|
121
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}/boot/grub/fonts/unicode.pf2`)) {
|
|
122
|
+
shx.cp(`${this.settings.work_dir.merged}/boot/grub/fonts/unicode.pf2`, `${this.settings.work_dir.merged}/boot/grub/fonts/UbuntuMono16.pf2`);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* cleaning /etc/resolv.conf
|
|
126
|
+
*/
|
|
127
|
+
const resolvFile = `${this.settings.work_dir.merged}/etc/resolv.conf`;
|
|
128
|
+
shx.rm(resolvFile);
|
|
129
|
+
/**
|
|
130
|
+
* Per tutte le distro systemd
|
|
131
|
+
*/
|
|
132
|
+
if (Utils.isSystemd()) {
|
|
133
|
+
const systemdctl = new Systemctl(this.verbose);
|
|
134
|
+
/**
|
|
135
|
+
* systemd-systemd-resolved
|
|
136
|
+
*/
|
|
137
|
+
let resolvContent = '';
|
|
138
|
+
if (await systemdctl.isActive('systemd-resolved.service')) {
|
|
139
|
+
await systemdctl.stop('systemd-resolved.service');
|
|
140
|
+
resolvContent = 'nameserver 127.0.0.53\noptions edns0 trust-ad\nsearch .\n';
|
|
141
|
+
}
|
|
142
|
+
fs.writeFileSync(resolvFile, resolvContent);
|
|
143
|
+
if (await systemdctl.isEnabled('systemd-networkd.service')) {
|
|
144
|
+
await systemdctl.disable('systemd-networkd.service', this.settings.work_dir.merged, true);
|
|
145
|
+
}
|
|
146
|
+
if (await systemdctl.isEnabled('remote-cryptsetup.target')) {
|
|
147
|
+
await systemdctl.disable('remote-cryptsetup.target', this.settings.work_dir.merged, true);
|
|
148
|
+
}
|
|
149
|
+
if (await systemdctl.isEnabled('speech-dispatcherd.service')) {
|
|
150
|
+
await systemdctl.disable('speech-dispatcherd.service', this.settings.work_dir.merged, true);
|
|
151
|
+
}
|
|
152
|
+
if (await systemdctl.isEnabled('wpa_supplicant-nl80211@.service')) {
|
|
153
|
+
await systemdctl.disable('wpa_supplicant-nl80211@.service', this.settings.work_dir.merged, true);
|
|
154
|
+
}
|
|
155
|
+
if (await systemdctl.isEnabled('wpa_supplicant@.service')) {
|
|
156
|
+
await systemdctl.disable('wpa_supplicant@.service', this.settings.work_dir.merged, true);
|
|
157
|
+
}
|
|
158
|
+
if (await systemdctl.isEnabled('wpa_supplicant-wired@.service')) {
|
|
159
|
+
await systemdctl.disable('wpa_supplicant-wired@.service', this.settings.work_dir.merged, true);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* All systemd distros rm
|
|
163
|
+
*/
|
|
164
|
+
await exec(`rm -f ${this.settings.work_dir.merged}/var/lib/wicd/configurations/*`, this.echo);
|
|
165
|
+
await exec(`rm -f ${this.settings.work_dir.merged}/etc/wicd/wireless-settings.conf`, this.echo);
|
|
166
|
+
await exec(`rm -f ${this.settings.work_dir.merged}/etc/NetworkManager/system-connections/*`, this.echo);
|
|
167
|
+
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/wifi/*`, this.echo);
|
|
168
|
+
/**
|
|
169
|
+
* removing from /etc/network/:
|
|
170
|
+
* if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
|
|
171
|
+
*/
|
|
172
|
+
const cleanDirs = ['if-down.d', 'if-post-down.d', 'if-pre-up.d', 'if-up.d', 'interfaces.d'];
|
|
173
|
+
let cleanDir = '';
|
|
174
|
+
for (cleanDir of cleanDirs) {
|
|
175
|
+
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/${cleanDir}/wpasupplicant`, this.echo);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Clear configs from /etc/network/interfaces, wicd and NetworkManager
|
|
180
|
+
* and netman, so they aren't stealthily included in the snapshot.
|
|
181
|
+
*/
|
|
182
|
+
if (this.familyId === 'debian') {
|
|
183
|
+
if (fs.existsSync(`${this.settings.work_dir.merged}/etc/network/interfaces`)) {
|
|
184
|
+
await exec(`rm -f ${this.settings.work_dir.merged}/etc/network/interfaces`, this.echo);
|
|
185
|
+
Utils.write(`${this.settings.work_dir.merged}/etc/network/interfaces`, 'auto lo\niface lo inet loopback');
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* add some basic files to /dev
|
|
189
|
+
*/
|
|
190
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/console`)) {
|
|
191
|
+
await exec(`mknod -m 622 ${this.settings.work_dir.merged}/dev/console c 5 1`, this.echo);
|
|
192
|
+
}
|
|
193
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/null`)) {
|
|
194
|
+
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/null c 1 3`, this.echo);
|
|
195
|
+
}
|
|
196
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/zero`)) {
|
|
197
|
+
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/zero c 1 5`, this.echo);
|
|
198
|
+
}
|
|
199
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/ptmx`)) {
|
|
200
|
+
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/ptmx c 5 2`, this.echo);
|
|
201
|
+
}
|
|
202
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/tty`)) {
|
|
203
|
+
await exec(`mknod -m 666 ${this.settings.work_dir.merged}/dev/tty c 5 0`, this.echo);
|
|
204
|
+
}
|
|
205
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/random`)) {
|
|
206
|
+
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/random c 1 8`, this.echo);
|
|
207
|
+
}
|
|
208
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/urandom`)) {
|
|
209
|
+
await exec(`mknod -m 444 ${this.settings.work_dir.merged}/dev/urandom c 1 9`, this.echo);
|
|
210
|
+
}
|
|
211
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`)) {
|
|
212
|
+
await exec(`chown -v root:tty ${this.settings.work_dir.merged}/dev/{console,ptmx,tty}`, this.echo);
|
|
213
|
+
}
|
|
214
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/fd`)) {
|
|
215
|
+
await exec(`ln -sv /proc/self/fd ${this.settings.work_dir.merged}/dev/fd`, this.echo);
|
|
216
|
+
}
|
|
217
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdin`)) {
|
|
218
|
+
await exec(`ln -sv /proc/self/fd/0 ${this.settings.work_dir.merged}/dev/stdin`, this.echo);
|
|
219
|
+
}
|
|
220
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stdout`)) {
|
|
221
|
+
await exec(`ln -sv /proc/self/fd/1 ${this.settings.work_dir.merged}/dev/stdout`, this.echo);
|
|
222
|
+
}
|
|
223
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/stderr`)) {
|
|
224
|
+
await exec(`ln -sv /proc/self/fd/2 ${this.settings.work_dir.merged}/dev/stderr`, this.echo);
|
|
225
|
+
}
|
|
226
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/core`)) {
|
|
227
|
+
await exec(`ln -sv /proc/kcore ${this.settings.work_dir.merged}/dev/core`, this.echo);
|
|
228
|
+
}
|
|
229
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
230
|
+
await exec(`mkdir -v ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
231
|
+
}
|
|
232
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/pts`)) {
|
|
233
|
+
await exec(`mkdir -v ${this.settings.work_dir.merged}/dev/pts`, this.echo);
|
|
234
|
+
}
|
|
235
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/dev/shm`)) {
|
|
236
|
+
await exec(`chmod 1777 ${this.settings.work_dir.merged}/dev/shm`, this.echo);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* creo /tmp
|
|
240
|
+
*/
|
|
241
|
+
if (!fs.existsSync(`${this.settings.work_dir.merged}/tmp`)) {
|
|
242
|
+
await exec(`mkdir ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Assegno 1777 a /tmp creava problemi con MXLINUX
|
|
246
|
+
*/
|
|
247
|
+
await exec(`chmod 1777 ${this.settings.work_dir.merged}/tmp`, this.echo);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/xorriso-command.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import Ovary from '../ovary.js';
|
|
9
|
+
/**
|
|
10
|
+
* @returns {boolean} success
|
|
11
|
+
*/
|
|
12
|
+
export declare function fertilization(this: Ovary, snapshot_prefix?: string, snapshot_basename?: string, theme?: string, compression?: string, nointeratctive?: boolean): Promise<boolean>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/xorriso-command.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
// packages
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import Settings from '../settings.js';
|
|
11
|
+
import Utils from '../utils.js';
|
|
12
|
+
// _dirname
|
|
13
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
14
|
+
/**
|
|
15
|
+
* @returns {boolean} success
|
|
16
|
+
*/
|
|
17
|
+
export async function fertilization(snapshot_prefix = '', snapshot_basename = '', theme = '', compression = '', nointeratctive = false) {
|
|
18
|
+
this.settings = new Settings();
|
|
19
|
+
if (await this.settings.load()) {
|
|
20
|
+
await this.settings.loadRemix(this.theme);
|
|
21
|
+
this.volid = Utils.getVolid(this.settings.remix.name);
|
|
22
|
+
this.uuid = Utils.uuidGen();
|
|
23
|
+
this.familyId = this.settings.distro.familyId;
|
|
24
|
+
this.nest = this.settings.config.snapshot_mnt;
|
|
25
|
+
if (snapshot_prefix !== '') {
|
|
26
|
+
this.settings.config.snapshot_prefix = snapshot_prefix;
|
|
27
|
+
}
|
|
28
|
+
if (snapshot_basename !== '') {
|
|
29
|
+
this.settings.config.snapshot_basename = snapshot_basename;
|
|
30
|
+
}
|
|
31
|
+
if (theme !== '') {
|
|
32
|
+
this.theme = theme;
|
|
33
|
+
}
|
|
34
|
+
if (compression !== '') {
|
|
35
|
+
this.settings.config.compression = compression;
|
|
36
|
+
}
|
|
37
|
+
if (!nointeratctive) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
this.settings.listFreeSpace();
|
|
41
|
+
if (await Utils.customConfirm('Select yes to continue...')) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/finished.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import Ovary from './../ovary.js';
|
|
9
|
+
/**
|
|
10
|
+
* finished = show the results
|
|
11
|
+
* @param scriptOnly
|
|
12
|
+
*/
|
|
13
|
+
export declare function finished(this: Ovary, scriptOnly?: boolean): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/finished.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
// interfaces
|
|
10
|
+
// libraries
|
|
11
|
+
// classes
|
|
12
|
+
import Utils from './../utils.js';
|
|
13
|
+
// _dirname
|
|
14
|
+
/**
|
|
15
|
+
* finished = show the results
|
|
16
|
+
* @param scriptOnly
|
|
17
|
+
*/
|
|
18
|
+
export function finished(scriptOnly = false) {
|
|
19
|
+
Utils.titles('produce');
|
|
20
|
+
if (scriptOnly) {
|
|
21
|
+
console.log('eggs is finished!\n\nYou can find the scripts to build iso: ' + chalk.cyanBright(this.settings.isoFilename) + '\nin the ovarium: ' + chalk.cyanBright(this.settings.config.snapshot_dir) + '.');
|
|
22
|
+
console.log('usage');
|
|
23
|
+
console.log(chalk.cyanBright(`cd ${this.settings.config.snapshot_dir}`));
|
|
24
|
+
console.log(chalk.cyanBright('sudo ./bind'));
|
|
25
|
+
console.log('Make all yours modifications in the directories filesystem.squashfs and iso.');
|
|
26
|
+
console.log('After when you are ready:');
|
|
27
|
+
console.log(chalk.cyanBright('sudo ./mksquashfs'));
|
|
28
|
+
console.log(chalk.cyanBright('sudo ./mkisofs'));
|
|
29
|
+
console.log(chalk.cyanBright('sudo ./ubind'));
|
|
30
|
+
console.log('happy hacking!');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.log('eggs is finished!\n\nYou can find the file iso: ' + chalk.cyanBright(this.settings.isoFilename) + '\nin the nest: ' + chalk.cyanBright(this.settings.config.snapshot_dir) + '.');
|
|
34
|
+
}
|
|
35
|
+
console.log();
|
|
36
|
+
console.log('Remember, on liveCD user = ' + chalk.cyanBright(this.settings.config.user_opt) + '/' + chalk.cyanBright(this.settings.config.user_opt_passwd));
|
|
37
|
+
console.log(' root = ' + chalk.cyanBright('root') + '/' + chalk.cyanBright(this.settings.config.root_passwd));
|
|
38
|
+
if (this.genisoimage) {
|
|
39
|
+
console.log(`Note: format UDF, generated by ${chalk.cyanBright('genisoimage')}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/initrd-arch.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import Ovary from '../ovary.js';
|
|
9
|
+
/**
|
|
10
|
+
* initrdAlpine
|
|
11
|
+
*/
|
|
12
|
+
export declare function initrdAlpine(this: Ovary): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* initrdArch
|
|
15
|
+
*/
|
|
16
|
+
export declare function initrdArch(this: Ovary): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* initrdDebian
|
|
19
|
+
*/
|
|
20
|
+
export declare function initrdDebian(this: Ovary, verbose?: boolean): Promise<void>;
|
|
21
|
+
export declare function initrdDracut(this: Ovary): Promise<void>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/initrd-arch.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
// packages
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import shx from 'shelljs';
|
|
12
|
+
// classes
|
|
13
|
+
import { exec } from '../../lib/utils.js';
|
|
14
|
+
import Utils from '../utils.js';
|
|
15
|
+
import Diversions from '../diversions.js';
|
|
16
|
+
// _dirname
|
|
17
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
18
|
+
/**
|
|
19
|
+
* initrdAlpine
|
|
20
|
+
*/
|
|
21
|
+
export async function initrdAlpine() {
|
|
22
|
+
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} Alpine on ISO/live`);
|
|
23
|
+
const sidecar = path.resolve(__dirname, `../../../mkinitfs/initramfs-init.in`);
|
|
24
|
+
Utils.warning(`Adding ${sidecar} to /usr/share/mkinitfs/initramfs-init`);
|
|
25
|
+
await exec(`cp ${sidecar} /usr/share/mkinitfs/initramfs-init`);
|
|
26
|
+
let initrdImg = Utils.initrdImg();
|
|
27
|
+
initrdImg = initrdImg.slice(Math.max(0, initrdImg.lastIndexOf('/') + 1));
|
|
28
|
+
const pathConf = path.resolve(__dirname, `../../mkinitfs/live.conf`);
|
|
29
|
+
await exec(`mkinitfs -c ${pathConf} -o ${this.settings.iso_work}live/${initrdImg}`, Utils.setEcho(true));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* initrdArch
|
|
33
|
+
*/
|
|
34
|
+
export async function initrdArch() {
|
|
35
|
+
let initrdImg = Utils.initrdImg();
|
|
36
|
+
initrdImg = initrdImg.slice(Math.max(0, initrdImg.lastIndexOf('/') + 1));
|
|
37
|
+
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} using mkinitcpio on ISO/live`);
|
|
38
|
+
const { distroId } = this.settings.distro;
|
|
39
|
+
let dirConf = 'arch';
|
|
40
|
+
if (Diversions.isManjaroBased(distroId)) {
|
|
41
|
+
dirConf = 'manjaro';
|
|
42
|
+
if (distroId === "Biglinux" || distroId === "Bigcommunity") {
|
|
43
|
+
dirConf = 'biglinux';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const pathConf = path.resolve(__dirname, `../../../mkinitcpio/${dirConf}/live.conf`);
|
|
47
|
+
await exec(`mkinitcpio -c ${pathConf} -g ${this.settings.iso_work}live/${initrdImg}`, this.echo);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* initrdDebian
|
|
51
|
+
*/
|
|
52
|
+
export async function initrdDebian(verbose = false) {
|
|
53
|
+
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} using mkinitramfs on ISO/live`);
|
|
54
|
+
let isCrypted = false;
|
|
55
|
+
if (fs.existsSync('/etc/crypttab')) {
|
|
56
|
+
isCrypted = true;
|
|
57
|
+
await exec('mv /etc/crypttab /etc/crypttab.saved', this.echo);
|
|
58
|
+
}
|
|
59
|
+
await exec(`mkinitramfs -o ${this.settings.iso_work}/live/initrd.img-$(uname -r) ${this.toNull}`, this.echo);
|
|
60
|
+
if (isCrypted) {
|
|
61
|
+
await exec('mv /etc/crypttab.saved /etc/crypttab', this.echo);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/*
|
|
65
|
+
* initrdDracut) Fedora/Openmamba/Opensuse/Voidlinux
|
|
66
|
+
*/
|
|
67
|
+
export async function initrdDracut() {
|
|
68
|
+
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} using dracut on ISO/live`);
|
|
69
|
+
const kernelVersion = shx.exec('uname -r', { silent: true }).stdout.trim();
|
|
70
|
+
const confdir = path.resolve(__dirname, `../../../dracut/dracut.conf.d`);
|
|
71
|
+
await exec(`dracut --confdir ${confdir} ${this.settings.iso_work}live/${this.settings.initrdImg}`, this.echo);
|
|
72
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/produce.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import Ovary from './../ovary.js';
|
|
9
|
+
/**
|
|
10
|
+
* kernelCopy
|
|
11
|
+
*/
|
|
12
|
+
export declare function kernelCopy(this: Ovary): Promise<void>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/produce.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
// packages
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
// interfaces
|
|
12
|
+
// libraries
|
|
13
|
+
import { exec } from '../../lib/utils.js';
|
|
14
|
+
// classes
|
|
15
|
+
import Utils from './../utils.js';
|
|
16
|
+
// _dirname
|
|
17
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
18
|
+
/**
|
|
19
|
+
* kernelCopy
|
|
20
|
+
*/
|
|
21
|
+
export async function kernelCopy() {
|
|
22
|
+
Utils.warning(`copying ${path.basename(this.settings.kernel_image)} on ISO/live`);
|
|
23
|
+
let lackVmlinuzImage = false;
|
|
24
|
+
if (fs.existsSync(this.settings.kernel_image)) {
|
|
25
|
+
await exec(`cp ${this.settings.kernel_image} ${this.settings.iso_work}live/`, this.echo);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
Utils.error(`Cannot find ${this.settings.kernel_image}`);
|
|
29
|
+
lackVmlinuzImage = true;
|
|
30
|
+
}
|
|
31
|
+
if (lackVmlinuzImage) {
|
|
32
|
+
Utils.warning('Try to edit /etc/penguins-eggs.d/eggs.yaml and check for');
|
|
33
|
+
Utils.warning(`vmlinuz: ${this.settings.kernel_image}`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/live-create-structure.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import Ovary from './../ovary.js';
|
|
9
|
+
/**
|
|
10
|
+
* Crea la struttura della workdir
|
|
11
|
+
*/
|
|
12
|
+
export declare function liveCreateStructure(this: Ovary): Promise<void>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/live-create-structure.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
// packages
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
// interfaces
|
|
12
|
+
// libraries
|
|
13
|
+
import { exec } from '../../lib/utils.js';
|
|
14
|
+
// classes
|
|
15
|
+
import Utils from './../utils.js';
|
|
16
|
+
// _dirname
|
|
17
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
18
|
+
/**
|
|
19
|
+
* Crea la struttura della workdir
|
|
20
|
+
*/
|
|
21
|
+
export async function liveCreateStructure() {
|
|
22
|
+
if (this.verbose) {
|
|
23
|
+
console.log('Ovary: liveCreateStructure');
|
|
24
|
+
}
|
|
25
|
+
Utils.warning(`creating egg in ${this.settings.config.snapshot_dir}`);
|
|
26
|
+
let cmd;
|
|
27
|
+
if (!fs.existsSync(this.settings.config.snapshot_dir)) {
|
|
28
|
+
cmd = `mkdir -p ${this.settings.config.snapshot_dir}`;
|
|
29
|
+
tryCatch(cmd, this.verbose);
|
|
30
|
+
}
|
|
31
|
+
if (!fs.existsSync(this.settings.config.snapshot_dir + '/README.md')) {
|
|
32
|
+
cmd = `cp ${path.resolve(__dirname, '../../conf/README.md')} ${this.settings.config.snapshot_dir}README.md`;
|
|
33
|
+
tryCatch(cmd, this.verbose);
|
|
34
|
+
}
|
|
35
|
+
// Ovarium
|
|
36
|
+
if (!fs.existsSync(this.settings.work_dir.ovarium)) {
|
|
37
|
+
cmd = `mkdir -p ${this.settings.work_dir.ovarium}`;
|
|
38
|
+
tryCatch(cmd, this.verbose);
|
|
39
|
+
}
|
|
40
|
+
if (!fs.existsSync(this.settings.work_dir.lowerdir)) {
|
|
41
|
+
cmd = `mkdir -p ${this.settings.work_dir.lowerdir}`;
|
|
42
|
+
tryCatch(cmd, this.verbose);
|
|
43
|
+
}
|
|
44
|
+
if (!fs.existsSync(this.settings.work_dir.upperdir)) {
|
|
45
|
+
cmd = `mkdir -p ${this.settings.work_dir.upperdir}`;
|
|
46
|
+
tryCatch(cmd, this.verbose);
|
|
47
|
+
}
|
|
48
|
+
if (!fs.existsSync(this.settings.work_dir.workdir)) {
|
|
49
|
+
cmd = `mkdir -p ${this.settings.work_dir.workdir}`;
|
|
50
|
+
tryCatch(cmd, this.verbose);
|
|
51
|
+
}
|
|
52
|
+
if (!fs.existsSync(this.settings.work_dir.merged)) {
|
|
53
|
+
cmd = `mkdir -p ${this.settings.work_dir.merged}`;
|
|
54
|
+
tryCatch(cmd, this.verbose);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creo le directory di destinazione per boot, efi, isolinux e live
|
|
58
|
+
*/
|
|
59
|
+
if (!fs.existsSync(this.settings.iso_work)) {
|
|
60
|
+
cmd = `mkdir -p ${this.settings.iso_work}boot/grub/${Utils.uefiFormat()}`;
|
|
61
|
+
tryCatch(cmd, this.verbose);
|
|
62
|
+
cmd = `mkdir -p ${this.settings.iso_work}isolinux`;
|
|
63
|
+
tryCatch(cmd, this.verbose);
|
|
64
|
+
cmd = `mkdir -p ${this.settings.iso_work}live`;
|
|
65
|
+
tryCatch(cmd, this.verbose);
|
|
66
|
+
}
|
|
67
|
+
// ln iso
|
|
68
|
+
cmd = `ln -s ${this.settings.iso_work} ${this.settings.config.snapshot_dir}/iso`;
|
|
69
|
+
tryCatch(cmd, this.verbose);
|
|
70
|
+
// ln livefs
|
|
71
|
+
cmd = `ln -s ${this.settings.work_dir.merged} ${this.settings.config.snapshot_dir}/livefs`;
|
|
72
|
+
tryCatch(cmd, this.verbose);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param cmd
|
|
77
|
+
*/
|
|
78
|
+
async function tryCatch(cmd = '', verbose = false) {
|
|
79
|
+
try {
|
|
80
|
+
let echo = Utils.setEcho(verbose);
|
|
81
|
+
if (verbose) {
|
|
82
|
+
console.log(cmd);
|
|
83
|
+
}
|
|
84
|
+
await exec(cmd, echo);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.log(`Error: ${error}`);
|
|
88
|
+
await Utils.pressKeyToExit(cmd);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/produce.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
import Ovary from './../ovary.js';
|
|
9
|
+
/**
|
|
10
|
+
* makeDotDisk
|
|
11
|
+
*/
|
|
12
|
+
export declare function makeDotDisk(this: Ovary, info?: string, mksquashfs?: string, mkisofs?: string): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./src/classes/ovary.d/produce.ts
|
|
3
|
+
* penguins-eggs v.10.0.0 / ecmascript 2020
|
|
4
|
+
* author: Piero Proietti
|
|
5
|
+
* email: piero.proietti@gmail.com
|
|
6
|
+
* license: MIT
|
|
7
|
+
*/
|
|
8
|
+
// packages
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import shx from 'shelljs';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
// interfaces
|
|
13
|
+
// libraries
|
|
14
|
+
// classes
|
|
15
|
+
import Utils from './../utils.js';
|
|
16
|
+
// _dirname
|
|
17
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
18
|
+
/**
|
|
19
|
+
* makeDotDisk
|
|
20
|
+
*/
|
|
21
|
+
export function makeDotDisk(info = '', mksquashfs = '', mkisofs = '') {
|
|
22
|
+
if (this.verbose) {
|
|
23
|
+
console.log('Ovary: makeDotDisk');
|
|
24
|
+
}
|
|
25
|
+
const dotDisk = this.settings.iso_work + '.disk';
|
|
26
|
+
if (fs.existsSync(dotDisk)) {
|
|
27
|
+
shx.rm('-rf', dotDisk);
|
|
28
|
+
}
|
|
29
|
+
shx.mkdir('-p', dotDisk);
|
|
30
|
+
let text = `# Created at: ${Utils.formatDate(new Date())}\n`;
|
|
31
|
+
text += `# penguins_eggs v. ${Utils.getPackageVersion()}\n`;
|
|
32
|
+
// .disk/info
|
|
33
|
+
fs.writeFileSync(dotDisk + '/info', text, 'utf-8');
|
|
34
|
+
shx.mkdir('-p', path.join(dotDisk, 'id'));
|
|
35
|
+
fs.writeFileSync(path.join(dotDisk, '/id', this.uuid), this.uuid, 'utf-8');
|
|
36
|
+
// .disk/mksquashfs
|
|
37
|
+
fs.writeFileSync(dotDisk + '/mksquashfs', text + mksquashfs, 'utf-8');
|
|
38
|
+
// .disk/mkisofs
|
|
39
|
+
fs.writeFileSync(dotDisk + '/mkisofs', text + mkisofs, 'utf-8');
|
|
40
|
+
}
|