mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-04-20 05:41:12 +02:00
pp-misc/toggle-cpu-governor: loops though cpu-governors
This commit is contained in:
parent
9b6714b670
commit
2ff758753f
4 changed files with 81 additions and 0 deletions
3
app-misc/toggle-cpu-governor/Manifest
Normal file
3
app-misc/toggle-cpu-governor/Manifest
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
AUX toggle-cpu-governor 1135 SHA256 59590d78941942d9b17d9d928d9152c7795ddf0cbcaf88ac691711ed696d4794 SHA512 b09016bd98212a8ef284d7831dc56b5bd674cd4d487e7b30657f0d0299574c8db536ac4de30f0dceb067544089ed01e690465e57beafaf9e6253b6ebd6a28c46 WHIRLPOOL 8252ad6af68b7d73641dd29cfea82fd3f308136ea7517888b1b1ac553087e3d9d61cb640ee9539c722b1773ed61e3c64051bb6c11b0e05ddcbf22dc0d549561b
|
||||
EBUILD toggle-cpu-governor-0.1.ebuild 466 SHA256 3e81a641e2e8384fc626367cb2c1230c00332599d38a847055d039e22ae1290c SHA512 efa6ec5c560e50e1f3b9ab1bafbdfc3ca8b1878fd2e36306ac56af5ab360d501075dff3ba2f8f2169ba40b2cef33055f5e75bf54bb9d44ee323589dc641b3410 WHIRLPOOL 233e5148d23a8682bfa0b72e46dc2c7d7c50cf5758f51201fb684a2390b9eb5f40e6fddc594146db74c38688d9839c2bcb9a30ea58a58de67fe761de4231c695
|
||||
MISC metadata.xml 246 SHA256 adf43b42c2e0a8da20c10878afa97282c39c9149d0a46d18994c18cffe5c35ba SHA512 e9c5ce40a7eb832ac8e92512356725c7f0f3c546cf7d9c6dceca6dd764738c6d5682fb2a343916ecab482ff75924204aae291d236fbd3844fd80351c65de0b87 WHIRLPOOL 61bbf4a1e98792b3c8d37293322dfaa76d85ee29331a3477b424349f81c5516416f9dc8a95eb9b833818703c64de503e635e99df51723e0f8b78f2881e1f5422
|
||||
45
app-misc/toggle-cpu-governor/files/toggle-cpu-governor
Executable file
45
app-misc/toggle-cpu-governor/files/toggle-cpu-governor
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
# Author: Stefan Kuhn <woudan@pentoo.ch>
|
||||
#
|
||||
# toggles cpu governors
|
||||
# (or loops through the list if more then 2 governors are available)
|
||||
|
||||
# sanity check
|
||||
if [ ! -x /usr/bin/cpufreq-info ] || [ ! -x /usr/bin/cpufreq-set ]; then
|
||||
echo "Error: /usr/bin/cpufreq-info or /usr/bin/cpufreq-set not found"
|
||||
echo "Do you have sys-power/cpufrequtils installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
setNextGovernor()
|
||||
{
|
||||
# get available governors
|
||||
local allGovernors=$(cpufreq-info -g)
|
||||
local currentGov=$(cpufreq-info -p | sed -r 's/^.*[[:space:]]+([[:alnum:]]+)$/\1/')
|
||||
local found=0
|
||||
local newGov=
|
||||
for gov in $allGovernors; do
|
||||
if [ $found -ne 0 ]; then
|
||||
newGov=$gov
|
||||
break
|
||||
fi
|
||||
[ "$gov" == "$currentGov" ] && found=1
|
||||
done
|
||||
# last gov was active, set to first
|
||||
if [ "$newGov" == '' ]; then
|
||||
newGov=$(echo "$allGovernors" | sed -r 's/^([[:alnum:]]+)[[:space:]]+.*$/\1/')
|
||||
fi
|
||||
echo "Available governors: \"$allGovernors\""
|
||||
echo "Old governor: \"$currentGov\""
|
||||
# set new governor
|
||||
cpufreq-set -r -g $newGov
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "New governor: $newGov"
|
||||
exit 0
|
||||
else
|
||||
echo "CPU governor not set ... are you root?"
|
||||
fi
|
||||
}
|
||||
|
||||
setNextGovernor
|
||||
6
app-misc/toggle-cpu-governor/metadata.xml
Normal file
6
app-misc/toggle-cpu-governor/metadata.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<longdescription lang="en">Toggles cpu governors - loops though the available governors</longdescription>
|
||||
</pkgmetadata>
|
||||
|
||||
27
app-misc/toggle-cpu-governor/toggle-cpu-governor-0.1.ebuild
Normal file
27
app-misc/toggle-cpu-governor/toggle-cpu-governor-0.1.ebuild
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI=4
|
||||
|
||||
DESCRIPTION="Toggles cpu governors - loops though the available governors"
|
||||
HOMEPAGE="http://pentoo.ch"
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE=""
|
||||
|
||||
DEPEND=""
|
||||
RDEPEND="${DEPEND} sys-power/cpufrequtils"
|
||||
|
||||
S="${WORKDIR}"
|
||||
src_prepare() {
|
||||
cp ""${FILESDIR}/${PN} .
|
||||
}
|
||||
|
||||
src_install() {
|
||||
exeinto /usr/bin
|
||||
doexe "${PN}"
|
||||
}
|
||||
Loading…
Reference in a new issue