penguins-eggs 9.3.26 → 9.3.27

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 (110) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/conf/derivatives.yaml +7 -0
  3. package/dist/classes/compressors.js +3 -3
  4. package/dist/classes/daddy.js +8 -8
  5. package/dist/classes/distro.js +23 -22
  6. package/dist/classes/family/archlinux.js +1 -1
  7. package/dist/classes/family/debian.js +5 -5
  8. package/dist/classes/incubation/branding.js +4 -4
  9. package/dist/classes/incubation/distros/jessie.js +1 -1
  10. package/dist/classes/incubation/distros/rolling.js +4 -4
  11. package/dist/classes/incubation/fisherman-helper/packages.js +8 -8
  12. package/dist/classes/incubation/fisherman.js +5 -7
  13. package/dist/classes/incubation/incubator.js +7 -7
  14. package/dist/classes/keyboards.js +16 -16
  15. package/dist/classes/locales.js +9 -9
  16. package/dist/classes/network.js +5 -7
  17. package/dist/classes/ovary.js +80 -84
  18. package/dist/classes/pacman.js +2 -4
  19. package/dist/classes/pxe.js +131 -131
  20. package/dist/classes/settings.js +2 -2
  21. package/dist/classes/sources_list.js +20 -22
  22. package/dist/classes/systemctl.js +2 -2
  23. package/dist/classes/tailor.js +216 -225
  24. package/dist/classes/users.js +24 -24
  25. package/dist/classes/xdg.js +17 -17
  26. package/dist/classes/yolk.js +2 -4
  27. package/dist/commands/adapt.js +2 -2
  28. package/dist/commands/analyze.js +34 -3
  29. package/dist/commands/calamares.js +6 -6
  30. package/dist/commands/config.js +8 -12
  31. package/dist/commands/cuckoo.js +8 -8
  32. package/dist/commands/dad.js +4 -4
  33. package/dist/commands/export/deb.js +7 -7
  34. package/dist/commands/export/iso.js +6 -6
  35. package/dist/commands/install.js +15 -15
  36. package/dist/commands/kill.js +3 -3
  37. package/dist/commands/mom.js +2 -2
  38. package/dist/commands/produce.js +9 -9
  39. package/dist/commands/status.js +2 -2
  40. package/dist/commands/syncfrom.js +11 -13
  41. package/dist/commands/syncto.js +36 -41
  42. package/dist/commands/tools/clean.js +3 -3
  43. package/dist/commands/tools/ppa.js +10 -10
  44. package/dist/commands/tools/skel.js +3 -3
  45. package/dist/commands/tools/stat.js +5 -5
  46. package/dist/commands/tools/yolk.js +2 -2
  47. package/dist/commands/update.js +4 -4
  48. package/dist/commands/wardrobe/get.js +5 -5
  49. package/dist/commands/wardrobe/list.js +13 -13
  50. package/dist/commands/wardrobe/show.js +12 -12
  51. package/dist/commands/wardrobe/wear.js +8 -8
  52. package/dist/interfaces/i-packages.js +1 -1
  53. package/dist/interfaces/i-pxe.js +39 -0
  54. package/dist/krill/modules/add-user.js +2 -2
  55. package/dist/krill/modules/bootloader-config-ubuntu.js +1 -1
  56. package/dist/krill/modules/bootloader.js +2 -2
  57. package/dist/krill/modules/fstab.js +21 -21
  58. package/dist/krill/modules/grubcfg.js +1 -1
  59. package/dist/krill/modules/hostname.js +15 -15
  60. package/dist/krill/modules/initramfs.js +4 -4
  61. package/dist/krill/modules/locale-cfg.js +8 -8
  62. package/dist/krill/modules/locale.js +6 -6
  63. package/dist/krill/modules/m-keyboard.js +20 -20
  64. package/dist/krill/modules/machine-id.js +1 -1
  65. package/dist/krill/modules/mkfs.js +1 -1
  66. package/dist/krill/modules/mount-fs.js +7 -9
  67. package/dist/krill/modules/network-cfg.js +15 -17
  68. package/dist/krill/modules/packages.js +6 -6
  69. package/dist/krill/modules/partition.js +91 -84
  70. package/dist/krill/modules/remove-installer-link.js +1 -1
  71. package/dist/krill/modules/unpackfs.js +1 -1
  72. package/dist/lib/cli-autologin.js +7 -7
  73. package/dist/lib/dependencies.js +10 -10
  74. package/dist/lib/get_address.js +2 -2
  75. package/dist/lib/get_dns.js +2 -2
  76. package/dist/lib/get_domain.js +2 -2
  77. package/dist/lib/get_gateway.js +2 -2
  78. package/dist/lib/get_hostname.js +2 -2
  79. package/dist/lib/get_netmask.js +2 -2
  80. package/dist/lib/get_password.js +4 -4
  81. package/dist/lib/get_root_password.js +3 -3
  82. package/dist/lib/get_userfullname.js +2 -2
  83. package/dist/lib/get_username.js +2 -2
  84. package/dist/lib/select_address_type.js +2 -2
  85. package/dist/lib/select_filesystem_type.js +2 -2
  86. package/dist/lib/select_installation_device.js +2 -2
  87. package/dist/lib/select_installation_mode.js +2 -2
  88. package/dist/lib/select_interface.js +2 -2
  89. package/dist/lib/select_keyboard_layout.js +4 -4
  90. package/dist/lib/select_keyboard_model.js +4 -4
  91. package/dist/lib/select_keyboard_option.js +4 -4
  92. package/dist/lib/select_keyboard_variant.js +4 -4
  93. package/dist/lib/select_languages.js +3 -3
  94. package/dist/lib/select_regions.js +2 -2
  95. package/dist/lib/select_user_swap_choice.js +2 -2
  96. package/dist/lib/select_zones.js +8 -8
  97. package/dist/lib/utils.js +3 -3
  98. package/dist/types/etrick.js +1 -0
  99. package/package.json +8 -2
  100. package/dist/dhcpd/dhcpd.js +0 -222
  101. package/dist/dhcpd/index.js +0 -7
  102. package/dist/dhcpd/packet/converters.js +0 -377
  103. package/dist/dhcpd/packet/options.js +0 -2
  104. package/dist/dhcpd/packet/types.js +0 -2
  105. package/dist/dhcpd/packet.js +0 -251
  106. package/dist/dhcpd/proxy.js +0 -152
  107. package/dist/dhcpd/server.js +0 -152
  108. package/dist/dhcpd/sprintf.js +0 -170
  109. package/dist/dhcpd/utils.js +0 -190
  110. package/dist/interfaces/i-pxe-options.js +0 -2
