sshifu-server 0.7.0 → 0.7.2
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/bin/sshifu-server +0 -0
- package/package.json +1 -1
- package/scripts/install.js +28 -8
- package/sshifu-server-0.0.0-dev.tgz +0 -0
|
Binary file
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -78,25 +78,45 @@ async function main() {
|
|
|
78
78
|
console.log(`[sshifu-server] Build manually with: go build -o bin/${binName} ./cmd/${PACKAGE_NAME}`);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
const
|
|
81
|
+
|
|
82
|
+
const isWindows = process.platform === 'win32';
|
|
83
|
+
const archiveExt = isWindows ? '.zip' : '.tar.gz';
|
|
84
|
+
const archiveName = `${PACKAGE_NAME}-${platform}${archiveExt}`;
|
|
83
85
|
const archiveUrl = `https://github.com/${REPO}/releases/download/v${version}/${archiveName}`;
|
|
84
86
|
const archivePath = path.join(binDir, archiveName);
|
|
85
|
-
|
|
87
|
+
|
|
86
88
|
console.log(`[sshifu-server] Downloading ${archiveUrl}...`);
|
|
87
|
-
|
|
89
|
+
|
|
88
90
|
try {
|
|
89
91
|
await download(archiveUrl, archivePath);
|
|
90
92
|
|
|
91
93
|
// Extract the archive
|
|
92
94
|
console.log(`[sshifu-server] Extracting...`);
|
|
93
|
-
const archiveBinName = `${PACKAGE_NAME}-${platform}${
|
|
95
|
+
const archiveBinName = `${PACKAGE_NAME}-${platform}${isWindows ? '.exe' : ''}`;
|
|
94
96
|
const extractedPath = path.join(binDir, archiveBinName);
|
|
95
|
-
|
|
97
|
+
if (isWindows) {
|
|
98
|
+
execSync(`powershell -Command "Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${binDir.replace(/'/g, "''")}' -Force"`, { stdio: 'ignore' });
|
|
99
|
+
} else {
|
|
100
|
+
execSync(`tar -xzf "${archivePath}" -C "${binDir}"`, { stdio: 'ignore' });
|
|
101
|
+
}
|
|
96
102
|
|
|
97
103
|
// Rename to expected name if different
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
console.log(`[sshifu-server] Looking for binary at: ${extractedPath}`);
|
|
105
|
+
console.log(`[sshifu-server] Target path: ${binPath}`);
|
|
106
|
+
if (archiveBinName !== binName) {
|
|
107
|
+
if (fs.existsSync(extractedPath)) {
|
|
108
|
+
console.log(`[sshifu-server] Renaming ${archiveBinName} to ${binName}`);
|
|
109
|
+
fs.renameSync(extractedPath, binPath);
|
|
110
|
+
} else {
|
|
111
|
+
// Try to find the extracted file (in case of path issues)
|
|
112
|
+
const files = fs.readdirSync(binDir);
|
|
113
|
+
console.log(`[sshifu-server] Files in binDir: ${files.join(', ')}`);
|
|
114
|
+
const exeFile = files.find(f => f.endsWith('.exe') && f.startsWith(PACKAGE_NAME));
|
|
115
|
+
if (exeFile) {
|
|
116
|
+
console.log(`[sshifu-server] Found ${exeFile}, renaming to ${binName}`);
|
|
117
|
+
fs.renameSync(path.join(binDir, exeFile), binPath);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
100
120
|
}
|
|
101
121
|
|
|
102
122
|
// Make executable on Unix
|
|
Binary file
|