Skip to content

Commit e517436

Browse files
frx-wintermuteshuahkh
authored andcommitted
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: 9c70b77 ("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>
1 parent 4edef85 commit e517436

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

tools/power/cpupower/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ install-tools: $(OUTPUT)cpupower
305305
$(INSTALL_PROGRAM) $(OUTPUT)cpupower $(DESTDIR)${bindir}
306306
$(INSTALL) -d $(DESTDIR)${bash_completion_dir}
307307
$(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}'
310310
$(INSTALL) -d $(DESTDIR)${libexecdir}
311311
$(INSTALL_PROGRAM) cpupower.sh '$(DESTDIR)${libexecdir}/cpupower'
312312
$(INSTALL) -d $(DESTDIR)${libdir}/systemd/system
@@ -346,7 +346,7 @@ uninstall:
346346
- rm -f $(DESTDIR)${includedir}/cpufreq.h
347347
- rm -f $(DESTDIR)${includedir}/cpuidle.h
348348
- rm -f $(DESTDIR)${bindir}/utils/cpupower
349-
- rm -f $(DESTDIR)${confdir}default/cpupower
349+
- rm -f $(DESTDIR)${confdir}cpupower-service.conf
350350
- rm -f $(DESTDIR)${libexecdir}/cpupower
351351
- rm -f $(DESTDIR)${libdir}/systemd/system/cpupower.service
352352
- rm -f $(DESTDIR)${mandir}/man1/cpupower.1

tools/power/cpupower/README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ command:
195195

196196
$ sudo systemctl daemon-reload
197197

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:
201201

202202
$ sudo systemctl enable --now cpupower.service
203203

tools/power/cpupower/cpupower.default renamed to tools/power/cpupower/cpupower-service.conf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
# Copyright (C) 2012, Sébastien Luttringer
33
# Copyright (C) 2024-2025, Francesco Poli <invernomuto@paranoici.org>
44

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.
610

711
# --- CPU clock frequency ---
812

@@ -15,14 +19,14 @@
1519
#MIN_FREQ="2.25GHz"
1620
#MAX_FREQ="3GHz"
1721

18-
# Specific frequency to be set.
22+
# Set a specific frequency
1923
# Requires userspace governor to be available.
2024
# If this option is set, all the previous frequency options are ignored
2125
#FREQ=
2226

2327
# --- CPU policy ---
2428

25-
# Sets a register on supported Intel processore which allows software to convey
29+
# Set a register on supported Intel processore which allows software to convey
2630
# its policy for the relative importance of performance versus energy savings to
2731
# the processor. See man CPUPOWER-SET(1) for additional details
2832
#PERF_BIAS=

tools/power/cpupower/cpupower.service.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
22
# 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>
44

55
[Unit]
66
Description=Apply cpupower configuration
77
ConditionVirtualization=!container
88

99
[Service]
1010
Type=oneshot
11-
EnvironmentFile=-___CDIR___default/cpupower
11+
EnvironmentFile=-___CDIR___cpupower-service.conf
1212
ExecStart=___LDIR___/cpupower
1313
RemainAfterExit=yes
1414

0 commit comments

Comments
 (0)