summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Chroot
diff options
context:
space:
mode:
authorJoey Hess2014-11-23 14:41:09 -0400
committerJoey Hess2014-11-23 14:41:09 -0400
commitac41f8b07b45b1855b1c10665757691a56b08353 (patch)
treed446f81a4068ca594abd881c2b055ad2f8662a12 /src/Propellor/Property/Chroot
parent1b34f23414b574105ddfdf36fbeb86aa115a0e2e (diff)
parent3c952a0de9d228eafe6e208007be7d2e018d68b8 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Chroot')
-rw-r--r--src/Propellor/Property/Chroot/Util.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Propellor/Property/Chroot/Util.hs b/src/Propellor/Property/Chroot/Util.hs
new file mode 100644
index 00000000..feb71d01
--- /dev/null
+++ b/src/Propellor/Property/Chroot/Util.hs
@@ -0,0 +1,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"