[packages/kernel-tools] add cpupower systemd services

glen glen at pld-linux.org
Sun Nov 25 19:34:48 CET 2012


commit f57fcd7183d70ba107229e0c482be872668cf34d
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Nov 25 20:33:16 2012 +0200

    add cpupower systemd services
    
    sniffed them from fedora

 cpupower.config   |  3 +++
 cpupower.service  | 13 +++++++++++++
 kernel-tools.spec | 23 ++++++++++++++++++++++-
 3 files changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/kernel-tools.spec b/kernel-tools.spec
index 8d106cd..66f1228 100644
--- a/kernel-tools.spec
+++ b/kernel-tools.spec
@@ -2,12 +2,13 @@
 # - BR deps for -perf
 # - asciidoc used at install stage of perf (should build doc in build section)
 # - different packages for perf-slang and perf-gtk
+
 #
 # Conditional build:
 %bcond_without	verbose		# verbose build (V=1)
 %bcond_with	perf		# perf tools (unfinished)
 
-%define		rel		0.1
+%define		rel		0.3
 %define		basever	3.6
 %define		postver	.6
 Summary:	Assortment of tools for the Linux kernel
@@ -22,6 +23,9 @@ Source0:	http://www.kernel.org/pub/linux/kernel/v3.x/linux-%{basever}.tar.xz
 Patch0:		http://www.kernel.org/pub/linux/kernel/v3.x/patch-%{version}.bz2
 # Patch0-md5:	363e730147333182616cc687345e7fe2
 %endif
+Source1:	cpupower.service
+Source2:	cpupower.config
+BuildRequires:	rpmbuild(macros) >= 1.647
 BuildRequires:	tar >= 1:1.22
 BuildRequires:	xz
 %if %{with perf}
@@ -52,6 +56,8 @@ the supporting documentation.
 %package cpupower
 Summary:	cpupower - Shows and sets processor power related values
 Group:		Applications/System
+Requires(post,preun,postun):	systemd-units >= 38
+Requires:	systemd-units >= 0.38
 
 %description cpupower
 cpupower is a collection of tools to examine and tune power saving
@@ -159,6 +165,10 @@ cd linux-%{basever}
 %find_lang cpupower
 mv cpupower.lang ..
 
+install -d $RPM_BUILD_ROOT{/etc/sysconfig,%{systemdunitdir}}
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/cpupower.service
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/cpupower
+
 %ifarch %{ix86}
 cd tools/power/cpupower/debug/i386
 install -p centrino-decode $RPM_BUILD_ROOT%{_bindir}/centrino-decode
@@ -235,6 +245,15 @@ rm -rf $RPM_BUILD_ROOT
 %post	cpupower-libs -p /sbin/ldconfig
 %postun	cpupower-libs -p /sbin/ldconfig
 
+%post cpupower
+%systemd_post cpupower.service
+
+%preun cpupower
+%systemd_preun cpupower.service
+
+%postun cpupower
+%systemd_reload
+
 %files
 %defattr(644,root,root,755)
 %ifarch %{ix86} %{x8664}
@@ -253,6 +272,8 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/cpupower
 %{_mandir}/man[1-8]/cpupower*
+%{systemdunitdir}/cpupower.service
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cpupower
 
 %files cpupower-libs
 %defattr(644,root,root,755)
diff --git a/cpupower.config b/cpupower.config
new file mode 100644
index 0000000..8629a4a
--- /dev/null
+++ b/cpupower.config
@@ -0,0 +1,3 @@
+# See 'cpupower help' and cpupower(1) for more info
+CPUPOWER_START_OPTS="frequency-set -g performance"
+CPUPOWER_STOP_OPTS="frequency-set -g ondemand"
diff --git a/cpupower.service b/cpupower.service
new file mode 100644
index 0000000..5f10ab7
--- /dev/null
+++ b/cpupower.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Configure CPU power related settings
+After=syslog.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+EnvironmentFile=/etc/sysconfig/cpupower
+ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS
+ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS
+
+[Install]
+WantedBy=multi-user.target
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel-tools.git/commitdiff/2bd21e063ecbb00108d340c8900c7d1d66da5d54



More information about the pld-cvs-commit mailing list