penguins-eggs 9.0.2 → 9.0.25
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/README.md +123 -25
- package/addons/eggs/theme/calamares/branding/show.qml +1 -1
- package/addons/eggs/theme/livecd/README.md +13 -15
- package/addons/eggs/theme/livecd/grub.theme.cfg +12 -15
- package/addons/eggs/theme/livecd/splash.png +0 -0
- package/addons/neon/theme/livecd/grub.theme.cfg +12 -15
- package/addons/neon/theme/livecd/splash.png +0 -0
- package/addons/templates/grub.template +30 -0
- package/addons/{neon/theme/livecd/isolinux.template.cfg → templates/isolinux.template} +7 -7
- package/addons/{blissos → waydroid}/theme/applications/install-debian.desktop +0 -0
- package/addons/{blissos → waydroid}/theme/artwork/install-debian.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/branding.desc +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/languages.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/show.qml +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/slide1.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/slide2.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/slide3.png +0 -0
- package/addons/{blissos/theme/calamares/branding/blissos-logo.png → waydroid/theme/calamares/branding/waydroid-logo.png} +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/branding/welcome.png +0 -0
- package/addons/{blissos → waydroid}/theme/calamares/modules/partition.yml +0 -0
- package/addons/{guadalinex/theme/livecd/isolinux.theme.cfg → waydroid/theme/livecd/grub.theme.cfg} +9 -8
- package/addons/{debian → waydroid}/theme/livecd/isolinux.theme.cfg +1 -1
- package/addons/{blissos → waydroid}/theme/livecd/splash.png +0 -0
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +1 -1
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.working.sh +1 -1
- package/conf/distros/jessie/krill/krill-modules/sources-yolk/sources-yolk.sh +1 -1
- package/conf/eggs.yaml +2 -2
- package/conf/exclude.list +10 -3
- package/lib/classes/daddy.js +6 -0
- package/lib/classes/distro.js +26 -1
- package/lib/classes/family/archlinux.js +2 -1
- package/lib/classes/incubation/incubator.js +5 -0
- package/lib/classes/krill_install.d.ts +52 -29
- package/lib/classes/krill_install.js +471 -199
- package/lib/classes/krill_prepare.d.ts +11 -3
- package/lib/classes/krill_prepare.js +41 -7
- package/lib/classes/ovary.d.ts +5 -14
- package/lib/classes/ovary.js +166 -179
- package/lib/classes/pacman.js +10 -4
- package/lib/classes/settings.js +1 -1
- package/lib/classes/users.d.ts +21 -0
- package/lib/classes/users.js +129 -0
- package/lib/classes/utils.d.ts +1 -1
- package/lib/classes/utils.js +1 -1
- package/lib/classes/xdg.js +21 -4
- package/lib/classes/yolk.js +2 -2
- package/lib/commands/analyze.d.ts +25 -0
- package/lib/commands/analyze.js +74 -0
- package/lib/commands/export/iso.js +1 -1
- package/lib/commands/install.d.ts +2 -0
- package/lib/commands/install.js +19 -3
- package/lib/commands/kill.js +1 -1
- package/lib/commands/produce.js +7 -2
- package/lib/commands/syncfrom.d.ts +37 -0
- package/lib/commands/syncfrom.js +156 -0
- package/lib/commands/syncto.d.ts +48 -0
- package/lib/commands/syncto.js +219 -0
- package/lib/commands/tools/yolk.js +1 -1
- package/lib/components/partitions.js +0 -1
- package/lib/interfaces/i-analyze.d.ts +13 -0
- package/lib/interfaces/i-analyze.js +18 -0
- package/lib/interfaces/i-devices.d.ts +1 -0
- package/lib/lib/cli-autologin.js +8 -3
- package/lib/lib/get_password.js +1 -0
- package/lib/lib/select_installation_mode.js +1 -1
- package/manpages/doc/man/eggs.html +567 -0
- package/manpages/doc/man/eggs.roll.gz +0 -0
- package/oclif.manifest.json +1 -1
- package/package.json +21 -20
- package/scripts/_eggs +276 -0
- package/scripts/eggs.bash +5 -2
- package/scripts/mom-cli.sh +6 -5
- package/scripts/{not-used/pve-live.sh → pve-live.sh} +0 -0
- package/addons/blissos/theme/livecd/README.md +0 -23
- package/addons/blissos/theme/livecd/grub.template.cfg +0 -34
- package/addons/blissos/theme/livecd/grub.theme.cfg +0 -46
- package/addons/blissos/theme/livecd/isolinux.template.cfg +0 -29
- package/addons/blissos/theme/livecd/isolinux.theme.cfg +0 -45
- package/addons/debian/theme/README.md +0 -23
- package/addons/debian/theme/applications/install-debian.desktop +0 -13
- package/addons/debian/theme/artwork/install-debian.png +0 -0
- package/addons/debian/theme/calamares/branding/branding.desc +0 -27
- package/addons/debian/theme/calamares/branding/debian-logo.png +0 -0
- package/addons/debian/theme/calamares/branding/show.qml +0 -51
- package/addons/debian/theme/calamares/branding/slide1.png +0 -0
- package/addons/debian/theme/calamares/branding/welcome.png +0 -0
- package/addons/debian/theme/calamares/modules/partition.yml +0 -233
- package/addons/debian/theme/livecd/README.md +0 -23
- package/addons/debian/theme/livecd/grub.template.cfg +0 -34
- package/addons/debian/theme/livecd/grub.theme.cfg +0 -46
- package/addons/debian/theme/livecd/isolinux.template.cfg +0 -30
- package/addons/debian/theme/livecd/splash.png +0 -0
- package/addons/deblinux/theme/README.md +0 -23
- package/addons/deblinux/theme/applications/install-debian.desktop +0 -13
- package/addons/deblinux/theme/artwork/install-debian.png +0 -0
- package/addons/deblinux/theme/calamares/branding/branding.desc +0 -23
- package/addons/deblinux/theme/calamares/branding/deblinux-logo.png +0 -0
- package/addons/deblinux/theme/calamares/branding/show.qml +0 -46
- package/addons/deblinux/theme/calamares/branding/slide1.png +0 -0
- package/addons/deblinux/theme/calamares/branding/welcome.png +0 -0
- package/addons/deblinux/theme/calamares/modules/partition.yml +0 -233
- package/addons/eggs/theme/calamares/branding/4tation.png +0 -0
- package/addons/eggs/theme/livecd/grub.template.cfg +0 -34
- package/addons/eggs/theme/livecd/isolinux.template.cfg +0 -29
- package/addons/guadalinex/theme/README.md +0 -9
- package/addons/guadalinex/theme/applications/install-debian.desktop +0 -28
- package/addons/guadalinex/theme/artwork/install-debian.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/branding.desc +0 -1
- package/addons/guadalinex/theme/calamares/branding/guadalinex-logo.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/show.qml +0 -85
- package/addons/guadalinex/theme/calamares/branding/slide1.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide2.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide3.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide4.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide5.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide6.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/slide7.png +0 -0
- package/addons/guadalinex/theme/calamares/branding/welcome.png +0 -0
- package/addons/guadalinex/theme/calamares/modules/partition.yml +0 -233
- package/addons/guadalinex/theme/livecd/README.md +0 -23
- package/addons/guadalinex/theme/livecd/isolinux.template.cfg +0 -63
- package/addons/guadalinex/theme/livecd/splash.png +0 -0
- package/addons/neon/theme/livecd/README.md +0 -23
- package/addons/neon/theme/livecd/grub.template.cfg +0 -34
- package/addons/neon/theme/livecd/splash.pcx +0 -0
- package/addons/openos/theme/applications/Install-OpenOS-Neon_RLTS-Desktop.png +0 -0
- package/addons/openos/theme/applications/install-debian.desktop +0 -24
- package/addons/openos/theme/artwork/install-debian.png +0 -0
- package/addons/openos/theme/calamares/branding/branding.desc +0 -28
- package/addons/openos/theme/calamares/branding/openos-logo.png +0 -0
- package/addons/openos/theme/calamares/branding/show.qml +0 -203
- package/addons/openos/theme/calamares/branding/slide1.png +0 -0
- package/addons/openos/theme/calamares/branding/slide10.png +0 -0
- package/addons/openos/theme/calamares/branding/slide11.png +0 -0
- package/addons/openos/theme/calamares/branding/slide12.png +0 -0
- package/addons/openos/theme/calamares/branding/slide13.png +0 -0
- package/addons/openos/theme/calamares/branding/slide14.png +0 -0
- package/addons/openos/theme/calamares/branding/slide15.png +0 -0
- package/addons/openos/theme/calamares/branding/slide16.png +0 -0
- package/addons/openos/theme/calamares/branding/slide2.png +0 -0
- package/addons/openos/theme/calamares/branding/slide3.png +0 -0
- package/addons/openos/theme/calamares/branding/slide4.png +0 -0
- package/addons/openos/theme/calamares/branding/slide5.png +0 -0
- package/addons/openos/theme/calamares/branding/slide6.png +0 -0
- package/addons/openos/theme/calamares/branding/slide7.png +0 -0
- package/addons/openos/theme/calamares/branding/slide8.png +0 -0
- package/addons/openos/theme/calamares/branding/slide9.png +0 -0
- package/addons/openos/theme/calamares/branding/welcome.png +0 -0
- package/addons/openos/theme/calamares/branding.desc +0 -24
- package/addons/openos/theme/calamares/lang/calamares-default_ar.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_en.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_eo.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_fr.qm +0 -0
- package/addons/openos/theme/calamares/lang/calamares-default_nl.qm +0 -0
- package/addons/openos/theme/calamares/modules/partition.yml +0 -233
- package/addons/openos/theme/livecd/README.md +0 -23
- package/addons/openos/theme/livecd/grub.template.cfg +0 -60
- package/addons/openos/theme/livecd/grub.theme.cfg +0 -42
- package/addons/openos/theme/livecd/isolinux.template.cfg +0 -62
- package/addons/openos/theme/livecd/isolinux.theme.cfg +0 -45
- package/addons/openos/theme/livecd/splash.png +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
5
|
+
const utils_1 = require("../lib/utils");
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class Users {
|
|
10
|
+
constructor(login, password, uid, gid, gecos, home, shell) {
|
|
11
|
+
this.login = login;
|
|
12
|
+
this.password = password;
|
|
13
|
+
this.uid = uid;
|
|
14
|
+
this.gid = gid;
|
|
15
|
+
this.gecos = gecos;
|
|
16
|
+
this.home = home;
|
|
17
|
+
this.shell = shell;
|
|
18
|
+
this.size = 0;
|
|
19
|
+
this.hasHome = false;
|
|
20
|
+
this.saveIt = false;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* getSize
|
|
24
|
+
* @param verbose
|
|
25
|
+
*/
|
|
26
|
+
async getValues() {
|
|
27
|
+
let fLevels = [
|
|
28
|
+
{ path: 'bin', saveIt: false },
|
|
29
|
+
{ path: 'boot', saveIt: false },
|
|
30
|
+
{ path: 'dev', saveIt: false },
|
|
31
|
+
{ path: 'etc', saveIt: false },
|
|
32
|
+
{ path: 'lib', saveIt: false },
|
|
33
|
+
{ path: 'lib32,', saveIt: false },
|
|
34
|
+
{ path: 'libx32', saveIt: false },
|
|
35
|
+
{ path: 'lib64', saveIt: false },
|
|
36
|
+
{ path: 'home', saveIt: true },
|
|
37
|
+
{ path: 'media', saveIt: false },
|
|
38
|
+
{ path: 'mnt', saveIt: false },
|
|
39
|
+
{ path: 'opt', saveIt: true },
|
|
40
|
+
{ path: 'proc', saveIt: false },
|
|
41
|
+
{ path: 'root', saveIt: false },
|
|
42
|
+
{ path: 'run', saveIt: false },
|
|
43
|
+
{ path: 'sbin', saveIt: false },
|
|
44
|
+
{ path: 'sys', saveIt: false },
|
|
45
|
+
{ path: 'srv', saveIt: true },
|
|
46
|
+
{ path: 'tmp', saveIt: false },
|
|
47
|
+
{ path: 'usr', saveIt: true },
|
|
48
|
+
{ path: 'var', saveIt: true }
|
|
49
|
+
];
|
|
50
|
+
let hasHome = false;
|
|
51
|
+
let saveIt = false;
|
|
52
|
+
let size = 0;
|
|
53
|
+
if (this.home != undefined) {
|
|
54
|
+
/**
|
|
55
|
+
* analyze firstLevel and
|
|
56
|
+
* excluded to be saved
|
|
57
|
+
*/
|
|
58
|
+
let fLevel = this.home.split('/')[1];
|
|
59
|
+
for (let i = 0; i < fLevels.length; i++) {
|
|
60
|
+
if (fLevels[i].path === fLevel) {
|
|
61
|
+
saveIt = fLevels[i].saveIt;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* analize second level
|
|
66
|
+
* examples: /var/run, /var/cache, /var/spool, etc
|
|
67
|
+
*/
|
|
68
|
+
if (saveIt) {
|
|
69
|
+
let sLevel = this.home.split('/')[2];
|
|
70
|
+
if (sLevel === 'cache' || sLevel === 'run' || sLevel === 'spool') {
|
|
71
|
+
saveIt = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* exclude to save if home don't exist
|
|
76
|
+
*/
|
|
77
|
+
if (!fs_1.default.existsSync(this.home)) {
|
|
78
|
+
saveIt = false;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* others motivations to exclude
|
|
82
|
+
*/
|
|
83
|
+
if (saveIt) {
|
|
84
|
+
switch (this.home) {
|
|
85
|
+
/**
|
|
86
|
+
* exclude always /
|
|
87
|
+
*/
|
|
88
|
+
case '/':
|
|
89
|
+
{
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* excludes: under /usr
|
|
94
|
+
*/
|
|
95
|
+
case '/usr/bin':
|
|
96
|
+
case '/usr/sbin': {
|
|
97
|
+
saveIt = false;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* excludes: under var
|
|
102
|
+
*/
|
|
103
|
+
case '/var/backups':
|
|
104
|
+
case '/var/lib/colord':
|
|
105
|
+
case '/var/lib/geoclue':
|
|
106
|
+
case '/var/lib/misc':
|
|
107
|
+
case '/var/mail':
|
|
108
|
+
{
|
|
109
|
+
saveIt = false;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
default: {
|
|
113
|
+
if (fs_1.default.existsSync(this.home)) {
|
|
114
|
+
hasHome = true;
|
|
115
|
+
const sizeUser = await (0, utils_1.exec)(` du --block-size=1 --summarize ${this.home} | awk '{print $1}'`, { echo: false, ignore: false, capture: true });
|
|
116
|
+
size = Number.parseInt(sizeUser.data);
|
|
117
|
+
}
|
|
118
|
+
saveIt = true;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this.saveIt = saveIt;
|
|
124
|
+
this.size = size;
|
|
125
|
+
this.hasHome = hasHome;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.default = Users;
|
package/lib/classes/utils.d.ts
CHANGED
package/lib/classes/utils.js
CHANGED
package/lib/classes/xdg.js
CHANGED
|
@@ -84,7 +84,14 @@ class Xdg {
|
|
|
84
84
|
}
|
|
85
85
|
// lightdm
|
|
86
86
|
if (pacman_1.default.packageIsInstalled('lightdm')) {
|
|
87
|
-
|
|
87
|
+
if (node_fs_1.default.existsSync(`${chroot}/etc/lightdm/lightdm.conf`)) {
|
|
88
|
+
shelljs_1.default.sed('-i', `autologin-user=${olduser}`, `autologin-user=${newuser}`, `${chroot}/etc/lightdm/lightdm.conf`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const autologin = `${chroot}/etc/lightdm/lightdm.conf`;
|
|
92
|
+
const content = `[Seat:*]\nautologin-user=${newuser}`;
|
|
93
|
+
node_fs_1.default.writeFileSync(autologin, content, 'utf-8');
|
|
94
|
+
}
|
|
88
95
|
}
|
|
89
96
|
// sddm
|
|
90
97
|
if (pacman_1.default.packageIsInstalled('sddm')) {
|
|
@@ -111,10 +118,20 @@ class Xdg {
|
|
|
111
118
|
}
|
|
112
119
|
}
|
|
113
120
|
}
|
|
114
|
-
// gdm3
|
|
121
|
+
// gdm3 in ubuntu, gdm in manjaro
|
|
115
122
|
if (pacman_1.default.packageIsInstalled('gdm3')) {
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
const gdm3Custom = `${chroot}/etc/gdm3/custom.conf`;
|
|
124
|
+
if (node_fs_1.default.existsSync(gdm3Custom)) {
|
|
125
|
+
shelljs_1.default.sed('-i', 'AutomaticLoginEnable=False', 'AutomaticLoginEnable=True', gdm3Custom);
|
|
126
|
+
shelljs_1.default.sed('-i', `AutomaticLogin=${olduser}`, `AutomaticLogin=${newuser}`, gdm3Custom);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (pacman_1.default.packageIsInstalled('gdm')) {
|
|
130
|
+
const gdmCustom = `${chroot}/etc/gdm/custom.conf`;
|
|
131
|
+
if (node_fs_1.default.existsSync(gdmCustom)) {
|
|
132
|
+
shelljs_1.default.sed('-i', 'AutomaticLoginEnable=False', 'AutomaticLoginEnable=True', gdmCustom);
|
|
133
|
+
shelljs_1.default.sed('-i', `AutomaticLogin=${olduser}`, `AutomaticLogin=${newuser}`, gdmCustom);
|
|
134
|
+
}
|
|
118
135
|
}
|
|
119
136
|
}
|
|
120
137
|
}
|
package/lib/classes/yolk.js
CHANGED
|
@@ -28,7 +28,7 @@ class Yolk {
|
|
|
28
28
|
/**
|
|
29
29
|
* riga apt
|
|
30
30
|
*
|
|
31
|
-
* deb [trusted=yes] file:/
|
|
31
|
+
* deb [trusted=yes] file:/var/local/yolk ./
|
|
32
32
|
*
|
|
33
33
|
*/
|
|
34
34
|
utils_1.default.warning('updating system...');
|
|
@@ -114,7 +114,7 @@ class Yolk {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
// e li vado a scaricare in /
|
|
117
|
+
// e li vado a scaricare in /var/local/yolk
|
|
118
118
|
for (const toDownload of toDownloads) {
|
|
119
119
|
process.chdir(this.dir);
|
|
120
120
|
const cmd = `apt-get download ${toDownload}`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* penguins-eggs-v7 based on Debian live
|
|
3
|
+
* author: Piero Proietti
|
|
4
|
+
* email: piero.proietti@gmail.com
|
|
5
|
+
* license: MIT
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from '@oclif/core';
|
|
8
|
+
import { IWorkDir } from '../interfaces/i-workdir';
|
|
9
|
+
import Users from '../classes/users';
|
|
10
|
+
export default class Analyze extends Command {
|
|
11
|
+
config_file: string;
|
|
12
|
+
snapshot_dir: string;
|
|
13
|
+
work_dir: IWorkDir;
|
|
14
|
+
static description: string;
|
|
15
|
+
static flags: {
|
|
16
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
17
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
static examples: string[];
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* fill
|
|
23
|
+
*/
|
|
24
|
+
fill(): Promise<Users[]>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/**
|
|
5
|
+
* penguins-eggs-v7 based on Debian live
|
|
6
|
+
* author: Piero Proietti
|
|
7
|
+
* email: piero.proietti@gmail.com
|
|
8
|
+
* license: MIT
|
|
9
|
+
*/
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const utils_1 = (0, tslib_1.__importDefault)(require("../classes/utils"));
|
|
13
|
+
const promises_1 = require("fs/promises");
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const users_1 = (0, tslib_1.__importDefault)(require("../classes/users"));
|
|
16
|
+
class Analyze extends core_1.Command {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.config_file = '/etc/penguins-eggs.d/eggs.yaml';
|
|
20
|
+
this.snapshot_dir = '';
|
|
21
|
+
this.work_dir = {};
|
|
22
|
+
}
|
|
23
|
+
async run() {
|
|
24
|
+
utils_1.default.titles(this.id + ' ' + this.argv);
|
|
25
|
+
const { flags } = await this.parse(Analyze);
|
|
26
|
+
let verbose = false;
|
|
27
|
+
if (flags.verbose) {
|
|
28
|
+
verbose = true;
|
|
29
|
+
}
|
|
30
|
+
const echo = utils_1.default.setEcho(verbose);
|
|
31
|
+
let totalSize = 0;
|
|
32
|
+
if (utils_1.default.isRoot(this.id)) {
|
|
33
|
+
utils_1.default.warning('eggs will analyze your system, to get users and servers data');
|
|
34
|
+
const users = await this.fill();
|
|
35
|
+
for (let i = 0; i < users.length; i++)
|
|
36
|
+
if (users[i].saveIt) {
|
|
37
|
+
console.log(`user: ${users[i].login} \thome: ${users[i].home.padEnd(16)} \tsize: ${utils_1.default.formatBytes(users[i].size)} \tBytes: ${users[i].size} `);
|
|
38
|
+
// console.log(`user: ${users[i].login} \thome: ${users[i].home} \tsize: ${users[i].size}`)
|
|
39
|
+
totalSize += users[i].size;
|
|
40
|
+
}
|
|
41
|
+
console.log(`Total\t\t\t\t\tSize: ${utils_1.default.formatBytes(totalSize)} \tBytes: ${totalSize}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* fill
|
|
46
|
+
*/
|
|
47
|
+
async fill() {
|
|
48
|
+
try {
|
|
49
|
+
const usersArray = [];
|
|
50
|
+
await (0, promises_1.access)('/etc/passwd', fs_1.constants.R_OK | fs_1.constants.W_OK);
|
|
51
|
+
const passwd = fs.readFileSync('/etc/passwd', 'utf-8').split('\n');
|
|
52
|
+
for (let i = 0; i < passwd.length; i++) {
|
|
53
|
+
var line = passwd[i].split(':');
|
|
54
|
+
const users = new users_1.default(line[0], line[1], line[2], line[3], line[4], line[5], line[6]);
|
|
55
|
+
await users.getValues();
|
|
56
|
+
if (users.password !== undefined) {
|
|
57
|
+
usersArray.push(users);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return usersArray;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
console.error("can't read /etc/passwd");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.default = Analyze;
|
|
69
|
+
Analyze.description = 'analyze situation';
|
|
70
|
+
Analyze.flags = {
|
|
71
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
72
|
+
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
|
|
73
|
+
};
|
|
74
|
+
Analyze.examples = ['$ sudo eggs analyze'];
|
|
@@ -16,7 +16,7 @@ class ExportIso extends core_1.Command {
|
|
|
16
16
|
utils_1.default.warning(ExportIso.description);
|
|
17
17
|
await Tu.loadSettings();
|
|
18
18
|
if (flags.backup) {
|
|
19
|
-
Tu.snapshot_name = Tu.snapshot_name.slice(0, 7) === 'egg-of-' ? '
|
|
19
|
+
Tu.snapshot_name = Tu.snapshot_name.slice(0, 7) === 'egg-of-' ? 'egg-eb-' + Tu.snapshot_name.slice(7) : 'backup-' + Tu.snapshot_name;
|
|
20
20
|
}
|
|
21
21
|
let cmd = `ssh root@${Tu.config.remoteHost} rm -rf ${Tu.config.remotePathIso}${Tu.snapshot_name}*`;
|
|
22
22
|
if (flags.clean) {
|
|
@@ -11,6 +11,8 @@ import { Command } from '@oclif/core';
|
|
|
11
11
|
export default class Install extends Command {
|
|
12
12
|
static flags: {
|
|
13
13
|
cli: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
crypted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
pve: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
16
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
15
17
|
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
18
|
};
|
package/lib/commands/install.js
CHANGED
|
@@ -23,22 +23,36 @@ class Install extends core_1.Command {
|
|
|
23
23
|
async run() {
|
|
24
24
|
utils_1.default.titles(this.id + ' ' + this.argv);
|
|
25
25
|
const { flags } = await this.parse(Install);
|
|
26
|
+
let cli = false;
|
|
27
|
+
if (flags.cli) {
|
|
28
|
+
cli = true;
|
|
29
|
+
}
|
|
30
|
+
let crypted = false;
|
|
31
|
+
if (flags.crypted) {
|
|
32
|
+
crypted = true;
|
|
33
|
+
}
|
|
34
|
+
let pve = false;
|
|
35
|
+
if (flags.pve) {
|
|
36
|
+
pve = true;
|
|
37
|
+
crypted = false;
|
|
38
|
+
cli = true;
|
|
39
|
+
}
|
|
26
40
|
let verbose = false;
|
|
27
41
|
if (flags.verbose) {
|
|
28
42
|
verbose = true;
|
|
29
43
|
}
|
|
30
44
|
if (utils_1.default.isRoot(this.id)) {
|
|
31
45
|
if (utils_1.default.isLive()) {
|
|
32
|
-
if (pacman_1.default.packageIsInstalled('calamares') && pacman_1.default.isRunningGui() && !
|
|
46
|
+
if (pacman_1.default.packageIsInstalled('calamares') && pacman_1.default.isRunningGui() && !cli) {
|
|
33
47
|
shelljs_1.default.exec('/usb/sbin/install-debian');
|
|
34
48
|
}
|
|
35
|
-
else if (pacman_1.default.packageIsInstalled('calamares') && !
|
|
49
|
+
else if (pacman_1.default.packageIsInstalled('calamares') && !cli) {
|
|
36
50
|
utils_1.default.warning('Calamares installer is present, start GUI and choose calamares to install the system');
|
|
37
51
|
utils_1.default.warning('If you still want to use krill, type: ' + chalk_1.default.bold('sudo eggs install --cli'));
|
|
38
52
|
}
|
|
39
53
|
else {
|
|
40
54
|
const krill = new krill_prepare_1.default();
|
|
41
|
-
await krill.prepare();
|
|
55
|
+
await krill.prepare(crypted, pve, verbose);
|
|
42
56
|
}
|
|
43
57
|
}
|
|
44
58
|
}
|
|
@@ -50,6 +64,8 @@ class Install extends core_1.Command {
|
|
|
50
64
|
exports.default = Install;
|
|
51
65
|
Install.flags = {
|
|
52
66
|
cli: core_1.Flags.boolean({ char: 'c', description: 'force use CLI installer' }),
|
|
67
|
+
crypted: core_1.Flags.boolean({ char: 'k', description: 'crypted CLI installation' }),
|
|
68
|
+
pve: core_1.Flags.boolean({ char: 'p', description: 'Proxmox VE install' }),
|
|
53
69
|
help: core_1.Flags.help({ char: 'h' }),
|
|
54
70
|
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
|
|
55
71
|
};
|
package/lib/commands/kill.js
CHANGED
|
@@ -32,7 +32,7 @@ class Kill extends core_1.Command {
|
|
|
32
32
|
await settings.load();
|
|
33
33
|
await settings.listFreeSpace();
|
|
34
34
|
if (await utils_1.default.customConfirm()) {
|
|
35
|
-
await (0, utils_2.exec)(`rm ${settings.work_dir.path} -rf`, echo);
|
|
35
|
+
await (0, utils_2.exec)(`rm ${settings.work_dir.path}/* -rf`, echo);
|
|
36
36
|
await (0, utils_2.exec)(`rm ${settings.config.snapshot_dir} -rf`, echo);
|
|
37
37
|
}
|
|
38
38
|
}
|
package/lib/commands/produce.js
CHANGED
|
@@ -73,7 +73,9 @@ class Produce extends core_1.Command {
|
|
|
73
73
|
else if (compressors.isEnabled.lz4) {
|
|
74
74
|
fastest = 'lz4';
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* jessie e stretch will use gzip for fastest
|
|
78
|
+
*/
|
|
77
79
|
const settings = new settings_1.default();
|
|
78
80
|
if (settings.distro.versionLike === 'jessie' || settings.distro.versionLike === 'stretch') {
|
|
79
81
|
fastest = 'gzip';
|
|
@@ -96,6 +98,9 @@ class Produce extends core_1.Command {
|
|
|
96
98
|
if (release) {
|
|
97
99
|
compression = 'xz -Xbcj x86';
|
|
98
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* theme: if not defined will use eggs
|
|
103
|
+
*/
|
|
99
104
|
let theme = 'eggs';
|
|
100
105
|
if (flags.theme !== undefined) {
|
|
101
106
|
theme = flags.theme;
|
|
@@ -145,7 +150,7 @@ Produce.flags = {
|
|
|
145
150
|
addons: core_1.Flags.string({ multiple: true, description: 'addons to be used: adapt, ichoice, pve, rsupport' }),
|
|
146
151
|
release: core_1.Flags.boolean({ description: 'release: configure GUI installer to remove eggs and calamares after installation' })
|
|
147
152
|
};
|
|
148
|
-
Produce.description = '
|
|
153
|
+
Produce.description = 'produce a live image from your system whithout your data';
|
|
149
154
|
Produce.aliases = ['spawn', 'lay'];
|
|
150
155
|
Produce.examples = [
|
|
151
156
|
'$ sudo eggs produce \nproduce an ISO called [hostname]-[arch]-YYYY-MM-DD_HHMM.iso, compressed xz (standard compression).\nIf hostname=ugo and arch=i386 ugo-x86-2020-08-25_1215.iso\n',
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* penguins-eggs-v9
|
|
3
|
+
* author: Piero Proietti
|
|
4
|
+
* email: piero.proietti@gmail.com
|
|
5
|
+
* license: MIT
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from '@oclif/core';
|
|
8
|
+
export default class Syncfrom extends Command {
|
|
9
|
+
luksName: string;
|
|
10
|
+
luksFile: string;
|
|
11
|
+
luksDevice: string;
|
|
12
|
+
luksMountpoint: string;
|
|
13
|
+
rootDir: string;
|
|
14
|
+
static description: string;
|
|
15
|
+
static flags: {
|
|
16
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
17
|
+
rootdir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
18
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
19
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
};
|
|
21
|
+
static aliases: string[];
|
|
22
|
+
static examples: string[];
|
|
23
|
+
run(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param verbose
|
|
27
|
+
*/
|
|
28
|
+
private restorePrivateData;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
luksOpen(verbose?: boolean): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
luksClose(verbose?: boolean): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/**
|
|
5
|
+
* penguins-eggs-v9
|
|
6
|
+
* author: Piero Proietti
|
|
7
|
+
* email: piero.proietti@gmail.com
|
|
8
|
+
* license: MIT
|
|
9
|
+
*/
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const utils_1 = (0, tslib_1.__importDefault)(require("../classes/utils"));
|
|
14
|
+
const utils_2 = require("../lib/utils");
|
|
15
|
+
class Syncfrom extends core_1.Command {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.luksName = 'luks-eggs-backup';
|
|
19
|
+
this.luksFile = `/run/live/medium/live/${this.luksName}`;
|
|
20
|
+
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
21
|
+
this.luksMountpoint = '/tmp/eggs-backup';
|
|
22
|
+
this.rootDir = '';
|
|
23
|
+
}
|
|
24
|
+
async run() {
|
|
25
|
+
const { flags } = await this.parse(Syncfrom);
|
|
26
|
+
let verbose = false;
|
|
27
|
+
if (flags.verbose) {
|
|
28
|
+
verbose = true;
|
|
29
|
+
}
|
|
30
|
+
let fileVolume = '';
|
|
31
|
+
if (flags.file) {
|
|
32
|
+
fileVolume = flags.file;
|
|
33
|
+
}
|
|
34
|
+
if (utils_1.default.isLive()) {
|
|
35
|
+
if (flags.rootdir) {
|
|
36
|
+
this.rootDir = flags.rootdir;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
utils_1.default.warning(`Argument --rootdir is mandatory, when running from live! Process will terminate`);
|
|
40
|
+
process.exit();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.rootDir = '/';
|
|
45
|
+
}
|
|
46
|
+
const echo = utils_1.default.setEcho(verbose);
|
|
47
|
+
if (utils_1.default.isRoot(this.id)) {
|
|
48
|
+
if (fileVolume === '') {
|
|
49
|
+
fileVolume = '/run/live/medium/live/luks-eggs-backup';
|
|
50
|
+
}
|
|
51
|
+
if (!utils_1.default.isLive()) {
|
|
52
|
+
/**
|
|
53
|
+
* WORKING FROM INSTALLED
|
|
54
|
+
*/
|
|
55
|
+
if (fs.existsSync(fileVolume)) {
|
|
56
|
+
this.luksName = path.basename(fileVolume);
|
|
57
|
+
this.luksFile = fileVolume;
|
|
58
|
+
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
59
|
+
this.luksMountpoint = '/tmp/eggs-backup';
|
|
60
|
+
await this.restorePrivateData(verbose);
|
|
61
|
+
if (await utils_1.default.customConfirm(`Your system was updated! Press a key to reboot`)) {
|
|
62
|
+
await (0, utils_2.exec)('reboot');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
utils_1.default.warning(`Can't find ${this.luksFile}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
/**
|
|
71
|
+
* WORKING FROM LIVE
|
|
72
|
+
*/
|
|
73
|
+
this.luksName = path.basename(fileVolume);
|
|
74
|
+
this.luksFile = fileVolume;
|
|
75
|
+
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
76
|
+
this.luksMountpoint = '/tmp/eggs-backup';
|
|
77
|
+
await this.restorePrivateData(verbose);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param verbose
|
|
84
|
+
*/
|
|
85
|
+
async restorePrivateData(verbose = false) {
|
|
86
|
+
const echo = utils_1.default.setEcho(verbose);
|
|
87
|
+
if (!fs.existsSync(this.luksMountpoint)) {
|
|
88
|
+
await (0, utils_2.exec)(`mkdir ${this.luksMountpoint}`);
|
|
89
|
+
}
|
|
90
|
+
await this.luksOpen();
|
|
91
|
+
/**
|
|
92
|
+
* ONLY FROM LIVE
|
|
93
|
+
* rm home, subst /etc/passwd, /etc/shadow, /etc/groups
|
|
94
|
+
*/
|
|
95
|
+
if (utils_1.default.isLive()) {
|
|
96
|
+
if (this.rootDir !== '/') {
|
|
97
|
+
utils_1.default.warning('Removing live user on destination system');
|
|
98
|
+
await (0, utils_2.exec)(`rm -rf ${this.rootDir}/home/*`, echo);
|
|
99
|
+
utils_1.default.warning('Restoring accounts');
|
|
100
|
+
await (0, utils_2.exec)(`cp ${this.luksMountpoint}/etc/passwd ${this.rootDir}/etc/`, echo);
|
|
101
|
+
await (0, utils_2.exec)(`cp ${this.luksMountpoint}/etc/shadow ${this.rootDir}/etc/`, echo);
|
|
102
|
+
await (0, utils_2.exec)(`cp ${this.luksMountpoint}/etc/group ${this.rootDir}/etc/`, echo);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
utils_1.default.warning('Restoring backup data');
|
|
106
|
+
await (0, utils_2.exec)(`rsync -a ${this.luksMountpoint}/ROOT/ ${this.rootDir}/`, echo);
|
|
107
|
+
await this.luksClose();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
*/
|
|
112
|
+
async luksOpen(verbose = false) {
|
|
113
|
+
const echo = utils_1.default.setEcho(verbose);
|
|
114
|
+
const echoYes = utils_1.default.setEcho(true); // echoYes serve solo per cryptsetup luksOpen
|
|
115
|
+
if (!fs.existsSync(this.luksDevice)) {
|
|
116
|
+
utils_1.default.warning(`LUKS open volume: ${this.luksName}`);
|
|
117
|
+
await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`, echoYes);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
utils_1.default.warning(`LUKS volume: ${this.luksName} already open`);
|
|
121
|
+
}
|
|
122
|
+
if (!fs.existsSync(this.luksMountpoint)) {
|
|
123
|
+
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}`, echo);
|
|
124
|
+
}
|
|
125
|
+
if (!utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
126
|
+
utils_1.default.warning(`mount volume: ${this.luksDevice} on ${this.luksMountpoint}`);
|
|
127
|
+
await (0, utils_2.exec)(`mount ${this.luksDevice} ${this.luksMountpoint}`, echo);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
utils_1.default.warning(`mount volume: ${this.luksDevice} already mounted on ${this.luksMountpoint}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
136
|
+
async luksClose(verbose = false) {
|
|
137
|
+
const echo = utils_1.default.setEcho(verbose);
|
|
138
|
+
if (utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
139
|
+
await (0, utils_2.exec)(`umount ${this.luksMountpoint}`, echo);
|
|
140
|
+
}
|
|
141
|
+
if (fs.existsSync(this.luksDevice)) {
|
|
142
|
+
utils_1.default.warning(`LUKS close volume: ${this.luksName}`);
|
|
143
|
+
await (0, utils_2.exec)(`cryptsetup luksClose ${this.luksName}`, echo);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.default = Syncfrom;
|
|
148
|
+
Syncfrom.description = 'Restore users, server and datas from luks-eggs-backup';
|
|
149
|
+
Syncfrom.flags = {
|
|
150
|
+
file: core_1.Flags.string({ char: 'f', description: "file with LUKS volume encrypted" }),
|
|
151
|
+
rootdir: core_1.Flags.string({ char: 'r', description: 'rootdir of the installed system, when used from live' }),
|
|
152
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
153
|
+
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
|
|
154
|
+
};
|
|
155
|
+
Syncfrom.aliases = ['restore'];
|
|
156
|
+
Syncfrom.examples = ['$ sudo eggs restore'];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* penguins-eggs-v9
|
|
3
|
+
* author: Piero Proietti
|
|
4
|
+
* email: piero.proietti@gmail.com
|
|
5
|
+
* license: MIT
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from '@oclif/core';
|
|
8
|
+
import Users from '../classes/users';
|
|
9
|
+
export default class Syncto extends Command {
|
|
10
|
+
luksName: string;
|
|
11
|
+
luksFile: string;
|
|
12
|
+
luksDevice: string;
|
|
13
|
+
luksMountpoint: string;
|
|
14
|
+
static description: string;
|
|
15
|
+
static flags: {
|
|
16
|
+
krill: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
18
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
19
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
};
|
|
21
|
+
static aliases: string[];
|
|
22
|
+
static examples: string[];
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
run(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param verbose
|
|
30
|
+
*/
|
|
31
|
+
backup(verbose?: boolean): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* usersFill
|
|
34
|
+
*/
|
|
35
|
+
usersFill(): Promise<Users[]>;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
luksCreate(verbose?: boolean): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
luksOpen(verbose?: boolean): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
luksClose(verbose?: boolean): Promise<void>;
|
|
48
|
+
}
|