penguins-eggs 9.0.31 → 9.1.10

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.
Files changed (153) hide show
  1. package/README.md +488 -28
  2. package/assets/leaves.svg +1 -0
  3. package/assets/live-installer/com.github.pieroproietti.penguins-eggs.policy +25 -0
  4. package/assets/live-installer/filesystem.packages-remove +49 -0
  5. package/assets/penguins-live-installer.desktop +27 -0
  6. package/conf/distros/buster/calamares/modules/bootloader.yml +3 -1
  7. package/conf/eggs.yaml +9 -2
  8. package/lib/classes/bleach.js +2 -2
  9. package/lib/classes/compressors.js +1 -1
  10. package/lib/classes/daddy.js +30 -30
  11. package/lib/classes/distro.d.ts +5 -3
  12. package/lib/classes/distro.js +78 -80
  13. package/lib/classes/family/archlinux.js +4 -4
  14. package/lib/classes/family/debian.d.ts +4 -0
  15. package/lib/classes/family/debian.js +13 -6
  16. package/lib/classes/family/fedora.js +4 -4
  17. package/lib/classes/family/suse.js +4 -4
  18. package/lib/classes/i18n.d.ts +28 -4
  19. package/lib/classes/i18n.js +112 -84
  20. package/lib/classes/incubation/branding.js +13 -7
  21. package/lib/classes/incubation/distros/bionic.js +1 -1
  22. package/lib/classes/incubation/distros/buster.js +1 -1
  23. package/lib/classes/incubation/distros/focal.js +1 -1
  24. package/lib/classes/incubation/distros/jessie.js +1 -1
  25. package/lib/classes/incubation/distros/rolling.js +1 -1
  26. package/lib/classes/incubation/fisherman-helper/displaymanager.js +1 -1
  27. package/lib/classes/incubation/fisherman-helper/packages.js +2 -2
  28. package/lib/classes/incubation/fisherman.js +5 -5
  29. package/lib/classes/incubation/incubator.js +5 -5
  30. package/lib/classes/incubation/installer.d.ts +1 -1
  31. package/lib/classes/incubation/installer.js +4 -4
  32. package/lib/classes/initrd.js +2 -2
  33. package/lib/classes/keyboards.d.ts +45 -0
  34. package/lib/classes/keyboards.js +196 -0
  35. package/lib/classes/krill_install.d.ts +5 -0
  36. package/lib/classes/krill_install.js +46 -14
  37. package/lib/classes/krill_prepare.d.ts +4 -0
  38. package/lib/classes/krill_prepare.js +56 -77
  39. package/lib/classes/locales.d.ts +14 -0
  40. package/lib/classes/locales.js +54 -0
  41. package/lib/classes/n8.js +1 -1
  42. package/lib/classes/ovary.d.ts +6 -1
  43. package/lib/classes/ovary.js +77 -60
  44. package/lib/classes/pacman.d.ts +1 -1
  45. package/lib/classes/pacman.js +40 -40
  46. package/lib/classes/pve-live.js +12 -16
  47. package/lib/classes/settings.d.ts +6 -0
  48. package/lib/classes/settings.js +13 -16
  49. package/lib/classes/sources_list.d.ts +27 -0
  50. package/lib/classes/sources_list.js +103 -0
  51. package/lib/classes/systemctl.js +1 -1
  52. package/lib/classes/tailor.d.ts +41 -0
  53. package/lib/classes/tailor.js +356 -0
  54. package/lib/classes/tools.js +4 -4
  55. package/lib/classes/users.js +1 -1
  56. package/lib/classes/utils.d.ts +16 -3
  57. package/lib/classes/utils.js +74 -36
  58. package/lib/classes/xdg.d.ts +2 -1
  59. package/lib/classes/xdg.js +56 -131
  60. package/lib/classes/yolk.d.ts +8 -7
  61. package/lib/classes/yolk.js +35 -38
  62. package/lib/commands/adapt.js +1 -1
  63. package/lib/commands/analyze.js +2 -2
  64. package/lib/commands/bro.js +2 -2
  65. package/lib/commands/calamares.js +4 -4
  66. package/lib/commands/config.js +8 -6
  67. package/lib/commands/dad.js +2 -2
  68. package/lib/commands/export/deb.js +2 -2
  69. package/lib/commands/export/docs.js +2 -2
  70. package/lib/commands/export/iso.js +2 -2
  71. package/lib/commands/info.js +2 -2
  72. package/lib/commands/install.js +5 -5
  73. package/lib/commands/kill.js +2 -2
  74. package/lib/commands/mom.js +2 -2
  75. package/lib/commands/produce.js +9 -9
  76. package/lib/commands/remove.js +2 -2
  77. package/lib/commands/syncfrom.d.ts +9 -3
  78. package/lib/commands/syncfrom.js +39 -32
  79. package/lib/commands/syncto.d.ts +26 -6
  80. package/lib/commands/syncto.js +73 -50
  81. package/lib/commands/tools/clean.js +2 -2
  82. package/lib/commands/tools/locales.js +9 -4
  83. package/lib/commands/tools/skel.js +2 -2
  84. package/lib/commands/tools/stat.js +3 -3
  85. package/lib/commands/tools/yolk.js +4 -4
  86. package/lib/commands/update.d.ts +0 -2
  87. package/lib/commands/update.js +7 -56
  88. package/lib/commands/wardrobe/get.d.ts +17 -0
  89. package/lib/commands/wardrobe/get.js +43 -0
  90. package/lib/commands/wardrobe/ironing.d.ts +15 -0
  91. package/lib/commands/wardrobe/ironing.js +125 -0
  92. package/lib/commands/wardrobe/list.d.ts +17 -0
  93. package/lib/commands/wardrobe/list.js +81 -0
  94. package/lib/commands/wardrobe/show.d.ts +19 -0
  95. package/lib/commands/wardrobe/show.js +71 -0
  96. package/lib/commands/wardrobe/wear.d.ts +20 -0
  97. package/lib/commands/wardrobe/wear.js +79 -0
  98. package/lib/components/elements/information.js +41 -34
  99. package/lib/components/elements/steps.js +1 -1
  100. package/lib/components/elements/title.js +5 -4
  101. package/lib/components/finished.js +6 -5
  102. package/lib/components/install.js +5 -5
  103. package/lib/components/keyboard.js +5 -8
  104. package/lib/components/location.js +5 -5
  105. package/lib/components/network.js +6 -5
  106. package/lib/components/partitions.js +5 -5
  107. package/lib/components/summary.js +5 -5
  108. package/lib/components/users.js +5 -5
  109. package/lib/components/welcome.js +7 -7
  110. package/lib/interfaces/i-costume.d.ts +27 -0
  111. package/lib/interfaces/i-costume.js +2 -0
  112. package/lib/interfaces/i-distro.d.ts +4 -2
  113. package/lib/interfaces/i-installer.d.ts +1 -1
  114. package/lib/interfaces/i-krill.d.ts +1 -0
  115. package/lib/interfaces/i-materia.d.ts +32 -0
  116. package/lib/interfaces/i-materia.js +2 -0
  117. package/lib/interfaces/i-packages.d.ts +13 -0
  118. package/lib/interfaces/i-packages.js +2 -0
  119. package/lib/interfaces/i-xkb-model.d.ts +17 -0
  120. package/lib/interfaces/i-xkb-model.js +2 -0
  121. package/lib/interfaces/index.d.ts +2 -0
  122. package/lib/lib/cli-autologin.js +3 -3
  123. package/lib/lib/select_address_type.js +1 -1
  124. package/lib/lib/select_filesystem_type.js +2 -2
  125. package/lib/lib/select_installation_device.js +1 -1
  126. package/lib/lib/select_interface.js +1 -1
  127. package/lib/lib/select_keyboard_layout.d.ts +1 -28
  128. package/lib/lib/select_keyboard_layout.js +18 -33
  129. package/lib/lib/select_keyboard_model.d.ts +4 -0
  130. package/lib/lib/select_keyboard_model.js +36 -0
  131. package/lib/lib/select_keyboard_option.d.ts +4 -0
  132. package/lib/lib/select_keyboard_option.js +36 -0
  133. package/lib/lib/select_keyboard_variant.d.ts +1 -5
  134. package/lib/lib/select_keyboard_variant.js +32 -5
  135. package/lib/lib/select_languages.d.ts +1 -1
  136. package/lib/lib/select_languages.js +8 -7
  137. package/lib/lib/select_regions.d.ts +1 -1
  138. package/lib/lib/select_regions.js +2 -2
  139. package/lib/lib/select_user_swap_choice.js +2 -2
  140. package/oclif.manifest.json +1 -1
  141. package/package.json +19 -20
  142. package/scripts/_eggs +53 -8
  143. package/scripts/eggs.bash +9 -4
  144. package/scripts/mom-cli.sh +66 -0
  145. package/scripts/resy.sh +8 -0
  146. package/scripts/userexist.sh +6 -0
  147. package/assets/penguins-clinstaller.desktop +0 -24
  148. package/assets/penguins-minstall.desktop +0 -95
  149. package/conf/distros/buster/locales/locale.gen.template +0 -10
  150. package/conf/distros/buster/locales/locale.template +0 -11
  151. package/conf/distros/focal/locale.gen.template +0 -8
  152. package/lib/classes/basket.d.ts +0 -22
  153. package/lib/classes/basket.js +0 -114
