diff options
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Hooks.hs | 14 | ||||
-rw-r--r-- | Remote/Helper/Ssh.hs | 6 |
2 files changed, 8 insertions, 12 deletions
diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs index 91190d841..bdeb653eb 100644 --- a/Remote/Helper/Hooks.hs +++ b/Remote/Helper/Hooks.hs @@ -13,15 +13,16 @@ import Common.Annex import Types.Remote import qualified Annex import Annex.LockPool -import Config import Annex.Perms {- Modifies a remote's access functions to first run the - annex-start-command hook, and trigger annex-stop-command on shutdown. - This way, the hooks are only run when a remote is actively being used. -} -addHooks :: Remote -> Annex Remote -addHooks r = addHooks' r <$> lookupHook r "start" <*> lookupHook r "stop" +addHooks :: Remote -> Remote +addHooks r = addHooks' r + (remoteAnnexStartCommand $ gitconfig r) + (remoteAnnexStopCommand $ gitconfig r) addHooks' :: Remote -> Maybe String -> Maybe String -> Remote addHooks' r Nothing Nothing = r addHooks' r starthook stophook = r' @@ -83,10 +84,3 @@ runHooks r starthook stophook a = do Left _ -> noop Right _ -> run stophook liftIO $ closeFd fd - -lookupHook :: Remote -> String -> Annex (Maybe String) -lookupHook r n = go =<< getRemoteConfig (repo r) hookname "" - where - go "" = return Nothing - go command = return $ Just command - hookname = n ++ "-command" diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index b6da80ec6..135b5c144 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -10,17 +10,19 @@ module Remote.Helper.Ssh where import Common.Annex import qualified Git import qualified Git.Url -import Config import Annex.UUID import Annex.Ssh import Fields +import Types.GitConfig {- Generates parameters to ssh to a repository's host and run a command. - Caller is responsible for doing any neccessary shellEscaping of the - passed command. -} sshToRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam] sshToRepo repo sshcmd = do - opts <- map Param . words <$> getRemoteConfig repo "ssh-options" "" + g <- fromRepo id + let c = extractRemoteGitConfig g (Git.repoDescribe repo) + let opts = map Param $ remoteAnnexSshOptions c params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo) opts return $ params ++ sshcmd |