sshifu-server 0.7.8-test.5 → 0.7.8-test.6
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/scripts/install.js +34 -6
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -95,7 +95,12 @@ async function main() {
|
|
|
95
95
|
const archiveBinName = `${PACKAGE_NAME}-${platform}${isWindows ? '.exe' : ''}`;
|
|
96
96
|
const extractedPath = path.join(binDir, archiveBinName);
|
|
97
97
|
if (isWindows) {
|
|
98
|
-
|
|
98
|
+
try {
|
|
99
|
+
execSync(`powershell -Command "Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${binDir.replace(/'/g, "''")}' -Force"`, { stdio: 'pipe' });
|
|
100
|
+
} catch (extractErr) {
|
|
101
|
+
console.error(`[sshifu-server] Extraction failed: ${extractErr.message}`);
|
|
102
|
+
throw extractErr;
|
|
103
|
+
}
|
|
99
104
|
} else {
|
|
100
105
|
execSync(`tar -xzf "${archivePath}" -C "${binDir}"`, { stdio: 'ignore' });
|
|
101
106
|
}
|
|
@@ -109,12 +114,35 @@ async function main() {
|
|
|
109
114
|
fs.renameSync(extractedPath, binPath);
|
|
110
115
|
} else {
|
|
111
116
|
// Try to find the extracted file (in case of path issues)
|
|
117
|
+
console.log(`[sshifu-server] Binary not found at expected location, searching...`);
|
|
112
118
|
const files = fs.readdirSync(binDir);
|
|
113
|
-
console.log(`[sshifu-server] Files in binDir: ${files.join(', ')}`);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
console.log(`[sshifu-server] Files in binDir (top level): ${files.join(', ')}`);
|
|
120
|
+
|
|
121
|
+
// Look for .exe file in binDir or any subdirectory
|
|
122
|
+
let foundFile = null;
|
|
123
|
+
for (const file of files) {
|
|
124
|
+
const filePath = path.join(binDir, file);
|
|
125
|
+
const stat = fs.statSync(filePath);
|
|
126
|
+
if (stat.isDirectory()) {
|
|
127
|
+
// Check subdirectory
|
|
128
|
+
const subFiles = fs.readdirSync(filePath);
|
|
129
|
+
console.log(`[sshifu-server] Files in ${file}/: ${subFiles.join(', ')}`);
|
|
130
|
+
const exeInSubdir = subFiles.find(f => f.endsWith('.exe') && f.startsWith(PACKAGE_NAME));
|
|
131
|
+
if (exeInSubdir) {
|
|
132
|
+
foundFile = path.join(filePath, exeInSubdir);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
} else if (file.endsWith('.exe') && file.startsWith(PACKAGE_NAME)) {
|
|
136
|
+
foundFile = filePath;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (foundFile) {
|
|
142
|
+
console.log(`[sshifu-server] Found ${foundFile}, renaming to ${binName}`);
|
|
143
|
+
fs.renameSync(foundFile, binPath);
|
|
144
|
+
} else {
|
|
145
|
+
throw new Error(`Could not find binary in ${binDir}`);
|
|
118
146
|
}
|
|
119
147
|
}
|
|
120
148
|
}
|