summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton2016-06-19 20:45:49 +0900
committerSean Whitton2016-06-19 20:45:49 +0900
commit4f7ff2b1bd6d5e491fa306d6e58db593d4b202c9 (patch)
treedf2c6fa39a4023eab69c66dbe583f05e61349adc
parent3543f151201fcf10906716dca4ad470bda818295 (diff)
Sbuild.built conditionally reboots to new kernel
-rw-r--r--src/Propellor/Property/Sbuild.hs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs
index 28450f5a..5d58a84a 100644
--- a/src/Propellor/Property/Sbuild.hs
+++ b/src/Propellor/Property/Sbuild.hs
@@ -79,6 +79,8 @@ import qualified Propellor.Property.Ccache as Ccache
import qualified Propellor.Property.ConfFile as ConfFile
import qualified Propellor.Property.File as File
-- import qualified Propellor.Property.Firewall as Firewall
+import qualified Propellor.Property.Schroot as Schroot
+import qualified Propellor.Property.Reboot as Reboot
import qualified Propellor.Property.User as User
import Utility.FileMode
@@ -122,7 +124,8 @@ built s@(SbuildSchroot suite arch) mirror =
(go
`requires` keypairGenerated
`requires` ccachePrepared
- `requires` installed)
+ `requires` installed
+ `requires` overlaysKernel)
<!> deleted
where
go :: Property DebianLike
@@ -171,6 +174,21 @@ built s@(SbuildSchroot suite arch) mirror =
commandPrefix = File.containsLine (schrootConf s)
"command-prefix=/var/cache/ccache-sbuild/sbuild-setup,eatmydata"
+ -- If the user has indicated that this host should use
+ -- union-type=overlay schroots, we need to ensure that we have rebooted
+ -- to a kernel supporting OverlayFS before we execute
+ -- sbuild-setupchroot(1). Otherwise, sbuild-setupchroot(1) will fail to
+ -- add the union-type=overlay line to the schroot config.
+ -- (We could just add that line ourselves, but then sbuild wouldn't work
+ -- for the user, so we might as well do the reboot for them.)
+ overlaysKernel :: Property DebianLike
+ overlaysKernel = property' "reboot for union-type=overlay" $ \w ->
+ Schroot.usesOverlays >>= \usesOverlays ->
+ if usesOverlays
+ then ensureProperty w $
+ Reboot.toKernelNewerThan "3.18"
+ else noChange
+
-- A failed debootstrap run will leave a debootstrap directory;
-- recover by deleting it and trying again.
ispartial = ifM (doesDirectoryExist (schrootRoot s </> "debootstrap"))