summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Chroot/Util.hs
blob: feb71d01190fc3d2c2275aef8992ce3f6547a4a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Propellor.Property.Chroot.Util where

import Utility.Env
import Control.Applicative

-- When chrooting, it's useful to ensure that PATH has all the standard
-- directories in it. This adds those directories to whatever PATH is
-- already set.
standardPathEnv :: IO [(String, String)]
standardPathEnv = do
	path <- getEnvDefault "PATH" "/bin"
	addEntry "PATH" (path ++ std)
		<$> getEnvironment
  where
	std = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"