Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpupower: do not install files to /etc/default/

Improve the installation procedure for the systemd service unit
'cpupower.service', to be more distro-agnostic. Do not install the
service unit configuration file to /etc/default/ (a directory that
is used by Debian and Debian-derivatives and only rarely by other
distros).

Also, clarify the role of the configuration file in its own comments.

Link: https://lore.kernel.org/linux-pm/20250509002206.bd2519ba52035d47c3c32aa6@paranoici.org/T/#ma8a3fa80acc4036af6c754e8ecabacc55b288ad1

Link: https://lore.kernel.org/r/20250513163937.61062-5-invernomuto@paranoici.org
Fixes: 9c70b779ad91 ("cpupower: add a systemd service to run cpupower")
Signed-off-by: Francesco Poli (wintermute) <invernomuto@paranoici.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Francesco Poli (wintermute) and committed by
Shuah Khan
e5174365 4edef850

+15 -11
+3 -3
tools/power/cpupower/Makefile
··· 305 305 $(INSTALL_PROGRAM) $(OUTPUT)cpupower $(DESTDIR)${bindir} 306 306 $(INSTALL) -d $(DESTDIR)${bash_completion_dir} 307 307 $(INSTALL_SCRIPT) cpupower-completion.sh '$(DESTDIR)${bash_completion_dir}/cpupower' 308 - $(INSTALL) -d $(DESTDIR)${confdir}default 309 - $(INSTALL_DATA) cpupower.default '$(DESTDIR)${confdir}default/cpupower' 308 + $(INSTALL) -d $(DESTDIR)${confdir} 309 + $(INSTALL_DATA) cpupower-service.conf '$(DESTDIR)${confdir}' 310 310 $(INSTALL) -d $(DESTDIR)${libexecdir} 311 311 $(INSTALL_PROGRAM) cpupower.sh '$(DESTDIR)${libexecdir}/cpupower' 312 312 $(INSTALL) -d $(DESTDIR)${libdir}/systemd/system ··· 346 346 - rm -f $(DESTDIR)${includedir}/cpufreq.h 347 347 - rm -f $(DESTDIR)${includedir}/cpuidle.h 348 348 - rm -f $(DESTDIR)${bindir}/utils/cpupower 349 - - rm -f $(DESTDIR)${confdir}default/cpupower 349 + - rm -f $(DESTDIR)${confdir}cpupower-service.conf 350 350 - rm -f $(DESTDIR)${libexecdir}/cpupower 351 351 - rm -f $(DESTDIR)${libdir}/systemd/system/cpupower.service 352 352 - rm -f $(DESTDIR)${mandir}/man1/cpupower.1
+3 -3
tools/power/cpupower/README
··· 195 195 196 196 $ sudo systemctl daemon-reload 197 197 198 - If you want to enable this systemd service, edit 199 - '${DESTDIR}/etc/default/cpupower' (uncommenting at least one of the options, 200 - depending on your preferences) and then issue the following command: 198 + If you want to enable this systemd service, edit '/etc/cpupower-service.conf' 199 + (uncommenting at least one of the options, depending on your preferences) 200 + and then issue the following command: 201 201 202 202 $ sudo systemctl enable --now cpupower.service 203 203
+7 -3
tools/power/cpupower/cpupower.default tools/power/cpupower/cpupower-service.conf
··· 2 2 # Copyright (C) 2012, Sébastien Luttringer 3 3 # Copyright (C) 2024-2025, Francesco Poli <invernomuto@paranoici.org> 4 4 5 - # Default file for linux-cpupower 5 + # Configuration file for cpupower.service systemd service unit 6 + # 7 + # Edit this file (uncommenting at least one of the options, depending on 8 + # your preferences) and then enable cpupower.service, if you want cpupower 9 + # to run at boot with these settings. 6 10 7 11 # --- CPU clock frequency --- 8 12 ··· 19 15 #MIN_FREQ="2.25GHz" 20 16 #MAX_FREQ="3GHz" 21 17 22 - # Specific frequency to be set. 18 + # Set a specific frequency 23 19 # Requires userspace governor to be available. 24 20 # If this option is set, all the previous frequency options are ignored 25 21 #FREQ= 26 22 27 23 # --- CPU policy --- 28 24 29 - # Sets a register on supported Intel processore which allows software to convey 25 + # Set a register on supported Intel processore which allows software to convey 30 26 # its policy for the relative importance of performance versus energy savings to 31 27 # the processor. See man CPUPOWER-SET(1) for additional details 32 28 #PERF_BIAS=
+2 -2
tools/power/cpupower/cpupower.service.in
··· 1 1 # SPDX-License-Identifier: GPL-2.0-or-later 2 2 # Copyright (C) 2012-2020, Sébastien Luttringer 3 - # Copyright (C) 2024, Francesco Poli <invernomuto@paranoici.org> 3 + # Copyright (C) 2024-2025, Francesco Poli <invernomuto@paranoici.org> 4 4 5 5 [Unit] 6 6 Description=Apply cpupower configuration ··· 8 8 9 9 [Service] 10 10 Type=oneshot 11 - EnvironmentFile=-___CDIR___default/cpupower 11 + EnvironmentFile=-___CDIR___cpupower-service.conf 12 12 ExecStart=___LDIR___/cpupower 13 13 RemainAfterExit=yes 14 14