@fredlackey/devutils 0.0.10 → 0.0.12
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/package.json +1 -1
- package/src/installs/balena-etcher.js +4 -0
- package/src/installs/bambu-studio.js +321 -108
- package/src/installs/chrome-canary.js +27 -98
- package/src/installs/chromium.js +5 -1
- package/src/installs/dependencies.md +14 -5
- package/src/installs/installers.json +1383 -211
- package/src/installs/ohmyzsh.js +529 -0
- package/src/installs/ohmyzsh.md +1094 -0
- package/src/installs/studio-3t.js +7 -5
- package/src/installs/sublime-text.js +7 -2
- package/src/installs/zsh.js +455 -0
- package/src/installs/zsh.md +1008 -0
- package/src/utils/ubuntu/snap.js +45 -3
package/src/utils/ubuntu/snap.js
CHANGED
|
@@ -9,11 +9,53 @@
|
|
|
9
9
|
const shell = require('../common/shell');
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Checks if snapd is installed and
|
|
13
|
-
*
|
|
12
|
+
* Checks if snapd is installed and the daemon is accessible.
|
|
13
|
+
*
|
|
14
|
+
* This function verifies both that the snap command exists AND that
|
|
15
|
+
* the snapd daemon is running and can be communicated with. This is
|
|
16
|
+
* important because in some environments (like Docker containers),
|
|
17
|
+
* the snap command may be installed but the daemon cannot run.
|
|
18
|
+
*
|
|
19
|
+
* @returns {boolean} True if snap command exists AND daemon is accessible
|
|
14
20
|
*/
|
|
15
21
|
function isInstalled() {
|
|
16
|
-
|
|
22
|
+
// First check if snap command exists
|
|
23
|
+
if (!shell.commandExists('snap')) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check if snapd daemon is accessible by checking snap version output
|
|
28
|
+
// Using syncExec for immediate result without spawning async process
|
|
29
|
+
const { execSync } = require('child_process');
|
|
30
|
+
try {
|
|
31
|
+
// Try to get snap version info with a short timeout
|
|
32
|
+
// In Docker without systemd, this may timeout or return "snapd unavailable"
|
|
33
|
+
const output = execSync('snap version 2>/dev/null', {
|
|
34
|
+
stdio: 'pipe',
|
|
35
|
+
timeout: 1000,
|
|
36
|
+
encoding: 'utf8'
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Check if snapd is listed as unavailable
|
|
40
|
+
// When snapd daemon is not running, snap version shows:
|
|
41
|
+
// snap 2.73+ubuntu22.04
|
|
42
|
+
// snapd unavailable
|
|
43
|
+
// series -
|
|
44
|
+
if (output.includes('snapd unavailable') || output.includes('snapd unavailable')) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Also check for empty or malformed output
|
|
49
|
+
if (!output || output.trim().length === 0) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return true;
|
|
54
|
+
} catch (err) {
|
|
55
|
+
// If snap version command fails (timeout, error), daemon is not accessible
|
|
56
|
+
// This handles the Docker case where snap command hangs trying to reach daemon
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
17
59
|
}
|
|
18
60
|
|
|
19
61
|
/**
|