summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-05-08 14:55:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-05-08 14:55:57 -0400
commit578f59a9f93750662c6c42f6a7223bac75de6018 (patch)
treef8f3ec68ba6c98f09179079986356a7a5525f0d6
parent51ffddd49c884144e9f9520a3e997a65a94aa57e (diff)
add a wrapper for ssh-keygen
-rw-r--r--Build/NullSoftInstaller.hs5
-rw-r--r--standalone/windows/ssh-keygen.cmd31
2 files changed, 35 insertions, 1 deletions
diff --git a/Build/NullSoftInstaller.hs b/Build/NullSoftInstaller.hs
index 41cf360a2..7bb16f3f7 100644
--- a/Build/NullSoftInstaller.hs
+++ b/Build/NullSoftInstaller.hs
@@ -199,4 +199,7 @@ findCygLibs p = filter iscyg . mapMaybe parse . lines <$> readProcess "ldd" [p]
iscyg f = "cyg" `isPrefixOf` f || "lib" `isPrefixOf` f
wrappers :: [FilePath]
-wrappers = ["standalone\\windows\\ssh.cmd"]
+wrappers =
+ [ "standalone\\windows\\ssh.cmd"
+ , "standalone\\windows\\ssh-keygen.cmd"
+ ]
diff --git a/standalone/windows/ssh-keygen.cmd b/standalone/windows/ssh-keygen.cmd
new file mode 100644
index 000000000..c4ec3cdb4
--- /dev/null
+++ b/standalone/windows/ssh-keygen.cmd
@@ -0,0 +1,31 @@
+@rem Do not use "echo off" to not affect any child calls.
+
+@rem Enable extensions, the `verify other 2>nul` is a trick from the setlocal help
+@verify other 2>nul
+@setlocal enableDelayedExpansion
+@if errorlevel 1 (
+ @echo Unable to enable delayed expansion. Immediate expansion will be used.
+ @goto fallback
+)
+
+@rem Get the absolute path to the parent directory, which is assumed to be the
+@rem Git installation root.
+@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
+@set PATH=!git_install_root!\bin;!git_install_root!\mingw\bin;!PATH!
+
+ssh-keygen %*
+@goto end
+
+:fallback
+@rem The above script again with immediate expansion, in case delayed expansion
+@rem is unavailable.
+@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
+@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%
+
+@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
+@if not exist "%HOME%" @set HOME=%USERPROFILE%
+
+ssh-keygen %*
+
+:end
+@rem End of script