summaryrefslogtreecommitdiff
path: root/Init.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-04 13:14:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-04 13:14:55 -0400
commitc5a116b86500c89070cb6591d96437454d2282c1 (patch)
tree92d744307e637173912fcbbdde2b1b4f6d73c5e2 /Init.hs
parent294e595b801524b69dcd877d3b7051572c10e89b (diff)
init: Probe whether the filesystem supports fifos, and if not, disable ssh connection caching.
Diffstat (limited to 'Init.hs')
-rw-r--r--Init.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Init.hs b/Init.hs
index 0ada312e7..678bd7301 100644
--- a/Init.hs
+++ b/Init.hs
@@ -18,6 +18,7 @@ import Utility.TempFile
import Utility.Network
import qualified Git
import qualified Git.LsFiles
+import qualified Git.Config
import qualified Annex.Branch
import Logs.UUID
import Annex.Version
@@ -44,6 +45,7 @@ initialize mdescription = do
prepUUID
setVersion defaultVersion
checkCrippledFileSystem
+ checkFifoSupport
Annex.Branch.create
gitPreCommitHookWrite
createInodeSentinalFile
@@ -144,3 +146,21 @@ checkCrippledFileSystem = whenM probeCrippledFileSystem $ do
void $ liftIO clean
setDirect True
setVersion directModeVersion
+
+probeFifoSupport :: Annex Bool
+probeFifoSupport = do
+ tmp <- fromRepo gitAnnexTmpDir
+ let f = tmp </> "gaprobe"
+ liftIO $ do
+ createDirectoryIfMissing True tmp
+ nukeFile f
+ createNamedPipe f ownerReadMode
+ ms <- tryIO $ getFileStatus f
+ nukeFile f
+ return $ either (const False) isNamedPipe ms
+
+checkFifoSupport :: Annex ()
+checkFifoSupport = unlessM probeFifoSupport $ do
+ warning "Detected a filesystem without fifo support."
+ warning "Disabling ssh connection caching."
+ setConfig (annexConfig "sshcaching") (Git.Config.boolConfig False)