module Propellor.Property.Reboot where
import Propellor
import Utility.SafeCommand
now :: Property
now = cmdProperty "reboot" []
`describe` "reboot now"
atEnd :: Bool -> (Result -> Bool) -> Property
atEnd force resultok = property "scheduled reboot at end of propellor run" $ do
endAction "rebooting" atend
return NoChange
where
atend r
| resultok r = liftIO $ toResult
<$> boolSystem "reboot" rebootparams
| otherwise = do
warningMessage "Not rebooting, due to status of propellor run."
return FailedChange
rebootparams
| force = [Param "--force"]
| otherwise = []