From ff1fc058c230ad0cf34d1faf3acfd5c64682e278 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 12 Jun 2016 09:54:04 +0900 Subject: toKernelNewerThan skeleton --- src/Propellor/Property/Reboot.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Propellor/Property') 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"] -- cgit v1.2.3