diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-10-20 12:06:35 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-10-20 12:06:35 -0400 |
| commit | 9b7719c2c78f1e6f3d012bb76aca7efa1df7faac (patch) | |
| tree | 736397753e2064407fb8befee07b325fbc055540 /src/Propellor/Property/Chroot | |
| parent | 650b7659cf07f1da31bcf51eb139af28d5bc8bb1 (diff) | |
| parent | 05d35eb568e74deafc936e6735171291410b5f0b (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Chroot')
| -rw-r--r-- | src/Propellor/Property/Chroot/Util.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Propellor/Property/Chroot/Util.hs b/src/Propellor/Property/Chroot/Util.hs index ea0df780..3ebda28f 100644 --- a/src/Propellor/Property/Chroot/Util.hs +++ b/src/Propellor/Property/Chroot/Util.hs @@ -2,11 +2,14 @@ module Propellor.Property.Chroot.Util where import Propellor.Property.Mount +import Utility.Exception import Utility.Env +import Utility.Directory + import Control.Applicative import System.Directory --- When chrooting, it's useful to ensure that PATH has all the standard +-- | 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)] @@ -18,9 +21,13 @@ standardPathEnv = do stdPATH :: String stdPATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" --- Removes the contents of a chroot. First, unmounts any filesystems +-- | Removes the contents of a chroot. First, unmounts any filesystems -- mounted within it. removeChroot :: FilePath -> IO () removeChroot c = do unmountBelow c removeDirectoryRecursive c + +-- | Returns true if a chroot directory is empty. +unpopulated :: FilePath -> IO Bool +unpopulated d = null <$> catchDefaultIO [] (dirContents d) |
