diff mbox series

[2/3] cpupower: do not call systemctl at install time

Message ID 20250513163937.61062-4-invernomuto@paranoici.org
State New
Headers show
Series None | expand

Commit Message

Francesco Poli (wintermute) May 13, 2025, 4:29 p.m. UTC
Fix the installation procedure for the systemd service unit
'cpupower.service'. Do not call "systemctl daemon-reload" in the
Makefile, but explain when this command should be manually issued
in the README file.

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

Fixes: 9c70b779ad91 ("cpupower: add a systemd service to run cpupower")

Signed-off-by: Francesco Poli (wintermute) <invernomuto@paranoici.org>
---
 tools/power/cpupower/Makefile |  2 --
 tools/power/cpupower/README   | 19 ++++++++++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 4ad931509eaa..7cec2c30f98a 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -312,7 +312,6 @@  install-tools: $(OUTPUT)cpupower
 	$(INSTALL) -d $(DESTDIR)${libdir}/systemd/system
 	sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
 	$(SETPERM_DATA) '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
-	if test -d /run/systemd/system; then systemctl daemon-reload; fi
 
 install-man:
 	$(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1
@@ -360,7 +359,6 @@  uninstall:
 	- for HLANG in $(LANGUAGES); do \
 		rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \
 	  done;
-	- if test -d /run/systemd/system; then systemctl daemon-reload; fi
 
 help:
 	@echo  'Building targets:'
diff --git a/tools/power/cpupower/README b/tools/power/cpupower/README
index e6ae7c1e0a0d..494104de1540 100644
--- a/tools/power/cpupower/README
+++ b/tools/power/cpupower/README
@@ -59,7 +59,7 @@  $ sudo make install
 -----------------------------------------------------------------------
 | man pages              | /usr/man                                   |
 -----------------------------------------------------------------------
-| systemd service        | /usr/lib                                   |
+| systemd service        | /usr/lib/systemd/system                    |
 -----------------------------------------------------------------------
 | systemd support script | /usr/libexec                               |
 -----------------------------------------------------------------------
@@ -113,7 +113,7 @@  The files will be installed to the following dirs:
 -----------------------------------------------------------------------
 | man pages              | ${DESTDIR}/usr/man                         |
 -----------------------------------------------------------------------
-| systemd service        | ${DESTDIR}/usr/lib                         |
+| systemd service        | ${DESTDIR}/usr/lib/systemd/system          |
 -----------------------------------------------------------------------
 | systemd support script | ${DESTDIR}/usr/libexec                     |
 -----------------------------------------------------------------------
@@ -185,11 +185,20 @@  systemd service
 ---------------
 
 A systemd service is also provided to run the cpupower utility at boot with
-settings read from a configuration file. In order to enable this systemd
-service, edit '${DESTDIR}/etc/default/cpupower' (uncommenting at least one of
-the options, depending on your preferences) and then issue the following
+settings read from a configuration file.
+
+If you want systemd to find the new service after the installation, the service
+unit must have been installed in one of the system unit search path directories
+(such as '/usr/lib/systemd/system/', which is the default location) and (unless
+you are willing to wait for the next reboot) you need to issue the following
 command:
 
+$ sudo systemctl daemon-reload
+
+If you want to enable this systemd service, edit
+'${DESTDIR}/etc/default/cpupower' (uncommenting at least one of the options,
+depending on your preferences) and then issue the following command:
+
 $ sudo systemctl enable --now cpupower.service