penguins-eggs 9.1.12 → 9.1.30

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 (146) hide show
  1. package/README.md +57 -83
  2. package/addons/eggs/adapt/applications/eggs-adapt.desktop +1 -1
  3. package/addons/eggs/adapt/bin/{eggs-adapt.sh → adapt} +1 -0
  4. package/addons/eggs/ichoice/bin/eggs-ichoice.sh +0 -0
  5. package/addons/eggs/pve/applications/eggs-pve.desktop +0 -0
  6. package/addons/eggs/rsupport/applications/eggs-rsupport.desktop +0 -0
  7. package/addons/eggs/theme/applications/install-debian.desktop +235 -22
  8. package/addons/neon/theme/applications/install-debian.desktop +0 -0
  9. package/addons/telos/theme/applications/install-debian.desktop +0 -0
  10. package/addons/ufficiozero/theme/applications/install-debian.desktop +0 -0
  11. package/addons/waydroid/theme/applications/install-debian.desktop +0 -0
  12. package/assets/calamares/install-debian +2 -2
  13. package/assets/penguins-eggs.desktop +0 -0
  14. package/assets/penguins-krill.desktop +0 -0
  15. package/assets/penguins-live-installer.desktop +0 -0
  16. package/bin/dev +0 -0
  17. package/conf/distros/bionic/calamares/calamares-modules/after-bootloader/after-bootloader.sh +0 -0
  18. package/conf/distros/bionic/calamares/calamares-modules/before-bootloader/before-bootloader.sh +0 -0
  19. package/conf/distros/bionic/calamares/calamares-modules/before-bootloader-mkdirs/before-bootloader-mkdirs.sh +0 -0
  20. package/conf/distros/bionic/calamares/calamares-modules/bug/bug.sh +0 -0
  21. package/conf/distros/bionic/calamares/calamares-modules/grubcfg/main.py +0 -0
  22. package/conf/distros/bionic/calamares/settings.yml +3 -3
  23. package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +12 -0
  24. package/conf/distros/buster/calamares/calamares-modules/cleanup/module.yml +9 -0
  25. package/conf/distros/buster/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +13 -0
  26. package/conf/distros/buster/calamares/calamares-modules/dpkg-unsafe-io/module.yml +6 -0
  27. package/conf/distros/buster/calamares/calamares-modules/dpkg-unsafe-io-undo/module.yml +6 -0
  28. package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
  29. package/conf/distros/buster/calamares/modules/bootloader.yml +6 -6
  30. package/conf/distros/buster/calamares/modules/displaymanager.yml +3 -2
  31. package/conf/distros/buster/calamares/modules/finished.yml +2 -2
  32. package/conf/distros/buster/calamares/modules/fstab.yml +1 -2
  33. package/conf/distros/buster/calamares/modules/luksopenswaphookcfg.yml +1 -2
  34. package/conf/distros/buster/calamares/modules/machineid.yml +9 -2
  35. package/conf/distros/buster/calamares/modules/mount.yml +1 -2
  36. package/conf/distros/buster/calamares/modules/packages.yml +1 -1
  37. package/conf/distros/buster/calamares/modules/unpackfs.yml +1 -2
  38. package/conf/distros/buster/calamares/modules/users.yml +3 -4
  39. package/conf/distros/buster/calamares/modules/welcome.yml +1 -1
  40. package/conf/distros/buster/calamares/settings.yml +40 -12
  41. package/conf/distros/focal/calamares/calamares-modules/automirror/main.py +0 -0
  42. package/conf/distros/focal/calamares/modules/after_bootloader_context.yml +2 -3
  43. package/conf/distros/focal/calamares/modules/automirror.yml +6 -0
  44. package/conf/distros/focal/calamares/modules/before_bootloader_context.yml +13 -14
  45. package/conf/distros/focal/calamares/modules/before_bootloader_mkdirs_context.yml +3 -4
  46. package/conf/distros/focal/calamares/modules/bootloader.yml +1 -2
  47. package/conf/distros/focal/calamares/modules/finished.yml +1 -2
  48. package/conf/distros/focal/calamares/modules/fstab.yml +1 -2
  49. package/conf/distros/focal/calamares/modules/grubcfg.yml +2 -3
  50. package/conf/distros/focal/calamares/modules/locale.yml +6 -7
  51. package/conf/distros/focal/calamares/modules/machineid.yml +1 -2
  52. package/conf/distros/focal/calamares/modules/mount.yml +19 -20
  53. package/conf/distros/focal/calamares/modules/partition.yml +5 -3
  54. package/conf/distros/focal/calamares/modules/shellprocess_add386arch.yml +2 -3
  55. package/conf/distros/focal/calamares/modules/shellprocess_bug-LP#1829805.yml +1 -3
  56. package/conf/distros/focal/calamares/modules/shellprocess_logs.yml +2 -3
  57. package/conf/distros/focal/calamares/modules/unpackfs.yml +2 -2
  58. package/conf/distros/focal/calamares/modules/users.yml +37 -16
  59. package/conf/distros/focal/calamares/modules/welcome.yml +21 -22
  60. package/conf/distros/focal/calamares/settings.yml +5 -6
  61. package/conf/distros/jammy/README.md +32 -0
  62. package/conf/distros/jessie/krill/settings.yml +1 -1
  63. package/conf/distros/rolling/calamares/modules/packages.yml +2 -2
  64. package/conf/distros/rolling/calamares/settings.yml +3 -3
  65. package/conf/exclude.list +3 -0
  66. package/lib/classes/daddy.js +7 -4
  67. package/lib/classes/distro.js +3 -2
  68. package/lib/classes/family/archlinux.js +1 -0
  69. package/lib/classes/family/debian.js +15 -29
  70. package/lib/classes/i18n.d.ts +0 -4
  71. package/lib/classes/i18n.js +15 -27
  72. package/lib/classes/incubation/distros/bionic.js +1 -1
  73. package/lib/classes/incubation/distros/buster.js +4 -3
  74. package/lib/classes/incubation/distros/focal.js +1 -1
  75. package/lib/classes/incubation/distros/rolling.js +0 -1
  76. package/lib/classes/incubation/fisherman-helper/displaymanager.js +5 -3
  77. package/lib/classes/incubation/fisherman-helper/packages.js +39 -67
  78. package/lib/classes/incubation/incubator.js +1 -0
  79. package/lib/classes/krill_install.d.ts +0 -1
  80. package/lib/classes/krill_install.js +19 -19
  81. package/lib/classes/ovary.js +97 -101
  82. package/lib/classes/pacman.js +5 -46
  83. package/lib/classes/sources_list.js +11 -20
  84. package/lib/classes/tailor.d.ts +13 -11
  85. package/lib/classes/tailor.js +266 -102
  86. package/lib/classes/users.js +63 -60
  87. package/lib/classes/utils.d.ts +1 -1
  88. package/lib/classes/utils.js +16 -12
  89. package/lib/classes/xdg.js +38 -21
  90. package/lib/classes/yolk.js +1 -1
  91. package/lib/commands/analyze.js +4 -4
  92. package/lib/commands/calamares.d.ts +1 -1
  93. package/lib/commands/calamares.js +7 -7
  94. package/lib/commands/config.d.ts +1 -1
  95. package/lib/commands/config.js +7 -5
  96. package/lib/commands/dad.js +2 -2
  97. package/lib/commands/produce.js +2 -1
  98. package/lib/commands/syncfrom.js +9 -9
  99. package/lib/commands/syncto.js +20 -20
  100. package/lib/commands/tools/skel.js +2 -2
  101. package/lib/commands/wardrobe/ironing.d.ts +3 -0
  102. package/lib/commands/wardrobe/ironing.js +22 -4
  103. package/lib/commands/wardrobe/wear.d.ts +1 -0
  104. package/lib/commands/wardrobe/wear.js +7 -2
  105. package/lib/interfaces/i-materia.d.ts +3 -0
  106. package/lib/interfaces/index.d.ts +0 -1
  107. package/lib/lib/cli-autologin.js +24 -24
  108. package/lib/lib/dependencies.js +4 -13
  109. package/lib/lib/get_address.js +3 -2
  110. package/lib/lib/get_dns.js +3 -2
  111. package/lib/lib/get_domain.js +3 -2
  112. package/lib/lib/get_gateway.js +3 -2
  113. package/lib/lib/get_hostname.js +3 -2
  114. package/lib/lib/get_netmask.js +3 -2
  115. package/lib/lib/get_password.js +3 -2
  116. package/lib/lib/get_root_password.js +3 -2
  117. package/lib/lib/get_userfullname.js +3 -2
  118. package/lib/lib/get_username.js +3 -2
  119. package/lib/lib/select_filesystem_type.js +2 -2
  120. package/lib/lib/select_installation_device.js +2 -2
  121. package/lib/lib/select_installation_mode.js +3 -2
  122. package/lib/lib/select_regions.js +3 -2
  123. package/lib/lib/select_user_swap_choice.js +2 -2
  124. package/lib/lib/select_zones.js +3 -2
  125. package/mkinitcpio/README.md +77 -0
  126. package/mkinitcpio/garuda/README.md +29 -0
  127. package/mkinitcpio/manjaro/mkinitcpio.conf +4 -0
  128. package/package.json +113 -114
  129. package/scripts/_eggs +3 -11
  130. package/scripts/bros/waydroid-helper.sh +0 -0
  131. package/scripts/eggs-adapt.sh +5 -0
  132. package/scripts/eggs.bash +2 -3
  133. package/scripts/install-eggs-ppa.sh +0 -0
  134. package/scripts/mom-cli.sh +0 -0
  135. package/scripts/pve-live.service +0 -0
  136. package/scripts/pve-live.sh +0 -0
  137. package/scripts/resy.sh +0 -0
  138. package/scripts/userexist.sh +0 -0
  139. package/conf/distros/buster/calamares/calamares-modules/remove-link/module.yml +0 -9
  140. package/conf/distros/buster/calamares/calamares-modules/remove-link/remove-link.sh +0 -3
  141. package/conf/distros/buster/calamares/modules/shellprocess_eggs-cleanup.yml +0 -6
  142. package/lib/commands/tools/locales.d.ts +0 -13
  143. package/lib/commands/tools/locales.js +0 -43
  144. package/lib/interfaces/i-costume.d.ts +0 -27
  145. package/lib/interfaces/i-costume.js +0 -2
  146. package/oclif.manifest.json +0 -1
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
2
4
  /**
3
5
  * penguins-eggs: tailor.ts
4
6
  * author: Piero Proietti
5
7
  * mail: piero.proietti@gmail.com
6
8
  *
7
9
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const tslib_1 = require("tslib");
10
10
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
11
11
  const utils_1 = tslib_1.__importDefault(require("./utils"));
12
12
  const utils_2 = require("../lib/utils");
@@ -16,7 +16,6 @@ const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
16
16
  const pacman_1 = tslib_1.__importDefault(require("./pacman"));
17
17
  const distro_1 = tslib_1.__importDefault(require("./distro"));
18
18
  const sources_list_1 = tslib_1.__importDefault(require("./sources_list"));
19
- const xdg_1 = tslib_1.__importDefault(require("./xdg"));
20
19
  const pjson = require('../../package.json');
21
20
  /**
22
21
  *
@@ -26,19 +25,21 @@ class Tailor {
26
25
  * @param wardrobe
27
26
  * @param costume
28
27
  */