@@ -0,0 +1,27 @@
1
+ /**
2
+ * penguins-eggs: tailor.ts
3
+ * author: Piero Proietti
4
+ * mail: piero.proietti@gmail.com
5
+ *
6
+ */
7
+ /**
8
+ *
9
+ */
10
+ export default class SourcesList {
11
+ /**
12
+ *
13
+ * @param repos
14
+ * @returns
15
+ */
16
+ distribution(distributions: string[]): Promise<boolean>;
17
+ /**
18
+ *
19
+ * @param repos
20
+ * @returns
21
+ */
22
+ components(components: string[]): Promise<boolean>;
23
+ /**
24
+ *
25
+ */
26
+ private get;
27
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ /**
3
+ * penguins-eggs: tailor.ts
4
+ * author: Piero Proietti
5
+ * mail: piero.proietti@gmail.com
6
+ *
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const tslib_1 = require("tslib");
10
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
11
+ const utils_1 = tslib_1.__importDefault(require("./utils"));
12
+ const utils_2 = require("../lib/utils");
13
+ const distro_1 = tslib_1.__importDefault(require("./distro"));
14
+ /**
15
+ *
16
+ */
17
+ class SourcesList {
18
+ /**
19
+ *
20
+ * @param repos
21
+ * @returns
22
+ */
23
+ async distribution(distributions) {
24
+ /**
25
+ * Linuxmint non ha nessuna configurazione in /etc/apt/sources.list
26
+ */
27
+ let checked = true;
28
+ const repos = await this.get();
29
+ if (repos.length !== 0) {
30
+ checked = false;
31
+ const distro = new distro_1.default();
32
+ for (const distribution of distributions) {
33
+ for (const repo of repos) {
34
+ if (repo.includes(distro.codenameLikeId)) {
35
+ checked = true;
36
+ }
37
+ }
38
+ }
39
+ if (!checked) {
40
+ console.log('You are on: ' + chalk_1.default.green(distro.distroId) + '/' + chalk_1.default.green(distro.codenameId));
41
+ console.log('compatible with: ' + chalk_1.default.green(distro.distroLike) + '/' + chalk_1.default.green(distro.codenameLikeId));
42
+ console.log(`This costume/accessory apply to: `);
43
+ for (const distribution of distributions) {
44
+ console.log(`- ${distribution}`);
45
+ }
46
+ utils_1.default.pressKeyToExit('distribution warning, check your /etc/apt/sources.list', true);
47
+ }
48
+ }
49
+ return checked;
50
+ }
51
+ /**
52
+ *
53
+ * @param repos
54
+ * @returns
55
+ */
56
+ async components(components) {
57
+ /**
58
+ * Linuxmint non ha nessuna configurazione in /etc/apt/sources.list
59
+ */
60
+ let checked = true;
61
+ const repos = await this.get();
62
+ if (repos.length !== 0) {
63
+ for (const repo of repos) {
64
+ for (const component of components) {
65
+ // On security we need just main
66
+ if (!repo.includes('security')) {
67
+ if (!repo.includes(component)) {
68
+ console.log('component: ' + chalk_1.default.green(component) + ' is not included in repo: ' + chalk_1.default.green(repo));
69
+ checked = false;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ if (checked) {
75
+ utils_1.default.warning('repositories checked');
76
+ }
77
+ else {
78
+ utils_1.default.pressKeyToExit('component warning, check your /etc/apt/sources.list', true);
79
+ }
80
+ }
81
+ return checked;
82
+ }
83
+ /**
84
+ *
85
+ */
86
+ async get() {
87
+ // deb uri distribution [component1] [component2] [...]
88
+ let checkRepos = await (0, utils_2.exec)(`grep "deb http"</etc/apt/sources.list`, { echo: false, capture: true });
89
+ let tmp = [];
90
+ if (checkRepos.code === 0) {
91
+ tmp = checkRepos.data.split('\n');
92
+ }
93
+ // remove empty line
94
+ let repos = [];
95
+ for (const repo of tmp) {
96
+ if (repo !== '') {
97
+ repos.push(repo);
98
+ }
99
+ }
100
+ return repos;
101
+ }
102
+ }
103
+ exports.default = SourcesList;
@@ -10,7 +10,7 @@
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  const tslib_1 = require("tslib");
12
12
  const utils_1 = require("../lib/utils");
13
- const utils_2 = (0, tslib_1.__importDefault)(require("./utils"));
13
+ const utils_2 = tslib_1.__importDefault(require("./utils"));
14
14
  class SistemdCtl {
15
15
  constructor(verbose = false) {
16
16
  this.echo = {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * penguins-eggs: tailor.ts
3
+ * author: Piero Proietti
4
+ * mail: piero.proietti@gmail.com
5
+ *
6
+ */
7
+ import { IMateria } from '../interfaces';
8
+ /**
9
+ *
10
+ */
11
+ export default class Tailor {
12
+ private verbose;
13
+ private echo;
14
+ private costume;
15
+ private wardrobe;
16
+ materials: IMateria;
17
+ /**
18
+ * @param wardrobe
19
+ * @param costume
20
+ */
21
+ constructor(costume: string);
22
+ /**
23
+ *
24
+ */
25
+ prepare(verbose?: boolean, no_accessories?: boolean): Promise<void>;
26
+ /**
27
+ * - check if every package if installed
28
+ * - if find any packages to install
29
+ * - install packages
30
+ */
31
+ helper(packages: string[], comment?: string, cmd?: string): Promise<void>;
32
+ /**
33
+ * hostname and hosts
34
+ */
35
+ private hostname;
36
+ /**
37
+ *
38
+ * @param command
39
+ */
40
+ titles(command?: string): void;
41
+ }
@@ -0,0 +1,356 @@
1
+ "use strict";
2
+ /**
3
+ * penguins-eggs: tailor.ts
4
+ * author: Piero Proietti
5
+ * mail: piero.proietti@gmail.com
6
+ *
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const tslib_1 = require("tslib");
10
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
11
+ const utils_1 = tslib_1.__importDefault(require("./utils"));
12
+ const utils_2 = require("../lib/utils");
13
+ const fs_1 = tslib_1.__importDefault(require("fs"));
14
+ const path_1 = tslib_1.__importDefault(require("path"));
15
+ const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
16
+ const pacman_1 = tslib_1.__importDefault(require("./pacman"));
17
+ const sources_list_1 = tslib_1.__importDefault(require("./sources_list"));
18
+ const xdg_1 = tslib_1.__importDefault(require("./xdg"));
19
+ const pjson = require('../../package.json');
20
+ /**
21
+ *
22
+ */
23
+ class Tailor {
24
+ /**
25
+ * @param wardrobe
26
+ * @param costume
27
+ */
28
+ constructor(costume) {
29
+ this.verbose = false;
30
+ this.echo = {};
31
+ this.costume = '';
32
+ this.wardrobe = '';
33
+ this.materials = {};
34
+ this.costume = costume;
35
+ this.wardrobe = path_1.default.dirname((path_1.default.dirname(costume)));
36
+ }
37
+ /**
38
+ *
39
+ */
40
+ async prepare(verbose = true, no_accessories = false) {
41
+ this.verbose = verbose;
42
+ this.echo = utils_1.default.setEcho(verbose);
43
+ utils_1.default.warning(`preparing ${this.costume}`);
44
+ /**
45
+ * check curl presence
46
+ */
47
+ if (!pacman_1.default.packageIsInstalled('curl')) {
48
+ utils_1.default.pressKeyToExit('In this tailoring shop we use curl. sudo apt update | apt install curl');
49
+ process.exit();
50
+ }
51
+ let tailorList = `${this.costume}/index.yml`;
52
+ if (fs_1.default.existsSync(tailorList)) {
53
+ this.materials = js_yaml_1.default.load(fs_1.default.readFileSync(tailorList, 'utf-8'));
54
+ }
55
+ /**
56
+ * sequence
57
+ */
58
+ if (this.materials.sequence !== undefined) {
59
+ /**
60
+ * sequence/repositories
61
+ */
62
+ if (this.materials.sequence.repositories !== undefined) {
63
+ utils_1.default.warning(`analyzing repositories`);
64
+ /**
65
+ * sequence/repositories/source_list_d
66
+ */
67
+ if (this.materials.sequence.repositories.sources_list !== undefined) {
68
+ let step = 'analyzing /etc/apt/sources.list';
69
+ utils_1.default.warning(step);
70
+ const sources_list = new sources_list_1.default();
71
+ sources_list.distribution(this.materials.sequence.repositories.sources_list);
72
+ sources_list.components(this.materials.sequence.repositories.sources_list);
73
+ }
74
+ /**
75
+ * sequence/repositories/source_list_d
76
+ */
77
+ if (this.materials.sequence.repositories.sources_list_d !== undefined) {
78
+ if (this.materials.sequence.repositories.sources_list_d[0] !== null) {
79
+ let step = `adding repositories to /etc/apt/sources.list.d`;
80
+ utils_1.default.warning(step);
81
+ for (const cmd of this.materials.sequence.repositories.sources_list_d) {
82
+ try {
83
+ await (0, utils_2.exec)(cmd, this.echo);
84
+ }
85
+ catch (error) {
86
+ await utils_1.default.pressKeyToExit(JSON.stringify(error));
87
+ }
88
+ }
89
+ }
90
+ }
91
+ /**
92
+ * sequence/repositories/update
93
+ */
94
+ if (this.materials.sequence.repositories.update === undefined) {
95
+ console.log('repositiories, and repositories.update MUDE be defined on sequence ');
96
+ process.exit();
97
+ }
98
+ let step = `updating repositories`;
99
+ utils_1.default.warning(step);
100
+ if (this.materials.sequence.repositories.update) {
101
+ await (0, utils_2.exec)('apt-get update', utils_1.default.setEcho(false));
102
+ }
103
+ /**
104
+ * sequence/repositories/upgrade
105
+ */
106
+ if (this.materials.sequence.repositories.upgrade !== undefined) {
107
+ let step = `apt-get full-upgrade`;
108
+ utils_1.default.warning(step);
109
+ if (this.materials.sequence.repositories.upgrade) {
110
+ await (0, utils_2.exec)('apt-get full-upgrade -y', utils_1.default.setEcho(false));
111
+ }
112
+ }
113
+ }
114
+ /**
115
+ * sequence/preinst
116
+ */
117
+ if (this.materials.sequence.preinst !== undefined) {
118
+ if (Array.isArray(this.materials.sequence.preinst)) {
119
+ let step = `preinst scripts`;
120
+ utils_1.default.warning(step);
121
+ for (const script of this.materials.sequence.preinst) {
122
+ await (0, utils_2.exec)(`${this.costume}/${script}`, utils_1.default.setEcho(true));
123
+ }
124
+ }
125
+ }
126
+ /**
127
+ * apt-get install packages
128
+ */
129
+ if (this.materials.sequence.packages !== undefined) {
130
+ await this.helper(this.materials.sequence.packages);
131
+ }
132
+ /**
133
+ * sequence/packages_no_install_recommends
134
+ */
135
+ if (this.materials.sequence.packages_no_install_recommends !== undefined) {
136
+ await this.helper(this.materials.sequence.packages_no_install_recommends, "packages without recommends and suggests", 'apt-get install --no-install-recommends --no-install-suggests -yq ');
137
+ }
138
+ /**
139
+ * sequence/debs
140
+ */
141
+ if (this.materials.sequence.debs !== undefined) {
142
+ if (this.materials.sequence.debs) {
143
+ let step = `installing local packages`;
144
+ utils_1.default.warning(step);
145
+ let cmd = `dpkg -i ${this.costume}/debs/*.deb`;
146
+ await (0, utils_2.exec)(cmd);
147
+ }
148
+ }
149
+ /**
150
+ * sequence/packages_python
151
+ */
152
+ if (this.materials.sequence.packages_python !== undefined) {
153
+ if (Array.isArray(this.materials.sequence.packages_python)) {
154
+ let cmd = 'pip install ';
155
+ let pip = '';
156
+ for (const elem of this.materials.sequence.packages_python) {
157
+ cmd += ` ${elem}`;
158
+ pip += `, ${elem}`;
159
+ }
160
+ let step = `installing python packages pip ${pip.substring(2)}`;
161
+ utils_1.default.warning(step);
162
+ await (0, utils_2.exec)(cmd, this.echo);
163
+ }
164
+ }
165
+ /**
166
+ * sequence/accessories
167
+ */
168
+ if (!no_accessories) {
169
+ if (this.materials.sequence.accessories !== undefined) {
170
+ if (Array.isArray(this.materials.sequence.accessories)) {
171
+ let step = `wearing accessories`;
172
+ for (const elem of this.materials.sequence.accessories) {
173
+ if (elem.substring(0, 2) === './') {
174
+ const tailor = new Tailor(`${this.costume}/${elem.substring(2)}`);
175
+ await tailor.prepare(verbose);
176
+ }
177
+ else {
178
+ const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`);
179
+ await tailor.prepare(verbose);
180
+ }
181
+ }
182
+ }
183
+ }
184
+ }
185
+ }
186
+ // customize è sempre indefinito
187
+ if (this.materials.customize !== undefined) {
188
+ /**
189
+ * customize/dirs
190
+ */
191
+ if (this.materials.customize.dirs) {
192
+ if (fs_1.default.existsSync(`/${this.costume}/dirs`)) {
193
+ let step = `copying dirs`;
194
+ utils_1.default.warning(step);
195
+ let cmd = `rsync -avx ${this.costume}/dirs/* /`;
196
+ await (0, utils_2.exec)(cmd, this.echo);
197
+ // chown root:root /etc -R
198
+ cmd = "chown root:root /etc/sudoers.d /etc/skel -R";
199
+ await (0, utils_2.exec)(cmd, this.echo);
200
+ /**
201
+ * Copyng skel in /home/user
202
+ */
203
+ if (fs_1.default.existsSync(`${this.costume}/dirs/etc/skel`)) {
204
+ const user = utils_1.default.getPrimaryUser();
205
+ step = `copying skel in /home/${user}/`;
206
+ utils_1.default.warning(step);
207
+ cmd = `rsync -avx ${this.costume}/dirs/etc/skel/.config /home/${user}/`;
208
+ await (0, utils_2.exec)(cmd, this.echo);
209
+ await (0, utils_2.exec)(`chown ${user}:${user} /home/${user}/ -R`);
210
+ }
211
+ }
212
+ }
213
+ /**
214
+ * customize/hostname
215
+ */
216
+ if (this.materials.customize.hostname) {
217
+ utils_1.default.warning(`changing hostname = ${this.materials.name}`);
218
+ await this.hostname();
219
+ }
220
+ /**
221
+ * customize/scripts
222
+ */
223
+ if (this.materials.customize.scripts !== undefined) {
224
+ if (Array.isArray(this.materials.customize.scripts)) {
225
+ let step = `customize script`;
226
+ utils_1.default.warning(step);
227
+ const user = process.env.SUDO_USER;
228
+ const desktop = `/home/${user}/${xdg_1.default.traduce("DESKTOP")}`;
229
+ for (const script of this.materials.customize.scripts) {
230
+ if (fs_1.default.existsSync(`${this.costume}/${script}`)) {
231
+ // exec script in costume
232
+ await (0, utils_2.exec)(`${this.costume}/${script} ${user} ${desktop}`, utils_1.default.setEcho(true));
233
+ }
234
+ else {
235
+ // exec script real env
236
+ await (0, utils_2.exec)(`${script}`, utils_1.default.setEcho(true));
237
+ }
238
+ }
239
+ }
240
+ }
241
+ }
242
+ /**
243
+ * reboot
244
+ */
245
+ if (this.materials.reboot) {
246
+ utils_1.default.warning(`Reboot`);
247
+ await utils_1.default.pressKeyToExit('system need to reboot', true);
248
+ await (0, utils_2.exec)('reboot');
249
+ }
250
+ else {
251
+ console.log(`You look good with: ${this.materials.name}`);
252
+ }
253
+ }
254
+ /**
255
+ * - check if every package if installed
256
+ * - if find any packages to install
257
+ * - install packages
258
+ */
259
+ async helper(packages, comment = 'packages', cmd = 'apt-get install -yqq ') {
260
+ if (packages[0] !== null) {
261
+ let elements = [];
262
+ let strElements = '';
263
+ for (const elem of packages) {
264
+ if (!pacman_1.default.packageIsInstalled(elem)) {
265
+ elements.push(elem);
266
+ cmd += ` ${elem}`;
267
+ strElements += `, ${elem}`;
268
+ }
269
+ }
270
+ if (elements.length > 0) {
271
+ let step = `installing ${comment}: `;
272
+ // if not verbose show strElements
273
+ if (!this.verbose) {
274
+ step += strElements.substring(2);
275
+ }
276
+ /**
277
+ * prova 5 volte
278
+ */
279
+ for (let tempts = 1; tempts < 5; tempts++) {
280
+ this.titles(step);
281
+ utils_1.default.warning(`tempts ${tempts} of 5`);
282
+ if (await tryCheckSuccess(cmd, this.echo)) {
283
+ break;
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
289
+ /**
290
+ * hostname and hosts
291
+ */
292
+ async hostname() {
293
+ /**
294
+ * hostname
295
+ */
296
+ let file = '/etc/hostname';
297
+ let text = this.materials.name;
298
+ await (0, utils_2.exec)(`rm ${file} `, this.echo);
299
+ fs_1.default.writeFileSync(file, text);
300
+ /**
301
+ * hosts
302
+ */
303
+ file = '/etc/hosts';
304
+ text = '';
305
+ text += '127.0.0.1 localhost localhost.localdomain\n';
306
+ text += `127.0.1.1 ${this.materials.name} \n`;
307
+ text += `# The following lines are desirable for IPv6 capable hosts\n`;
308
+ text += `:: 1 ip6 - localhost ip6 - loopback\n`;
309
+ text += `fe00:: 0 ip6 - localnet\n`;
310
+ text += `ff00:: 0 ip6 - mcastprefix\n`;
311
+ text += `ff02:: 1 ip6 - allnodes\n`;
312
+ text += `ff02:: 2 ip6 - allrouters\n`;
313
+ text += `ff02:: 3 ip6 - allhosts\n`;
314
+ await (0, utils_2.exec)(`rm ${file} `, this.echo);
315
+ fs_1.default.writeFileSync(file, text);
316
+ /**
317
+ * chenge config.snapshot.basename
318
+ */
319
+ const config_file = '/etc/penguins-eggs.d/eggs.yaml';
320
+ let config = js_yaml_1.default.load(fs_1.default.readFileSync(config_file, 'utf-8'));
321
+ config.snapshot_basename = this.materials.name;
322
+ fs_1.default.writeFileSync(config_file, js_yaml_1.default.dump(config), 'utf-8');
323
+ }
324
+ /**
325
+ *
326
+ * @param command
327
+ */
328
+ titles(command = '') {
329
+ console.clear();
330
+ console.log('');
331
+ console.log(' E G G S: the reproductive system of penguins');
332
+ console.log('');
333
+ console.log(chalk_1.default.bgGreen.whiteBright(' ' + pjson.name + ' ') +
334
+ chalk_1.default.bgWhite.blue(" Perri's Brewery edition ") +
335
+ chalk_1.default.bgRed.whiteBright(' ver. ' + pjson.version + ' '));
336
+ console.log('wearing: ' + chalk_1.default.bgBlack.cyan(this.costume) + ' ' + chalk_1.default.bgBlack.white(command) + '\n');
337
+ }
338
+ }
339
+ exports.default = Tailor;
340
+ /**
341
+ *
342
+ * @param cmd
343
+ * @param echo
344
+ * @returns
345
+ */
346
+ async function tryCheckSuccess(cmd, echo) {
347
+ let success = false;
348
+ try {
349
+ await (0, utils_2.exec)(cmd, echo);
350
+ success = true;
351
+ }
352
+ catch (e) {
353
+ success = false;
354
+ }
355
+ return success;
356
+ }
@@ -7,10 +7,10 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const tslib_1 = require("tslib");
10
- const node_fs_1 = (0, tslib_1.__importDefault)(require("node:fs"));
11
- const js_yaml_1 = (0, tslib_1.__importDefault)(require("js-yaml"));
12
- const settings_1 = (0, tslib_1.__importDefault)(require("./settings"));
13
- const utils_1 = (0, tslib_1.__importDefault)(require("./utils"));
10
+ const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
11
+ const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
12
+ const settings_1 = tslib_1.__importDefault(require("./settings"));
13
+ const utils_1 = tslib_1.__importDefault(require("./utils"));
14
14
  /**
15
15
  * Utils: general porpourse utils
16
16
  * @remarks all the utilities
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
4
+ const fs_1 = tslib_1.__importDefault(require("fs"));
5
5
  const utils_1 = require("../lib/utils");
6
6
  /**
7
7
  *
@@ -12,9 +12,9 @@ export default class Utils {
12
12
  /**
13
13
  * Restituisce il prefisso della iso
14
14
  * @param distroId
15
- * @param versionId
15
+ * @param codenameId
16
16
  */
17
- static snapshotPrefix(distroId: string, versionId: string): string;
17
+ static snapshotPrefix(distroId: string, codenameId: string): string;
18
18
  /**
19
19
  * Controlla se il sistema è avviato con systemd
20
20
  * funziona anche in MX che utilizza systemd
@@ -28,7 +28,10 @@ export default class Utils {
28
28
  static isSysvinit(): boolean;
29
29
  /**
30
30
  * ricava path per vmlinuz
31
- * BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.15.6-200.fc35.x86_64 root=UUID=91cf614e-62a1-464c-904f-38d0a1ceb7a7 ro rootflags=subvol=root rhgb quiet
31
+ * Normalmente cerca BOOT_IMAGE
32
+ * BOOT_IMAGE=/boot/vmlinuz-5.16.0-3-amd64 root=UUID=13768873-d6ba-4ae5-9e14-b5011f5aa31c ro quiet splash resume=UUID=beafb9b4-c429-4e1f-a268-4270b63a14e6
33
+ * se non è presente, come nel caso di Franco, cerca initrd e ricostruisce vmlinuz
34
+ * ro root=UUID=3dc0f202-8ac8-4686-9316-dddcec060c48 initrd=boot\initrd.img-5.15.0-0.bpo.3-amd64 // Conidi
32
35
  */
33
36
  static vmlinuz(): string;
34
37
  /**
@@ -179,6 +182,11 @@ export default class Utils {
179
182
  * @returns isRoot
180
183
  */
181
184
  static isRoot(command?: string): boolean;
185
+ /**
186
+ *
187
+ * @param command
188
+ */
189
+ static useRoot(command?: string): void;
182
190
  /**
183
191
  * get the kernel version
184
192
  */
@@ -283,4 +291,9 @@ export default class Utils {
283
291
  * @returns
284
292
  */
285
293
  static formatBytes(bytes: number, decimals?: number): string;
294
+ /**
295
+ *
296
+ * @returns wardrobe
297
+ */
298
+ static wardrobe(): Promise<string>;
286
299
  }