Skip to content

Commit e044b8a

Browse files
frx-wintermuteshuahkh
authored andcommitted
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/[email protected]/T/#m0601940ab439d5cbd288819d2af190ce59e810e6 Fixes: 9c70b77 ("cpupower: add a systemd service to run cpupower") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Francesco Poli (wintermute) <[email protected]> Tested-by: Thorsten Leemhuis <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 19272b3 commit e044b8a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/power/cpupower/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ sbindir ?= /usr/sbin
7373
mandir ?= /usr/man
7474
libdir ?= /usr/lib
7575
libexecdir ?= /usr/libexec
76+
unitdir ?= /usr/lib/systemd/system
7677
includedir ?= /usr/include
7778
localedir ?= /usr/share/locale
7879
docdir ?= /usr/share/doc/packages/cpupower
@@ -309,9 +310,9 @@ install-tools: $(OUTPUT)cpupower
309310
$(INSTALL_DATA) cpupower-service.conf '$(DESTDIR)${confdir}'
310311
$(INSTALL) -d $(DESTDIR)${libexecdir}
311312
$(INSTALL_PROGRAM) cpupower.sh '$(DESTDIR)${libexecdir}/cpupower'
312-
$(INSTALL) -d $(DESTDIR)${libdir}/systemd/system
313-
sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
314-
$(SETPERM_DATA) '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
313+
$(INSTALL) -d $(DESTDIR)${unitdir}
314+
sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${unitdir}/cpupower.service'
315+
$(SETPERM_DATA) '$(DESTDIR)${unitdir}/cpupower.service'
315316

316317
install-man:
317318
$(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1
@@ -348,7 +349,7 @@ uninstall:
348349
- rm -f $(DESTDIR)${bindir}/utils/cpupower
349350
- rm -f $(DESTDIR)${confdir}cpupower-service.conf
350351
- rm -f $(DESTDIR)${libexecdir}/cpupower
351-
- rm -f $(DESTDIR)${libdir}/systemd/system/cpupower.service
352+
- rm -f $(DESTDIR)${unitdir}/cpupower.service
352353
- rm -f $(DESTDIR)${mandir}/man1/cpupower.1
353354
- rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1
354355
- rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-info.1

0 commit comments

Comments
 (0)