diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-05 14:49:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-05 14:49:47 -0400 |
commit | cb0f435d948a597429db5e51f2b3d2b15294090f (patch) | |
tree | 3334d153133668abc296b7343899b5cf64ae28f1 /Init.hs | |
parent | ccedd06023b0c2f189ff157e29b6295f984c9624 (diff) |
adding removable drive repos now basically works
Diffstat (limited to 'Init.hs')
-rw-r--r-- | Init.hs | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -14,6 +14,7 @@ module Init ( import Common.Annex import Utility.TempFile +import Utility.Network import qualified Git import qualified Annex.Branch import Logs.UUID @@ -25,18 +26,12 @@ import System.Posix.User genDescription :: Maybe String -> Annex String genDescription (Just d) = return d genDescription Nothing = do - hostname <- getHostname + hostname <- maybe "" id <$> liftIO getHostname let at = if null hostname then "" else "@" username <- clicketyclickety reldir <- liftIO . relHome =<< fromRepo Git.repoPath return $ concat [username, at, hostname, ":", reldir] where - {- Haskell lacks uname(2) bindings, except in the - - Bindings.Uname addon. Rather than depend on that, - - use uname -n when available. -} - getHostname = liftIO $ catchDefaultIO uname_node "" - uname_node = takeWhile (/= '\n') <$> - readProcess "uname" ["-n"] clicketyclickety = liftIO $ userName <$> (getUserEntryForID =<< getEffectiveUserID) |