@@ -44,78 +44,85 @@ class Tailor {
44
44
  this.echo = utils_1.default.setEcho(verbose);
45
45
  utils_1.default.warning(`preparing ${this.costume}`);
46
46
  /**
47
- * check curl presence
48
- */
47
+ * check curl presence
48
+ */
49
49
  if (!pacman_1.default.packageIsInstalled('curl')) {
50
50
  utils_1.default.pressKeyToExit('In this tailoring shop we use curl. sudo apt update | apt install curl');
51
51
  process.exit();
52
52
  }
53
- let tailorList = `${this.costume}/index.yml`;
53
+ const tailorList = `${this.costume}/index.yml`;
54
54
  if (fs_1.default.existsSync(tailorList)) {
55
55
  this.materials = js_yaml_1.default.load(fs_1.default.readFileSync(tailorList, 'utf-8'));
56
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');
57
+ else
58
+ switch (this.category) {
59
+ case 'costume': {
60
+ this.titles(`${this.category}: ${this.costume}`);
61
+ console.log('Tailor\'s list ' + chalk_1.default.cyan(tailorList) + ' is not found \non your wardrobe ' + chalk_1.default.cyan(this.wardrobe) + '.\n');
90
62
  console.log('Costume will not be installed, operations will abort.\n');
91
63
  utils_1.default.pressKeyToExit();
92
64
  process.exit();
65
+ break;
93
66
  }
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');
67
+ case 'accessory': {
68
+ this.titles(`${this.category}: ${this.costume}`);
69
+ console.log('Tailor\'s list ' + chalk_1.default.cyan(tailorList) + ' is not found \non your wardrobe ' + chalk_1.default.cyan(this.wardrobe) + '.\n');
97
70
  console.log('Accessory will not be installed, operations will continue.\n');
98
71
  utils_1.default.pressKeyToExit();
99
72
  return;
100
73
  }
101
- else if (this.category === 'try_accessory') {
74
+ case 'try_accessory': {
102
75
  return;
103
76
  }
77
+ // No default
78
+ }
79
+ /**
80
+ * distro e sources_list
81
+ * vengono definite qua perchè servono a tutti
82
+ */
83
+ const distro = new distro_1.default();
84
+ const sources_list = new sources_list_1.default();
85
+ let step = '';
86
+ if (this.materials.distributions !== undefined) {
87
+ step = 'analyzing distribution';
88
+ utils_1.default.warning(step);
89
+ if (!await sources_list.distribution(this.materials.distributions)) {
90
+ switch (this.category) {
91
+ case 'costume': {
92
+ this.titles('step');
93
+ 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');
94
+ console.log('Costume will not be installed, operations will abort.\n');
95
+ utils_1.default.pressKeyToExit();
96
+ process.exit();
97
+ break;
98
+ }
99
+ case 'accessory': {
100
+ this.titles('step');
101
+ 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');
102
+ console.log('Accessory will not be installed, operations will continue.\n');
103
+ utils_1.default.pressKeyToExit();
104
+ return;
105
+ }
106
+ case 'try_accessory': {
107
+ return;
108
+ }
109
+ // No default
110
+ }
104
111
  }
105
112
  }
106
113
  /**
107
- * sequence
108
- */
114
+ * sequence
115
+ */
109
116
  if (this.materials.sequence !== undefined) {
110
117
  step = 'analyzing sequence';
111
118
  utils_1.default.warning(step);
112
119
  /**
113
- * sequence/repositories
114
- */
120
+ * sequence/repositories
121
+ */
115
122
  if (this.materials.sequence.repositories !== undefined) {
116
123
  /**
117
- * sequence/repositories/sources_list
118
- */
124
+ * sequence/repositories/sources_list
125
+ */
119
126
  // evito di fallire se sources_list non è presente
120
127
  if (this.materials.sequence.repositories.sources_list !== undefined) {
121
128
  step = 'analyzing sources_list';
@@ -126,45 +133,43 @@ class Tailor {
126
133
  }
127
134
  }
128
135
  /**
129
- * sequence/repositories/sources_list_d
130
- */
131
- if (this.materials.sequence.repositories.sources_list_d !== undefined) {
132
- if (this.materials.sequence.repositories.sources_list_d[0] !== null) {
133
- step = `adding repositories to /etc/apt/sources_list_d`;
134
- utils_1.default.warning(step);
135
- for (const cmd of this.materials.sequence.repositories.sources_list_d) {
136
- try {
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
- }
136
+ * sequence/repositories/sources_list_d
137
+ */
138
+ if (this.materials.sequence.repositories.sources_list_d !== undefined && this.materials.sequence.repositories.sources_list_d[0] !== null) {
139
+ step = 'adding repositories to /etc/apt/sources_list_d';
140
+ utils_1.default.warning(step);
141
+ for (const cmd of this.materials.sequence.repositories.sources_list_d) {
142
+ try {
143
+ // repeat 3 times if fail curl or others commands
144
+ for (let i = 0; i < 2; i++) {
145
+ const result = await (0, utils_2.exec)(cmd, this.echo);
146
+ if (result.code === 0) {
147
+ break;
143
148
  }
144
149
  }
145
- catch (error) {
146
- await utils_1.default.pressKeyToExit(JSON.stringify(error));
147
- }
150
+ }
151
+ catch (error) {
152
+ await utils_1.default.pressKeyToExit(JSON.stringify(error));
148
153
  }
149
154
  }
150
155
  }
151
156
  /**
152
- * sequence/repositories/update
153
- */
157
+ * sequence/repositories/update
158
+ */
154
159
  if (this.materials.sequence.repositories.update === undefined) {
155
160
  console.log('repositiories, and repositories.update MUST be defined on sequence ');
156
161
  process.exit();
157
162
  }
158
- step = `updating repositories`;
163
+ step = 'updating repositories';
159
164
  utils_1.default.warning(step);
160
165
  if (this.materials.sequence.repositories.update) {
161
166
  await (0, utils_2.exec)('apt-get update', utils_1.default.setEcho(false));
162
167
  }
163
168
  /**
164
- * sequence/repositories/upgrade
165
- */
169
+ * sequence/repositories/upgrade
170
+ */
166
171
  if (this.materials.sequence.repositories.upgrade !== undefined) {
167
- step = `apt-get full-upgrade`;
172
+ step = 'apt-get full-upgrade';
168
173
  utils_1.default.warning(step);
169
174
  if (this.materials.sequence.repositories.upgrade) {
170
175
  await (0, utils_2.exec)('apt-get full-upgrade -y', utils_1.default.setEcho(false));
@@ -173,35 +178,33 @@ class Tailor {
173
178
  }
174
179
  } // fine repositories
175
180
  /**
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}`)) {
184
- await (0, utils_2.exec)(`${this.costume}/${script}`, utils_1.default.setEcho(true));
185
- }
186
- else {
187
- // exec script real env
188
- await (0, utils_2.exec)(`${script}`, utils_1.default.setEcho(true));
189
- }
181
+ * sequence/preinst
182
+ */
183
+ if (this.materials.sequence.preinst !== undefined && Array.isArray(this.materials.sequence.preinst)) {
184
+ step = 'preinst scripts';
185
+ utils_1.default.warning(step);
186
+ for (const script of this.materials.sequence.preinst) {
187
+ if (fs_1.default.existsSync(`${this.costume}/${script}`)) {
188
+ await (0, utils_2.exec)(`${this.costume}/${script}`, utils_1.default.setEcho(true));
189
+ }
190
+ else {
191
+ // exec script real env
192
+ await (0, utils_2.exec)(`${script}`, utils_1.default.setEcho(true));
190
193
  }
191
194
  }
192
195
  }
193
196
  /**
194
- * apt-get install dependencies
195
- */
197
+ * apt-get install dependencies
198
+ */
196
199
  if (this.materials.sequence.dependencies !== undefined) {
197
200
  const dependencies = await this.helperExists(this.materials.sequence.dependencies);
198
201
  if (dependencies.length > 1) {
199
- await this.helperInstall(dependencies, "dependencies");
202
+ await this.helperInstall(dependencies, 'dependencies');
200
203
  }
201
204
  }
202
205
  /**
203
- * apt-get install packages
204
- */
206
+ * apt-get install packages
207
+ */
205
208
  if (this.materials.sequence.packages !== undefined) {
206
209
  const packages = await this.helperExists(this.materials.sequence.packages, true, 'packages');
207
210
  if (packages.length > 1) {
@@ -209,17 +212,17 @@ class Tailor {
209
212
  }
210
213
  }
211
214
  /**
212
- * sequence/packages_no_install_recommends
213
- */
215
+ * sequence/packages_no_install_recommends
216
+ */
214
217
  if (this.materials.sequence.packages_no_install_recommends !== undefined) {
215
218
  const packages_no_install_recommends = await this.helperExists(this.materials.sequence.packages_no_install_recommends, true, 'packages_no_install_recommends');
216
219
  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 ');
220
+ await this.helperInstall(packages_no_install_recommends, 'packages without recommends and suggests', 'apt-get install --no-install-recommends --no-install-suggests -yq ');
218
221
  }
219
222
  }
220
223
  /**
221
- * apt-get TRY install packages
222
- */
224
+ * apt-get TRY install packages
225
+ */
223
226
  if (this.materials.sequence.try_packages !== undefined) {
224
227
  const try_packages = await this.helperExists(this.materials.sequence.try_packages, false);
225
228
  if (try_packages.length > 1) {
@@ -227,151 +230,139 @@ class Tailor {
227
230
  }
228
231
  }
229
232
  /**
230
- * apt-get TRY packages_no_install_recommends
231
- */
233
+ * apt-get TRY packages_no_install_recommends
234
+ */
232
235
  if (this.materials.sequence.try_packages_no_install_recommends !== undefined) {
233
236
  const try_packages_no_install_recommends = await this.helperExists(this.materials.sequence.try_packages_no_install_recommends, false);
234
237
  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 ');
238
+ 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
239
  }
237
240
  }
238
241
  /**
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`);
252
- }
242
+ * sequence/debs
243
+ */
244
+ if (this.materials.sequence.debs !== undefined && this.materials.sequence.debs) {
245
+ step = 'installing local packages';
246
+ utils_1.default.warning(step);
247
+ let pathDebs = `${this.costume}/debs/${distro.codenameLikeId}`;
248
+ if (!fs_1.default.existsSync(pathDebs)) {
249
+ pathDebs = `${this.costume}/debs`;
250
+ }
251
+ // if exists pathDebs
252
+ if (fs_1.default.existsSync(pathDebs)) {
253
+ await (0, utils_2.exec)(`dpkg -i ${pathDebs}/*.deb`);
253
254
  }
254
255
  }
255
256
  /**
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);
257
+ * sequence/packages_python
258
+ */
259
+ if (this.materials.sequence.packages_python !== undefined && 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}`;
269
265
  }
266
+ step = `installing python packages pip ${pip.slice(2)}`;
267
+ utils_1.default.warning(step);
268
+ await (0, utils_2.exec)(cmd, this.echo);
270
269
  }
271
270
  /**
272
- * sequence/accessories
273
- */
271
+ * sequence/accessories
272
+ */
274
273
  if (!no_accessories) {
275
274
  // 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
- }
275
+ if (this.materials.sequence.accessories !== undefined && Array.isArray(this.materials.sequence.accessories)) {
276
+ step = 'wearing accessories';
277
+ for (const elem of this.materials.sequence.accessories) {
278
+ if ((elem === 'firmwares' || elem === './firmwares') && no_firmwares) {
279
+ continue;
280
+ }
281
+ if (elem.slice(0, 2) === './') {
282
+ const tailor = new Tailor(`${this.costume}/${elem.slice(2)}`, 'accessory');
283
+ await tailor.prepare(verbose);
284
+ }
285
+ else {
286
+ const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`, 'accessory');
287
+ await tailor.prepare(verbose);
291
288
  }
292
289
  }
293
290
  }
294
291
  // 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);
309
- }
292
+ if (this.materials.sequence.try_accessories !== undefined && Array.isArray(this.materials.sequence.try_accessories)) {
293
+ step = 'wearing try_accessories';
294
+ for (const elem of this.materials.sequence.try_accessories) {
295
+ if ((elem === 'firmwares' || elem === './firmwares') && no_firmwares) {
296
+ continue;
297
+ }
298
+ if (elem.slice(0, 2) === './') {
299
+ const tailor = new Tailor(`${this.costume}/${elem.slice(2)}`, 'try_accessory');
300
+ await tailor.prepare(verbose);
301
+ }
302
+ else {
303
+ const tailor = new Tailor(`${this.wardrobe}/accessories/${elem}`, 'try_accessory');
304
+ await tailor.prepare(verbose);
310
305
  }
311
306
  }
312
307
  }
313
308
  } // no-accessories
314
309
  /**
315
- * customize
316
- */
310
+ * customize
311
+ */
317
312
  if (this.materials.customize !== undefined) {
318
313
  /**
319
- * customize/dirs
320
- */
321
- if (this.materials.customize.dirs) {
322
- if (fs_1.default.existsSync(`/${this.costume}/dirs`)) {
323
- step = `copying dirs`;
314
+ * customize/dirs
315
+ */
316
+ if (this.materials.customize.dirs && fs_1.default.existsSync(`/${this.costume}/dirs`)) {
317
+ step = 'copying dirs';
318
+ utils_1.default.warning(step);
319
+ let cmd = `rsync -avx ${this.costume}/dirs/* /`;
320
+ await (0, utils_2.exec)(cmd, this.echo);
321
+ // chown root:root /etc -R
322
+ cmd = 'chown root:root /etc/sudoers.d /etc/skel -R';
323
+ await (0, utils_2.exec)(cmd, this.echo);
324
+ /**
325
+ * Copyng skel in /home/user
326
+ */
327
+ if (fs_1.default.existsSync(`${this.costume}/dirs/etc/skel`)) {
328
+ const user = await utils_1.default.getPrimaryUser();
329
+ step = `copying skel in /home/${user}/`;
324
330
  utils_1.default.warning(step);
325
- let cmd = `rsync -avx ${this.costume}/dirs/* /`;
326
- await (0, utils_2.exec)(cmd, this.echo);
327
- // chown root:root /etc -R
328
- cmd = "chown root:root /etc/sudoers.d /etc/skel -R";
331
+ cmd = `rsync -avx ${this.costume}/dirs/etc/skel/.config /home/${user}/`;
329
332
  await (0, utils_2.exec)(cmd, this.echo);
330
- /**
331
- * Copyng skel in /home/user
332
- */
333
- if (fs_1.default.existsSync(`${this.costume}/dirs/etc/skel`)) {
334
- const user = await utils_1.default.getPrimaryUser();
335
- step = `copying skel in /home/${user}/`;
336
- utils_1.default.warning(step);
337
- cmd = `rsync -avx ${this.costume}/dirs/etc/skel/.config /home/${user}/`;
338
- await (0, utils_2.exec)(cmd, this.echo);
339
- await (0, utils_2.exec)(`chown ${user}:${user} /home/${user}/ -R`);
340
- }
333
+ await (0, utils_2.exec)(`chown ${user}:${user} /home/${user}/ -R`);
341
334
  }
342
335
  }
343
336
  /**
344
- * customize/hostname
345
- */
337
+ * customize/hostname
338
+ */
346
339
  if (this.materials.customize.hostname) {
347
340
  utils_1.default.warning(`changing hostname = ${this.materials.name}`);
348
341
  await this.hostname();
349
342
  }
350
343
  /**
351
- * customize/scripts
352
- */
353
- if (this.materials.customize.scripts !== undefined) {
354
- if (Array.isArray(this.materials.customize.scripts)) {
355
- step = `customize script`;
356
- utils_1.default.warning(step);
357
- for (const script of this.materials.customize.scripts) {
358
- if (fs_1.default.existsSync(`${this.costume}/${script}`)) {
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));
361
- }
362
- else {
363
- // exec script real env
364
- await (0, utils_2.exec)(`${script}`, utils_1.default.setEcho(true));
365
- }
344
+ * customize/scripts
345
+ */
346
+ if (this.materials.customize.scripts !== undefined && Array.isArray(this.materials.customize.scripts)) {
347
+ step = 'customize script';
348
+ utils_1.default.warning(step);
349
+ for (const script of this.materials.customize.scripts) {
350
+ if (fs_1.default.existsSync(`${this.costume}/${script}`)) {
351
+ // exec script in costume passing costume-name
352
+ await (0, utils_2.exec)(`${this.costume}/${script} ${this.materials.name}`, utils_1.default.setEcho(true));
353
+ }
354
+ else {
355
+ // exec script real env
356
+ await (0, utils_2.exec)(`${script}`, utils_1.default.setEcho(true));
366
357
  }
367
358
  }
368
359
  }
369
360
  }
370
361
  /**
371
- * reboot
372
- */
362
+ * reboot
363
+ */
373
364
  if (this.materials.reboot) {
374
- utils_1.default.warning(`Reboot`);
365
+ utils_1.default.warning('Reboot');
375
366
  await utils_1.default.pressKeyToExit('system need to reboot', true);
376
367
  await (0, utils_2.exec)('reboot');
377
368
  }
@@ -394,8 +385,8 @@ class Tailor {
394
385
  await (0, utils_2.exec)(`rm -f ${packages_not_exists}`);
395
386
  await (0, utils_2.exec)(`rm -f ${packages_exists}`);
396
387
  /**
397
- * packages_we_want
398
- */
388
+ * packages_we_want
389
+ */
399
390
  let content = '';
400
391
  packages.sort();
401
392
  for (const elem of packages) {
@@ -405,12 +396,12 @@ class Tailor {
405
396
  }
406
397
  fs_1.default.writeFileSync(packages_we_want, content, 'utf-8');
407
398
  /**
408
- * packages_exists
409
- */
399
+ * packages_exists
400
+ */
410
401
  await (0, utils_2.exec)(`apt-cache --no-generate pkgnames | sort | comm -12 - ${packages_we_want} > ${packages_exists}`);
411
402
  /**
412
- * packages_not_exists
413
- */
403
+ * packages_not_exists
404
+ */
414
405
  if (verbose) {
415
406
  await (0, utils_2.exec)(`apt-cache --no-generate pkgnames | sort | comm -13 - ${packages_we_want} > ${packages_not_exists}`);
416
407
  const not_exist_packages = fs_1.default.readFileSync(packages_not_exists, 'utf-8').split('\n');
@@ -421,9 +412,9 @@ class Tailor {
421
412
  content += `- ${not_exist_packages[i]}\n`;
422
413
  }
423
414
  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:`);
415
+ console.log('Following packages from ' + chalk_1.default.cyan(this.materials.name) + ' section: ' + chalk_1.default.cyan(section) + ', was not found:');
425
416
  console.log(content);
426
- utils_1.default.pressKeyToExit("Press a key to continue...");
417
+ utils_1.default.pressKeyToExit('Press a key to continue...');
427
418
  }
428
419
  }
429
420
  return fs_1.default.readFileSync(packages_exists, 'utf-8').split('\n');
@@ -434,7 +425,7 @@ class Tailor {
434
425
  */
435
426
  async helperInstall(packages, comment = 'packages', cmd = 'apt-get install -yqq ') {
436
427
  if (packages[0] !== null) {
437
- let elements = [];
428
+ const elements = [];
438
429
  let strElements = '';
439
430
  for (const elem of packages) {
440
431
  elements.push(elem);
@@ -445,12 +436,12 @@ class Tailor {
445
436
  let step = `installing ${comment}: `;
446
437
  // if not verbose show strElements
447
438
  if (!this.verbose) {
448
- step += strElements.substring(2);
439
+ step += strElements.slice(2);
449
440
  }
450
441
  /**
451
- * prova 3 volte
452
- */
453
- let limit = 3;
442
+ * prova 3 volte
443
+ */
444
+ const limit = 3;
454
445
  for (let tempts = 1; tempts < limit; tempts++) {
455
446
  this.titles(step);
456
447
  utils_1.default.warning(`tempts ${tempts} of ${limit}`);
@@ -466,33 +457,33 @@ class Tailor {
466
457
  */
467
458
  async hostname() {
468
459
  /**
469
- * hostname
470
- */
460
+ * hostname
461
+ */
471
462
  let file = '/etc/hostname';
472
463
  let text = this.materials.name;
473
464
  await (0, utils_2.exec)(`rm ${file} `, this.echo);
474
465
  fs_1.default.writeFileSync(file, text);
475
466
  /**
476
- * hosts
477
- */
467
+ * hosts
468
+ */
478
469
  file = '/etc/hosts';
479
470
  text = '';
480
471
  text += '127.0.0.1 localhost localhost.localdomain\n';
481
472
  text += `127.0.1.1 ${this.materials.name} \n`;
482
- text += `# The following lines are desirable for IPv6 capable hosts\n`;
483
- text += `:: 1 ip6 - localhost ip6 - loopback\n`;
484
- text += `fe00:: 0 ip6 - localnet\n`;
485
- text += `ff00:: 0 ip6 - mcastprefix\n`;
486
- text += `ff02:: 1 ip6 - allnodes\n`;
487
- text += `ff02:: 2 ip6 - allrouters\n`;
488
- text += `ff02:: 3 ip6 - allhosts\n`;
473
+ text += '# The following lines are desirable for IPv6 capable hosts\n';
474
+ text += ':: 1 ip6 - localhost ip6 - loopback\n';
475
+ text += 'fe00:: 0 ip6 - localnet\n';
476
+ text += 'ff00:: 0 ip6 - mcastprefix\n';
477
+ text += 'ff02:: 1 ip6 - allnodes\n';
478
+ text += 'ff02:: 2 ip6 - allrouters\n';
479
+ text += 'ff02:: 3 ip6 - allhosts\n';
489
480
  await (0, utils_2.exec)(`rm ${file} `, this.echo);
490
481
  fs_1.default.writeFileSync(file, text);
491
482
  /**
492
- * chenge config.snapshot.basename
493
- */
483
+ * chenge config.snapshot.basename
484
+ */
494
485
  const config_file = '/etc/penguins-eggs.d/eggs.yaml';
495
- let config = js_yaml_1.default.load(fs_1.default.readFileSync(config_file, 'utf-8'));
486
+ const config = js_yaml_1.default.load(fs_1.default.readFileSync(config_file, 'utf-8'));
496
487
  config.snapshot_basename = this.materials.name;
497
488
  fs_1.default.writeFileSync(config_file, js_yaml_1.default.dump(config), 'utf-8');
498
489
  }
@@ -524,7 +515,7 @@ async function tryCheckSuccess(cmd, echo) {
524
515
  await (0, utils_2.exec)(cmd, echo);
525
516
  success = true;
526
517
  }
527
- catch (e) {
518
+ catch {
528
519
  success = false;
529
520
  }
530
521
  return success;