From c57a42388366f4e0bb6195ec4d957f8bc8ebad6e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 4 Dec 2014 17:01:43 -0400 Subject: [PATCH] propellor spin --- src/Propellor/Property/OS.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Property/OS.hs b/src/Propellor/Property/OS.hs index 8b221b9..603e459 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,