diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2003-10-10 06:23:13 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2003-10-10 06:23:13 +0000 |
commit | fb899dd66925769538a03d1c04e80c25cbf5129d (patch) | |
tree | 22a190eea1321014407927ae8bc791e39f4ff968 /sys-apps | |
parent | initial commit, thanks to degrenier@easyconnect.fr bug #30558 (diff) | |
download | gentoo-2-fb899dd66925769538a03d1c04e80c25cbf5129d.tar.gz gentoo-2-fb899dd66925769538a03d1c04e80c25cbf5129d.tar.bz2 gentoo-2-fb899dd66925769538a03d1c04e80c25cbf5129d.zip |
initial commit, thanks to degrenier@easyconnect.fr bug #30558
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/cpudyn/ChangeLog | 10 | ||||
-rw-r--r-- | sys-apps/cpudyn/Manifest | 5 | ||||
-rw-r--r-- | sys-apps/cpudyn/cpudyn-0.4.6.ebuild | 34 | ||||
-rw-r--r-- | sys-apps/cpudyn/files/cpudyn.init | 68 | ||||
-rw-r--r-- | sys-apps/cpudyn/files/digest-cpudyn-0.4.6 | 1 |
5 files changed, 116 insertions, 2 deletions
diff --git a/sys-apps/cpudyn/ChangeLog b/sys-apps/cpudyn/ChangeLog new file mode 100644 index 000000000000..d457d477df3b --- /dev/null +++ b/sys-apps/cpudyn/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for sys-apps/cpudyn +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cpudyn/ChangeLog,v 1.1 2003/10/10 06:23:09 robbat2 Exp $ + +*cpudyn-0.4.6 (09 Oct 2003) + + 09 Oct 2003; Robin H. Johnson <robbat2@gentoo.org> cpudyn-0.4.6.ebuild, + files/cpudyn.init: + initial commit, thanks to degrenier@easyconnect.fr bug #30558 + diff --git a/sys-apps/cpudyn/Manifest b/sys-apps/cpudyn/Manifest index 29d9517afb75..c14e2302453e 100644 --- a/sys-apps/cpudyn/Manifest +++ b/sys-apps/cpudyn/Manifest @@ -1,3 +1,4 @@ -MD5 26115375ae8e84687d673fbed29683fc cpudyn-0.4.6.ebuild 777 -MD5 984c976ada631b978a3ef0c2d3aa2703 files/cpudyn.init 1226 +MD5 083ae0f788f190d16154e2d8e6e1c8bd cpudyn-0.4.6.ebuild 871 +MD5 0c26312d25134befa7c43692a1578fa3 ChangeLog 401 +MD5 1571f484ce2c296bd9da8173fa187d77 files/cpudyn.init 2219 MD5 b013c06b8e09ed9137d72775c991aff1 files/digest-cpudyn-0.4.6 60 diff --git a/sys-apps/cpudyn/cpudyn-0.4.6.ebuild b/sys-apps/cpudyn/cpudyn-0.4.6.ebuild new file mode 100644 index 000000000000..c14c3c72ce3f --- /dev/null +++ b/sys-apps/cpudyn/cpudyn-0.4.6.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/cpudyn/cpudyn-0.4.6.ebuild,v 1.1 2003/10/10 06:23:09 robbat2 Exp $ + +DESCRIPTION="A daemon to control laptop power consumption via cpufreq and disk standby" +HOMEPAGE="http://mnm.uib.es/~gallir/${PN}/" +SRC_URI="http://mnm.uib.es/~gallir/${PN}/download/${P}.tgz" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="" +S=${WORKDIR}/${PN} + +src_compile() { + emake cpudynd || die "Compilation failed." +} + +src_install() { + into / + exeinto /etc/init.d + newexe ${FILESDIR}/cpudyn.init cpudyn + insinto /etc/conf.d + newins debian/cpudyn.conf cpudyn + + into /usr + doman cpudynd.8 + dosbin cpudynd + dodoc INSTALL README VERSION changelog COPYING + dohtml *.html +} + +pkg_postinst() { + einfo "Configuration file is /etc/conf.d/cpudyn." +} diff --git a/sys-apps/cpudyn/files/cpudyn.init b/sys-apps/cpudyn/files/cpudyn.init new file mode 100644 index 000000000000..3cfdd5193101 --- /dev/null +++ b/sys-apps/cpudyn/files/cpudyn.init @@ -0,0 +1,68 @@ +#!/sbin/runscript +# +# Based on the Debian init script written by Celso Gonzalez <celso@bulma.net>, +# and on the cpufreqd Gentoo init script written by Robert Gogolok <robertgogolok@web.de>. +# + +DAEMON=/usr/sbin/cpudynd +PIDFILE=/var/run/cpudynd.pid + +depend() { + need localmount +} + +checkconfig() { + local CPUFREQ_24="/proc/cpufreq" + local CPUFREQ_25="/sys/devices/system/cpu/cpu0/cpufreq /sysfs/devices/system/cpu/cpu0/cpufreq" + local CPUFREQ_ACPI="/proc/acpi/processor/CPU0/throttling" + local CPUFREQ_FILES="${CPUFREQ_24} ${CPUFREQ_25} ${CPUFREQ_ACPI}" + local CPUFREQ_FILE="" + for i in ${CPUFREQ_FILES}; do [ -e ${i} ] && CPUFREQ_FILE="${i}" && break ; done + if [ -z "${CPUFREQ_FILE}" ]; then + eerror "Neither CPUFreq nor ACPI throttling support were found" + return 1 + fi + if [ "${CPUFREQ_FILE}" = "${CPUFREQ_ACPI}" ]; then + # see if the file says we are supported or not + grep 'not supported' ${CPUFREQ_ACPI} 2>&1 >/dev/null + retval="$?" + if [ $retval -eq 0 ]; then + eerror "ACPI throttling support found, but hardware doesn't support it" + return 1 + fi + # now check that we can write to the file + local acpistate=`grep 'active state' ${CPUFREQ_ACPI} | cut -dT -f2-` + echo $acpistate > ${CPUFREQ_ACPI} + retval="$?" + if [ ! $retval -eq 0 ]; then + eerror "Writing to ACPI throttling file failed" + return 1 + fi + fi +} + + +start() { + local CPUDYN_OPTS="-d" + if [ -n "$INTERVAL" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -i $INTERVAL"; fi + if [ -n "$CPU_UP" -a -n "$CPU_DOWN" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -p $CPU_UP $CPU_DOWN"; fi + if [ -n "$THROTTLING_LOW" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -l $THROTTLING_LOW"; fi + if [ -n "$TIMEOUT" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -t $TIMEOUT"; fi + if [ -n "$DISKS" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -h $DISKS"; fi + + ebegin "Starting cpudynd" + if checkconfig; then + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --background --make-pidfile --exec $DAEMON -- $CPUDYN_OPTS + eend $? + else + eend 1 + fi +} + +stop() { + ebegin "Stopping cpudynd" + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON && rm -f $PIDFILE + eend $? +} diff --git a/sys-apps/cpudyn/files/digest-cpudyn-0.4.6 b/sys-apps/cpudyn/files/digest-cpudyn-0.4.6 new file mode 100644 index 000000000000..4695693ad932 --- /dev/null +++ b/sys-apps/cpudyn/files/digest-cpudyn-0.4.6 @@ -0,0 +1 @@ +MD5 3b40552655f14b8f6975d074cef362f6 cpudyn-0.4.6.tgz 26602 |