sshifu 0.7.8-test.10 → 0.7.8-test.11

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 +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sshifu",
3
- "version": "0.7.8-test.10",
3
+ "version": "0.7.8-test.11",
4
4
  "description": "SSH authentication system with short-lived certificates and OAuth authentication (GitHub organizations)",
5
5
  "main": "bin/sshifu.js",
6
6
  "bin": {
@@ -95,12 +95,15 @@ 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
- // On Windows, extract to temp directory first to avoid file lock issues
98
+ // On Windows, copy zip to temp location first to avoid file lock issues
99
+ const tempZip = path.join(binDir, 'temp_' + Date.now() + '.zip');
100
+ fs.copyFileSync(archivePath, tempZip);
101
+
99
102
  const tempDir = path.join(binDir, 'tmp_extract_' + Date.now());
100
103
  fs.mkdirSync(tempDir, { recursive: true });
101
104
 
102
105
  try {
103
- const psCommand = `Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${tempDir.replace(/'/g, "''")}' -Force -ErrorAction Stop`;
106
+ const psCommand = `Expand-Archive -Path '${tempZip.replace(/'/g, "''")}' -DestinationPath '${tempDir.replace(/'/g, "''")}' -Force -ErrorAction Stop`;
104
107
  console.log(`[sshifu] Running: ${psCommand}`);
105
108
  execSync(`powershell -Command "${psCommand}"`, { stdio: ['ignore', 'pipe', 'pipe'] });
106
109
 
@@ -116,11 +119,16 @@ async function main() {
116
119
  // Move to final location
117
120
  const tempBinPath = path.join(tempDir, extractedBin);
118
121
  fs.renameSync(tempBinPath, binPath);
122
+
123
+ // Cleanup
124
+ fs.unlinkSync(tempZip);
119
125
  fs.rmSync(tempDir, { recursive: true, force: true });
126
+ fs.unlinkSync(archivePath);
120
127
 
121
128
  console.log(`[sshifu] Binary installed successfully!`);
122
129
  } catch (extractErr) {
123
- // Cleanup temp dir on error
130
+ // Cleanup temp files on error
131
+ try { fs.unlinkSync(tempZip); } catch (e) {}
124
132
  try { fs.rmSync(tempDir, { recursive: true, force: true }); } catch (e) {}
125
133
  console.error(`[sshifu] Extraction failed: ${extractErr.message}`);
126
134
  console.error(`[sshifu] stderr: ${extractErr.stderr?.toString() || 'N/A'}`);