summaryrefslogtreecommitdiff
path: root/src/Propellor/Shim.hs
diff options
context:
space:
mode:
authorJoey Hess2018-05-03 12:25:48 -0400
committerJoey Hess2018-05-03 12:25:48 -0400
commit8f4a01225dbaf4d3f68ad0d94edab3f7650250ad (patch)
treef08f8e3e79e813ba132c7195a62868ba17e829a6 /src/Propellor/Shim.hs
parent543aa510790b7b91c0c7dfc13fe41d8c80bc1f77 (diff)
parent94653981cab8a9e0640a8ce3eee54a186479c1e5 (diff)
Merge branch 'master' into joeyconfig
Diffstat (limited to 'src/Propellor/Shim.hs')
-rw-r--r--src/Propellor/Shim.hs9
1 files changed, 8 insertions, 1 deletions
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