move thirdparty program installation for standalone bundle into haskell program

This allows it to use Build.SysConfig to always install the programs
configure detected. Amoung other fixes, this ensures the right uuid
generator and checksum programs are installed.

I also cleaned up the handling of lsof's path; configure now checks for
it in PATH, but falls back to looking for it in sbin directories.
This commit is contained in:
Joey Hess 2012-12-14 15:52:44 -04:00
parent 1a10f109c1
commit 82617b92e9
7 changed files with 136 additions and 27 deletions

View file

@ -132,11 +132,25 @@ relHome path = do
then "~/" ++ relPathDirToFile home path
else path
{- Checks if a command is available in PATH. -}
{- Checks if a command is available in PATH.
-
- The command may be fully-qualified, in which case, this succeeds as
- long as it exists. -}
inPath :: String -> IO Bool
inPath command = getSearchPath >>= anyM indir
inPath command = isJust <$> searchPath command
{- Finds a command in PATH and returns the full path to it.
-
- The command may be fully qualified already, in which case it will
- be returned if it exists.
-}
searchPath :: String -> IO (Maybe FilePath)
searchPath command
| isAbsolute command = check command
| otherwise = getSearchPath >>= getM indir
where
indir d = doesFileExist $ d </> command
indir d = check $ d </> command
check f = ifM (doesFileExist f) ( return (Just f), return Nothing )
{- Checks if a filename is a unix dotfile. All files inside dotdirs
- count as dotfiles. -}