diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-12-20 17:46:14 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-12-20 17:46:14 -0400 |
commit | 93c09f231269895fd765040016f19a097ca6db9d (patch) | |
tree | d5da4f4027812c3633f67a6e1e3cd8673a1009c4 /Command/EnableTor.hs | |
parent | 5387e0e1aeee46b94ad6e0a1d59b1422a8048665 (diff) |
fail before suing when not in a git-annex repo
Diffstat (limited to 'Command/EnableTor.hs')
-rw-r--r-- | Command/EnableTor.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Command/EnableTor.hs b/Command/EnableTor.hs index 91d5af701..d12a6e446 100644 --- a/Command/EnableTor.hs +++ b/Command/EnableTor.hs @@ -32,12 +32,15 @@ seek = withWords start start :: [String] -> CommandStart start os = do + uuid <- getUUID + when (uuid == NoUUID) $ + giveup "This can only be run in a git-annex repository." #ifndef mingw32_HOST_OS curruserid <- liftIO getEffectiveUserID if curruserid == 0 then case readish =<< headMaybe os of Nothing -> giveup "Need user-id parameter." - Just userid -> go userid + Just userid -> go uuid userid else do liftIO $ putStrLn "Need root access to enable tor..." gitannex <- liftIO readProgramFile @@ -48,13 +51,10 @@ start os = do [ "Failed to run as root:" , gitannex ] ++ toCommand ps ) #else - go 0 + go uuid 0 #endif where - go userid = do - uuid <- getUUID - when (uuid == NoUUID) $ - giveup "This can only be run in a git-annex repository." + go uuid userid = do (onionaddr, onionport) <- liftIO $ addHiddenService "tor-annex" userid (fromUUID uuid) storeP2PAddress $ TorAnnex onionaddr onionport |