penguins-eggs 9.3.26 → 9.3.28

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