beltsh 1.14.10 → 1.14.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/install.js +16 -3
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -77,7 +77,12 @@ async function main() {
|
|
|
77
77
|
|
|
78
78
|
// Extract
|
|
79
79
|
if (archivePath.endsWith(".zip")) {
|
|
80
|
-
|
|
80
|
+
if (process.platform === "win32") {
|
|
81
|
+
// bsdtar ships with Windows 10+ and extracts zip natively; unzip does not exist on Windows
|
|
82
|
+
execSync(`tar -xf "${archivePath}" -C "${tmpDir}"`, { stdio: "pipe" });
|
|
83
|
+
} else {
|
|
84
|
+
execSync(`unzip -o "${archivePath}" -d "${tmpDir}"`, { stdio: "pipe" });
|
|
85
|
+
}
|
|
81
86
|
} else {
|
|
82
87
|
execSync(`tar -xzf "${archivePath}" -C "${tmpDir}"`, { stdio: "pipe" });
|
|
83
88
|
}
|
|
@@ -95,16 +100,24 @@ async function main() {
|
|
|
95
100
|
const src = path.join(tmpDir, files[0]);
|
|
96
101
|
const dest = path.join(installDir, `belt${ext}`);
|
|
97
102
|
|
|
103
|
+
// Remove any existing file/symlink first — copyFileSync follows symlinks,
|
|
104
|
+
// which corrupts installs where an older installer left belt as a symlink.
|
|
105
|
+
try { fs.unlinkSync(dest); } catch {}
|
|
98
106
|
fs.copyFileSync(src, dest);
|
|
99
107
|
if (PLATFORM !== "windows") {
|
|
100
108
|
fs.chmodSync(dest, 0o755);
|
|
101
109
|
}
|
|
102
110
|
|
|
103
|
-
// Create
|
|
111
|
+
// Create aliases (same as curl installer). Symlinks require elevation on
|
|
112
|
+
// Windows, so fall back to copying the binary there.
|
|
104
113
|
for (const alias of ["infsh", "inferencesh"]) {
|
|
105
114
|
const link = path.join(installDir, `${alias}${ext}`);
|
|
106
115
|
try { fs.unlinkSync(link); } catch {}
|
|
107
|
-
|
|
116
|
+
if (PLATFORM === "windows") {
|
|
117
|
+
fs.copyFileSync(dest, link);
|
|
118
|
+
} else {
|
|
119
|
+
fs.symlinkSync(`belt${ext}`, link);
|
|
120
|
+
}
|
|
108
121
|
}
|
|
109
122
|
|
|
110
123
|
// Clean up temp
|
package/package.json
CHANGED