penguins-eggs 9.6.23 → 9.8.1
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 +1458 -1
- package/README.md +1527 -201
- package/addons/eggs/theme/livecd/grub.main.cfg +4 -4
- package/addons/eggs/theme/livecd/isolinux.main.cfg +5 -5
- package/bin/dev.js +6 -0
- package/bin/run +0 -0
- package/bin/run.js +7 -0
- package/conf/derivatives.yaml +23 -3
- package/conf/distros/README.md +25 -0
- package/conf/distros/bionic/calamares/calamares-modules/sources-yolk/module.yml +8 -0
- package/conf/distros/bionic/calamares/calamares-modules/sources-yolk/sources-yolk.sh +82 -0
- package/conf/distros/bionic/calamares/modules/packages.yml +6 -0
- package/conf/distros/{rolling/calamares-32 → bionic/calamares}/modules/removeuser.yml +2 -3
- package/conf/distros/bionic/calamares/modules/unpackfs.yml +6 -0
- package/conf/distros/buster/calamares/calamares-modules/bootloader-config/bootloader-config.sh +3 -3
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +1 -1
- package/conf/distros/buster/calamares/modules/bootloader.yml +2 -1
- package/conf/distros/buster/calamares/modules/fstab.yml +1 -1
- package/conf/distros/buster/calamares/modules/mount.yml +2 -2
- package/conf/distros/focal/calamares/modules/after_bootloader_context.yml +10 -1
- package/conf/distros/focal/calamares/modules/before_bootloader_mkdirs_context.yml +4 -4
- package/conf/distros/focal/calamares/modules/fstab.yml +1 -1
- package/conf/distros/focal/calamares/modules/mount.yml +2 -2
- package/conf/distros/focal/calamares/modules/shellprocess_bug-LP#1829805.yml +1 -1
- package/conf/distros/focal/calamares/modules/shellprocess_logs.yml +1 -1
- package/conf/distros/stretch/krill/krill-modules/bootloader-config/bootloader-config.sh +28 -0
- package/conf/distros/stretch/krill/krill-modules/bootloader-config/module.yml +8 -0
- package/conf/distros/stretch/krill/krill-modules/remove-link/module.yml +9 -0
- package/conf/distros/stretch/krill/krill-modules/remove-link/remove-link.sh +5 -0
- package/conf/distros/stretch/krill/krill-modules/sources-yolk/module.yml +8 -0
- package/conf/distros/stretch/krill/krill-modules/sources-yolk/sources-yolk.sh +75 -0
- package/conf/distros/stretch/krill/krill-modules/sources-yolk-unmount/module.yml +8 -0
- package/conf/distros/stretch/krill/modules/partitions.yml +8 -0
- package/conf/distros/stretch/krill/modules/removeuser.yml +15 -0
- package/conf/distros/{rolling/calamares-32 → stretch/krill}/settings.yml +50 -11
- package/conf/eggs.yaml +2 -9
- package/conf/{exclude.list.homes → exclude.list.d/home.list} +6 -1
- package/conf/{exclude.list.template → exclude.list.d/master.list} +16 -26
- package/conf/{exclude.list.usr → exclude.list.d/usr.list} +2 -2
- package/conf/exclude.list.d/var.list +21 -0
- package/conf/tools.yaml +1 -3
- package/dist/classes/compressors.js +11 -13
- package/dist/classes/daddy.js +1 -3
- package/dist/classes/distro.js +23 -4
- package/dist/classes/families/archlinux.js +7 -9
- package/dist/classes/families/debian.js +1 -1
- package/dist/classes/families/fedora.js +1 -1
- package/dist/classes/families/suse.js +1 -1
- package/dist/classes/incubation/branding.js +9 -3
- package/dist/classes/incubation/distros/bionic.js +8 -3
- package/dist/classes/incubation/distros/buster.js +8 -3
- package/dist/classes/incubation/distros/focal.js +8 -3
- package/dist/classes/incubation/distros/jessie.js +6 -3
- package/dist/classes/incubation/distros/rolling.js +8 -4
- package/dist/classes/incubation/fisherman-helper/packages.js +5 -2
- package/dist/classes/incubation/fisherman.js +18 -3
- package/dist/classes/incubation/incubator.js +7 -2
- package/dist/classes/incubation/installer.js +3 -1
- package/dist/classes/initrd.js +5 -5
- package/dist/classes/keyboards.js +4 -4
- package/dist/classes/network.js +7 -7
- package/dist/classes/ovary.js +136 -176
- package/dist/classes/pacman.js +12 -14
- package/dist/classes/pve-live.js +1 -1
- package/dist/classes/pxe.js +10 -12
- package/dist/classes/settings.js +19 -18
- package/dist/classes/systemctl.js +1 -1
- package/dist/classes/tailor.js +6 -6
- package/dist/classes/tools.js +4 -6
- package/dist/classes/users.js +10 -0
- package/dist/classes/utils.js +30 -0
- package/dist/classes/xdg.js +21 -8
- package/dist/classes/yolk.js +3 -5
- package/dist/commands/adapt.js +8 -8
- package/dist/commands/analyze.js +9 -12
- package/dist/commands/calamares.js +20 -23
- package/dist/commands/config.js +13 -13
- package/dist/commands/cuckoo.js +7 -7
- package/dist/commands/dad.js +12 -12
- package/dist/commands/export/deb.js +20 -25
- package/dist/commands/export/iso.js +11 -11
- package/dist/commands/install.js +41 -37
- package/dist/commands/kill.js +12 -15
- package/dist/commands/mom.js +7 -7
- package/dist/commands/produce.js +71 -47
- package/dist/commands/status.js +8 -8
- package/dist/commands/syncfrom.js +34 -40
- package/dist/commands/syncto.js +142 -202
- package/dist/commands/tools/clean.js +9 -9
- package/dist/commands/tools/ppa.js +12 -12
- package/dist/commands/tools/skel.js +10 -10
- package/dist/commands/tools/stat.js +11 -11
- package/dist/commands/tools/yolk.js +9 -9
- package/dist/commands/update.js +8 -8
- package/dist/commands/wardrobe/get.js +13 -10
- package/dist/commands/wardrobe/list.js +15 -13
- package/dist/commands/wardrobe/show.js +16 -13
- package/dist/commands/wardrobe/wear.js +16 -14
- package/dist/components/summary.js +5 -2
- package/dist/interfaces/i-analyze.js +8 -10
- package/dist/interfaces/{i-filters.js → i-excludes.js} +0 -1
- package/dist/krill/krill-prepare.js +23 -11
- package/dist/krill/krill-sequence.js +72 -73
- package/dist/krill/modules/fstab.js +59 -32
- package/dist/krill/modules/mkfs.js +29 -16
- package/dist/krill/modules/network-cfg.js +22 -21
- package/dist/krill/modules/partition.js +3 -3
- package/dist/lib/dependencies.js +1 -0
- package/dist/lib/select_filesystem_type.js +6 -1
- package/manpages/doc/man/eggs.1.gz +0 -0
- package/manpages/doc/man/eggs.html +128 -74
- package/mkinitcpio/biglinux/live.conf +74 -0
- package/mkinitcpio/biglinux/mkinitcpio.conf +73 -0
- package/package.json +43 -41
- package/scripts/_eggs +17 -14
- package/scripts/eggs.bash +6 -6
- package/conf/distros/rolling/calamares-32/modules/displaymanager.yml +0 -23
- package/conf/distros/rolling/calamares-32/modules/finished.yml +0 -6
- package/conf/distros/rolling/calamares-32/modules/fstab.yml +0 -14
- package/conf/distros/rolling/calamares-32/modules/locale.yml +0 -11
- package/conf/distros/rolling/calamares-32/modules/mount.yml +0 -39
- package/conf/distros/rolling/calamares-32/modules/packages.yml +0 -11
- package/conf/distros/rolling/calamares-32/modules/partition.yml +0 -283
- package/conf/distros/rolling/calamares-32/modules/shellprocess_removelink.yml +0 -8
- package/conf/distros/rolling/calamares-32/modules/unpackfs.yml +0 -7
- package/conf/distros/rolling/calamares-32/modules/users.yml +0 -20
- package/conf/exclude.list.custom +0 -3
- package/manpages/doc/man/README.md +0 -0
package/dist/commands/syncto.js
CHANGED
|
@@ -8,236 +8,176 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* syncfrom (restore)
|
|
14
|
-
* --include-from file.list // if only include is provided everything from the list if used to update the system.
|
|
15
|
-
* --exclude-from file-list // it just updates the system
|
|
16
|
-
* --delete
|
|
17
|
-
*
|
|
18
|
-
* If both options are provided then it works as a combination as provided in the link above.
|
|
19
|
-
* https://stackoverflow.com/questions/19296190/rsync-include-from-vs-exclude-from-what-is-the-actual-difference
|
|
20
|
-
*
|
|
21
|
-
* The same logic is applied for the syncto also.
|
|
22
|
-
*
|
|
23
|
-
* On top of all of this the --delete option
|
|
24
|
-
* if needed to be passed so that everything else is removed, but this
|
|
25
|
-
* this should not be available by default
|
|
26
|
-
*/
|
|
11
|
+
// https://gist.github.com/ansemjo/6f1cf9d9b8f7ce8f70813f52c63b74a6
|
|
27
12
|
const core_1 = require("@oclif/core");
|
|
28
13
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const promises_1 = require("fs/promises");
|
|
34
|
-
const fs_2 = require("fs");
|
|
35
|
-
const users_1 = tslib_1.__importDefault(require("../classes/users"));
|
|
14
|
+
const utils_1 = require("../lib/utils");
|
|
15
|
+
const compressors_1 = tslib_1.__importDefault(require("../classes/compressors"));
|
|
16
|
+
const settings_1 = tslib_1.__importDefault(require("../classes/settings"));
|
|
17
|
+
const utils_2 = tslib_1.__importDefault(require("../classes/utils"));
|
|
36
18
|
/**
|
|
37
19
|
*
|
|
38
20
|
*/
|
|
39
21
|
class Syncto extends core_1.Command {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
22
|
+
static flags = {
|
|
23
|
+
file: core_1.Flags.string({ char: 'f', description: 'file luks-volume encrypted' }),
|
|
24
|
+
excludes: core_1.Flags.boolean({ char: 'e', description: 'use: exclude.list.d/home.list' }),
|
|
25
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
26
|
+
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
27
|
+
};
|
|
28
|
+
static description = 'Save users and users\' data ENCRYPTED';
|
|
29
|
+
static examples = [
|
|
30
|
+
'sudo eggs syncto',
|
|
31
|
+
'sudo eggs syncto --file /path/to/luks-volume',
|
|
32
|
+
'sudo eggs syncto --excludes'
|
|
33
|
+
];
|
|
34
|
+
verbose = false;
|
|
35
|
+
echo = {};
|
|
36
|
+
luksName = 'luks-volume';
|
|
37
|
+
luksFile = `/tmp/${this.luksName}`;
|
|
38
|
+
luksDevice = `/dev/mapper/${this.luksName}`;
|
|
39
|
+
luksMountpoint = `/tmp/mnt/${this.luksName}`;
|
|
40
|
+
privateSquashfs = `private.squashfs`;
|
|
41
|
+
excludeHome = '/etc/penguins-eggs.d/exclude.list.d/home.list';
|
|
42
|
+
exclude = false;
|
|
43
|
+
settings = {};
|
|
49
44
|
/**
|
|
50
45
|
*
|
|
51
46
|
*/
|
|
52
47
|
async run() {
|
|
48
|
+
utils_2.default.titles(this.id + ' ' + this.argv);
|
|
53
49
|
const { flags } = await this.parse(Syncto);
|
|
54
50
|
if (flags.verbose) {
|
|
55
51
|
this.verbose = true;
|
|
56
52
|
}
|
|
57
|
-
this.echo =
|
|
58
|
-
let
|
|
53
|
+
this.echo = utils_2.default.setEcho(this.verbose);
|
|
54
|
+
let fileLuks = '';
|
|
59
55
|
if (flags.file) {
|
|
60
|
-
|
|
56
|
+
fileLuks = flags.file;
|
|
61
57
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
destDelete = true;
|
|
58
|
+
if (flags.excludes) {
|
|
59
|
+
this.exclude = true;
|
|
65
60
|
}
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
* restore con file
|
|
69
|
-
*/
|
|
70
|
-
if (fileVolume === '') {
|
|
71
|
-
fileVolume = '/tmp/luks-eggs-data';
|
|
72
|
-
}
|
|
73
|
-
this.luksName = path_1.default.basename(fileVolume);
|
|
74
|
-
this.luksFile = fileVolume;
|
|
75
|
-
this.luksDevice = `/dev/mapper/${this.luksName}`;
|
|
76
|
-
this.luksMountpoint = '/tmp/eggs-data';
|
|
77
|
-
if (!fs_1.default.existsSync(fileVolume)) {
|
|
78
|
-
await this.luksCreate();
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
utils_1.default.warning(`LUKS volume: ${this.luksFile} exist, don't need create`);
|
|
82
|
-
}
|
|
83
|
-
if (fs_1.default.existsSync(fileVolume)) {
|
|
84
|
-
await this.luksOpen();
|
|
85
|
-
await this.backup(destDelete);
|
|
86
|
-
await this.luksClose();
|
|
87
|
-
}
|
|
61
|
+
if (utils_2.default.isRoot()) {
|
|
62
|
+
await this.luksCreate();
|
|
88
63
|
}
|
|
89
64
|
else {
|
|
90
|
-
|
|
65
|
+
utils_2.default.useRoot(this.id);
|
|
91
66
|
}
|
|
92
67
|
}
|
|
93
68
|
/**
|
|
94
69
|
*
|
|
95
70
|
*/
|
|
96
|
-
async
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
await (0, utils_2.exec)(cmd, this.echo);
|
|
71
|
+
async luksCreate() {
|
|
72
|
+
await (0, utils_1.exec)(`rm -rf ${this.luksFile}`);
|
|
73
|
+
//==========================================================================
|
|
74
|
+
// Create squashfs
|
|
75
|
+
//==========================================================================
|
|
76
|
+
utils_2.default.warning(`Creating private.squashfs`);
|
|
77
|
+
const compressors = new compressors_1.default();
|
|
78
|
+
await compressors.populate();
|
|
79
|
+
// comp
|
|
80
|
+
let comp = '';
|
|
81
|
+
this.settings = new settings_1.default();
|
|
82
|
+
if (await this.settings.load()) {
|
|
83
|
+
let compression = compressors.fast();
|
|
84
|
+
if (this.settings.config.compression == `max`) {
|
|
85
|
+
compression = compressors.max();
|
|
113
86
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}/etc`, this.echo);
|
|
117
|
-
await (0, utils_2.exec)(`cp /etc/passwd ${this.luksMountpoint}/etc`, this.echo);
|
|
118
|
-
await (0, utils_2.exec)(`cp /etc/shadow ${this.luksMountpoint}/etc`, this.echo);
|
|
119
|
-
await (0, utils_2.exec)(`cp /etc/group ${this.luksMountpoint}/etc`, this.echo);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* usersFill
|
|
123
|
-
*/
|
|
124
|
-
async usersFill() {
|
|
125
|
-
const usersArray = [];
|
|
126
|
-
await (0, promises_1.access)('/etc/passwd', fs_2.constants.R_OK | fs_2.constants.W_OK);
|
|
127
|
-
const passwd = fs_1.default.readFileSync('/etc/passwd', 'utf-8').split('\n');
|
|
128
|
-
for (const element of passwd) {
|
|
129
|
-
const line = element.split(':');
|
|
130
|
-
const users = new users_1.default(line[0], line[1], line[2], line[3], line[4], line[5], line[6]);
|
|
131
|
-
await users.getValues();
|
|
132
|
-
if (users.password !== undefined) {
|
|
133
|
-
usersArray.push(users);
|
|
87
|
+
else if (this.settings.config.compression == `standard`) {
|
|
88
|
+
compression = compressors.standard();
|
|
134
89
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
let
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
90
|
+
comp = `-comp ${compression}`;
|
|
91
|
+
}
|
|
92
|
+
// exclude /home/eggs
|
|
93
|
+
let exclude_nest = '';
|
|
94
|
+
if (fs_1.default.existsSync(this.settings.work_dir.workdir)) {
|
|
95
|
+
exclude_nest = `-e ${this.settings.config.snapshot_dir}`;
|
|
96
|
+
}
|
|
97
|
+
// exclude file
|
|
98
|
+
let exclude_home = '';
|
|
99
|
+
if (this.exclude) {
|
|
100
|
+
exclude_home = `-ef ${this.excludeHome}`;
|
|
101
|
+
}
|
|
102
|
+
// creato dummyfs per /etc/
|
|
103
|
+
await (0, utils_1.exec)(`mkdir -p /tmp/dummyfs/etc`, this.echo);
|
|
104
|
+
await (0, utils_1.exec)(`cp -a /etc/passwd /tmp/dummyfs/etc`, this.echo);
|
|
105
|
+
await (0, utils_1.exec)(`cp -a /etc/group /tmp/dummyfs/etc`, this.echo);
|
|
106
|
+
await (0, utils_1.exec)(`cp -a /etc/shadow /tmp/dummyfs/etc`, this.echo);
|
|
107
|
+
await (0, utils_1.exec)(`mkdir -p /tmp/dummyfs/etc/lightdm`, this.echo); // lightdm
|
|
108
|
+
await (0, utils_1.exec)(`cp -a /etc/lightdm/lightdm.conf /tmp/dummyfs/etc/lightdm/`, this.echo); // lightdm
|
|
109
|
+
let mkPrivateSquashfs = `mksquashfs \
|
|
110
|
+
/tmp/dummyfs/etc \
|
|
111
|
+
/home \
|
|
112
|
+
/tmp/${this.privateSquashfs} \
|
|
113
|
+
${comp} \
|
|
114
|
+
${exclude_nest} \
|
|
115
|
+
${exclude_home} \
|
|
116
|
+
-keep-as-directory \
|
|
117
|
+
-noappend`;
|
|
118
|
+
mkPrivateSquashfs = mkPrivateSquashfs.replace(/\s\s+/g, ` `);
|
|
119
|
+
await (0, utils_1.exec)(mkPrivateSquashfs, utils_2.default.setEcho(true));
|
|
120
|
+
// remove dummyfs
|
|
121
|
+
await (0, utils_1.exec)(`rm /tmp/dummyfs/ -rf`, this.echo);
|
|
122
|
+
//==========================================================================
|
|
123
|
+
// Create LUKS volume
|
|
124
|
+
//==========================================================================
|
|
125
|
+
utils_2.default.titles("Creating LUKS Volume");
|
|
126
|
+
// calcolo size
|
|
127
|
+
let sizeString = (await (0, utils_1.exec)(`unsquashfs -s /tmp/${this.privateSquashfs} | grep "Filesystem size" | sed -e 's/.*size //' -e 's/ .*//'`, { echo: false, capture: true })).data;
|
|
128
|
+
let size = parseInt(sizeString) + 2048;
|
|
129
|
+
console.log("size private.squashfs:", bytesToGB(size), size);
|
|
130
|
+
let luksBlockSize = 512;
|
|
131
|
+
let luksBlocks = Math.ceil(size / luksBlockSize);
|
|
132
|
+
size = luksBlockSize * luksBlocks;
|
|
133
|
+
// Aggiungo un 20% in più per ottenere luksSize
|
|
134
|
+
let luksSize = Math.ceil((size) * 1.20);
|
|
135
|
+
console.log("luksSize:", bytesToGB(luksSize), luksSize);
|
|
136
|
+
// truncate * 2048 è cruciale
|
|
137
|
+
let truncateAt = luksSize * 2048;
|
|
138
|
+
utils_2.default.warning(`Preparing file ${this.luksFile} for ${this.luksDevice}, size ${truncateAt}`);
|
|
139
|
+
await (0, utils_1.exec)(`truncate --size ${luksSize} ${this.luksFile}`, this.echo);
|
|
140
|
+
utils_2.default.warning(`Creating LUKS Volume on ${this.luksFile}`);
|
|
141
|
+
await (0, utils_1.exec)(`cryptsetup --batch-mode luksFormat ${this.luksFile}`, utils_2.default.setEcho(true));
|
|
142
|
+
console.log('');
|
|
143
|
+
// open LUKS volume temp
|
|
144
|
+
utils_2.default.warning(`Opening LUKS Volume on ${this.luksFile}`);
|
|
145
|
+
let code = (await (0, utils_1.exec)(`cryptsetup luksOpen ${this.luksFile} ${this.luksName}`, utils_2.default.setEcho(true))).code;
|
|
146
|
+
if (code != 0) {
|
|
147
|
+
utils_2.default.error(`cryptsetup luksOpen ${this.luksFile} ${this.luksName} failed`);
|
|
148
|
+
process.exit(code);
|
|
149
|
+
}
|
|
150
|
+
await (0, utils_1.exec)('udevadm settle', this.echo);
|
|
151
|
+
// formatta ext4 il volume
|
|
152
|
+
await (0, utils_1.exec)(`mkfs.ext4 ${this.luksDevice}`, this.echo);
|
|
153
|
+
console.log('');
|
|
154
|
+
// mount LUKS volume
|
|
155
|
+
if (!fs_1.default.existsSync(`this.luksMountpoint)`)) {
|
|
156
|
+
utils_2.default.warning(`creating mountpoint ${this.luksMountpoint}`);
|
|
157
|
+
await (0, utils_1.exec)(`mkdir -p ${this.luksMountpoint}`, this.echo);
|
|
158
|
+
}
|
|
159
|
+
if (!utils_2.default.isMountpoint(`${this.luksMountpoint}`)) {
|
|
160
|
+
utils_2.default.warning(`mounting volume: ${this.luksDevice} on ${this.luksMountpoint}`);
|
|
161
|
+
let code = (await (0, utils_1.exec)(`mount ${this.luksDevice} ${this.luksMountpoint}`, utils_2.default.setEcho(true))).code;
|
|
162
|
+
if (code != 0) {
|
|
163
|
+
utils_2.default.error(`mount ${this.luksDevice} ${this.luksMountpoint} failed`);
|
|
164
|
+
process.exit(code);
|
|
154
165
|
}
|
|
155
166
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const blockSize = 512;
|
|
164
|
-
let blocks = Math.ceil(volumeSize / blockSize);
|
|
165
|
-
// We need a minimum size of 32 MB
|
|
166
|
-
const minimunSize = 134217728; // 128 * 1024 *1024
|
|
167
|
-
if (totalSize < minimunSize) { }
|
|
168
|
-
if (blocks * blockSize < minimunSize) {
|
|
169
|
-
blocks = Math.ceil(minimunSize / blockSize);
|
|
170
|
-
}
|
|
171
|
-
utils_1.default.warning(`Creating an encrypted file ${this.luksFile} blocks=${blocks}, block size: ${blockSize}, size: ${utils_1.default.formatBytes(blocks * blockSize)}`);
|
|
172
|
-
await (0, utils_2.exec)(`dd if=/dev/zero of=${this.luksFile} bs=${blockSize} count=${blocks}`, this.echo);
|
|
173
|
-
// find first unused device
|
|
174
|
-
const findFirstUnusedDevice = await (0, utils_2.exec)('losetup -f', { echo: this.verbose, ignore: false, capture: true });
|
|
175
|
-
let firstUnusedDevice = '';
|
|
176
|
-
if (findFirstUnusedDevice.code !== 0) {
|
|
177
|
-
utils_1.default.pressKeyToExit(`Error: ${findFirstUnusedDevice.code} ${findFirstUnusedDevice.data}`);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
firstUnusedDevice = findFirstUnusedDevice.data.trim();
|
|
181
|
-
}
|
|
182
|
-
await (0, utils_2.exec)(`losetup ${firstUnusedDevice} ${this.luksFile}`, this.echo);
|
|
183
|
-
// Utils.warning('Enter a large string of random text below to setup the pre-encryption')
|
|
184
|
-
await (0, utils_2.exec)(`cryptsetup -y -v --type luks2 luksFormat ${this.luksFile}`, utils_1.default.setEcho(true));
|
|
185
|
-
// Utils.warning(`Enter the desired passphrase for the encrypted ${this.luksName} below`)
|
|
186
|
-
const crytoSetup = await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`, utils_1.default.setEcho(true));
|
|
187
|
-
if (crytoSetup.code !== 0) {
|
|
188
|
-
utils_1.default.pressKeyToExit(`Error: ${crytoSetup.code} ${crytoSetup.data}`);
|
|
189
|
-
}
|
|
190
|
-
utils_1.default.warning(`Formatting ${this.luksDevice} to ext2`);
|
|
191
|
-
const formatting = await (0, utils_2.exec)(`sudo mkfs.ext2 ${this.luksDevice}`, this.echo);
|
|
192
|
-
if (formatting.code !== 0) {
|
|
193
|
-
utils_1.default.pressKeyToExit(`Error: ${formatting.code} ${formatting.data}`);
|
|
194
|
-
}
|
|
195
|
-
// this.luksClose()
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
*
|
|
199
|
-
*/
|
|
200
|
-
async luksOpen() {
|
|
201
|
-
if (!fs_1.default.existsSync(this.luksDevice)) {
|
|
202
|
-
// Utils.warning(`LUKS open volume: ${this.luksName}`)
|
|
203
|
-
await (0, utils_2.exec)(`cryptsetup luksOpen --type luks2 ${this.luksFile} ${this.luksName}`, utils_1.default.setEcho(true));
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
utils_1.default.warning(`LUKS volume: ${this.luksName} already open`);
|
|
207
|
-
}
|
|
208
|
-
if (!fs_1.default.existsSync(this.luksMountpoint)) {
|
|
209
|
-
await (0, utils_2.exec)(`mkdir -p ${this.luksMountpoint}`, this.echo);
|
|
210
|
-
}
|
|
211
|
-
if (!utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
212
|
-
utils_1.default.warning(`mount volume: ${this.luksDevice} on ${this.luksMountpoint}`);
|
|
213
|
-
await (0, utils_2.exec)(`mount ${this.luksDevice} ${this.luksMountpoint}`, this.echo);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
utils_1.default.warning(`mount volume: ${this.luksDevice} already mounted on ${this.luksMountpoint}`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
*
|
|
221
|
-
*/
|
|
222
|
-
async luksClose() {
|
|
223
|
-
if (utils_1.default.isMountpoint(this.luksMountpoint)) {
|
|
224
|
-
await (0, utils_2.exec)(`umount ${this.luksMountpoint}`, this.echo);
|
|
225
|
-
}
|
|
226
|
-
if (fs_1.default.existsSync(this.luksDevice)) {
|
|
227
|
-
utils_1.default.warning(`LUKS close volume: ${this.luksName}`);
|
|
228
|
-
await (0, utils_2.exec)(`cryptsetup luksClose ${this.luksName}`, this.echo);
|
|
229
|
-
}
|
|
167
|
+
// copy private.squashfs
|
|
168
|
+
utils_2.default.warning(`moving /tmp/${this.privateSquashfs} to ${this.luksMountpoint}`);
|
|
169
|
+
await (0, utils_1.exec)(`mv /tmp/${this.privateSquashfs} ${this.luksMountpoint}`, this.echo);
|
|
170
|
+
utils_2.default.warning(`Umounting ${this.luksMountpoint}`);
|
|
171
|
+
await (0, utils_1.exec)(`umount ${this.luksMountpoint}`, this.echo);
|
|
172
|
+
utils_2.default.warning(`Vlosing ${this.luksMountpoint}`);
|
|
173
|
+
await (0, utils_1.exec)(`cryptsetup luksClose ${this.luksName}`, this.echo);
|
|
230
174
|
}
|
|
231
175
|
}
|
|
232
|
-
Syncto.flags = {
|
|
233
|
-
delete: core_1.Flags.string({ description: 'rsync --delete delete extraneous files from dest dirs' }),
|
|
234
|
-
file: core_1.Flags.string({ char: 'f', description: 'file LUKS volume encrypted' }),
|
|
235
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
236
|
-
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
237
|
-
};
|
|
238
|
-
Syncto.description = 'saves users and user data in a LUKS volume inside the iso';
|
|
239
|
-
Syncto.examples = [
|
|
240
|
-
'sudo eggs syncto',
|
|
241
|
-
'sudo eggs syncto --file /path/to/fileLUKS',
|
|
242
|
-
];
|
|
243
176
|
exports.default = Syncto;
|
|
177
|
+
/**
|
|
178
|
+
* Convert bytes to gigabytes
|
|
179
|
+
*/
|
|
180
|
+
function bytesToGB(bytes) {
|
|
181
|
+
const gigabytes = bytes / 1073741824;
|
|
182
|
+
return gigabytes.toFixed(2) + ' GB';
|
|
183
|
+
}
|
|
@@ -12,6 +12,15 @@ const core_1 = require("@oclif/core");
|
|
|
12
12
|
const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
|
|
13
13
|
const bleach_1 = tslib_1.__importDefault(require("../../classes/bleach"));
|
|
14
14
|
class Clean extends core_1.Command {
|
|
15
|
+
static flags = {
|
|
16
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
17
|
+
nointeractive: core_1.Flags.boolean({ char: 'n', description: 'no user interaction' }),
|
|
18
|
+
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
19
|
+
};
|
|
20
|
+
static description = 'clean system log, apt, etc';
|
|
21
|
+
static examples = [
|
|
22
|
+
'sudo eggs tools clean',
|
|
23
|
+
];
|
|
15
24
|
async run() {
|
|
16
25
|
const { flags } = await this.parse(Clean);
|
|
17
26
|
utils_1.default.titles(this.id + ' ' + this.argv);
|
|
@@ -31,13 +40,4 @@ class Clean extends core_1.Command {
|
|
|
31
40
|
}
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
|
-
Clean.flags = {
|
|
35
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
36
|
-
nointeractive: core_1.Flags.boolean({ char: 'n', description: 'no user interaction' }),
|
|
37
|
-
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
38
|
-
};
|
|
39
|
-
Clean.description = 'clean system log, apt, etc';
|
|
40
|
-
Clean.examples = [
|
|
41
|
-
'sudo eggs tools clean',
|
|
42
|
-
];
|
|
43
43
|
exports.default = Clean;
|
|
@@ -19,6 +19,18 @@ const flist = '/etc/apt/sources.list.d/penguins-eggs-ppa.list';
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
class Ppa extends core_1.Command {
|
|
22
|
+
static flags = {
|
|
23
|
+
add: core_1.Flags.boolean({ char: 'a', description: 'add penguins-eggs PPA repository' }),
|
|
24
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
25
|
+
nointeractive: core_1.Flags.boolean({ char: 'n', description: 'no user interaction' }),
|
|
26
|
+
remove: core_1.Flags.boolean({ char: 'r', description: 'remove penguins-eggs PPA repository' }),
|
|
27
|
+
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
28
|
+
};
|
|
29
|
+
static description = 'add/remove repo';
|
|
30
|
+
static examples = [
|
|
31
|
+
'sudo eggs tools ppa --add',
|
|
32
|
+
'sudo eggs tools ppa --remove',
|
|
33
|
+
];
|
|
22
34
|
/**
|
|
23
35
|
*
|
|
24
36
|
*/
|
|
@@ -74,18 +86,6 @@ class Ppa extends core_1.Command {
|
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
|
-
Ppa.flags = {
|
|
78
|
-
add: core_1.Flags.boolean({ char: 'a', description: 'add penguins-eggs PPA repository' }),
|
|
79
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
80
|
-
nointeractive: core_1.Flags.boolean({ char: 'n', description: 'no user interaction' }),
|
|
81
|
-
remove: core_1.Flags.boolean({ char: 'r', description: 'remove penguins-eggs PPA repository' }),
|
|
82
|
-
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
83
|
-
};
|
|
84
|
-
Ppa.description = 'add/remove repo';
|
|
85
|
-
Ppa.examples = [
|
|
86
|
-
'sudo eggs tools ppa --add',
|
|
87
|
-
'sudo eggs tools ppa --remove',
|
|
88
|
-
];
|
|
89
89
|
exports.default = Ppa;
|
|
90
90
|
/**
|
|
91
91
|
* archAdd
|
|
@@ -13,6 +13,16 @@ const utils_1 = tslib_1.__importDefault(require("../../classes/utils"));
|
|
|
13
13
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
14
14
|
const xdg_1 = tslib_1.__importDefault(require("../../classes/xdg"));
|
|
15
15
|
class Skel extends core_1.Command {
|
|
16
|
+
static flags = {
|
|
17
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
18
|
+
user: core_1.Flags.string({ char: 'u', description: 'user to be used' }),
|
|
19
|
+
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
20
|
+
};
|
|
21
|
+
static description = 'update skel from home configuration';
|
|
22
|
+
static examples = [
|
|
23
|
+
'sudo eggs tools skel',
|
|
24
|
+
'sudo eggs tools skel --user user-to-be-copied',
|
|
25
|
+
];
|
|
16
26
|
async run() {
|
|
17
27
|
utils_1.default.titles(this.id + ' ' + this.argv);
|
|
18
28
|
const { flags } = await this.parse(Skel);
|
|
@@ -38,14 +48,4 @@ class Skel extends core_1.Command {
|
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
}
|
|
41
|
-
Skel.flags = {
|
|
42
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
43
|
-
user: core_1.Flags.string({ char: 'u', description: 'user to be used' }),
|
|
44
|
-
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
45
|
-
};
|
|
46
|
-
Skel.description = 'update skel from home configuration';
|
|
47
|
-
Skel.examples = [
|
|
48
|
-
'sudo eggs tools skel',
|
|
49
|
-
'sudo eggs tools skel --user user-to-be-copied',
|
|
50
|
-
];
|
|
51
51
|
exports.default = Skel;
|
|
@@ -19,6 +19,17 @@ const agent = new node_https_1.default.Agent({
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
class ToolsStat extends core_1.Command {
|
|
22
|
+
static flags = {
|
|
23
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
24
|
+
month: core_1.Flags.boolean({ char: 'm', description: 'current month' }),
|
|
25
|
+
year: core_1.Flags.boolean({ char: 'y', description: 'current year' }),
|
|
26
|
+
};
|
|
27
|
+
static description = 'get statistics from sourceforge';
|
|
28
|
+
static examples = [
|
|
29
|
+
'eggs tools stat',
|
|
30
|
+
'eggs tools stat --month',
|
|
31
|
+
'eggs tools stat --year',
|
|
32
|
+
];
|
|
22
33
|
/**
|
|
23
34
|
*
|
|
24
35
|
*/
|
|
@@ -64,15 +75,4 @@ class ToolsStat extends core_1.Command {
|
|
|
64
75
|
}
|
|
65
76
|
}
|
|
66
77
|
}
|
|
67
|
-
ToolsStat.flags = {
|
|
68
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
69
|
-
month: core_1.Flags.boolean({ char: 'm', description: 'current month' }),
|
|
70
|
-
year: core_1.Flags.boolean({ char: 'y', description: 'current year' }),
|
|
71
|
-
};
|
|
72
|
-
ToolsStat.description = 'get statistics from sourceforge';
|
|
73
|
-
ToolsStat.examples = [
|
|
74
|
-
'eggs tools stat',
|
|
75
|
-
'eggs tools stat --month',
|
|
76
|
-
'eggs tools stat --year',
|
|
77
|
-
];
|
|
78
78
|
exports.default = ToolsStat;
|
|
@@ -17,6 +17,15 @@ const yolk_1 = tslib_1.__importDefault(require("../../classes/yolk"));
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
class ToolsYolk extends core_1.Command {
|
|
20
|
+
static flags = {
|
|
21
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
22
|
+
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
23
|
+
};
|
|
24
|
+
static description = 'configure eggs to install without internet';
|
|
25
|
+
static examples = [
|
|
26
|
+
'sudo eggs tools yolk',
|
|
27
|
+
];
|
|
28
|
+
static dir = '/var/local/yolk';
|
|
20
29
|
/**
|
|
21
30
|
*
|
|
22
31
|
*/
|
|
@@ -39,13 +48,4 @@ class ToolsYolk extends core_1.Command {
|
|
|
39
48
|
}
|
|
40
49
|
}
|
|
41
50
|
}
|
|
42
|
-
ToolsYolk.flags = {
|
|
43
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
44
|
-
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
45
|
-
};
|
|
46
|
-
ToolsYolk.description = 'configure eggs to install without internet';
|
|
47
|
-
ToolsYolk.examples = [
|
|
48
|
-
'sudo eggs tools yolk',
|
|
49
|
-
];
|
|
50
|
-
ToolsYolk.dir = '/var/local/yolk';
|
|
51
51
|
exports.default = ToolsYolk;
|
package/dist/commands/update.js
CHANGED
|
@@ -18,6 +18,14 @@ const inquirer = require('inquirer');
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
class Update extends core_1.Command {
|
|
21
|
+
static flags = {
|
|
22
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
23
|
+
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
24
|
+
};
|
|
25
|
+
static description = "update the Penguins' eggs tool";
|
|
26
|
+
static examples = [
|
|
27
|
+
'eggs update',
|
|
28
|
+
];
|
|
21
29
|
async run() {
|
|
22
30
|
utils_1.default.titles(this.id + ' ' + this.argv);
|
|
23
31
|
const { flags } = await this.parse(Update);
|
|
@@ -135,12 +143,4 @@ class Update extends core_1.Command {
|
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
|
-
Update.flags = {
|
|
139
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
140
|
-
verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
|
|
141
|
-
};
|
|
142
|
-
Update.description = "update the Penguins' eggs tool";
|
|
143
|
-
Update.examples = [
|
|
144
|
-
'eggs update',
|
|
145
|
-
];
|
|
146
146
|
exports.default = Update;
|
|
@@ -17,6 +17,19 @@ const path_1 = require("path");
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
class Get extends core_1.Command {
|
|
20
|
+
static flags = {
|
|
21
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
22
|
+
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
23
|
+
};
|
|
24
|
+
static args = {
|
|
25
|
+
repo: core_1.Args.string({ name: 'repo', description: 'repository to get', required: false }),
|
|
26
|
+
};
|
|
27
|
+
//static args ={name: 'repo', description: 'repository to get', required: false}
|
|
28
|
+
static description = 'get warorobe';
|
|
29
|
+
static examples = [
|
|
30
|
+
'eggs wardrobe get',
|
|
31
|
+
'eggs wardrobe get your-wardrobe',
|
|
32
|
+
];
|
|
20
33
|
async run() {
|
|
21
34
|
const { args, flags } = await this.parse(Get);
|
|
22
35
|
let verbose = false;
|
|
@@ -43,14 +56,4 @@ class Get extends core_1.Command {
|
|
|
43
56
|
}
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
|
-
Get.flags = {
|
|
47
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
48
|
-
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
49
|
-
};
|
|
50
|
-
Get.args = [{ name: 'repo', description: 'repository to get', required: false }];
|
|
51
|
-
Get.description = 'get warorobe';
|
|
52
|
-
Get.examples = [
|
|
53
|
-
'eggs wardrobe get',
|
|
54
|
-
'eggs wardrobe get your-wardrobe',
|
|
55
|
-
];
|
|
56
59
|
exports.default = Get;
|
|
@@ -20,6 +20,21 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
22
|
class List extends core_1.Command {
|
|
23
|
+
static flags = {
|
|
24
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
25
|
+
distro: core_1.Flags.string({ char: 'd', description: 'distro' }),
|
|
26
|
+
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
27
|
+
};
|
|
28
|
+
static args = {
|
|
29
|
+
repo: core_1.Args.string({ name: 'wardrobe', description: 'wardrobe to get', required: false }),
|
|
30
|
+
};
|
|
31
|
+
//static args = [{ name: 'wardrobe', description: 'wardrobe', required: false }]
|
|
32
|
+
static description = 'list costumes and accessoires in wardrobe';
|
|
33
|
+
static examples = [
|
|
34
|
+
'eggs wardrobe list',
|
|
35
|
+
'eggs wardrobe list your-wardrobe',
|
|
36
|
+
'eggs wardrobe list --distro arch',
|
|
37
|
+
];
|
|
23
38
|
async run() {
|
|
24
39
|
const { args, flags } = await this.parse(List);
|
|
25
40
|
let verbose = false;
|
|
@@ -108,19 +123,6 @@ class List extends core_1.Command {
|
|
|
108
123
|
console.log('- ' + chalk_1.default.cyan(vendor));
|
|
109
124
|
}
|
|
110
125
|
}
|
|
111
|
-
console.log();
|
|
112
126
|
}
|
|
113
127
|
}
|
|
114
|
-
List.flags = {
|
|
115
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
116
|
-
distro: core_1.Flags.string({ char: 'd', description: 'distro' }),
|
|
117
|
-
verbose: core_1.Flags.boolean({ char: 'v' }),
|
|
118
|
-
};
|
|
119
|
-
List.args = [{ name: 'wardrobe', description: 'wardrobe', required: false }];
|
|
120
|
-
List.description = 'list costumes and accessoires in wardrobe';
|
|
121
|
-
List.examples = [
|
|
122
|
-
'eggs wardrobe list',
|
|
123
|
-
'eggs wardrobe list your-wardrobe',
|
|
124
|
-
'eggs wardrobe list --distro arch',
|
|
125
|
-
];
|
|
126
128
|
exports.default = List;
|