Use USER and HOME environment when set, and only fall back to getpwent, which doesn't work with LDAP or NIS.
This commit is contained in:
parent
2018de53a3
commit
7ee0ffaeb9
13 changed files with 49 additions and 20 deletions
8
Init.hs
8
Init.hs
|
@ -20,20 +20,16 @@ import qualified Annex.Branch
|
|||
import Logs.UUID
|
||||
import Annex.Version
|
||||
import Annex.UUID
|
||||
|
||||
import System.Posix.User
|
||||
import Utility.UserInfo
|
||||
|
||||
genDescription :: Maybe String -> Annex String
|
||||
genDescription (Just d) = return d
|
||||
genDescription Nothing = do
|
||||
hostname <- maybe "" id <$> liftIO getHostname
|
||||
let at = if null hostname then "" else "@"
|
||||
username <- clicketyclickety
|
||||
username <- liftIO myUserName
|
||||
reldir <- liftIO . relHome =<< fromRepo Git.repoPath
|
||||
return $ concat [username, at, hostname, ":", reldir]
|
||||
where
|
||||
clicketyclickety = liftIO $ userName <$>
|
||||
(getUserEntryForID =<< getEffectiveUserID)
|
||||
|
||||
initialize :: Maybe String -> Annex ()
|
||||
initialize mdescription = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue