From 141cf24148a1258a94f95ba1a6b2265070675d30 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 1 Feb 2018 12:19:09 -0400 Subject: Laptop: New module, starting with powertopAutoTuneOnBoot. This commit was sponsored by Brock Spratlen on Patreon. --- src/Propellor/Property/Laptop.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Propellor/Property/Laptop.hs (limited to 'src/Propellor/Property/Laptop.hs') diff --git a/src/Propellor/Property/Laptop.hs b/src/Propellor/Property/Laptop.hs new file mode 100644 index 00000000..a36bda18 --- /dev/null +++ b/src/Propellor/Property/Laptop.hs @@ -0,0 +1,28 @@ +module Propellor.Property.Laptop where + +import Propellor.Base +import qualified Propellor.Property.File as File +import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.Systemd as Systemd + +-- | Makes powertop auto-tune the system for optimal power consumption on +-- boot. +powertopAutoTuneOnBoot :: RevertableProperty DebianLike DebianLike +powertopAutoTuneOnBoot = setup undo + `describe` "powertop auto-tune on boot" + where + setup = Systemd.enabled "powertop" + `requires` Apt.installed ["powertop"] + `requires` File.hasContent servicefile + [ "[Unit]" + , "Description=Powertop tunings" + , "[Service]" + , "ExecStart=/usr/sbin/powertop --auto-tune" + , "RemainAfterExit=true" + , "[Install]" + , "WantedBy=multi-user.target" + ] + undo = tightenTargets $ File.notPresent servicefile + `requires` check (doesFileExist servicefile) + (Systemd.disabled "powertop") + servicefile = "/etc/systemd/system/powertop.service" -- cgit v1.2.3