summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Chroot/Util.hs
diff options
context:
space:
mode:
authorJoey Hess2014-11-22 22:37:25 -0400
committerJoey Hess2014-11-22 22:37:25 -0400
commit5fefb161c388f72fa598c238295ce1f051cc0029 (patch)
treededa74d1b11a02a2cc3c9a2390e51b6b9d3b0f43 /src/Propellor/Property/Chroot/Util.hs
parentca09087caf5298b01f05bae4a4601fce47966c4f (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/Chroot/Util.hs')
-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"