summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Propellor/Property/Bootstrap.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Propellor/Property/Bootstrap.hs b/src/Propellor/Property/Bootstrap.hs
index fa240782..7fd9595b 100644
--- a/src/Propellor/Property/Bootstrap.hs
+++ b/src/Propellor/Property/Bootstrap.hs
@@ -5,6 +5,7 @@ import Propellor.Bootstrap
import Propellor.Property.Chroot
import Data.List
+import System.Posix.Directory
-- | Where a propellor repository should be bootstrapped from.
data RepoSource
@@ -97,6 +98,12 @@ exposeTrueLocaldir a = ifM inChroot
-- Have to lazy unmount, because the propellor process
-- is running in the localdir that it's unmounting..
run "umount" [Param "-l", File from]
+ -- We were in the old localdir; move to the new one after
+ -- flipping the bind mounts. Otherwise, commands that try
+ -- to access the cwd will fail because it got umounted out
+ -- from under.
+ changeWorkingDirectory "/"
+ changeWorkingDirectory localdir
run cmd ps = unlessM (boolSystem cmd ps) $
error $ "exposeTrueLocaldir failed to run " ++ show (cmd, ps)