Skip to content

Commit 7799ba2

Browse files
jmarcoscostashuahkh
authored andcommitted
cpupower: make systemd unit installation optional
cpupower currently installs a cpupower.service unit file into unitdir unconditionally, regardless of whether systemd is used by the host. Improve the installation procedure by making this systemd step optional: a 'SYSTEMD' build parameter that defaults to 'true' and can be set to 'false' to disable the installation of systemd's unit file. Since 'SYSTEMD' defaults to true, the current behavior is kept as the default. Link: https://lore.kernel.org/r/20260113132753.1730020-2-joaomarcos.costa@bootlin.com Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent ff72619 commit 7799ba2

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

tools/power/cpupower/Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,17 @@ endif
315315
$(INSTALL_DATA) lib/cpuidle.h $(DESTDIR)${includedir}/cpuidle.h
316316
$(INSTALL_DATA) lib/powercap.h $(DESTDIR)${includedir}/powercap.h
317317

318-
install-tools: $(OUTPUT)cpupower
318+
# SYSTEMD=false disables installation of the systemd unit file
319+
SYSTEMD ?= true
320+
321+
install-systemd:
322+
$(INSTALL) -d $(DESTDIR)${unitdir}
323+
sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${unitdir}/cpupower.service'
324+
$(SETPERM_DATA) '$(DESTDIR)${unitdir}/cpupower.service'
325+
326+
INSTALL_SYSTEMD := $(if $(filter true,$(strip $(SYSTEMD))),install-systemd)
327+
328+
install-tools: $(OUTPUT)cpupower $(INSTALL_SYSTEMD)
319329
$(INSTALL) -d $(DESTDIR)${bindir}
320330
$(INSTALL_PROGRAM) $(OUTPUT)cpupower $(DESTDIR)${bindir}
321331
$(INSTALL) -d $(DESTDIR)${bash_completion_dir}
@@ -324,9 +334,6 @@ install-tools: $(OUTPUT)cpupower
324334
$(INSTALL_DATA) cpupower-service.conf '$(DESTDIR)${confdir}'
325335
$(INSTALL) -d $(DESTDIR)${libexecdir}
326336
$(INSTALL_PROGRAM) cpupower.sh '$(DESTDIR)${libexecdir}/cpupower'
327-
$(INSTALL) -d $(DESTDIR)${unitdir}
328-
sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${unitdir}/cpupower.service'
329-
$(SETPERM_DATA) '$(DESTDIR)${unitdir}/cpupower.service'
330337

331338
install-man:
332339
$(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1
@@ -406,4 +413,4 @@ help:
406413
@echo ' uninstall - Remove previously installed files from the dir defined by "DESTDIR"'
407414
@echo ' cmdline or Makefile config block option (default: "")'
408415

409-
.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean help
416+
.PHONY: all utils libcpupower update-po create-gmo install-lib install-systemd install-tools install-man install-gmo install uninstall clean help

0 commit comments

Comments
 (0)