diff options
author | root <root@rshg054.dnsready.net> | 2012-08-07 00:01:58 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-08-07 00:01:58 +0000 |
commit | 9d36fcd5638035abf19f303deebd9e861d384254 (patch) | |
tree | ec8d5410dd1f54369b7b5926bb94cedbc906ef70 /community/linux-tools | |
parent | 1613e8d1c11997f5507d90ecfc05213199aca3ed (diff) |
Tue Aug 7 00:01:58 UTC 2012
Diffstat (limited to 'community/linux-tools')
-rw-r--r-- | community/linux-tools/PKGBUILD | 21 | ||||
-rw-r--r-- | community/linux-tools/cpupower.rc | 34 | ||||
-rw-r--r-- | community/linux-tools/cpupower.service | 2 | ||||
-rw-r--r-- | community/linux-tools/cpupower.systemd | 32 |
4 files changed, 50 insertions, 39 deletions
diff --git a/community/linux-tools/PKGBUILD b/community/linux-tools/PKGBUILD index 56dfeb802..a0541720d 100644 --- a/community/linux-tools/PKGBUILD +++ b/community/linux-tools/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 74127 2012-07-22 02:44:47Z seblu $ +# $Id: PKGBUILD 74810 2012-08-06 02:37:26Z seblu $ # Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org> pkgbase=linux-tools pkgname=('perf' 'cpupower' 'x86_energy_perf_policy') pkgver=3.5 -pkgrel=1 +pkgrel=2 license=('GPL2') arch=('i686' 'x86_64') url='http://www.kernel.org' @@ -16,11 +16,13 @@ source=("http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$pkgver.tar.xz" # "http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.4.xz" 'cpupower.rc' 'cpupower.conf' + 'cpupower.systemd' 'cpupower.service') md5sums=('24153eaaa81dedc9481ada8cd9c3b83d' - '73dbc931e86b3b73d6e2338dcbee81a4' + '1d9214637968b91706b6e616a100d44b' '857ccdd0598511e3bf4b63522754dc48' - '20870541e88109d2f153be3c58a277f1') + 'c0d17b5295fe964623c772a2dd981771' + '2450e8ff41b30eb58d43b5fffbfde1f4') build() { # apply stable patching set @@ -83,17 +85,18 @@ package_cpupower() { install install-man popd # install rc.d script - install -D -m 755 cpupower.rc "$pkgdir/etc/rc.d/cpupower" - install -D -m 644 cpupower.conf "$pkgdir/etc/conf.d/cpupower" - install -D -m 644 cpupower.service "$pkgdir/usr/lib/systemd/system/cpupower.service" + install -Dm 755 $pkgname.rc "$pkgdir/etc/rc.d/$pkgname" + install -Dm 644 $pkgname.conf "$pkgdir/etc/conf.d/$pkgname" + install -Dm 644 $pkgname.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" + install -Dm 755 $pkgname.systemd "$pkgdir/usr/lib/systemd/scripts/$pkgname" } package_x86_energy_perf_policy() { pkgdesc='Read or write MSR_IA32_ENERGY_PERF_BIAS' cd linux-$pkgver/tools/power/x86/x86_energy_perf_policy - install -D -m 755 x86_energy_perf_policy "$pkgdir/usr/bin/x86_energy_perf_policy" - install -D -m 644 x86_energy_perf_policy.8 "$pkgdir/usr/share/man/man8/x86_energy_perf_policy.8" + install -Dm 755 x86_energy_perf_policy "$pkgdir/usr/bin/x86_energy_perf_policy" + install -Dm 644 x86_energy_perf_policy.8 "$pkgdir/usr/share/man/man8/x86_energy_perf_policy.8" } # vim:set ts=2 sw=2 ft=sh et: diff --git a/community/linux-tools/cpupower.rc b/community/linux-tools/cpupower.rc index 27a491e95..2c4441c4e 100644 --- a/community/linux-tools/cpupower.rc +++ b/community/linux-tools/cpupower.rc @@ -2,40 +2,16 @@ . /etc/rc.conf . /etc/rc.d/functions - -[[ -f /etc/conf.d/cpupower ]] && . /etc/conf.d/cpupower +. /etc/conf.d/${0##*/} case "$1" in start|restart) - stat_busy "Setting cpupower rules" - declare -i fail=0 - - # frequency-set options - declare -a params=() - params+=(${governor:+-g $governor}) - params+=(${min_freq:+-d $min_freq}) - params+=(${max_freq:+-u $max_freq}) - params+=(${freq:+-f $freq}) - if ((${#params[@]} > 0)); then - cpupower frequency-set "${params[@]}" >/dev/null || fail=1 - fi - - # set options - declare -a params=() - params+=(${mc_scheduler:+-m $mc_scheduler}) - params+=(${smp_scheduler:+-s $smp_scheduler}) - params+=(${perf_bias:+-b $perf_bias}) - if ((${#params[@]} > 0)); then - cpupower set "${params[@]}" >/dev/null || fail=1 - fi - - # print failure if any - (($fail > 0)) && stat_fail && exit 1 || stat_done + status 'Setting cpupower rules' /usr/lib/systemd/scripts/cpupower || exit 1 ;; *) - echo "usage: ${0##*/} {start|restart}" + echo "usage: ${0##*/} {start|restart}" >&2 + exit 1 + ;; esac -true - # vim:set ts=2 sw=2 ft=sh et: diff --git a/community/linux-tools/cpupower.service b/community/linux-tools/cpupower.service index f77cfdc97..aaeba2b08 100644 --- a/community/linux-tools/cpupower.service +++ b/community/linux-tools/cpupower.service @@ -3,7 +3,7 @@ Description=Apply cpupower configuration [Service] Type=oneshot -ExecStart=/etc/rc.d/cpupower start +ExecStart=/usr/lib/systemd/scripts/cpupower RemainAfterExit=yes [Install] diff --git a/community/linux-tools/cpupower.systemd b/community/linux-tools/cpupower.systemd new file mode 100644 index 000000000..f45b02bc8 --- /dev/null +++ b/community/linux-tools/cpupower.systemd @@ -0,0 +1,32 @@ +#!/bin/bash + +. /etc/conf.d/cpupower + +declare -i fail=0 + +# parse frequency options +declare -a params=() +params+=(${governor:+-g $governor}) +params+=(${min_freq:+-d $min_freq}) +params+=(${max_freq:+-u $max_freq}) +params+=(${freq:+-f $freq}) + +# apply frequency options +if ((${#params[@]} > 0)); then + cpupower frequency-set "${params[@]}" >/dev/null || fail=1 +fi + +# parse cpu options +declare -a params=() +params+=(${mc_scheduler:+-m $mc_scheduler}) +params+=(${smp_scheduler:+-s $smp_scheduler}) +params+=(${perf_bias:+-b $perf_bias}) + +# apply cpu options +if ((${#params[@]} > 0)); then + cpupower set "${params[@]}" >/dev/null || fail=1 +fi + +exit $fail + +# vim:set ts=2 sw=2 ft=sh et: |