From d4c642e989ab10e476757dbdc48c0d5dd6b3bb8b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Jan 2013 13:34:08 -0400 Subject: assistant: Detect when system is not configured with a user name, and set environment to prevent git from failing. --- Utility/UserInfo.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Utility') diff --git a/Utility/UserInfo.hs b/Utility/UserInfo.hs index bdddf4f8e..8fba3e17f 100644 --- a/Utility/UserInfo.hs +++ b/Utility/UserInfo.hs @@ -7,7 +7,8 @@ module Utility.UserInfo ( myHomeDir, - myUserName + myUserName, + myUserGecos, ) where import Control.Applicative @@ -24,6 +25,9 @@ myHomeDir = myVal ["HOME"] homeDirectory myUserName :: IO String myUserName = myVal ["USER", "LOGNAME"] userName +myUserGecos :: IO String +myUserGecos = myVal [] userGecos + myVal :: [String] -> (UserEntry -> String) -> IO String myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars where -- cgit v1.2.3