codify-plugin-lib 1.0.182-beta62 → 1.0.182-beta63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +23 -13
- package/package.json +1 -1
- package/src/utils/index.ts +28 -15
package/dist/utils/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const Utils: {
|
|
|
32
32
|
* Installs a package via the system package manager. This will use Homebrew on macOS and apt on Ubuntu/Debian or dnf on Fedora.
|
|
33
33
|
* @param packageName
|
|
34
34
|
*/
|
|
35
|
-
installViaPkgMgr(packageName: string): Promise<
|
|
35
|
+
installViaPkgMgr(packageName: string): Promise<void>;
|
|
36
36
|
uninstallViaPkgMgr(packageName: string): Promise<boolean>;
|
|
37
37
|
linuxDistro(): Promise<"arch" | "centos" | "debian" | "fedora" | "rhel" | "ubuntu" | undefined>;
|
|
38
38
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -159,28 +159,38 @@ Brew can be installed using Codify:
|
|
|
159
159
|
const $ = getPty();
|
|
160
160
|
if (Utils.isMacOS()) {
|
|
161
161
|
await this.assertBrewInstalled();
|
|
162
|
-
|
|
163
|
-
return status === SpawnStatus.SUCCESS;
|
|
162
|
+
await $.spawn(`brew install ${packageName}`, { interactive: true, env: { HOMEBREW_NO_AUTO_UPDATE: 1 } });
|
|
164
163
|
}
|
|
165
164
|
if (Utils.isLinux()) {
|
|
166
165
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
167
166
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
await $.spawn('apt-get update', { requiresRoot: true });
|
|
168
|
+
const { status, data } = await $.spawnSafe(`apt-get -y install ${packageName}`, { requiresRoot: true, env: { DEBIAN_FRONTEND: 'noninteractive' } });
|
|
169
|
+
if (status === SpawnStatus.ERROR && data.includes('E: dpkg was interrupted, you must manually run \'sudo dpkg --configure -a\' to correct the problem.')) {
|
|
170
|
+
await $.spawn('dpkg --configure -a', { requiresRoot: true });
|
|
171
|
+
await $.spawn(`apt-get -y install ${packageName}`, { requiresRoot: true, env: { DEBIAN_FRONTEND: 'noninteractive' } });
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (status === SpawnStatus.ERROR) {
|
|
175
|
+
throw new Error(`Failed to install package ${packageName} via apt: ${data}`);
|
|
176
|
+
}
|
|
170
177
|
}
|
|
171
178
|
const isDnfInstalled = await $.spawnSafe('which dnf');
|
|
172
179
|
if (isDnfInstalled.status === SpawnStatus.SUCCESS) {
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
await $.spawn('dnf update', { requiresRoot: true });
|
|
181
|
+
await $.spawn(`dnf install ${packageName} -y`, { requiresRoot: true });
|
|
175
182
|
}
|
|
176
183
|
const isYumInstalled = await $.spawnSafe('which yum');
|
|
177
184
|
if (isYumInstalled.status === SpawnStatus.SUCCESS) {
|
|
178
|
-
|
|
179
|
-
|
|
185
|
+
await $.spawn('yum update', { requiresRoot: true });
|
|
186
|
+
await $.spawn(`yum install ${packageName} -y`, { requiresRoot: true });
|
|
187
|
+
}
|
|
188
|
+
const isPacmanInstalled = await $.spawnSafe('which pacman');
|
|
189
|
+
if (isPacmanInstalled.status === SpawnStatus.SUCCESS) {
|
|
190
|
+
await $.spawn('pacman -Syu', { requiresRoot: true });
|
|
191
|
+
await $.spawn(`pacman -S ${packageName} --noconfirm`, { requiresRoot: true });
|
|
180
192
|
}
|
|
181
|
-
return false;
|
|
182
193
|
}
|
|
183
|
-
return false;
|
|
184
194
|
},
|
|
185
195
|
async uninstallViaPkgMgr(packageName) {
|
|
186
196
|
const $ = getPty();
|
|
@@ -192,17 +202,17 @@ Brew can be installed using Codify:
|
|
|
192
202
|
if (Utils.isLinux()) {
|
|
193
203
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
194
204
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
195
|
-
const { status } = await $.spawnSafe(`apt autoremove -y --purge ${packageName}`, {
|
|
205
|
+
const { status } = await $.spawnSafe(`apt-get autoremove -y --purge ${packageName}`, { requiresRoot: true, env: { DEBIAN_FRONTEND: 'noninteractive' } });
|
|
196
206
|
return status === SpawnStatus.SUCCESS;
|
|
197
207
|
}
|
|
198
208
|
const isDnfInstalled = await $.spawnSafe('which dnf');
|
|
199
209
|
if (isDnfInstalled.status === SpawnStatus.SUCCESS) {
|
|
200
|
-
const { status } = await $.spawnSafe(`dnf autoremove ${packageName} -y`, {
|
|
210
|
+
const { status } = await $.spawnSafe(`dnf autoremove ${packageName} -y`, { requiresRoot: true });
|
|
201
211
|
return status === SpawnStatus.SUCCESS;
|
|
202
212
|
}
|
|
203
213
|
const isYumInstalled = await $.spawnSafe('which yum');
|
|
204
214
|
if (isYumInstalled.status === SpawnStatus.SUCCESS) {
|
|
205
|
-
const { status } = await $.spawnSafe(`yum autoremove ${packageName} -y`, {
|
|
215
|
+
const { status } = await $.spawnSafe(`yum autoremove ${packageName} -y`, { requiresRoot: true });
|
|
206
216
|
return status === SpawnStatus.SUCCESS;
|
|
207
217
|
}
|
|
208
218
|
return false;
|
package/package.json
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -196,38 +196,51 @@ Brew can be installed using Codify:
|
|
|
196
196
|
* Installs a package via the system package manager. This will use Homebrew on macOS and apt on Ubuntu/Debian or dnf on Fedora.
|
|
197
197
|
* @param packageName
|
|
198
198
|
*/
|
|
199
|
-
async installViaPkgMgr(packageName: string): Promise<
|
|
199
|
+
async installViaPkgMgr(packageName: string): Promise<void> {
|
|
200
200
|
const $ = getPty();
|
|
201
201
|
|
|
202
202
|
if (Utils.isMacOS()) {
|
|
203
203
|
await this.assertBrewInstalled();
|
|
204
|
-
|
|
205
|
-
return status === SpawnStatus.SUCCESS;
|
|
204
|
+
await $.spawn(`brew install ${packageName}`, { interactive: true, env: { HOMEBREW_NO_AUTO_UPDATE: 1 } });
|
|
206
205
|
}
|
|
207
206
|
|
|
208
207
|
if (Utils.isLinux()) {
|
|
209
208
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
210
209
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
await $.spawn('apt-get update', { requiresRoot: true });
|
|
211
|
+
const { status, data } = await $.spawnSafe(`apt-get -y install ${packageName}`, { requiresRoot: true, env: { DEBIAN_FRONTEND: 'noninteractive' } });
|
|
212
|
+
|
|
213
|
+
if (status === SpawnStatus.ERROR && data.includes('E: dpkg was interrupted, you must manually run \'sudo dpkg --configure -a\' to correct the problem.')) {
|
|
214
|
+
await $.spawn('dpkg --configure -a', { requiresRoot: true });
|
|
215
|
+
await $.spawn(`apt-get -y install ${packageName}`, { requiresRoot: true, env: { DEBIAN_FRONTEND: 'noninteractive' } });
|
|
216
|
+
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (status === SpawnStatus.ERROR) {
|
|
221
|
+
throw new Error(`Failed to install package ${packageName} via apt: ${data}`);
|
|
222
|
+
}
|
|
213
223
|
}
|
|
214
224
|
|
|
215
225
|
const isDnfInstalled = await $.spawnSafe('which dnf');
|
|
216
226
|
if (isDnfInstalled.status === SpawnStatus.SUCCESS) {
|
|
217
|
-
|
|
218
|
-
|
|
227
|
+
await $.spawn('dnf update', { requiresRoot: true });
|
|
228
|
+
await $.spawn(`dnf install ${packageName} -y`, { requiresRoot: true });
|
|
219
229
|
}
|
|
220
230
|
|
|
221
231
|
const isYumInstalled = await $.spawnSafe('which yum');
|
|
222
232
|
if (isYumInstalled.status === SpawnStatus.SUCCESS) {
|
|
223
|
-
|
|
224
|
-
|
|
233
|
+
await $.spawn('yum update', { requiresRoot: true });
|
|
234
|
+
await $.spawn(`yum install ${packageName} -y`, { requiresRoot: true });
|
|
225
235
|
}
|
|
226
236
|
|
|
227
|
-
|
|
228
|
-
|
|
237
|
+
const isPacmanInstalled = await $.spawnSafe('which pacman');
|
|
238
|
+
if (isPacmanInstalled.status === SpawnStatus.SUCCESS) {
|
|
239
|
+
await $.spawn('pacman -Syu', { requiresRoot: true });
|
|
240
|
+
await $.spawn(`pacman -S ${packageName} --noconfirm`, { requiresRoot: true });
|
|
241
|
+
}
|
|
229
242
|
|
|
230
|
-
|
|
243
|
+
}
|
|
231
244
|
},
|
|
232
245
|
|
|
233
246
|
async uninstallViaPkgMgr(packageName: string): Promise<boolean> {
|
|
@@ -242,19 +255,19 @@ Brew can be installed using Codify:
|
|
|
242
255
|
if (Utils.isLinux()) {
|
|
243
256
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
244
257
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
245
|
-
const { status } = await $.spawnSafe(`apt autoremove -y --purge ${packageName}`, {
|
|
258
|
+
const { status } = await $.spawnSafe(`apt-get autoremove -y --purge ${packageName}`, { requiresRoot: true, env: { DEBIAN_FRONTEND: 'noninteractive' } });
|
|
246
259
|
return status === SpawnStatus.SUCCESS;
|
|
247
260
|
}
|
|
248
261
|
|
|
249
262
|
const isDnfInstalled = await $.spawnSafe('which dnf');
|
|
250
263
|
if (isDnfInstalled.status === SpawnStatus.SUCCESS) {
|
|
251
|
-
const { status } = await $.spawnSafe(`dnf autoremove ${packageName} -y`, {
|
|
264
|
+
const { status } = await $.spawnSafe(`dnf autoremove ${packageName} -y`, { requiresRoot: true });
|
|
252
265
|
return status === SpawnStatus.SUCCESS;
|
|
253
266
|
}
|
|
254
267
|
|
|
255
268
|
const isYumInstalled = await $.spawnSafe('which yum');
|
|
256
269
|
if (isYumInstalled.status === SpawnStatus.SUCCESS) {
|
|
257
|
-
const { status } = await $.spawnSafe(`yum autoremove ${packageName} -y`, {
|
|
270
|
+
const { status } = await $.spawnSafe(`yum autoremove ${packageName} -y`, { requiresRoot: true });
|
|
258
271
|
return status === SpawnStatus.SUCCESS;
|
|
259
272
|
}
|
|
260
273
|
|