From 8c812aeccc8979cf1dc426299e7b54b9eb076e16 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Jul 2017 16:39:58 -0400 Subject: clean up after merge --- config.hs | 2 +- privdata/relocate | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 privdata/relocate diff --git a/config.hs b/config.hs index 97d90636..ec313725 120000 --- a/config.hs +++ b/config.hs @@ -1 +1 @@ -joeyconfig.hs \ No newline at end of file +config-simple.hs \ No newline at end of file diff --git a/privdata/relocate b/privdata/relocate deleted file mode 100644 index 271692d8..00000000 --- a/privdata/relocate +++ /dev/null @@ -1 +0,0 @@ -.joeyconfig -- cgit v1.2.3 From acd436a2518977ffde07912bcb0829df7b9c37d4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Jul 2017 16:42:27 -0400 Subject: releasing package propellor version 4.5.0 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4a9775db..bc874b4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -propellor (4.5.0) UNRELEASED; urgency=medium +propellor (4.5.0) unstable; urgency=medium * Generalized the PartSpec DSL, so it can be used for both disk image partitioning, and disk device partitioning, with @@ -8,7 +8,7 @@ propellor (4.5.0) UNRELEASED; urgency=medium PartSpec DiskPart, and a useDiskSpace combinator. * Generate a better description for versioned properties. - -- Joey Hess Mon, 17 Jul 2017 16:51:11 -0400 + -- Joey Hess Fri, 21 Jul 2017 16:40:13 -0400 propellor (4.4.0) unstable; urgency=medium -- cgit v1.2.3 From 20dc9f103776c77e15a8aa756d816a6f54e45c90 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Jul 2017 16:42:44 -0400 Subject: add news item for propellor 4.5.0 --- doc/news/version_4.3.3.mdwn | 17 ----------------- doc/news/version_4.5.0.mdwn | 9 +++++++++ 2 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 doc/news/version_4.3.3.mdwn create mode 100644 doc/news/version_4.5.0.mdwn diff --git a/doc/news/version_4.3.3.mdwn b/doc/news/version_4.3.3.mdwn deleted file mode 100644 index b51ab5df..00000000 --- a/doc/news/version_4.3.3.mdwn +++ /dev/null @@ -1,17 +0,0 @@ -propellor 4.3.3 released with [[!toggle text="these changes"]] -[[!toggleable text=""" - * Hosts can be configured to build propellor using stack, by adding - a property: - & bootstrapWith (Robustly Stack) - * Hosts can be configured to build propellor using cabal, but using - only packages installed from the operating system. This - will work on eg Debian: - & bootstrapWith OSOnly - * Iproved fix for bug that sometimes made --spin fail with - "fatal: Couldn't find remote ref HEAD". The previous fix didn't work - reliably. - * User: add systemGroup and use it for systemAccountFor' - Thanks, Félix Sipma. - * Export a Restic.backup' property. - Thanks, Félix Sipma. - * Updated stack config to lts-8.22."""]] \ No newline at end of file diff --git a/doc/news/version_4.5.0.mdwn b/doc/news/version_4.5.0.mdwn new file mode 100644 index 00000000..d78a2618 --- /dev/null +++ b/doc/news/version_4.5.0.mdwn @@ -0,0 +1,9 @@ +propellor 4.5.0 released with [[!toggle text="these changes"]] +[[!toggleable text=""" + * Generalized the PartSpec DSL, so it can be used for both + disk image partitioning, and disk device partitioning, with + different partition sizing methods as appropriate for the different + uses. (minor API change) + * Propellor.Property.Parted: Added calcPartTable function which uses + PartSpec DiskPart, and a useDiskSpace combinator. + * Generate a better description for versioned properties."""]] \ No newline at end of file -- cgit v1.2.3 From e10ca0800469bcae1d208d2d4540e44b21ee1edf Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 22 Jul 2017 10:53:02 -0700 Subject: avoid one failure of Reboot.toKernelNewerThan when /boot not mounted If the running kernel is new enough, there is no need to look at the kernels installed on the system. --- src/Propellor/Property/Reboot.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Propellor/Property/Reboot.hs b/src/Propellor/Property/Reboot.hs index 3781cd7b..909d87fb 100644 --- a/src/Propellor/Property/Reboot.hs +++ b/src/Propellor/Property/Reboot.hs @@ -78,15 +78,16 @@ toKernelNewerThan ver = property' ("reboot to kernel newer than " ++ ver) $ \w -> do wantV <- tryReadVersion ver runningV <- tryReadVersion =<< liftIO runningKernelVersion - installedV <- maximum <$> - (mapM tryReadVersion =<< liftIO installedKernelVersions) if runningV >= wantV then noChange - else if installedV >= wantV - then ensureProperty w now - else errorMessage $ - "kernel newer than " - ++ ver - ++ " not installed" + else maximum <$> installedVs >>= \installedV -> + if installedV >= wantV + then ensureProperty w now + else errorMessage $ + "kernel newer than " + ++ ver + ++ " not installed" + where + installedVs = mapM tryReadVersion =<< liftIO installedKernelVersions runningInstalledKernel :: IO Bool runningInstalledKernel = do -- cgit v1.2.3 From ba41661be5c739519ba82608c8f781b7a8b84321 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 23 Jul 2017 09:42:55 -0400 Subject: Reboot.toKernelNewerThan: If running kernel is new enough, avoid looking at what kernels are installed. Thanks, Sean Whitton. --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index bc874b4b..c359ac2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +propellor (4.5.1) UNRELEASED; urgency=medium + + * Reboot.toKernelNewerThan: If running kernel is new enough, avoid + looking at what kernels are installed. + Thanks, Sean Whitton. + + -- Joey Hess Sun, 23 Jul 2017 09:41:58 -0400 + propellor (4.5.0) unstable; urgency=medium * Generalized the PartSpec DSL, so it can be used for both -- cgit v1.2.3 From f01286bc4338dcb3942b3870d7a6ea69ca773265 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 25 Jul 2017 15:13:57 -0400 Subject: DiskImage: Avoid re-partitioning disk image unncessarily, for a large speedup. This commit was sponsored by Anthony DeRobertis on Patreon. --- debian/changelog | 2 ++ src/Propellor/Property/DiskImage.hs | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index c359ac2b..d0b62bbf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ propellor (4.5.1) UNRELEASED; urgency=medium * Reboot.toKernelNewerThan: If running kernel is new enough, avoid looking at what kernels are installed. Thanks, Sean Whitton. + * DiskImage: Avoid re-partitioning disk image unncessarily, for a large + speedup. -- Joey Hess Sun, 23 Jul 2017 09:41:58 -0400 diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 4d10f300..332ad96a 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -174,9 +174,7 @@ imageBuiltFrom img chrootdir tabletype final partspec = mkimg rmimg let (mnts, mntopts, parttable) = fitChrootSize tabletype partspec $ map (calcsz mnts) mnts ensureProperty w $ - imageExists img (partTableSize parttable) - `before` - partitioned YesReallyDeleteDiskContents img parttable + imageSetup img parttable `before` kpartx img (mkimg' mnts mntopts parttable) mkimg' mnts mntopts parttable devs = @@ -273,6 +271,24 @@ imageExists img isz = property ("disk image exists" ++ img) $ liftIO $ do -- Common sector sizes are 512 and 4096; use 4096 as it's larger. sectorsize = 4096 :: Double +-- | Ensure that disk image file exists and is partitioned. +-- +-- Avoids repartitioning the disk image, when a file of the right size +-- already exists, and it has the same PartTable. +imageSetup :: FilePath -> PartTable -> Property DebianLike +imageSetup img parttable = property' ("disk image set up " ++ img) $ \w -> do + oldparttable <- liftIO $ catchDefaultIO "" $ readFile parttablefile + res <- ensureProperty w $ imageExists img (partTableSize parttable) + if res == NoChange && oldparttable == show parttable + then return NoChange + else if res == FailedChange + then return FailedChange + else do + liftIO $ writeFile parttablefile (show parttable) + ensureProperty w $ partitioned YesReallyDeleteDiskContents img parttable + where + parttablefile = img ++ ".parttable" + -- | A property that is run after the disk image is created, with -- its populated partition tree mounted in the provided -- location from the provided loop devices. This is typically used to -- cgit v1.2.3