* Stop bundling curl in the OSX dmg and linux standalone image.
* sync, assist, push, pull: Skip more types of remotes when they
are not present due to eg being on a drive that is offline.
+ (directory, borg, bup, ddar, rsync)
* info: Added available to the info displayed for a remote.
* Added AVAILABILITY UNAVAILABLE and the UNAVAILABLERESPONSE extension
to the external special remote protocol.
{- Using borg as a remote.
-
- - Copyright 2020,2021 Joey Hess <id@joeyh.name>
+ - Copyright 2020,2023 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
import Annex.SpecialRemote.Config
import Remote.Helper.Special
import Remote.Helper.ExportImport
+import Remote.Helper.Path
import Annex.UUID
import Types.ProposedAccepted
import Utility.Metered
, gitconfig = gc
, localpath = borgRepoLocalPath borgrepo
, remotetype = remote
- , availability = pure $
- if borgLocal borgrepo then LocallyAvailable else GloballyAvailable
+ , availability = checkAvailability borgrepo
, readonly = False
, appendonly = False
-- When the user sets the appendonly field, they are
borgRepoLocalPath :: BorgRepo -> Maybe FilePath
borgRepoLocalPath r@(BorgRepo p)
- | borgLocal r && not (null p) = Just p
+ | borgLocal r = Just p
| otherwise = Nothing
+checkAvailability :: BorgRepo -> Annex Availability
+checkAvailability borgrepo@(BorgRepo r) =
+ checkPathAvailability (borgLocal borgrepo) r
+
listImportableContentsM :: UUID -> BorgRepo -> ParsedRemoteConfig -> Annex (Maybe (ImportableContentsChunkable Annex (ContentIdentifier, ByteSize)))
listImportableContentsM u borgrepo c = prompt $ do
imported <- getImported u
import Annex.SpecialRemote.Config
import Remote.Helper.Special
import Remote.Helper.ExportImport
+import Remote.Helper.Path
import Utility.Hash
import Utility.UserInfo
import Annex.UUID
then Just buprepo
else Nothing
, remotetype = remote
- , availability = pure $
- if bupLocal buprepo then LocallyAvailable else GloballyAvailable
+ , availability = if null buprepo
+ then pure LocallyAvailable
+ else checkPathAvailability (bupLocal buprepo) buprepo
, readonly = False
, appendonly = False
, untrustworthy = False
import Annex.SpecialRemote.Config
import Remote.Helper.Special
import Remote.Helper.ExportImport
+import Remote.Helper.Path
import Annex.Ssh
import Annex.UUID
import Utility.SshHost
then Just $ ddarRepoLocation ddarrepo
else Nothing
, remotetype = remote
- , availability = pure $
- if ddarLocal ddarrepo then LocallyAvailable else GloballyAvailable
+ , availability = checkPathAvailability
+ (ddarLocal ddarrepo && not (null $ ddarRepoLocation ddarrepo))
+ (ddarRepoLocation ddarrepo)
, readonly = False
, appendonly = False
, untrustworthy = False
import Annex.SpecialRemote.Config
import Remote.Helper.Special
import Remote.Helper.ExportImport
+import Remote.Helper.Path
import Types.Import
import qualified Remote.Directory.LegacyChunked as Legacy
import Annex.CopyFile
, readonly = False
, appendonly = False
, untrustworthy = False
- , availability = pure LocallyAvailable
+ , availability = checkPathAvailability True dir'
, remotetype = remote
, mkUnavailable = gen r u rc
(gc { remoteAnnexDirectory = Just "/dev/null" }) rs
localpathCalc :: Git.Repo -> Maybe FilePath
localpathCalc r
- | availabilityCalc r == GloballyAvailable = Nothing
+ | not (Git.repoIsLocal r) && not (Git.repoIsLocalUnknown r) = Nothing
| otherwise = Just $ fromRawFilePath $ Git.repoPath r
availabilityCalc :: Git.Repo -> Availability
--- /dev/null
+{- Utilities for remotes located in a path in the filesystem.
+ -
+ - Copyright 2023 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU AGPL version 3 or higher.
+ -}
+
+module Remote.Helper.Path where
+
+import Annex.Common
+import Types.Availability
+
+checkPathAvailability :: Bool -> FilePath -> Annex Availability
+checkPathAvailability islocal d
+ | not islocal = return GloballyAvailable
+ | otherwise = ifM (liftIO $ doesDirectoryExist d)
+ ( return LocallyAvailable
+ , return Unavailable
+ )
import Annex.Perms
import Remote.Helper.Special
import Remote.Helper.ExportImport
+import Remote.Helper.Path
import Types.Export
import Types.ProposedAccepted
import Remote.Rsync.RsyncUrl
, readonly = False
, appendonly = False
, untrustworthy = False
- , availability = pure $
- if islocal then LocallyAvailable else GloballyAvailable
+ , availability = checkPathAvailability islocal (rsyncUrl o)
, remotetype = remote
, mkUnavailable = return Nothing
, getInfo = return [("url", url)]
Remote.Helper.Http
Remote.Helper.Messages
Remote.Helper.P2P
+ Remote.Helper.Path
Remote.Helper.ReadOnly
Remote.Helper.ThirdPartyPopulated
Remote.Helper.Special