diff options
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Property/Chroot.hs | 5 | ||||
| -rw-r--r-- | src/Propellor/Shim.hs | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs index 0dd1f05a..5d29538c 100644 --- a/src/Propellor/Property/Chroot.hs +++ b/src/Propellor/Property/Chroot.hs @@ -169,10 +169,7 @@ propellChroot :: Chroot -> ([String] -> IO (CreateProcess, IO ())) -> Bool -> Pr propellChroot c@(Chroot loc _ _ _) mkproc systemdonly = property (chrootDesc c "provisioned") $ do let d = localdir </> shimdir c let me = localdir </> "propellor" - shim <- liftIO $ ifM (doesDirectoryExist d) - ( pure (Shim.file me d) - , Shim.setup me Nothing d - ) + shim <- liftIO $ Shim.setup me Nothing d ifM (liftIO $ bindmount shim) ( chainprovision shim , return FailedChange diff --git a/src/Propellor/Shim.hs b/src/Propellor/Shim.hs index 811ae7f0..b8ebdf46 100644 --- a/src/Propellor/Shim.hs +++ b/src/Propellor/Shim.hs @@ -16,12 +16,19 @@ import System.Posix.Files -- | Sets up a shimmed version of the program, in a directory, and -- returns its path. -- +-- If the shim was already set up, it's refreshed, in case newer +-- versions of libraries are needed. +-- -- Propellor may be running from an existing shim, in which case it's -- simply reused. setup :: FilePath -> Maybe FilePath -> FilePath -> IO FilePath -setup propellorbin propellorbinpath dest = checkAlreadyShimmed shim $ do +setup propellorbin propellorbinpath dest = checkAlreadyShimmed propellorbin $ do createDirectoryIfMissing True dest + -- Remove all old libraries inside dest, but do not delete the + -- directory itself, since it may be bind-mounted inside a chroot. + mapM_ nukeFile =<< dirContentsRecursive dest + libs <- parseLdd <$> readProcess "ldd" [propellorbin] glibclibs <- glibcLibs let libs' = nub $ libs ++ glibclibs |
