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

cpupower: split unitdir from libdir in Makefile

Improve the installation procedure for the systemd service unit
'cpupower.service', to be more flexible. Some distros install libraries
to /usr/lib64/, but systemd service units have to be installed to
/usr/lib/systemd/system: as a consequence, the installation procedure
should not assume that systemd service units can be installed to
${libdir}/systemd/system ...
Define a dedicated variable ("unitdir") in the Makefile.

Link: https://lore.kernel.org/linux-pm/260b6d79-ab61-43b7-a0eb-813e257bc028@leemhuis.info/T/#m0601940ab439d5cbd288819d2af190ce59e810e6

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

Link: https://lore.kernel.org/r/20250521211656.65646-1-invernomuto@paranoici.org
Signed-off-by: Francesco Poli (wintermute) <invernomuto@paranoici.org>
Tested-by: Thorsten Leemhuis <linux@leemhuis.info>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Francesco Poli (wintermute) and committed by
Shuah Khan
e044b8a9 19272b37

+5 -4
+5 -4
tools/power/cpupower/Makefile
··· 73 73 mandir ?= /usr/man 74 74 libdir ?= /usr/lib 75 75 libexecdir ?= /usr/libexec 76 + unitdir ?= /usr/lib/systemd/system 76 77 includedir ?= /usr/include 77 78 localedir ?= /usr/share/locale 78 79 docdir ?= /usr/share/doc/packages/cpupower ··· 310 309 $(INSTALL_DATA) cpupower-service.conf '$(DESTDIR)${confdir}' 311 310 $(INSTALL) -d $(DESTDIR)${libexecdir} 312 311 $(INSTALL_PROGRAM) cpupower.sh '$(DESTDIR)${libexecdir}/cpupower' 313 - $(INSTALL) -d $(DESTDIR)${libdir}/systemd/system 314 - sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${libdir}/systemd/system/cpupower.service' 315 - $(SETPERM_DATA) '$(DESTDIR)${libdir}/systemd/system/cpupower.service' 312 + $(INSTALL) -d $(DESTDIR)${unitdir} 313 + sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${unitdir}/cpupower.service' 314 + $(SETPERM_DATA) '$(DESTDIR)${unitdir}/cpupower.service' 316 315 317 316 install-man: 318 317 $(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1 ··· 349 348 - rm -f $(DESTDIR)${bindir}/utils/cpupower 350 349 - rm -f $(DESTDIR)${confdir}cpupower-service.conf 351 350 - rm -f $(DESTDIR)${libexecdir}/cpupower 352 - - rm -f $(DESTDIR)${libdir}/systemd/system/cpupower.service 351 + - rm -f $(DESTDIR)${unitdir}/cpupower.service 353 352 - rm -f $(DESTDIR)${mandir}/man1/cpupower.1 354 353 - rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1 355 354 - rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-info.1