summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Remote/Rsync.hs33
-rw-r--r--doc/design/assistant/android.mdwn3
2 files changed, 26 insertions, 10 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 79d742aed..7ce0e69b6 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -20,6 +20,7 @@ import Remote.Helper.Special
import Remote.Helper.Encryptable
import Crypto
import Utility.Rsync
+import Utility.CopyFile
import Annex.Perms
type RsyncUrl = String
@@ -207,16 +208,30 @@ rsyncRemote o callback params = do
{- To send a single key is slightly tricky; need to build up a temporary
- directory structure to pass to rsync so it can create the hash
- - directories. -}
+ - directories.
+ -
+ - This would not be necessary if the hash directory structure used locally
+ - was always the same as that used on the rsync remote. So if that's ever
+ - unified, this gets nicer. Especially in the crippled filesystem case.
+ - (When we have the right hash directory structure, we can just
+ - pass --include=X --include=X/Y --include=X/Y/file --exclude=*)
+ -}
rsyncSend :: RsyncOpts -> MeterUpdate -> Key -> FilePath -> Annex Bool
rsyncSend o callback k src = withRsyncScratchDir $ \tmp -> do
let dest = tmp </> Prelude.head (keyPaths k)
liftIO $ createDirectoryIfMissing True $ parentDir dest
- liftIO $ createLink src dest
- rsyncRemote o (Just callback)
- [ Param "--recursive"
- , partialParams
- -- tmp/ to send contents of tmp dir
- , Param $ addTrailingPathSeparator tmp
- , Param $ rsyncUrl o
- ]
+ ok <- ifM crippledFileSystem
+ ( liftIO $ copyFileExternal src dest
+ , do
+ liftIO $ createLink src dest
+ return True
+ )
+ if ok
+ then rsyncRemote o (Just callback)
+ [ Param "--recursive"
+ , partialParams
+ -- tmp/ to send contents of tmp dir
+ , Param $ addTrailingPathSeparator tmp
+ , Param $ rsyncUrl o
+ ]
+ else return False
diff --git a/doc/design/assistant/android.mdwn b/doc/design/assistant/android.mdwn
index 79171c14c..ff391e301 100644
--- a/doc/design/assistant/android.mdwn
+++ b/doc/design/assistant/android.mdwn
@@ -17,9 +17,10 @@ transfers when not on wifi. This may need to be configurable.
Due to use of the FAT filesystem, which doesn't do symlinks, [[desymlink]]
is probably needed for at least older Android devices that have SD cards.
+Additionally, cripped filesystem mode is needed, to avoid hard links,
+file modes, etc.
## TODO
-* rsync backend creates hard links
* migrate creates hard links between old and new keys
* avoid all symlink creation in crippled filesystem + direct mode