summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Reboot.hs
diff options
context:
space:
mode:
authorSean Whitton2016-06-12 09:54:04 +0900
committerSean Whitton2016-06-12 09:54:04 +0900
commitff1fc058c230ad0cf34d1faf3acfd5c64682e278 (patch)
tree5cfbba54ea8aa8bdaf0015ebdfa5e98c595278a0 /src/Propellor/Property/Reboot.hs
parente20599639212ca6223f94a88dbff6641ed54234f (diff)
toKernelNewerThan skeleton
Diffstat (limited to 'src/Propellor/Property/Reboot.hs')
-rw-r--r--src/Propellor/Property/Reboot.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Propellor/Property/Reboot.hs b/src/Propellor/Property/Reboot.hs
index b1d76613..78c253d2 100644
--- a/src/Propellor/Property/Reboot.hs
+++ b/src/Propellor/Property/Reboot.hs
@@ -2,12 +2,15 @@ module Propellor.Property.Reboot (
now,
atEnd,
toDistroKernel,
+ toKernelNewerThan,
) where
import Propellor.Base
import Data.List
+data Version = String
+
now :: Property Linux
now = tightenTargets $ cmdProperty "reboot" []
`assume` MadeChange
@@ -45,6 +48,15 @@ toDistroKernel :: Property DebianLike
toDistroKernel = check (not <$> runningInstalledKernel) now
`describe` "running installed kernel"
+-- | Given a kernel version string @v@, reboots immediately if the running
+-- kernel version is strictly less than @v@ and the installed kernel version is
+-- greater than or equal to @v@
+--
+-- This is useful when upgrading to a new version of Debian where you need to
+-- ensure that a new enough kernel is running before ensuring other properties.
+toKernelNewerThan :: Version -> Property DebianLike
+toKernelNewerThan v = undefined
+
runningInstalledKernel :: IO Bool
runningInstalledKernel = do
kernelver <- takeWhile (/= '\n') <$> readProcess "uname" ["-r"]