diff options
| author | Joey Hess <joeyh@joeyh.name> | 2018-02-01 12:19:09 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2018-02-01 12:19:09 -0400 |
| commit | 141cf24148a1258a94f95ba1a6b2265070675d30 (patch) | |
| tree | bb05015fa75a61b1ed3dece3d32e87cb40d00c95 | |
| parent | 121c20726cebf3657b0b5d22d220cbdc7aa1aac4 (diff) | |
Laptop: New module, starting with powertopAutoTuneOnBoot.
This commit was sponsored by Brock Spratlen on Patreon.
| -rw-r--r-- | debian/changelog | 1 | ||||
| -rw-r--r-- | joeyconfig.hs | 5 | ||||
| -rw-r--r-- | propellor.cabal | 1 | ||||
| -rw-r--r-- | src/Propellor/Property/Laptop.hs | 28 |
4 files changed, 33 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 7dc8c42a..23172a22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ propellor (5.3.0) UNRELEASED; urgency=medium * Run su with --login, to avoid inheriting some problematic environment variables, such as TMP, from the caller. * Grub: Added properties to configure /etc/default/grub. + * Laptop: New module, starting with powertopAutoTuneOnBoot. -- Joey Hess <id@joeyh.name> Tue, 02 Jan 2018 13:06:45 -0400 diff --git a/joeyconfig.hs b/joeyconfig.hs index 3d895e69..1d019498 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -33,6 +33,7 @@ import qualified Propellor.Property.Gpg as Gpg import qualified Propellor.Property.Systemd as Systemd import qualified Propellor.Property.Journald as Journald import qualified Propellor.Property.Fail2Ban as Fail2Ban +import qualified Propellor.Property.Laptop as Laptop import qualified Propellor.Property.OS as OS import qualified Propellor.Property.HostingProvider.CloudAtCost as CloudAtCost import qualified Propellor.Property.HostingProvider.Linode as Linode @@ -89,9 +90,9 @@ darkstar = host "darkstar.kitenet.net" $ props & ipv6 "2001:4830:1600:187::2" & Hostname.sane & Apt.serviceInstalledRunning "swapspace" - ! Grub.cmdline_Linux_default "quiet" - -- Power consumption tuning + & Laptop.powertopAutoTuneOnBoot & Grub.cmdline_Linux_default "i915.enable_psr=1" + ! Grub.cmdline_Linux_default "quiet" & JoeySites.dkimMilter & JoeySites.postfixSaslPasswordClient diff --git a/propellor.cabal b/propellor.cabal index a76d63f0..e59a55a4 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -127,6 +127,7 @@ Library Propellor.Property.Journald Propellor.Property.Kerberos Propellor.Property.LetsEncrypt + Propellor.Property.Laptop Propellor.Property.List Propellor.Property.LightDM Propellor.Property.Locale 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" |
