summaryrefslogtreecommitdiff
path: root/src/Propellor/Shim.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-02 11:06:20 -0700
committerJoey Hess2015-09-02 11:06:20 -0700
commitbce9d314a94a1378ee35a4575aa7ecadf5967e62 (patch)
tree1fd4ba1089ba2a42589af7bc5b690a2e62b819c1 /src/Propellor/Shim.hs
parente972d8bd6e283803ce4f5ef03cb35aa72de45d7f (diff)
Fix bug that caused provisioning new chroots to fail.
Diffstat (limited to 'src/Propellor/Shim.hs')
-rw-r--r--src/Propellor/Shim.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Propellor/Shim.hs b/src/Propellor/Shim.hs
index 7cdecefd..a3c8e701 100644
--- a/src/Propellor/Shim.hs
+++ b/src/Propellor/Shim.hs
@@ -55,12 +55,15 @@ shebang :: String
shebang = "#!/bin/sh"
checkAlreadyShimmed :: FilePath -> IO FilePath -> IO FilePath
-checkAlreadyShimmed f nope = withFile f ReadMode $ \h -> do
- fileEncoding h
- s <- hGetLine h
- if s == shebang
- then return f
- else nope
+checkAlreadyShimmed f nope = ifM (doesFileExist f)
+ ( withFile f ReadMode $ \h -> do
+ fileEncoding h
+ s <- hGetLine h
+ if s == shebang
+ then return f
+ else nope
+ , nope
+ )
-- Called when the shimmed propellor is running, so that commands it runs
-- don't see it.