penguins-eggs 9.0.25 → 9.0.48
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 +448 -22
- package/addons/telos/theme/applications/install-debian.desktop +28 -0
- package/addons/telos/theme/artwork/install-debian.png +0 -0
- package/addons/telos/theme/calamares/branding/banner.png +0 -0
- package/addons/telos/theme/calamares/branding/branding.desc +25 -0
- package/addons/telos/theme/calamares/branding/show.qml +51 -0
- package/addons/telos/theme/calamares/branding/slide1.png +0 -0
- package/addons/telos/theme/calamares/branding/telos-logo.png +0 -0
- package/addons/telos/theme/calamares/branding/welcome.png +0 -0
- package/addons/telos/theme/calamares/modules/partition.yml +233 -0
- package/addons/telos/theme/livecd/grub.theme.cfg +43 -0
- package/addons/telos/theme/livecd/isolinux.theme.cfg +45 -0
- package/addons/telos/theme/livecd/splash.png +0 -0
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +57 -38
- package/conf/distros/buster/calamares/modules/bootloader.yml +3 -1
- package/conf/eggs.yaml +9 -2
- package/lib/classes/basket.js +4 -4
- package/lib/classes/bleach.js +2 -2
- package/lib/classes/compressors.js +1 -1
- package/lib/classes/daddy.js +13 -13
- package/lib/classes/distro.d.ts +4 -2
- package/lib/classes/distro.js +77 -79
- package/lib/classes/family/archlinux.js +4 -4
- package/lib/classes/family/debian.js +6 -6
- package/lib/classes/family/fedora.js +4 -4
- package/lib/classes/family/suse.js +4 -4
- package/lib/classes/i18n.d.ts +28 -4
- package/lib/classes/i18n.js +112 -84
- package/lib/classes/incubation/branding.js +13 -7
- package/lib/classes/incubation/distros/bionic.js +1 -1
- package/lib/classes/incubation/distros/buster.js +1 -1
- package/lib/classes/incubation/distros/focal.js +1 -1
- package/lib/classes/incubation/distros/jessie.js +1 -1
- package/lib/classes/incubation/distros/rolling.js +1 -1
- package/lib/classes/incubation/fisherman-helper/displaymanager.js +1 -1
- package/lib/classes/incubation/fisherman-helper/packages.js +2 -2
- package/lib/classes/incubation/fisherman.js +5 -5
- package/lib/classes/incubation/incubator.js +5 -5
- package/lib/classes/incubation/installer.d.ts +1 -1
- package/lib/classes/incubation/installer.js +4 -4
- package/lib/classes/initrd.js +2 -2
- package/lib/classes/keyboards.d.ts +45 -0
- package/lib/classes/keyboards.js +196 -0
- package/lib/classes/krill_install.d.ts +12 -1
- package/lib/classes/krill_install.js +300 -312
- package/lib/classes/krill_prepare.d.ts +4 -0
- package/lib/classes/krill_prepare.js +81 -83
- package/lib/classes/locales.d.ts +14 -0
- package/lib/classes/locales.js +54 -0
- package/lib/classes/n8.js +1 -1
- package/lib/classes/ovary.d.ts +27 -27
- package/lib/classes/ovary.js +356 -387
- package/lib/classes/pacman.d.ts +1 -1
- package/lib/classes/pacman.js +40 -40
- package/lib/classes/pve-live.js +12 -16
- package/lib/classes/settings.d.ts +6 -0
- package/lib/classes/settings.js +11 -13
- package/lib/classes/systemctl.d.ts +36 -7
- package/lib/classes/systemctl.js +63 -28
- package/lib/classes/tailor.d.ts +20 -0
- package/lib/classes/tailor.js +460 -0
- package/lib/classes/tools.js +4 -4
- package/lib/classes/users.js +1 -1
- package/lib/classes/utils.d.ts +14 -3
- package/lib/classes/utils.js +75 -28
- package/lib/classes/xdg.js +23 -39
- package/lib/classes/yolk.d.ts +12 -10
- package/lib/classes/yolk.js +54 -56
- package/lib/commands/adapt.js +1 -1
- package/lib/commands/analyze.js +2 -2
- package/lib/commands/bro.js +2 -2
- package/lib/commands/calamares.js +4 -4
- package/lib/commands/config.js +4 -4
- package/lib/commands/dad.js +2 -2
- package/lib/commands/export/deb.js +2 -2
- package/lib/commands/export/docs.js +2 -2
- package/lib/commands/export/iso.js +2 -2
- package/lib/commands/info.js +1 -1
- package/lib/commands/install.js +5 -5
- package/lib/commands/kill.js +2 -2
- package/lib/commands/mom.js +2 -2
- package/lib/commands/produce.js +11 -11
- package/lib/commands/remove.js +2 -2
- package/lib/commands/syncfrom.d.ts +9 -3
- package/lib/commands/syncfrom.js +39 -32
- package/lib/commands/syncto.d.ts +26 -6
- package/lib/commands/syncto.js +73 -50
- package/lib/commands/tools/clean.js +2 -2
- package/lib/commands/tools/locales.js +9 -4
- package/lib/commands/tools/skel.js +2 -2
- package/lib/commands/tools/stat.js +3 -3
- package/lib/commands/tools/yolk.js +4 -4
- package/lib/commands/update.js +5 -5
- package/lib/commands/wardrobe/ironing.d.ts +14 -0
- package/lib/commands/wardrobe/ironing.js +123 -0
- package/lib/commands/wardrobe/list.d.ts +13 -0
- package/lib/commands/wardrobe/list.js +46 -0
- package/lib/commands/wardrobe/show.d.ts +15 -0
- package/lib/commands/wardrobe/show.js +55 -0
- package/lib/commands/wardrobe/wear.d.ts +11 -0
- package/lib/commands/wardrobe/wear.js +42 -0
- package/lib/components/elements/information.js +37 -18
- package/lib/components/elements/steps.js +1 -1
- package/lib/components/elements/title.js +2 -2
- package/lib/components/finished.js +5 -5
- package/lib/components/install.js +5 -5
- package/lib/components/keyboard.js +5 -8
- package/lib/components/location.js +5 -5
- package/lib/components/network.js +5 -5
- package/lib/components/partitions.js +5 -5
- package/lib/components/summary.js +5 -5
- package/lib/components/users.js +5 -5
- package/lib/components/welcome.js +6 -6
- package/lib/interfaces/i-costume.d.ts +43 -0
- package/lib/interfaces/i-costume.js +2 -0
- package/lib/interfaces/i-distro.d.ts +4 -2
- package/lib/interfaces/i-installer.d.ts +1 -1
- package/lib/interfaces/i-krill.d.ts +1 -0
- package/lib/interfaces/i-packages.d.ts +13 -0
- package/lib/interfaces/i-packages.js +2 -0
- package/lib/interfaces/i-xkb-model.d.ts +17 -0
- package/lib/interfaces/i-xkb-model.js +2 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/lib/cli-autologin.js +3 -3
- package/lib/lib/select_address_type.js +1 -1
- package/lib/lib/select_filesystem_type.js +2 -2
- package/lib/lib/select_installation_device.js +2 -1
- package/lib/lib/select_interface.js +1 -1
- package/lib/lib/select_keyboard_layout.d.ts +1 -28
- package/lib/lib/select_keyboard_layout.js +18 -33
- package/lib/lib/select_keyboard_model.d.ts +4 -0
- package/lib/lib/select_keyboard_model.js +36 -0
- package/lib/lib/select_keyboard_option.d.ts +4 -0
- package/lib/lib/select_keyboard_option.js +36 -0
- package/lib/lib/select_keyboard_variant.d.ts +1 -5
- package/lib/lib/select_keyboard_variant.js +32 -5
- package/lib/lib/select_languages.d.ts +1 -1
- package/lib/lib/select_languages.js +8 -7
- package/lib/lib/select_regions.d.ts +1 -1
- package/lib/lib/select_regions.js +2 -2
- package/lib/lib/select_user_swap_choice.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +6 -5
- package/scripts/_eggs +43 -2
- package/scripts/bros/waydroid-helper.sh +1 -1
- package/scripts/eggs.bash +6 -2
- package/scripts/{not-used/install-eggs-ppa.sh → install-eggs-ppa.sh} +1 -0
- package/scripts/mom-cli.sh +1 -1
- package/scripts/pve-live.sh +2 -6
- package/scripts/resy.sh +8 -0
- package/scripts/userexist.sh +6 -0
- package/wardrobe.d/external.yml +7 -0
- package/wardrobe.d/hen/control.template +10 -0
- package/wardrobe.d/hen/index.yml +212 -0
- package/wardrobe.d/kde/index.yml +41 -0
- package/wardrobe.d/lamp/index.yml +35 -0
- package/wardrobe.d/xfce4/index.yml +53 -0
- package/conf/distros/buster/locales/locale.gen.template +0 -10
- package/conf/distros/buster/locales/locale.template +0 -11
- package/conf/distros/focal/locale.gen.template +0 -8
- package/scripts/not-used/eggs-cleanup.sh +0 -7
- package/scripts/not-used/mkinitramfs +0 -469
- package/scripts/update-initramfs +0 -94
package/lib/commands/syncfrom.js
CHANGED
|
@@ -10,40 +10,44 @@ const tslib_1 = require("tslib");
|
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
11
|
const fs = require("fs");
|
|
12
12
|
const path = require("path");
|
|
13
|
-
const utils_1 =
|
|
13
|
+
const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
|
|
14
14
|
const utils_2 = require("../lib/utils");
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
15
18
|
class Syncfrom extends core_1.Command {
|
|
16
19
|
constructor() {
|
|
17
20
|
super(...arguments);
|
|
21
|
+
this.verbose = false;
|
|
22
|
+
this.echo = {};
|
|
23
|
+
this.rootDir = '/';
|
|
18
24
|
this.luksName = 'luks-eggs-backup';
|
|
19
25
|
this.luksFile = `/run/live/medium/live/${this.luksName}`;
|
|
20
26
|
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
21
27
|
this.luksMountpoint = '/tmp/eggs-backup';
|
|
22
|
-
this.rootDir = '';
|
|
23
28
|
}
|
|
24
29
|
async run() {
|
|
25
30
|
const { flags } = await this.parse(Syncfrom);
|
|
26
|
-
let verbose = false;
|
|
27
31
|
if (flags.verbose) {
|
|
28
|
-
verbose = true;
|
|
32
|
+
this.verbose = true;
|
|
29
33
|
}
|
|
34
|
+
this.echo = utils_1.default.setEcho(this.verbose);
|
|
30
35
|
let fileVolume = '';
|
|
31
36
|
if (flags.file) {
|
|
32
37
|
fileVolume = flags.file;
|
|
33
38
|
}
|
|
39
|
+
let destDelete = false;
|
|
40
|
+
if (flags.delete) {
|
|
41
|
+
destDelete = true;
|
|
42
|
+
}
|
|
34
43
|
if (utils_1.default.isLive()) {
|
|
35
44
|
if (flags.rootdir) {
|
|
36
45
|
this.rootDir = flags.rootdir;
|
|
37
46
|
}
|
|
38
47
|
else {
|
|
39
|
-
utils_1.default.
|
|
40
|
-
process.exit();
|
|
48
|
+
utils_1.default.pressKeyToExit(`Argument --rootdir is mandatory, when running live! Process will terminate`);
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
|
-
else {
|
|
44
|
-
this.rootDir = '/';
|
|
45
|
-
}
|
|
46
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
47
51
|
if (utils_1.default.isRoot(this.id)) {
|
|
48
52
|
if (fileVolume === '') {
|
|
49
53
|
fileVolume = '/run/live/medium/live/luks-eggs-backup';
|
|
@@ -57,13 +61,13 @@ class Syncfrom extends core_1.Command {
|
|
|
57
61
|
this.luksFile = fileVolume;
|
|
58
62
|
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
59
63
|
this.luksMountpoint = '/tmp/eggs-backup';
|
|
60
|
-
await this.restorePrivateData(
|
|
64
|
+
await this.restorePrivateData();
|
|
61
65
|
if (await utils_1.default.customConfirm(`Your system was updated! Press a key to reboot`)) {
|
|
62
66
|
await (0, utils_2.exec)('reboot');
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
else {
|
|
66
|
-
utils_1.default.
|
|
70
|
+
utils_1.default.pressKeyToExit(`Can't find ${this.luksFile}`);
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
else {
|
|
@@ -74,7 +78,7 @@ class Syncfrom extends core_1.Command {
|
|
|
74
78
|
this.luksFile = fileVolume;
|
|
75
79
|
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
76
80
|
this.luksMountpoint = '/tmp/eggs-backup';
|
|
77
|
-
await this.restorePrivateData(
|
|
81
|
+
await this.restorePrivateData();
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
}
|
|
@@ -82,10 +86,9 @@ class Syncfrom extends core_1.Command {
|
|
|
82
86
|
*
|
|
83
87
|
* @param verbose
|
|
84
88
|
*/
|
|
85
|
-
async restorePrivateData(
|
|
86
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
89
|
+
async restorePrivateData(destDelete = false) {
|
|
87
90
|
if (!fs.existsSync(this.luksMountpoint)) {
|
|
88
|
-
await (0, utils_2.exec)(`mkdir ${this.luksMountpoint}
|
|
91
|
+
await (0, utils_2.exec)(`mkdir ${this.luksMountpoint}`, this.echo);
|
|
89
92
|
}
|
|
90
93
|
await this.luksOpen();
|
|
91
94
|
/**
|
|
@@ -95,36 +98,38 @@ class Syncfrom extends core_1.Command {
|
|
|
95
98
|
if (utils_1.default.isLive()) {
|
|
96
99
|
if (this.rootDir !== '/') {
|
|
97
100
|
utils_1.default.warning('Removing live user on destination system');
|
|
98
|
-
await (0, utils_2.exec)(`rm -rf ${this.rootDir}/home/*`, echo);
|
|
101
|
+
await (0, utils_2.exec)(`rm -rf ${this.rootDir}/home/*`, this.echo);
|
|
99
102
|
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
|
+
await (0, utils_2.exec)(`cp ${this.luksMountpoint}/etc/passwd ${this.rootDir}/etc/`, this.echo);
|
|
104
|
+
await (0, utils_2.exec)(`cp ${this.luksMountpoint}/etc/shadow ${this.rootDir}/etc/`, this.echo);
|
|
105
|
+
await (0, utils_2.exec)(`cp ${this.luksMountpoint}/etc/group ${this.rootDir}/etc/`, this.echo);
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
utils_1.default.warning('Restoring backup data');
|
|
106
|
-
|
|
109
|
+
let cmd = `rsync -a ${this.luksMountpoint}/ROOT/ ${this.rootDir}/`;
|
|
110
|
+
if (destDelete) {
|
|
111
|
+
cmd = `rsync --archive --delete ${this.luksMountpoint}/ROOT/ ${this.rootDir}/`;
|
|
112
|
+
}
|
|
113
|
+
await (0, utils_2.exec)(cmd, this.echo);
|
|
107
114
|
await this.luksClose();
|
|
108
115
|
}
|
|
109
116
|
/**
|
|
110
117
|
*
|
|
111
118
|
*/
|
|
112
|
-
async luksOpen(
|
|
113
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
114
|
-
const echoYes = utils_1.default.setEcho(true); // echoYes serve solo per cryptsetup luksOpen
|
|
119
|
+
async luksOpen() {
|
|
115
120
|
if (!fs.existsSync(this.luksDevice)) {
|
|
116
121
|
utils_1.default.warning(`LUKS open volume: ${this.luksName}`);
|
|
117
|
-
await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`,
|
|
122
|
+
await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`, utils_1.default.setEcho(true));
|
|
118
123
|
}
|
|
119
124
|
else {
|
|
120
125
|
utils_1.default.warning(`LUKS volume: ${this.luksName} already open`);
|
|
121
126
|
}
|
|
122
127
|
if (!fs.existsSync(this.luksMountpoint)) {
|
|
123
|
-
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}`, echo);
|
|
128
|
+
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}`, this.echo);
|
|
124
129
|
}
|
|
125
130
|
if (!utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
126
131
|
utils_1.default.warning(`mount volume: ${this.luksDevice} on ${this.luksMountpoint}`);
|
|
127
|
-
await (0, utils_2.exec)(`mount ${this.luksDevice} ${this.luksMountpoint}`, echo);
|
|
132
|
+
await (0, utils_2.exec)(`mount ${this.luksDevice} ${this.luksMountpoint}`, this.echo);
|
|
128
133
|
}
|
|
129
134
|
else {
|
|
130
135
|
utils_1.default.warning(`mount volume: ${this.luksDevice} already mounted on ${this.luksMountpoint}`);
|
|
@@ -133,21 +138,23 @@ class Syncfrom extends core_1.Command {
|
|
|
133
138
|
/**
|
|
134
139
|
*
|
|
135
140
|
*/
|
|
136
|
-
async luksClose(
|
|
137
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
141
|
+
async luksClose() {
|
|
138
142
|
if (utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
139
|
-
await (0, utils_2.exec)(`umount ${this.luksMountpoint}`, echo);
|
|
143
|
+
await (0, utils_2.exec)(`umount ${this.luksMountpoint}`, this.echo);
|
|
140
144
|
}
|
|
141
145
|
if (fs.existsSync(this.luksDevice)) {
|
|
142
146
|
utils_1.default.warning(`LUKS close volume: ${this.luksName}`);
|
|
143
|
-
await (0, utils_2.exec)(`cryptsetup luksClose ${this.luksName}`, echo);
|
|
147
|
+
await (0, utils_2.exec)(`cryptsetup luksClose ${this.luksName}`, this.echo);
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
151
|
exports.default = Syncfrom;
|
|
148
152
|
Syncfrom.description = 'Restore users, server and datas from luks-eggs-backup';
|
|
149
153
|
Syncfrom.flags = {
|
|
150
|
-
|
|
154
|
+
delete: core_1.Flags.string({ description: 'rsync --delete delete extraneous files from dest dirs' }),
|
|
155
|
+
// excludeFrom: Flags.string({ description: 'same as rsync --exclude-from=FILE read exclude patterns from FILE' }),
|
|
156
|
+
// includeFrom: Flags.string({ description: 'same as rsync --include-from=FILE read include patterns from FILE' }),
|
|
157
|
+
file: core_1.Flags.string({ char: 'f', description: "file LUKS volume encrypted" }),
|
|
151
158
|
rootdir: core_1.Flags.string({ char: 'r', description: 'rootdir of the installed system, when used from live' }),
|
|
152
159
|
help: core_1.Flags.help({ char: 'h' }),
|
|
153
160
|
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
|
package/lib/commands/syncto.d.ts
CHANGED
|
@@ -4,16 +4,37 @@
|
|
|
4
4
|
* email: piero.proietti@gmail.com
|
|
5
5
|
* license: MIT
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* syncfrom (restore)
|
|
10
|
+
* --include-from file.list // if only include is provided everything from the list if used to update the system.
|
|
11
|
+
* --exclude-from file-list // it just updates the system
|
|
12
|
+
* --delete
|
|
13
|
+
*
|
|
14
|
+
* If both options are provided then it works as a combination as provided in the link above.
|
|
15
|
+
* https://stackoverflow.com/questions/19296190/rsync-include-from-vs-exclude-from-what-is-the-actual-difference
|
|
16
|
+
*
|
|
17
|
+
* The same logic is applied for the syncto also.
|
|
18
|
+
*
|
|
19
|
+
* On top of all of this the --delete option
|
|
20
|
+
* if needed to be passed so that everything else is removed, but this
|
|
21
|
+
* this should not be available by default
|
|
22
|
+
*/
|
|
7
23
|
import { Command } from '@oclif/core';
|
|
8
24
|
import Users from '../classes/users';
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
9
28
|
export default class Syncto extends Command {
|
|
29
|
+
verbose: boolean;
|
|
30
|
+
echo: {};
|
|
10
31
|
luksName: string;
|
|
11
32
|
luksFile: string;
|
|
12
33
|
luksDevice: string;
|
|
13
34
|
luksMountpoint: string;
|
|
14
35
|
static description: string;
|
|
15
36
|
static flags: {
|
|
16
|
-
|
|
37
|
+
delete: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
17
38
|
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
18
39
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
19
40
|
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -26,9 +47,8 @@ export default class Syncto extends Command {
|
|
|
26
47
|
run(): Promise<void>;
|
|
27
48
|
/**
|
|
28
49
|
*
|
|
29
|
-
* @param verbose
|
|
30
50
|
*/
|
|
31
|
-
backup(
|
|
51
|
+
backup(destDelete?: boolean): Promise<void>;
|
|
32
52
|
/**
|
|
33
53
|
* usersFill
|
|
34
54
|
*/
|
|
@@ -36,13 +56,13 @@ export default class Syncto extends Command {
|
|
|
36
56
|
/**
|
|
37
57
|
*
|
|
38
58
|
*/
|
|
39
|
-
luksCreate(
|
|
59
|
+
luksCreate(): Promise<void>;
|
|
40
60
|
/**
|
|
41
61
|
*
|
|
42
62
|
*/
|
|
43
|
-
luksOpen(
|
|
63
|
+
luksOpen(): Promise<void>;
|
|
44
64
|
/**
|
|
45
65
|
*
|
|
46
66
|
*/
|
|
47
|
-
luksClose(
|
|
67
|
+
luksClose(): Promise<void>;
|
|
48
68
|
}
|
package/lib/commands/syncto.js
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
2
|
/**
|
|
5
3
|
* penguins-eggs-v9
|
|
6
4
|
* author: Piero Proietti
|
|
7
5
|
* email: piero.proietti@gmail.com
|
|
8
6
|
* license: MIT
|
|
9
7
|
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* syncfrom (restore)
|
|
13
|
+
* --include-from file.list // if only include is provided everything from the list if used to update the system.
|
|
14
|
+
* --exclude-from file-list // it just updates the system
|
|
15
|
+
* --delete
|
|
16
|
+
*
|
|
17
|
+
* If both options are provided then it works as a combination as provided in the link above.
|
|
18
|
+
* https://stackoverflow.com/questions/19296190/rsync-include-from-vs-exclude-from-what-is-the-actual-difference
|
|
19
|
+
*
|
|
20
|
+
* The same logic is applied for the syncto also.
|
|
21
|
+
*
|
|
22
|
+
* On top of all of this the --delete option
|
|
23
|
+
* if needed to be passed so that everything else is removed, but this
|
|
24
|
+
* this should not be available by default
|
|
25
|
+
*/
|
|
10
26
|
const core_1 = require("@oclif/core");
|
|
11
27
|
const fs = require("fs");
|
|
12
28
|
const path = require("path");
|
|
13
|
-
const utils_1 =
|
|
29
|
+
const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
|
|
14
30
|
const utils_2 = require("../lib/utils");
|
|
15
31
|
// backup
|
|
16
32
|
const promises_1 = require("fs/promises");
|
|
17
33
|
const fs_1 = require("fs");
|
|
18
|
-
const users_1 =
|
|
34
|
+
const users_1 = tslib_1.__importDefault(require("../classes/users"));
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
19
38
|
class Syncto extends core_1.Command {
|
|
20
39
|
constructor() {
|
|
21
40
|
super(...arguments);
|
|
41
|
+
this.verbose = false;
|
|
42
|
+
this.echo = {};
|
|
22
43
|
this.luksName = 'luks-eggs-backup';
|
|
23
44
|
this.luksFile = `/run/live/medium/live/${this.luksName}`;
|
|
24
45
|
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
@@ -29,15 +50,18 @@ class Syncto extends core_1.Command {
|
|
|
29
50
|
*/
|
|
30
51
|
async run() {
|
|
31
52
|
const { flags } = await this.parse(Syncto);
|
|
32
|
-
let verbose = false;
|
|
33
53
|
if (flags.verbose) {
|
|
34
|
-
verbose = true;
|
|
54
|
+
this.verbose = true;
|
|
35
55
|
}
|
|
56
|
+
this.echo = utils_1.default.setEcho(this.verbose);
|
|
36
57
|
let fileVolume = '';
|
|
37
58
|
if (flags.file) {
|
|
38
59
|
fileVolume = flags.file;
|
|
39
60
|
}
|
|
40
|
-
|
|
61
|
+
let destDelete = false;
|
|
62
|
+
if (flags.delete) {
|
|
63
|
+
destDelete = true;
|
|
64
|
+
}
|
|
41
65
|
if (utils_1.default.isRoot(this.id)) {
|
|
42
66
|
/**
|
|
43
67
|
* restore con file
|
|
@@ -50,44 +74,47 @@ class Syncto extends core_1.Command {
|
|
|
50
74
|
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
51
75
|
this.luksMountpoint = '/tmp/eggs-backup';
|
|
52
76
|
if (!fs.existsSync(fileVolume)) {
|
|
53
|
-
await this.luksCreate(
|
|
77
|
+
await this.luksCreate();
|
|
54
78
|
}
|
|
55
79
|
else {
|
|
56
80
|
utils_1.default.warning(`LUKS volume: ${this.luksFile} exist, don't need create`);
|
|
57
81
|
}
|
|
58
82
|
if (fs.existsSync(fileVolume)) {
|
|
59
|
-
await this.luksOpen(
|
|
60
|
-
await this.backup(
|
|
61
|
-
await this.luksClose(
|
|
83
|
+
await this.luksOpen();
|
|
84
|
+
await this.backup(destDelete);
|
|
85
|
+
await this.luksClose();
|
|
62
86
|
}
|
|
63
87
|
}
|
|
64
88
|
}
|
|
65
89
|
/**
|
|
66
90
|
*
|
|
67
|
-
* @param verbose
|
|
68
91
|
*/
|
|
69
|
-
async backup(
|
|
70
|
-
|
|
71
|
-
if (verbose) {
|
|
92
|
+
async backup(destDelete = false) {
|
|
93
|
+
if (this.verbose) {
|
|
72
94
|
utils_1.default.warning('backup');
|
|
73
95
|
}
|
|
96
|
+
utils_1.default.warning(`Coping users and services data on ${this.luksFile}`);
|
|
74
97
|
const usersArray = await this.usersFill();
|
|
75
98
|
const cmds = [];
|
|
76
99
|
for (let i = 0; i < usersArray.length; i++) {
|
|
77
100
|
if (usersArray[i].saveIt) {
|
|
78
101
|
if (fs.existsSync(usersArray[i].home)) {
|
|
79
|
-
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}/ROOT${usersArray[i].home}`, echo);
|
|
102
|
+
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}/ROOT${usersArray[i].home}`, this.echo);
|
|
80
103
|
const source = usersArray[i].home;
|
|
81
104
|
let dest = this.luksMountpoint + '/ROOT' + usersArray[i].home;
|
|
82
105
|
dest = dest.substring(0, dest.lastIndexOf('/'));
|
|
83
|
-
|
|
106
|
+
let cmd = `rsync --archive ${source} ${dest}`;
|
|
107
|
+
if (destDelete) {
|
|
108
|
+
cmd = `rsync --archive --delete ${source} ${dest}`;
|
|
109
|
+
}
|
|
110
|
+
await (0, utils_2.exec)(cmd, this.echo);
|
|
84
111
|
}
|
|
85
112
|
}
|
|
86
113
|
}
|
|
87
|
-
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}/etc`, echo);
|
|
88
|
-
await (0, utils_2.exec)(`cp /etc/passwd ${this.luksMountpoint}/etc`, echo);
|
|
89
|
-
await (0, utils_2.exec)(`cp /etc/shadow ${this.luksMountpoint}/etc`, echo);
|
|
90
|
-
await (0, utils_2.exec)(`cp /etc/group ${this.luksMountpoint}/etc`, echo);
|
|
114
|
+
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}/etc`, this.echo);
|
|
115
|
+
await (0, utils_2.exec)(`cp /etc/passwd ${this.luksMountpoint}/etc`, this.echo);
|
|
116
|
+
await (0, utils_2.exec)(`cp /etc/shadow ${this.luksMountpoint}/etc`, this.echo);
|
|
117
|
+
await (0, utils_2.exec)(`cp /etc/group ${this.luksMountpoint}/etc`, this.echo);
|
|
91
118
|
}
|
|
92
119
|
/**
|
|
93
120
|
* usersFill
|
|
@@ -109,9 +136,7 @@ class Syncto extends core_1.Command {
|
|
|
109
136
|
/**
|
|
110
137
|
*
|
|
111
138
|
*/
|
|
112
|
-
async luksCreate(
|
|
113
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
114
|
-
const echoYes = utils_1.default.setEcho(true);
|
|
139
|
+
async luksCreate() {
|
|
115
140
|
utils_1.default.warning(`Creating LUKS Volume on ${this.luksFile}`);
|
|
116
141
|
let totalSize = 0;
|
|
117
142
|
console.log(`I will extimate volume size from your private data:`);
|
|
@@ -119,12 +144,16 @@ class Syncto extends core_1.Command {
|
|
|
119
144
|
for (let i = 0; i < users.length; i++) {
|
|
120
145
|
if (users[i].login !== 'root') {
|
|
121
146
|
if (users[i].saveIt) {
|
|
122
|
-
|
|
147
|
+
let utype = 'user ';
|
|
148
|
+
if (parseInt(users[i].uid) < 1000) {
|
|
149
|
+
utype = 'service';
|
|
150
|
+
}
|
|
151
|
+
console.log(`- ${utype}: ${users[i].login.padEnd(16)} \thome: ${users[i].home} \tsize: ${utils_1.default.formatBytes(users[i].size)} \tBytes: ${users[i].size} `);
|
|
123
152
|
totalSize += users[i].size;
|
|
124
153
|
}
|
|
125
154
|
}
|
|
126
155
|
}
|
|
127
|
-
console.log(`Total\t\t\t\t\
|
|
156
|
+
console.log(`Total\t\t\t\t\t\t\tsize: ${utils_1.default.formatBytes(totalSize)} \tBytes: ${totalSize}`);
|
|
128
157
|
/**
|
|
129
158
|
* after we get size, we can start building luks-volume
|
|
130
159
|
*/
|
|
@@ -141,53 +170,48 @@ class Syncto extends core_1.Command {
|
|
|
141
170
|
blocks = Math.ceil(minimunSize / blockSize);
|
|
142
171
|
}
|
|
143
172
|
utils_1.default.warning(`Creating an encrypted file ${this.luksFile} blocks=${blocks}, block size: ${blockSize}, size: ${utils_1.default.formatBytes(blocks * blockSize)}`);
|
|
144
|
-
await (0, utils_2.exec)(`dd if=/dev/zero of=${this.luksFile} bs=${blockSize} count=${blocks}`, echo);
|
|
173
|
+
await (0, utils_2.exec)(`dd if=/dev/zero of=${this.luksFile} bs=${blockSize} count=${blocks}`, this.echo);
|
|
145
174
|
// find first unused device
|
|
146
|
-
let findFirstUnusedDevice = await (0, utils_2.exec)(`losetup -f`, { echo: verbose, ignore: false, capture: true });
|
|
175
|
+
let findFirstUnusedDevice = await (0, utils_2.exec)(`losetup -f`, { echo: this.verbose, ignore: false, capture: true });
|
|
147
176
|
let firstUnusedDevice = '';
|
|
148
177
|
if (findFirstUnusedDevice.code !== 0) {
|
|
149
|
-
utils_1.default.
|
|
150
|
-
process.exit(1);
|
|
178
|
+
utils_1.default.pressKeyToExit(`Error: ${findFirstUnusedDevice.code} ${findFirstUnusedDevice.data}`);
|
|
151
179
|
}
|
|
152
180
|
else {
|
|
153
181
|
firstUnusedDevice = findFirstUnusedDevice.data.trim();
|
|
154
182
|
}
|
|
155
|
-
await (0, utils_2.exec)(`losetup ${firstUnusedDevice} ${this.luksFile}`, echo);
|
|
183
|
+
await (0, utils_2.exec)(`losetup ${firstUnusedDevice} ${this.luksFile}`, this.echo);
|
|
156
184
|
utils_1.default.warning('Enter a large string of random text below to setup the pre-encryption');
|
|
157
|
-
await (0, utils_2.exec)(`cryptsetup -y -v --type luks2 luksFormat ${this.luksFile}`,
|
|
185
|
+
await (0, utils_2.exec)(`cryptsetup -y -v --type luks2 luksFormat ${this.luksFile}`, utils_1.default.setEcho(true));
|
|
158
186
|
utils_1.default.warning(`Enter the desired passphrase for the encrypted ${this.luksName} below`);
|
|
159
|
-
let crytoSetup = await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`,
|
|
187
|
+
let crytoSetup = await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`, utils_1.default.setEcho(true));
|
|
160
188
|
if (crytoSetup.code !== 0) {
|
|
161
|
-
utils_1.default.
|
|
162
|
-
process.exit(1);
|
|
189
|
+
utils_1.default.pressKeyToExit(`Error: ${crytoSetup.code} ${crytoSetup.data}`);
|
|
163
190
|
}
|
|
164
191
|
utils_1.default.warning(`Formatting ${this.luksDevice} to ext2`);
|
|
165
|
-
let formatting = await (0, utils_2.exec)(`sudo mkfs.ext2 ${this.luksDevice}`, echo);
|
|
192
|
+
let formatting = await (0, utils_2.exec)(`sudo mkfs.ext2 ${this.luksDevice}`, this.echo);
|
|
166
193
|
if (formatting.code !== 0) {
|
|
167
|
-
utils_1.default.
|
|
168
|
-
process.exit(1);
|
|
194
|
+
utils_1.default.pressKeyToExit(`Error: ${formatting.code} ${formatting.data}`);
|
|
169
195
|
}
|
|
170
196
|
// this.luksClose()
|
|
171
197
|
}
|
|
172
198
|
/**
|
|
173
199
|
*
|
|
174
200
|
*/
|
|
175
|
-
async luksOpen(
|
|
176
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
177
|
-
const echoYes = utils_1.default.setEcho(true); // echoYes serve solo per cryptsetup luksOpen
|
|
201
|
+
async luksOpen() {
|
|
178
202
|
if (!fs.existsSync(this.luksDevice)) {
|
|
179
203
|
utils_1.default.warning(`LUKS open volume: ${this.luksName}`);
|
|
180
|
-
await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`,
|
|
204
|
+
await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`, utils_1.default.setEcho(true));
|
|
181
205
|
}
|
|
182
206
|
else {
|
|
183
207
|
utils_1.default.warning(`LUKS volume: ${this.luksName} already open`);
|
|
184
208
|
}
|
|
185
209
|
if (!fs.existsSync(this.luksMountpoint)) {
|
|
186
|
-
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}`, echo);
|
|
210
|
+
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}`, this.echo);
|
|
187
211
|
}
|
|
188
212
|
if (!utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
189
213
|
utils_1.default.warning(`mount volume: ${this.luksDevice} on ${this.luksMountpoint}`);
|
|
190
|
-
await (0, utils_2.exec)(`mount ${this.luksDevice} ${this.luksMountpoint}`, echo);
|
|
214
|
+
await (0, utils_2.exec)(`mount ${this.luksDevice} ${this.luksMountpoint}`, this.echo);
|
|
191
215
|
}
|
|
192
216
|
else {
|
|
193
217
|
utils_1.default.warning(`mount volume: ${this.luksDevice} already mounted on ${this.luksMountpoint}`);
|
|
@@ -196,24 +220,23 @@ class Syncto extends core_1.Command {
|
|
|
196
220
|
/**
|
|
197
221
|
*
|
|
198
222
|
*/
|
|
199
|
-
async luksClose(
|
|
200
|
-
const echo = utils_1.default.setEcho(verbose);
|
|
223
|
+
async luksClose() {
|
|
201
224
|
if (utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
202
|
-
await (0, utils_2.exec)(`umount ${this.luksMountpoint}`, echo);
|
|
225
|
+
await (0, utils_2.exec)(`umount ${this.luksMountpoint}`, this.echo);
|
|
203
226
|
}
|
|
204
227
|
if (fs.existsSync(this.luksDevice)) {
|
|
205
228
|
utils_1.default.warning(`LUKS close volume: ${this.luksName}`);
|
|
206
|
-
await (0, utils_2.exec)(`cryptsetup luksClose ${this.luksName}`, echo);
|
|
229
|
+
await (0, utils_2.exec)(`cryptsetup luksClose ${this.luksName}`, this.echo);
|
|
207
230
|
}
|
|
208
231
|
}
|
|
209
232
|
}
|
|
210
233
|
exports.default = Syncto;
|
|
211
234
|
Syncto.description = 'Backup users, server and datas to luks-eggs-backup';
|
|
212
235
|
Syncto.flags = {
|
|
213
|
-
|
|
236
|
+
delete: core_1.Flags.string({ description: 'rsync --delete delete extraneous files from dest dirs' }),
|
|
214
237
|
file: core_1.Flags.string({ char: 'f', description: "file LUKS volume encrypted" }),
|
|
215
238
|
help: core_1.Flags.help({ char: 'h' }),
|
|
216
239
|
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' })
|
|
217
240
|
};
|
|
218
241
|
Syncto.aliases = ['backup'];
|
|
219
|
-
Syncto.examples = ['$ sudo eggs
|
|
242
|
+
Syncto.examples = ['$ sudo eggs syncto'];
|
|
@@ -8,8 +8,8 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
* license: MIT
|
|
9
9
|
*/
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
|
-
const utils_1 =
|
|
12
|
-
const bleach_1 =
|
|
11
|
+
const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
|
|
12
|
+
const bleach_1 = tslib_1.__importDefault(require("../../classes/bleach"));
|
|
13
13
|
class Clean extends core_1.Command {
|
|
14
14
|
async run() {
|
|
15
15
|
const { flags } = await this.parse(Clean);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const utils_1 =
|
|
6
|
-
const i18n_1 =
|
|
5
|
+
const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
|
|
6
|
+
const i18n_1 = tslib_1.__importDefault(require("../../classes/i18n"));
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
@@ -21,8 +21,13 @@ class Locales extends core_1.Command {
|
|
|
21
21
|
}
|
|
22
22
|
const echo = utils_1.default.setEcho(verbose);
|
|
23
23
|
if (utils_1.default.isRoot()) {
|
|
24
|
-
const i18n = new i18n_1.default(verbose);
|
|
25
|
-
|
|
24
|
+
const i18n = new i18n_1.default('/', verbose);
|
|
25
|
+
if (reinstall) {
|
|
26
|
+
await i18n.reinstall();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
await i18n.generate(true);
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
}
|
|
@@ -8,9 +8,9 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
* license: MIT
|
|
9
9
|
*/
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
|
-
const utils_1 =
|
|
11
|
+
const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
|
|
12
12
|
const fs = require("fs");
|
|
13
|
-
const xdg_1 =
|
|
13
|
+
const xdg_1 = tslib_1.__importDefault(require("../../classes/xdg"));
|
|
14
14
|
class Skel extends core_1.Command {
|
|
15
15
|
async run() {
|
|
16
16
|
utils_1.default.titles(this.id + ' ' + this.argv);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const utils_1 =
|
|
6
|
-
const axios_1 =
|
|
7
|
-
const node_https_1 =
|
|
5
|
+
const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
|
|
6
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
7
|
+
const node_https_1 = tslib_1.__importDefault(require("node:https"));
|
|
8
8
|
const agent = new node_https_1.default.Agent({
|
|
9
9
|
rejectUnauthorized: false
|
|
10
10
|
});
|
|
@@ -8,10 +8,10 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
* license: MIT
|
|
9
9
|
*/
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
|
-
const shelljs_1 =
|
|
12
|
-
const node_fs_1 =
|
|
13
|
-
const utils_1 =
|
|
14
|
-
const yolk_1 =
|
|
11
|
+
const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
|
|
12
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
13
|
+
const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
|
|
14
|
+
const yolk_1 = tslib_1.__importDefault(require("../../classes/yolk"));
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
*/
|
package/lib/commands/update.js
CHANGED
|
@@ -8,12 +8,12 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
* license: MIT
|
|
9
9
|
*/
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
|
-
const utils_1 =
|
|
12
|
-
const tools_1 =
|
|
13
|
-
const pacman_1 =
|
|
14
|
-
const basket_1 =
|
|
11
|
+
const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
|
|
12
|
+
const tools_1 = tslib_1.__importDefault(require("../classes/tools"));
|
|
13
|
+
const pacman_1 = tslib_1.__importDefault(require("../classes/pacman"));
|
|
14
|
+
const basket_1 = tslib_1.__importDefault(require("../classes/basket"));
|
|
15
15
|
const utils_2 = require("../lib/utils");
|
|
16
|
-
const inquirer_1 =
|
|
16
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export default class Ironing extends Command {
|
|
6
|
+
static description: string;
|
|
7
|
+
static flags: {
|
|
8
|
+
costume: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
|
+
wardrobe: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|