diff options
author | Joey Hess <joey@kitenet.net> | 2013-02-14 14:10:36 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-02-14 14:15:26 -0400 |
commit | 177245deb6ee3271eb44d77c2b0cd722755b2c3f (patch) | |
tree | 876c4844937c831470192d367123f581fb6cc3d8 /Remote | |
parent | 4e2d50d2e4c9b4d3487c24042b733d02c2f4dd46 (diff) |
crippled filesystem support, probing and initial support
git annex init probes for crippled filesystems, and sets direct mode, as
well as `annex.crippledfilesystem`.
Avoid manipulating permissions of files on crippled filesystems.
That would likely cause an exception to be thrown.
Very basic support in Command.Add for cripped filesystems; avoids the lock
down entirely since doing it needs both permissions and hard links.
Will make this better soon.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Directory.hs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 922742099..3070a530b 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -183,12 +183,14 @@ storeHelper d chunksize key storer = check <&&> go void $ tryIO $ removeDirectoryRecursive dest -- or not exist createDirectoryIfMissing True (parentDir dest) renameDirectory tmp dest - mapM_ preventWrite =<< dirContents dest - preventWrite dest + -- may fail on some filesystems + void $ tryIO $ do + mapM_ preventWrite =<< dirContents dest + preventWrite dest recorder f s = do void $ tryIO $ allowWrite f writeFile f s - preventWrite f + void $ tryIO $ preventWrite f retrieve :: FilePath -> ChunkSize -> Key -> AssociatedFile -> FilePath -> Annex Bool retrieve d chunksize k _ f = metered Nothing k $ \meterupdate -> @@ -215,10 +217,11 @@ retrieveCheap d _ k f = liftIO $ withStoredFiles Nothing d k go go _files = return False remove :: FilePath -> Key -> Annex Bool -remove d k = liftIO $ catchBoolIO $ do - allowWrite dir - removeDirectoryRecursive dir - return True +remove d k = liftIO $ do + void $ tryIO $ allowWrite dir + catchBoolIO $ do + removeDirectoryRecursive dir + return True where dir = storeDir d k |