sshifu-server 0.7.8-test.4 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/install.js +34 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sshifu-server",
3
- "version": "0.7.8-test.4",
3
+ "version": "0.7.8-test.6",
4
4
  "description": "SSH authentication server with OAuth gateway and certificate authority",
5
5
  "main": "bin/sshifu-server.js",
6
6
  "bin": {
@@ -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
- execSync(`powershell -Command "Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${binDir.replace(/'/g, "''")}' -Force"`, { stdio: 'ignore' });
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
- 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);
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
  }