29
- constructor(costume) {
28
+ constructor(costume, category = 'costume') {
30
29
  this.verbose = false;
31
30
  this.echo = {};
32
31
  this.costume = '';
33
32
  this.wardrobe = '';
33
+ this.category = 'costume';
34
34
  this.materials = {};
35
35
  this.costume = costume;
36
36
  this.wardrobe = path_1.default.dirname((path_1.default.dirname(costume)));
37
+ this.category = category;
37
38
  }
38
39
  /**
39
40
  *
40
41
  */
41
- async prepare(verbose = true, no_accessories = false) {
42
+ async prepare(verbose = true, no_accessories = false, no_firmwares = false) {
42
43
  this.verbose = verbose;
43
44
  this.echo = utils_1.default.setEcho(verbose);
44
45
  utils_1.default.warning(`preparing ${this.costume}`);
@@ -53,39 +54,93 @@ class Tailor {
53
54
  if (fs_1.default.existsSync(tailorList)) {
54
55
  this.materials = js_yaml_1.default.load(fs_1.default.readFileSync(tailorList, 'utf-8'));
55
56
  }
57
+ else {
58
+ if (this.category === 'costume') {
59
+ this.titles(`${this.category}: ${this.costume}`);
60
+ console.log('Tailor\'s list ' + chalk_1.default.cyan(tailorList) + ' is not found \non your wardrobe ' + chalk_1.default.cyan(this.wardrobe) + '.\n');
61
+ console.log('Costume will not be installed, operations will abort.\n');
62
+ utils_1.default.pressKeyToExit();
63
+ process.exit();
64
+ }
65
+ else if (this.category === 'accessory') {
66
+ this.titles(`${this.category}: ${this.costume}`);
67
+ console.log('Tailor\'s list ' + chalk_1.default.cyan(tailorList) + ' is not found \non your wardrobe ' + chalk_1.default.cyan(this.wardrobe) + '.\n');
68
+ console.log('Accessory will not be installed, operations will continue.\n');
69
+ utils_1.default.pressKeyToExit();
70
+ return;
71
+ }
72
+ else if (this.category === 'try_accessory') {
73
+ return;
74
+ }
75
+ }
76
+ /**
77
+ * distro e sources_list
78
+ * vengono definite qua perchè servono a tutti
79
+ */
80
+ const distro = new distro_1.default();
81
+ const sources_list = new sources_list_1.default();
82
+ let step = '';
83
+ if (this.materials.distributions !== undefined) {
84
+ step = 'analyzing distribution';
85
+ utils_1.default.warning(step);
86
+ if (!await sources_list.distribution(this.materials.distributions)) {
87
+ if (this.category === 'costume') {
88
+ this.titles('step');
89
+ console.log('Costume ' + chalk_1.default.cyan(this.materials.name) + ' is not compatible \nwith your ' + chalk_1.default.cyan(distro.distroId + '/' + distro.codenameId) + ' system.\n');
90
+ console.log('Costume will not be installed, operations will abort.\n');
91
+ utils_1.default.pressKeyToExit();
92
+ process.exit();
93
+ }
94
+ else if (this.category === 'accessory') {
95
+ this.titles('step');
96
+ console.log('Accessory ' + chalk_1.default.cyan(this.materials.name) + ' is not compatible \nwith your ' + chalk_1.default.cyan(distro.distroId + '/' + distro.codenameId) + ' system.\n');
97
+ console.log('Accessory will not be installed, operations will continue.\n');
98
+ utils_1.default.pressKeyToExit();
99
+ return;
100
+ }
101
+ else if (this.category === 'try_accessory') {
102
+ return;
103
+ }
104
+ }
105
+ }
56
106
  /**
57
107
  * sequence
58
108
  */
59
109
  if (this.materials.sequence !== undefined) {
110
+ step = 'analyzing sequence';
111
+ utils_1.default.warning(step);
60
112
  /**
61
113
  * sequence/repositories
62
114
  */
63
115
  if (this.materials.sequence.repositories !== undefined) {
64
- utils_1.default.warning(`analyzing repositories`);
65
116
  /**
66
- * sequence/repositories/source_list
67
- * solo per Debian/Devuan
117
+ * sequence/repositories/sources_list
68
118
  */
69
- const distro = new distro_1.default();
70
- if (distro.distroId === 'Debian' || distro.distroId === 'Devuan') {
71
- if (this.materials.sequence.repositories.sources_list !== undefined) {
72
- let step = 'analyzing /etc/apt/sources.list';
73
- utils_1.default.warning(step);
74
- const sources_list = new sources_list_1.default();
75
- sources_list.distribution(this.materials.sequence.repositories.sources_list);
76
- sources_list.components(this.materials.sequence.repositories.sources_list);
119
+ // evito di fallire se sources_list non è presente
120
+ if (this.materials.sequence.repositories.sources_list !== undefined) {
121
+ step = 'analyzing sources_list';
122
+ utils_1.default.warning(step);
123
+ // controllo i componenti solo se Debian/Devuab
124
+ if (distro.distroId === 'Debian' || distro.distroId === 'Devuan') {
125
+ await sources_list.components(this.materials.sequence.repositories.sources_list);
77
126
  }
78
127
  }
79
128
  /**
80
- * sequence/repositories/source_list_d
129
+ * sequence/repositories/sources_list_d
81
130
  */
82
131
  if (this.materials.sequence.repositories.sources_list_d !== undefined) {
83
132
  if (this.materials.sequence.repositories.sources_list_d[0] !== null) {
84
- let step = `adding repositories to /etc/apt/sources.list.d`;
133
+ step = `adding repositories to /etc/apt/sources_list_d`;
85
134
  utils_1.default.warning(step);
86
135
  for (const cmd of this.materials.sequence.repositories.sources_list_d) {
87
136
  try {
88
- await (0, utils_2.exec)(cmd, this.echo);
137
+ // repeat 3 times if fail curl or others commands
138
+ for (let i = 0; i < 2; i++) {
139
+ let result = await (0, utils_2.exec)(cmd, this.echo);
140
+ if (result.code === 0) {
141
+ break;
142
+ }
143
+ }
89
144
  }
90
145
  catch (error) {
91
146
  await utils_1.default.pressKeyToExit(JSON.stringify(error));
@@ -97,10 +152,10 @@ class Tailor {
97
152
  * sequence/repositories/update
98
153
  */
99
154
  if (this.materials.sequence.repositories.update === undefined) {
100
- console.log('repositiories, and repositories.update MUDE be defined on sequence ');
155
+ console.log('repositiories, and repositories.update MUST be defined on sequence ');
101
156
  process.exit();
102
157
  }
103
- let step = `updating repositories`;
158
+ step = `updating repositories`;
104
159
  utils_1.default.warning(step);
105
160
  if (this.materials.sequence.repositories.update) {
106
161
  await (0, utils_2.exec)('apt-get update', utils_1.default.setEcho(false));
@@ -109,99 +164,163 @@ class Tailor {
109
164
  * sequence/repositories/upgrade
110
165
  */
111
166
  if (this.materials.sequence.repositories.upgrade !== undefined) {
112
- let step = `apt-get full-upgrade`;
167
+ step = `apt-get full-upgrade`;
113
168
  utils_1.default.warning(step);
114
169
  if (this.materials.sequence.repositories.upgrade) {
115
170
  await (0, utils_2.exec)('apt-get full-upgrade -y', utils_1.default.setEcho(false));
116
171
  }
117
172
  }
118
173
  }
119
- /**
120
- * sequence/preinst
121
- */
122
- if (this.materials.sequence.preinst !== undefined) {
123
- if (Array.isArray(this.materials.sequence.preinst)) {
124
- let step = `preinst scripts`;
125
- utils_1.default.warning(step);
126
- for (const script of this.materials.sequence.preinst) {
174
+ } // fine repositories
175
+ /**
176
+ * sequence/preinst
177
+ */
178
+ if (this.materials.sequence.preinst !== undefined) {
179
+ if (Array.isArray(this.materials.sequence.preinst)) {
180
+ step = `preinst scripts`;
181
+ utils_1.default.warning(step);
182
+ for (const script of this.materials.sequence.preinst) {
183
+ if (fs_1.default.existsSync(`${this.costume}/${script}`)) {
127
184
  await (0, utils_2.exec)(`${this.costume}/${script}`, utils_1.default.setEcho(true));
128
185
  }
186
+ else {
187
+ // exec script real env
188
+ await (0, utils_2.exec)(`${script}`, utils_1.default.setEcho(true));
189
+ }
129
190
  }
130
191
  }
131
- /**
132
- * apt-get install dependencies
133
- */
134
- if (this.materials.sequence.dependencies !== undefined) {
135
- await this.helper(this.materials.sequence.dependencies, "dependencies");
192
+ }
193
+ /**
194
+ * apt-get install dependencies
195
+ */
196
+ if (this.materials.sequence.dependencies !== undefined) {
197
+ const dependencies = await this.helperExists(this.materials.sequence.dependencies);
198
+ if (dependencies.length > 1) {
199
+ await this.helperInstall(dependencies, "dependencies");
136
200
  }
137
- /**
138
- * apt-get install packages
139
- */
140
- if (this.materials.sequence.packages !== undefined) {
141
- await this.helper(this.materials.sequence.packages);
201
+ }
202
+ /**
203
+ * apt-get install packages
204
+ */
205
+ if (this.materials.sequence.packages !== undefined) {
206
+ const packages = await this.helperExists(this.materials.sequence.packages, true, 'packages');
207
+ if (packages.length > 1) {
208
+ await this.helperInstall(packages);
142
209
  }
143
- /**
144
- * sequence/packages_no_install_recommends
145
- */
146
- if (this.materials.sequence.packages_no_install_recommends !== undefined) {
147
- 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 ');
210
+ }
211
+ /**
212
+ * sequence/packages_no_install_recommends
213
+ */
214
+ if (this.materials.sequence.packages_no_install_recommends !== undefined) {
215
+ const packages_no_install_recommends = await this.helperExists(this.materials.sequence.packages_no_install_recommends, true, 'packages_no_install_recommends');
216
+ if (packages_no_install_recommends.length > 1) {
217
+ await this.helperInstall(packages_no_install_recommends, "packages without recommends and suggests", 'apt-get install --no-install-recommends --no-install-suggests -yq ');
148
218
  }
149
- /**
150
- * sequence/debs
151
- */
152
- if (this.materials.sequence.debs !== undefined) {
153
- if (this.materials.sequence.debs) {
154
- let step = `installing local packages`;
155
- utils_1.default.warning(step);
156
- let cmd = `dpkg -i ${this.costume}/debs/*.deb`;
157
- await (0, utils_2.exec)(cmd);
219
+ }
220
+ /**
221
+ * apt-get TRY install packages
222
+ */
223
+ if (this.materials.sequence.try_packages !== undefined) {
224
+ const try_packages = await this.helperExists(this.materials.sequence.try_packages, false);
225
+ if (try_packages.length > 1) {
226
+ await this.helperInstall(try_packages, 'try packages ');
227
+ }
228
+ }
229
+ /**
230
+ * apt-get TRY packages_no_install_recommends
231
+ */
232
+ if (this.materials.sequence.try_packages_no_install_recommends !== undefined) {
233
+ const try_packages_no_install_recommends = await this.helperExists(this.materials.sequence.try_packages_no_install_recommends, false);
234
+ if (try_packages_no_install_recommends.length > 1) {
235
+ await this.helperInstall(try_packages_no_install_recommends, "try packages without recommends and suggests", 'apt-get install --no-install-recommends --no-install-suggests -yq ');
236
+ }
237
+ }
238
+ /**
239
+ * sequence/debs
240
+ */
241
+ if (this.materials.sequence.debs !== undefined) {
242
+ if (this.materials.sequence.debs) {
243
+ step = `installing local packages`;
244
+ utils_1.default.warning(step);
245
+ let pathDebs = `${this.costume}/debs/${distro.codenameLikeId}`;
246
+ if (!fs_1.default.existsSync(pathDebs)) {
247
+ pathDebs = `${this.costume}/debs`;
248
+ }
249
+ // if exists pathDebs
250
+ if (fs_1.default.existsSync(pathDebs)) {
251
+ await (0, utils_2.exec)(`dpkg -i ${pathDebs}/*.deb`);
158
252
  }
159
253
  }
160
- /**
161
- * sequence/packages_python
162
- */
163
- if (this.materials.sequence.packages_python !== undefined) {
164
- if (Array.isArray(this.materials.sequence.packages_python)) {
165
- let cmd = 'pip install ';
166
- let pip = '';
167
- for (const elem of this.materials.sequence.packages_python) {
168
- cmd += ` ${elem}`;
169
- pip += `, ${elem}`;
254
+ }
255
+ /**
256
+ * sequence/packages_python
257
+ */
258
+ if (this.materials.sequence.packages_python !== undefined) {
259
+ if (Array.isArray(this.materials.sequence.packages_python)) {
260
+ let cmd = 'pip install ';
261
+ let pip = '';
262
+ for (const elem of this.materials.sequence.packages_python) {
263
+ cmd += ` ${elem}`;
264
+ pip += `, ${elem}`;
265
+ }
266
+ step = `installing python packages pip ${pip.substring(2)}`;
267
+ utils_1.default.warning(step);
268
+ await (0, utils_2.exec)(cmd, this.echo);
269
+ }
270
+ }
271
+ /**
272
+ * sequence/accessories
273
+ */
274
+ if (!no_accessories) {
275
+ // accessories
276
+ if (this.materials.sequence.accessories !== undefined) {
277
+ if (Array.isArray(this.materials.sequence.accessories)) {
278
+ step = `wearing accessories`;
279
+ for (const elem of this.materials.sequence.accessories) {
280
+ if ((elem === 'firmwares' || elem === './firmwares') && no_firmwares) {
281
+ continue;
282
+ }
283
+ if (elem.substring(0, 2) === './') {
284
+ const tailor = new Tailor(`${this.costume}/${elem.substring(2)}`, 'accessory');
285
+ await tailor.prepare(verbose);
286
+ }
287
+ else {
288
+ const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`, 'accessory');
289
+ await tailor.prepare(verbose);
290
+ }
170
291
  }
171
- let step = `installing python packages pip ${pip.substring(2)}`;
172
- utils_1.default.warning(step);
173
- await (0, utils_2.exec)(cmd, this.echo);
174
292
  }
175
293
  }
176
- /**
177
- * sequence/accessories
178
- */
179
- if (!no_accessories) {
180
- if (this.materials.sequence.accessories !== undefined) {
181
- if (Array.isArray(this.materials.sequence.accessories)) {
182
- let step = `wearing accessories`;
183
- for (const elem of this.materials.sequence.accessories) {
184
- if (elem.substring(0, 2) === './') {
185
- const tailor = new Tailor(`${this.costume}/${elem.substring(2)}`);
186
- await tailor.prepare(verbose);
187
- }
188
- else {
189
- const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`);
190
- await tailor.prepare(verbose);
191
- }
294
+ // try_accessories
295
+ if (this.materials.sequence.try_accessories !== undefined) {
296
+ if (Array.isArray(this.materials.sequence.try_accessories)) {
297
+ step = `wearing try_accessories`;
298
+ for (const elem of this.materials.sequence.try_accessories) {
299
+ if ((elem === 'firmwares' || elem === './firmwares') && no_firmwares) {
300
+ continue;
301
+ }
302
+ if (elem.substring(0, 2) === './') {
303
+ const tailor = new Tailor(`${this.costume}/${elem.substring(2)}`, 'try_accessory');
304
+ await tailor.prepare(verbose);
305
+ }
306
+ else {
307
+ const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`, 'try_accessory');
308
+ await tailor.prepare(verbose);
192
309
  }
193
310
  }
194
311
  }
195
312
  }
196
- }
197
- // customize è sempre indefinito
313
+ } // no-accessories
314
+ /**
315
+ * customize
316
+ */
198
317
  if (this.materials.customize !== undefined) {
199
318
  /**
200
319
  * customize/dirs
201
320
  */
202
321
  if (this.materials.customize.dirs) {
203
322
  if (fs_1.default.existsSync(`/${this.costume}/dirs`)) {
204
- let step = `copying dirs`;
323
+ step = `copying dirs`;
205
324
  utils_1.default.warning(step);
206
325
  let cmd = `rsync -avx ${this.costume}/dirs/* /`;
207
326
  await (0, utils_2.exec)(cmd, this.echo);
@@ -233,14 +352,12 @@ class Tailor {
233
352
  */
234
353
  if (this.materials.customize.scripts !== undefined) {
235
354
  if (Array.isArray(this.materials.customize.scripts)) {
236
- let step = `customize script`;
355
+ step = `customize script`;
237
356
  utils_1.default.warning(step);
238
- const user = process.env.SUDO_USER;
239
- const desktop = `/home/${user}/${xdg_1.default.traduce("DESKTOP")}`;
240
357
  for (const script of this.materials.customize.scripts) {
241
358
  if (fs_1.default.existsSync(`${this.costume}/${script}`)) {
242
- // exec script in costume
243
- await (0, utils_2.exec)(`${this.costume}/${script} ${user} ${desktop}`, utils_1.default.setEcho(true));
359
+ // exec script in costume passing costume-name
360
+ await (0, utils_2.exec)(`${this.costume}/${script} ${this.materials.name}`, utils_1.default.setEcho(true));
244
361
  }
245
362
  else {
246
363
  // exec script real env
@@ -262,21 +379,67 @@ class Tailor {
262
379
  console.log(`You look good with: ${this.materials.name}`);
263
380
  }
264
381
  }
382
+ /**
383
+ *
384
+ * @param packages
385
+ * @param verbose
386
+ * @param section
387
+ * @returns
388
+ */
389
+ async helperExists(packages, verbose = false, section = '') {
390
+ const packages_we_want = '/tmp/packages_we_want';
391
+ const packages_not_exists = '/tmp/packages_not_exists';
392
+ const packages_exists = '/tmp/packages_exists';
393
+ await (0, utils_2.exec)(`rm -f ${packages_we_want}`);
394
+ await (0, utils_2.exec)(`rm -f ${packages_not_exists}`);
395
+ await (0, utils_2.exec)(`rm -f ${packages_exists}`);
396
+ /**
397
+ * packages_we_want
398
+ */
399
+ let content = '';
400
+ packages.sort();
401
+ for (const elem of packages) {
402
+ if (!pacman_1.default.packageIsInstalled(elem)) {
403
+ content += elem + '\n';
404
+ }
405
+ }
406
+ fs_1.default.writeFileSync(packages_we_want, content, 'utf-8');
407
+ /**
408
+ * packages_exists
409
+ */
410
+ await (0, utils_2.exec)(`apt-cache --no-generate pkgnames | sort | comm -12 - ${packages_we_want} > ${packages_exists}`);
411
+ /**
412
+ * packages_not_exists
413
+ */
414
+ if (verbose) {
415
+ await (0, utils_2.exec)(`apt-cache --no-generate pkgnames | sort | comm -13 - ${packages_we_want} > ${packages_not_exists}`);
416
+ const not_exist_packages = fs_1.default.readFileSync(packages_not_exists, 'utf-8').split('\n');
417
+ if (not_exist_packages.length > 1) { // Una riga c'è sempre
418
+ let content = '';
419
+ // for (const elem of not_exist_packages) {
420
+ for (let i = 0; i < not_exist_packages.length - 1; i++) {
421
+ content += `- ${not_exist_packages[i]}\n`;
422
+ }
423
+ this.titles('tailor');
424
+ console.log(`Following packages from ` + chalk_1.default.cyan(this.materials.name) + ' section: ' + chalk_1.default.cyan(section) + `, was not found:`);
425
+ console.log(content);
426
+ utils_1.default.pressKeyToExit("Press a key to continue...");
427
+ }
428
+ }
429
+ return fs_1.default.readFileSync(packages_exists, 'utf-8').split('\n');
430
+ }
265
431
  /**
266
432
  * - check if every package if installed
267
- * - if find any packages to install
268
- * - install packages
433
+ * - if find any packages to install, install it
269
434
  */
270
- async helper(packages, comment = 'packages', cmd = 'apt-get install -yqq ') {
435
+ async helperInstall(packages, comment = 'packages', cmd = 'apt-get install -yqq ') {
271
436
  if (packages[0] !== null) {
272
437
  let elements = [];
273
438
  let strElements = '';
274
439
  for (const elem of packages) {
275
- if (!pacman_1.default.packageIsInstalled(elem)) {
276
- elements.push(elem);
277
- cmd += ` ${elem}`;
278
- strElements += `, ${elem}`;
279
- }
440
+ elements.push(elem);
441
+ cmd += ` ${elem}`;
442
+ strElements += `, ${elem}`;
280
443
  }
281
444
  if (elements.length > 0) {
282
445
  let step = `installing ${comment}: `;
@@ -285,11 +448,12 @@ class Tailor {
285
448
  step += strElements.substring(2);
286
449
  }
287
450
  /**
288
- * prova 5 volte
451
+ * prova 3 volte
289
452
  */
290
- for (let tempts = 1; tempts < 5; tempts++) {
453
+ let limit = 3;
454
+ for (let tempts = 1; tempts < limit; tempts++) {
291
455
  this.titles(step);
292
- utils_1.default.warning(`tempts ${tempts} of 5`);
456
+ utils_1.default.warning(`tempts ${tempts} of ${limit}`);
293
457
  if (await tryCheckSuccess(cmd, this.echo)) {
294
458
  break;
295
459
  }
@@ -50,73 +50,76 @@ class Users {
50
50
  let hasHome = false;
51
51
  let saveIt = false;
52
52
  let size = 0;
53
- if (this.home != undefined) {
54
- /**
55
- * analyze firstLevel and
56
- * excluded to be saved
57
- */
58
- let fLevel = this.home.split('/')[1];
59
- for (let i = 0; i < fLevels.length; i++) {
60
- if (fLevels[i].path === fLevel) {
61
- saveIt = fLevels[i].saveIt;
62
- }
63
- }
64
- /**
65
- * analize second level
66
- * examples: /var/run, /var/cache, /var/spool, etc
67
- */
68
- if (saveIt) {
69
- let sLevel = this.home.split('/')[2];
70
- if (sLevel === 'cache' || sLevel === 'run' || sLevel === 'spool') {
71
- saveIt = false;
53
+ // Only users not services
54
+ if (parseInt(this.uid) >= 1000) {
55
+ if (this.home != undefined) {
56
+ /**
57
+ * analyze firstLevel and
58
+ * excluded to be saved
59
+ */
60
+ let fLevel = this.home.split('/')[1];
61
+ for (let i = 0; i < fLevels.length; i++) {
62
+ if (fLevels[i].path === fLevel) {
63
+ saveIt = fLevels[i].saveIt;
64
+ }
72
65
  }
73
- }
74
- /**
75
- * exclude to save if home don't exist
76
- */
77
- if (!fs_1.default.existsSync(this.home)) {
78
- saveIt = false;
79
- }
80
- /**
81
- * others motivations to exclude
82
- */
83
- if (saveIt) {
84
- switch (this.home) {
85
- /**
86
- * exclude always /
87
- */
88
- case '/':
89
- {
90
- break;
91
- }
92
- /**
93
- * excludes: under /usr
94
- */
95
- case '/usr/bin':
96
- case '/usr/sbin': {
66
+ /**
67
+ * analize second level
68
+ * examples: /var/run, /var/cache, /var/spool, etc
69
+ */
70
+ if (saveIt) {
71
+ let sLevel = this.home.split('/')[2];
72
+ if (sLevel === 'cache' || sLevel === 'run' || sLevel === 'spool') {
97
73
  saveIt = false;
98
- break;
99
74
  }
100
- /**
101
- * excludes: under var
102
- */
103
- case '/var/backups':
104
- case '/var/lib/colord':
105
- case '/var/lib/geoclue':
106
- case '/var/lib/misc':
107
- case '/var/mail':
108
- {
75
+ }
76
+ /**
77
+ * exclude to save if home don't exist
78
+ */
79
+ if (!fs_1.default.existsSync(this.home)) {
80
+ saveIt = false;
81
+ }
82
+ /**
83
+ * others motivations to exclude
84
+ */
85
+ if (saveIt) {
86
+ switch (this.home) {
87
+ /**
88
+ * exclude always /
89
+ */
90
+ case '/':
91
+ {
92
+ break;
93
+ }
94
+ /**
95
+ * excludes: under /usr
96
+ */
97
+ case '/usr/bin':
98
+ case '/usr/sbin': {
109
99
  saveIt = false;
110
100
  break;
111
101
  }
112
- default: {
113
- if (fs_1.default.existsSync(this.home)) {
114
- hasHome = true;
115
- const sizeUser = await (0, utils_1.exec)(` du --block-size=1 --summarize ${this.home} | awk '{print $1}'`, { echo: false, ignore: false, capture: true });
116
- size = Number.parseInt(sizeUser.data);
102
+ /**
103
+ * excludes: under var
104
+ */
105
+ case '/var/backups':
106
+ case '/var/lib/colord':
107
+ case '/var/lib/geoclue':
108
+ case '/var/lib/misc':
109
+ case '/var/mail':
110
+ {
111
+ saveIt = false;
112
+ break;
113
+ }
114
+ default: {
115
+ if (fs_1.default.existsSync(this.home)) {
116
+ hasHome = true;
117
+ const sizeUser = await (0, utils_1.exec)(` du --block-size=1 --summarize ${this.home} | awk '{print $1}'`, { echo: false, ignore: false, capture: true });
118
+ size = Number.parseInt(sizeUser.data);
119
+ }
120
+ saveIt = true;
121
+ break;
117
122
  }
118
- saveIt = true;
119
- break;
120
123
  }
121
124
  }
122
125
  }
@@ -273,7 +273,7 @@ export default class Utils {
273
273
  /**
274
274
  *
275
275
  */
276
- static pressKeyToExit(warming?: string, canContinue?: boolean): Promise<void>;
276
+ static pressKeyToExit(warming?: string, stopProcess?: boolean): Promise<void>;
277
277
  /**
278
278
  * titles
279
279
  * Penguin's are gettings alive!