summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-12-04 17:01:43 -0400
committerJoey Hess2014-12-04 17:01:43 -0400
commitc57a42388366f4e0bb6195ec4d957f8bc8ebad6e (patch)
treee873f32cd2f0e9293312076c1d4e6c7aaf325a99
parent61766ff027ffaad3e816c7cda20284f87e16478b (diff)
propellor spin
-rw-r--r--src/Propellor/Property/OS.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Propellor/Property/OS.hs b/src/Propellor/Property/OS.hs
index 8b221b95..603e4593 100644
--- a/src/Propellor/Property/OS.hs
+++ b/src/Propellor/Property/OS.hs
@@ -76,7 +76,7 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $
Debootstrap.built newOSDir targetos Debootstrap.DefaultConfig
umountall = property "mount points unmounted" $ liftIO $ do
- mnts <- filter (`notElem` ["/", "/proc"]) <$> mountPoints
+ mnts <- filter (`notElem` ("/": trickydirs)) <$> mountPoints
-- reverse so that deeper mount points come first
forM_ (reverse mnts) umountLazy
return $ if null mnts then NoChange else MadeChange
@@ -85,7 +85,7 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $
createDirectoryIfMissing True oldOSDir
rootcontents <- dirContents "/"
forM_ rootcontents $ \d ->
- when (d `notElem` [oldOSDir, newOSDir, "/proc"]) $
+ when (d `notElem` (oldOSDir:newOSDir:trickydirs)) $
renameDirectory d (oldOSDir ++ d)
newrootcontents <- dirContents newOSDir
forM_ newrootcontents $ \d -> do
@@ -95,6 +95,14 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $
removeDirectory newOSDir
return MadeChange
+ trickydirs =
+ -- /tmp can contain X's sockets, which prevent moving it
+ -- so it's left as-is.
+ [ "/tmp"
+ -- /proc is left mounted
+ , "/proc"
+ ]
+
propellorbootstrapped = property "propellor re-debootstrapped in new os" $
return NoChange
-- re-bootstrap propellor in /usr/local/propellor,