diff options
author | Joey Hess <joeyh@joeyh.name> | 2018-03-07 15:15:23 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2018-03-07 15:38:01 -0400 |
commit | 9f4771eb3c3f29ea38bbfc70eaf78198ca948840 (patch) | |
tree | 254a904d70a593da0c4bcfc4d948d4f9a07d19c2 /CmdLine/GitAnnexShell/Checks.hs | |
parent | b7aa7445a5d97d6f43fbea26ae2ee1773744ebc9 (diff) |
implemented git-annex-shell p2pstdio
Not yet used by git-annex, but this will allow faster transfers etc than
using individual ssh connections and rsync.
Not called git-annex-shell p2p, because git-annex p2p does something
else and I don't want two subcommands with the same name between the two
for sanity reasons.
This commit was sponsored by Øyvind Andersen Holm.
Diffstat (limited to 'CmdLine/GitAnnexShell/Checks.hs')
-rw-r--r-- | CmdLine/GitAnnexShell/Checks.hs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/CmdLine/GitAnnexShell/Checks.hs b/CmdLine/GitAnnexShell/Checks.hs index fcbf14b24..3409884c0 100644 --- a/CmdLine/GitAnnexShell/Checks.hs +++ b/CmdLine/GitAnnexShell/Checks.hs @@ -14,17 +14,28 @@ import Annex.Init import Utility.UserInfo import Utility.Env +limitedEnv :: String +limitedEnv = "GIT_ANNEX_SHELL_LIMITED" + checkNotLimited :: IO () -checkNotLimited = checkEnv "GIT_ANNEX_SHELL_LIMITED" +checkNotLimited = checkEnv limitedEnv + +readOnlyEnv :: String +readOnlyEnv = "GIT_ANNEX_SHELL_READONLY" checkNotReadOnly :: IO () -checkNotReadOnly = checkEnv "GIT_ANNEX_SHELL_READONLY" +checkNotReadOnly = checkEnv readOnlyEnv checkEnv :: String -> IO () -checkEnv var = getEnv var >>= \case - Nothing -> noop - Just "" -> noop - Just _ -> giveup $ "Action blocked by " ++ var +checkEnv var = checkEnvSet var >>= \case + False -> noop + True -> giveup $ "Action blocked by " ++ var + +checkEnvSet :: String -> IO Bool +checkEnvSet var = getEnv var >>= return . \case + Nothing -> False + Just "" -> False + Just _ -> True checkDirectory :: Maybe FilePath -> IO () checkDirectory mdir = do |