summaryrefslogtreecommitdiff
path: root/Annex/Perms.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-14 14:10:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-14 14:15:26 -0400
commit177245deb6ee3271eb44d77c2b0cd722755b2c3f (patch)
tree876c4844937c831470192d367123f581fb6cc3d8 /Annex/Perms.hs
parent4e2d50d2e4c9b4d3487c24042b733d02c2f4dd46 (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 'Annex/Perms.hs')
-rw-r--r--Annex/Perms.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Annex/Perms.hs b/Annex/Perms.hs
index 27804ad3d..b1bac5e23 100644
--- a/Annex/Perms.hs
+++ b/Annex/Perms.hs
@@ -18,6 +18,7 @@ import Common.Annex
import Utility.FileMode
import Git.SharedRepository
import qualified Annex
+import Config
import System.Posix.Types
@@ -34,7 +35,8 @@ withShared a = maybe startup a =<< Annex.getState Annex.shared
- use the default mode, but with core.sharedRepository set,
- allow the group to write, etc. -}
setAnnexPerm :: FilePath -> Annex ()
-setAnnexPerm file = withShared $ liftIO . go
+setAnnexPerm file = unlessM crippledFileSystem $
+ withShared $ liftIO . go
where
go GroupShared = groupWriteRead file
go AllShared = modifyFileMode file $ addModes $
@@ -77,7 +79,8 @@ createAnnexDirectory dir = traverse dir [] =<< top
- file.
-}
freezeContentDir :: FilePath -> Annex ()
-freezeContentDir file = liftIO . go =<< fromRepo getSharedRepository
+freezeContentDir file = unlessM crippledFileSystem $
+ liftIO . go =<< fromRepo getSharedRepository
where
dir = parentDir file
go GroupShared = groupWriteRead dir
@@ -91,6 +94,7 @@ createContentDir dest = do
unlessM (liftIO $ doesDirectoryExist dir) $
createAnnexDirectory dir
-- might have already existed with restricted perms
- liftIO $ allowWrite dir
+ unlessM crippledFileSystem $
+ liftIO $ allowWrite dir
where
dir = parentDir dest