From d796284d8bb483a89bf3d65d198a890a62090d96 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 Nov 2015 15:06:35 -0400 Subject: Added Chroot.noServices property. --- debian/changelog | 1 + 1 file changed, 1 insertion(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 043848c5..b27ab8b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ propellor (2.13.1) UNRELEASED; urgency=medium * Add Propellor.Property.PropellorRepo.hasOriginUrl, an explicit way to set the git repository url normally implicitly set when using --spin. + * Added Chroot.noServices property. -- Joey Hess Wed, 11 Nov 2015 13:37:00 -0400 -- cgit v1.3-2-g0d8e From b75db5ae653b7b87859e582528df9b03aa5366f1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 Nov 2015 15:22:29 -0400 Subject: DiskImage creation automatically uses Chroot.noServices. --- debian/changelog | 1 + src/Propellor/Property/Chroot.hs | 6 ++++-- src/Propellor/Property/DiskImage.hs | 13 +++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index b27ab8b2..320aff96 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ propellor (2.13.1) UNRELEASED; urgency=medium * Add Propellor.Property.PropellorRepo.hasOriginUrl, an explicit way to set the git repository url normally implicitly set when using --spin. * Added Chroot.noServices property. + * DiskImage creation automatically uses Chroot.noServices. -- Joey Hess Wed, 11 Nov 2015 13:37:00 -0400 diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs index a763a56b..30c11ed3 100644 --- a/src/Propellor/Property/Chroot.hs +++ b/src/Propellor/Property/Chroot.hs @@ -261,8 +261,10 @@ noServices = setup teardown where f = "/usr/sbin/policy-rc.d" script = [ "#!/bin/sh", "exit 101" ] - setup = File.mode f (combineModes (readModes ++ executeModes)) - `requires` File.hasContent f script + setup = combineProperties "no services started" + [ File.hasContent f script + , File.mode f (combineModes (readModes ++ executeModes)) + ] teardown = File.notPresent f -- | Check if propellor is currently running within a chroot. diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 5b8619ba..4878c365 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -1,8 +1,6 @@ -- | Disk image generation. -- -- This module is designed to be imported unqualified. --- --- TODO avoid starting services while populating chroot and running final module Propellor.Property.DiskImage ( -- * Partition specification @@ -69,6 +67,11 @@ type DiskImage = FilePath -- 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. +-- +-- Note that the `Chroot.noServices` property is automatically added to the +-- chroot while the disk image is being built, which should prevent any +-- daemons that are included from being started on the system that is +-- building the disk image. imageBuilt :: DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty HasInfo imageBuilt = imageBuilt' False @@ -93,6 +96,9 @@ imageBuilt' rebuild img mkchroot tabletype final partspec = | otherwise = doNothing chrootdir = img ++ ".chroot" chroot = mkchroot chrootdir + -- Before ensuring any other properties of the chroot, avoid + -- starting services. Reverted by imageFinalized. + &^ Chroot.noServices -- First stage finalization. & fst final -- Avoid wasting disk image space on the apt cache @@ -227,6 +233,7 @@ imageFinalized (_, final) mnts mntopts devs (PartTable _ parts) = go top = do liftIO $ mountall top liftIO $ writefstab top + liftIO $ allowservices top ensureProperty $ final top devs -- Ordered lexographically by mount point, so / comes before /usr @@ -260,6 +267,8 @@ imageFinalized (_, final) mnts mntopts devs (PartTable _ parts) = -- Eg "UNCONFIGURED FSTAB FOR BASE SYSTEM" unconfigured s = "UNCONFIGURED" `isInfixOf` s + allowservices top = nukeFile (top ++ "/usr/sbin/policy-rc.d") + noFinalization :: Finalization noFinalization = (doNothing, \_ _ -> doNothing) -- cgit v1.3-2-g0d8e From 9ad0f07358df3d87a5d05e9f44131da79cfe266e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 Nov 2015 15:51:12 -0400 Subject: Removed the (unused) dependency on quickcheck. --- debian/changelog | 1 + debian/control | 2 -- propellor.cabal | 7 +++--- src/Propellor/Bootstrap.hs | 1 - src/Utility/QuickCheck.hs | 53 ---------------------------------------------- src/Utility/Scheduled.hs | 37 -------------------------------- 6 files changed, 4 insertions(+), 97 deletions(-) delete mode 100644 src/Utility/QuickCheck.hs (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 320aff96..a117e1d3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ propellor (2.13.1) UNRELEASED; urgency=medium set the git repository url normally implicitly set when using --spin. * Added Chroot.noServices property. * DiskImage creation automatically uses Chroot.noServices. + * Removed the (unused) dependency on quickcheck. -- Joey Hess Wed, 11 Nov 2015 13:37:00 -0400 diff --git a/debian/control b/debian/control index 1a7909a3..757462d1 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,6 @@ Build-Depends: libghc-ansi-terminal-dev, libghc-ifelse-dev, libghc-network-dev, - libghc-quickcheck2-dev, libghc-mtl-dev, libghc-transformers-dev, libghc-exceptions-dev (>= 0.6), @@ -37,7 +36,6 @@ Depends: ${misc:Depends}, ${shlibs:Depends}, libghc-ansi-terminal-dev, libghc-ifelse-dev, libghc-network-dev, - libghc-quickcheck2-dev, libghc-mtl-dev, libghc-transformers-dev, libghc-exceptions-dev (>= 0.6), diff --git a/propellor.cabal b/propellor.cabal index ee3a4f70..0a27acb2 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -38,7 +38,7 @@ Executable propellor Hs-Source-Dirs: src Build-Depends: MissingH, directory, filepath, base >= 4.5, base < 5, IfElse, process, bytestring, hslogger, unix-compat, ansi-terminal, - containers (>= 0.5), network, async, time, QuickCheck, mtl, transformers, + containers (>= 0.5), network, async, time, mtl, transformers, exceptions (>= 0.6), stm, text, unix Executable propellor-config @@ -47,7 +47,7 @@ Executable propellor-config Hs-Source-Dirs: src Build-Depends: MissingH, directory, filepath, base >= 4.5, base < 5, IfElse, process, bytestring, hslogger, unix-compat, ansi-terminal, - containers (>= 0.5), network, async, time, QuickCheck, mtl, transformers, + containers (>= 0.5), network, async, time, mtl, transformers, exceptions (>= 0.6), stm, text, unix Library @@ -55,7 +55,7 @@ Library Hs-Source-Dirs: src Build-Depends: MissingH, directory, filepath, base >= 4.5, base < 5, IfElse, process, bytestring, hslogger, unix-compat, ansi-terminal, - containers (>= 0.5), network, async, time, QuickCheck, mtl, transformers, + containers (>= 0.5), network, async, time, mtl, transformers, exceptions (>= 0.6), stm, text, unix Exposed-Modules: @@ -175,7 +175,6 @@ Library Utility.ThreadScheduler Utility.Tmp Utility.UserInfo - Utility.QuickCheck System.Console.Concurrent System.Console.Concurrent.Internal System.Process.Concurrent diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs index 21772b34..f2f5af55 100644 --- a/src/Propellor/Bootstrap.hs +++ b/src/Propellor/Bootstrap.hs @@ -77,7 +77,6 @@ depsCommand = "( " ++ intercalate " ; " (concat [osinstall, cabalinstall]) ++ " , "libghc-ansi-terminal-dev" , "libghc-ifelse-dev" , "libghc-network-dev" - , "libghc-quickcheck2-dev" , "libghc-mtl-dev" , "libghc-transformers-dev" , "libghc-exceptions-dev" diff --git a/src/Utility/QuickCheck.hs b/src/Utility/QuickCheck.hs deleted file mode 100644 index cd408ddc..00000000 --- a/src/Utility/QuickCheck.hs +++ /dev/null @@ -1,53 +0,0 @@ -{- QuickCheck with additional instances - - - - Copyright 2012-2014 Joey Hess - - - - License: BSD-2-clause - -} - -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-# LANGUAGE TypeSynonymInstances #-} - -module Utility.QuickCheck - ( module X - , module Utility.QuickCheck - ) where - -import Test.QuickCheck as X -import Data.Time.Clock.POSIX -import System.Posix.Types -import qualified Data.Map as M -import qualified Data.Set as S -import Control.Applicative -import Prelude - -instance (Arbitrary k, Arbitrary v, Eq k, Ord k) => Arbitrary (M.Map k v) where - arbitrary = M.fromList <$> arbitrary - -instance (Arbitrary v, Eq v, Ord v) => Arbitrary (S.Set v) where - arbitrary = S.fromList <$> arbitrary - -{- Times before the epoch are excluded. -} -instance Arbitrary POSIXTime where - arbitrary = fromInteger <$> nonNegative arbitrarySizedIntegral - -instance Arbitrary EpochTime where - arbitrary = fromInteger <$> nonNegative arbitrarySizedIntegral - -{- Pids are never negative, or 0. -} -instance Arbitrary ProcessID where - arbitrary = arbitrarySizedBoundedIntegral `suchThat` (> 0) - -{- Inodes are never negative. -} -instance Arbitrary FileID where - arbitrary = nonNegative arbitrarySizedIntegral - -{- File sizes are never negative. -} -instance Arbitrary FileOffset where - arbitrary = nonNegative arbitrarySizedIntegral - -nonNegative :: (Num a, Ord a) => Gen a -> Gen a -nonNegative g = g `suchThat` (>= 0) - -positive :: (Num a, Ord a) => Gen a -> Gen a -positive g = g `suchThat` (> 0) diff --git a/src/Utility/Scheduled.hs b/src/Utility/Scheduled.hs index 5e813d4a..ead8f771 100644 --- a/src/Utility/Scheduled.hs +++ b/src/Utility/Scheduled.hs @@ -23,12 +23,10 @@ module Utility.Scheduled ( toRecurrance, toSchedule, parseSchedule, - prop_schedule_roundtrips, prop_past_sane, ) where import Utility.Data -import Utility.QuickCheck import Utility.PartialPrelude import Utility.Misc @@ -337,41 +335,6 @@ parseSchedule s = do recurrance = unwords rws scheduledtime = unwords tws -instance Arbitrary Schedule where - arbitrary = Schedule <$> arbitrary <*> arbitrary - -instance Arbitrary ScheduledTime where - arbitrary = oneof - [ pure AnyTime - , SpecificTime - <$> choose (0, 23) - <*> choose (1, 59) - ] - -instance Arbitrary Recurrance where - arbitrary = oneof - [ pure Daily - , Weekly <$> arbday - , Monthly <$> arbday - , Yearly <$> arbday - , Divisible - <$> positive arbitrary - <*> oneof -- no nested Divisibles - [ pure Daily - , Weekly <$> arbday - , Monthly <$> arbday - , Yearly <$> arbday - ] - ] - where - arbday = oneof - [ Just <$> nonNegative arbitrary - , pure Nothing - ] - -prop_schedule_roundtrips :: Schedule -> Bool -prop_schedule_roundtrips s = toSchedule (fromSchedule s) == Just s - prop_past_sane :: Bool prop_past_sane = and [ all (checksout oneMonthPast) (mplus1 ++ yplus1) -- cgit v1.3-2-g0d8e From 5a228385a648219a2a38dcec80da2f86f0b25cb7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 20 Nov 2015 11:07:46 -0400 Subject: changelog --- debian/changelog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index a117e1d3..c39ef219 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,12 @@ -propellor (2.13.1) UNRELEASED; urgency=medium +propellor (2.14.0) UNRELEASED; urgency=medium * Add Propellor.Property.PropellorRepo.hasOriginUrl, an explicit way to set the git repository url normally implicitly set when using --spin. * Added Chroot.noServices property. * DiskImage creation automatically uses Chroot.noServices. * Removed the (unused) dependency on quickcheck. + * DebianMirror: Added a new [RsyncExtra] parameter. (minor API change) + Thanks, Félix Sipma. -- Joey Hess Wed, 11 Nov 2015 13:37:00 -0400 -- cgit v1.3-2-g0d8e From dd5ffce2b68ac0b4e306682e8511f13974948e39 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 21 Nov 2015 13:21:51 -0400 Subject: changelog --- debian/changelog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index c39ef219..4cfa3657 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,9 @@ propellor (2.14.0) UNRELEASED; urgency=medium * Added Chroot.noServices property. * DiskImage creation automatically uses Chroot.noServices. * Removed the (unused) dependency on quickcheck. - * DebianMirror: Added a new [RsyncExtra] parameter. (minor API change) + * DebianMirror: Added a DebianMirror type for configuration (API change) + Thanks, Félix Sipma. + * DebianMirror: Add RsyncExtra to configuration. Thanks, Félix Sipma. -- Joey Hess Wed, 11 Nov 2015 13:37:00 -0400 -- cgit v1.3-2-g0d8e