summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-20 18:38:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-20 18:39:10 -0400
commit4509637a6af277606332274a1e8cfc93f7fec628 (patch)
tree324fcdbe2930eab14c528a9361074af7632f3dfa /Assistant
parentd966ae01814e1f818ddf8afd58dd8ef9c7668b51 (diff)
webapp: Support using git-annex on a remote server, which was installed from the standalone tarball or OSX app, and so does not have git-annex in PATH (and may also not have git or rsync in PATH).
* webapp: Support using git-annex on a remote server, which was installed from the standalone tarball or OSX app, and so does not have git-annex in PATH (and may also not have git or rsync in PATH). * standalone tarball, OSX app: Install a ~/.ssh/git-annex-wrapper, which can be used to run git-annex, git, rsync, etc.
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Install.hs37
1 files changed, 21 insertions, 16 deletions
diff --git a/Assistant/Install.hs b/Assistant/Install.hs
index 883ca484c..afbe5b9c0 100644
--- a/Assistant/Install.hs
+++ b/Assistant/Install.hs
@@ -30,8 +30,8 @@ standaloneAppBase = getEnv "GIT_ANNEX_APP_BASE"
{- The standalone app does not have an installation process.
- So when it's run, it needs to set up autostarting of the assistant
- - daemon, as well as writing the programFile, and putting a
- - git-annex-shell wrapper into ~/.ssh
+ - daemon, as well as writing the programFile, and putting the
+ - git-annex-shell and git-annex-wrapper wrapper scripts into ~/.ssh
-
- Note that this is done every time it's started, so if the user moves
- it around, the paths this sets up won't break.
@@ -59,30 +59,35 @@ ensureInstalled = go =<< standaloneAppBase
#endif
installAutoStart program autostartfile
- {- This shim is only updated if it doesn't
- - already exist with the right content. -}
sshdir <- sshDir
- let shim = sshdir </> "git-annex-shell"
- let runshell var = "exec " ++ base </> "runshell" ++
- " git-annex-shell -c \"" ++ var ++ "\""
- let content = unlines
+ let runshell var = "exec " ++ base </> "runshell " ++ var
+ let rungitannexshell var = runshell $ "git-annex-shell -c \"" ++ var ++ "\""
+
+ installWrapper (sshdir </> "git-annex-shell") $ unlines
[ shebang_local
, "set -e"
, "if [ \"x$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then"
- , runshell "$SSH_ORIGINAL_COMMAND"
+ , rungitannexshell "$SSH_ORIGINAL_COMMAND"
, "else"
- , runshell "$@"
+ , rungitannexshell "$@"
, "fi"
]
-
- curr <- catchDefaultIO "" $ readFileStrict shim
- when (curr /= content) $ do
- createDirectoryIfMissing True (parentDir shim)
- viaTmp writeFile shim content
- modifyFileMode shim $ addModes [ownerExecuteMode]
+ installWrapper (sshdir </> "git-annex-wrapper") $ unlines
+ [ shebang_local
+ , "set -e"
+ , runshell "\"$@\""
+ ]
installNautilus program
+installWrapper :: FilePath -> String -> IO ()
+installWrapper file content = do
+ curr <- catchDefaultIO "" $ readFileStrict file
+ when (curr /= content) $ do
+ createDirectoryIfMissing True (parentDir file)
+ viaTmp writeFile file content
+ modifyFileMode file $ addModes [ownerExecuteMode]
+
installNautilus :: FilePath -> IO ()
#ifdef linux_HOST_OS
installNautilus program = do