diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-10-23 11:46:11 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-10-23 11:46:11 -0400 |
| commit | 83a07d5c56223fe31d64a691c9775b5d237a9f3f (patch) | |
| tree | e738ec7edd10b7bfd6677f8d7eec9850dbe3c5ef /src/Propellor/Property | |
| parent | 2e42b9db53ecf8cc33d92e2374e0d5ca24013a85 (diff) | |
propellor spin
Diffstat (limited to 'src/Propellor/Property')
| -rw-r--r-- | src/Propellor/Property/DiskImage.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index af8a020b..9da374c7 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -77,6 +77,10 @@ type DiskImage = FilePath -- > `addFreeSpace` MegaBytes 100 -- > , swapPartition (MegaBytes 256) -- > ] +-- +-- Note that the disk image file is reused if it already exists, +-- to avoid expensive IO to generate a new one. And, it's updated in-place, +-- so its contents are undefined during the build process. imageBuilt :: DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty imageBuilt = imageBuilt' False @@ -327,11 +331,12 @@ imageFinalized (_, final) mnts devs (PartTable _ parts) = umountLazy top writefstab top = do + let fstab = top ++ "/etc/fstab" old <- catchDefaultIO [] $ filter (not . unconfigured) . lines - <$> readFileStrict (top ++ "/etc/fstab") + <$> readFileStrict fstab new <- genFstab (map (top ++) (catMaybes mnts)) swaps (toSysDir top) - writeFile "/etc/fstab" $ unlines $ new ++ old + writeFile fstab $ unlines $ new ++ old -- Eg "UNCONFIGURED FSTAB FOR BASE SYSTEM" unconfigured s = "UNCONFIGURED" `isInfixOf` s |
