diff options
| author | Joey Hess <id@joeyh.name> | 2014-12-04 16:54:04 -0400 |
|---|---|---|
| committer | Joey Hess <id@joeyh.name> | 2014-12-04 16:54:04 -0400 |
| commit | 31cf8e0c24ff25a14ce750bbb1491436c55f07e0 (patch) | |
| tree | e35b07465d6b9b5cdcec0d8d47dd51cc4b8d4831 /src | |
| parent | bf4840f341c83f28a53cf80fd7750a661e734d65 (diff) | |
propellor spin
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/OS.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Propellor/Property/OS.hs b/src/Propellor/Property/OS.hs index aa304f61..2888800e 100644 --- a/src/Propellor/Property/OS.hs +++ b/src/Propellor/Property/OS.hs @@ -75,8 +75,8 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $ debootstrap targetos = ensureProperty $ toProp $ Debootstrap.built newOSDir targetos Debootstrap.DefaultConfig - umountall = property "all mount points unmounted" $ liftIO $ do - mnts <- filter (/= "/") <$> mountPoints + umountall = property "mount points unmounted" $ liftIO $ do + mnts <- filter (`notElem` ["/", "/proc"]) <$> mountPoints forM_ mnts umountLazy return $ if null mnts then NoChange else MadeChange @@ -84,11 +84,13 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $ createDirectoryIfMissing True oldOSDir rootcontents <- dirContents "/" forM_ rootcontents $ \d -> - when (d /= oldOSDir && d /= newOSDir) $ + when (d `notElem` [oldOSDir, newOSDir, "/proc"]) $ renameDirectory d (oldOSDir ++ d) newrootcontents <- dirContents newOSDir - forM_ newrootcontents $ \d -> - renameDirectory d ("/" ++ takeFileName d) + forM_ newrootcontents $ \d -> do + let dest = "/" ++ takeFileName d + whenM (not <$> doesDirectoryExist dest) $ + renameDirectory d dest removeDirectory newOSDir return MadeChange |
