From e51cf415764a2c267f373965c48eec082ad59d81 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 22 Mar 2010 12:27:27 -0500
Subject: cpufreq and utils:  intial import refs 492

---
 abs/extra-testing/cpufreqd/PKGBUILD          | 30 ++++++++++++++
 abs/extra-testing/cpufreqd/cpufreqd          | 35 ++++++++++++++++
 abs/extra-testing/cpufreqd/cpufreqd.install  | 26 ++++++++++++
 abs/extra-testing/cpufrequtils/PKGBUILD      | 32 +++++++++++++++
 abs/extra-testing/cpufrequtils/cpufreq.confd | 14 +++++++
 abs/extra-testing/cpufrequtils/cpufreq.rcd   | 60 ++++++++++++++++++++++++++++
 6 files changed, 197 insertions(+)
 create mode 100644 abs/extra-testing/cpufreqd/PKGBUILD
 create mode 100644 abs/extra-testing/cpufreqd/cpufreqd
 create mode 100644 abs/extra-testing/cpufreqd/cpufreqd.install
 create mode 100644 abs/extra-testing/cpufrequtils/PKGBUILD
 create mode 100644 abs/extra-testing/cpufrequtils/cpufreq.confd
 create mode 100644 abs/extra-testing/cpufrequtils/cpufreq.rcd

diff --git a/abs/extra-testing/cpufreqd/PKGBUILD b/abs/extra-testing/cpufreqd/PKGBUILD
new file mode 100644
index 0000000..a727e28
--- /dev/null
+++ b/abs/extra-testing/cpufreqd/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 60269 2009-12-02 16:30:29Z giovanni $
+# Maintainer: Andrea Scarpino <andrea@archlinux.org>
+# Contributor: Kevin Piche <kevin@archlinux.org>
+# Contributor: Manolis Tzanidakis <manolis@archlinux.org>
+
+pkgname=cpufreqd
+pkgver=2.3.4
+pkgrel=2
+pkgdesc="A small daemon to adjust cpu speed (and indeed voltage)"
+arch=('i686' 'x86_64')
+url="http://sourceforge.net/projects/cpufreqd"
+license=('GPL2')
+depends=('cpufrequtils')
+install="$pkgname.install"
+backup=(etc/cpufreqd.conf)
+options=('!libtool')
+source=(http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
+	'cpufreqd')
+md5sums=('f4193f688305566a8422dd3989667668'
+	'ae7b0ec1e8e9f9e7f05fb83749af4ed4')
+
+build() {
+  cd $srcdir/$pkgname-$pkgver
+  ./configure --prefix=/usr \
+    --sysconfdir=/etc
+  make || return 1
+  make DESTDIR=$pkgdir install
+
+  install -D -m 755 $srcdir/cpufreqd $pkgdir/etc/rc.d/cpufreqd || return 1
+}
diff --git a/abs/extra-testing/cpufreqd/cpufreqd b/abs/extra-testing/cpufreqd/cpufreqd
new file mode 100644
index 0000000..af55456
--- /dev/null
+++ b/abs/extra-testing/cpufreqd/cpufreqd
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/cpufreqd`
+case "$1" in
+  start)
+    stat_busy "Starting cpufreqd"
+    [ -z "$PID" ] && /usr/sbin/cpufreqd
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      add_daemon cpufreqd
+      stat_done
+    fi
+    ;;
+  stop)
+    stat_busy "Stopping cpufreqd"
+    [ ! -z "$PID" ]  && kill $PID &> /dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      rm_daemon cpufreqd
+      stat_done
+    fi
+    ;;
+  restart)
+    $0 stop
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"  
+esac
+exit 0
diff --git a/abs/extra-testing/cpufreqd/cpufreqd.install b/abs/extra-testing/cpufreqd/cpufreqd.install
new file mode 100644
index 0000000..e56ce57
--- /dev/null
+++ b/abs/extra-testing/cpufreqd/cpufreqd.install
@@ -0,0 +1,26 @@
+post_install() {
+	cat << EOF
+
+NOTE
+----
+In order to use that daemon you need to either patch your
+kernel-2.4.x with cpufreq patch (check 
+http://www.codemonkey.org.uk/projects/cpufreq/),
+or use kernel-2.6.x or 2.4.x.-ac.
+
+EOF
+}
+
+post_upgrade() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+pre_remove() {
+  /bin/true
+}
+
+op=$1
+shift
+
+$op $*
diff --git a/abs/extra-testing/cpufrequtils/PKGBUILD b/abs/extra-testing/cpufrequtils/PKGBUILD
new file mode 100644
index 0000000..826e6c9
--- /dev/null
+++ b/abs/extra-testing/cpufrequtils/PKGBUILD
@@ -0,0 +1,32 @@
+# $Id: PKGBUILD 66595 2010-02-01 00:00:07Z giovanni $
+# Maintainer: kevin <kevin@archlinux.org>
+# Contributor: phrakture <aaronmgriffin+gmail+com>
+# Contributor: SpepS <dreamspepser at yahoo dot it>
+
+pkgname=cpufrequtils
+pkgver=007
+pkgrel=1
+pkgdesc="Userspace tools for the kernel cpufreq subsystem"
+arch=('i686' 'x86_64')
+url="http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html"
+license=('GPL')
+depends=('sysfsutils')
+backup=('etc/conf.d/cpufreq')
+source=(http://www.kernel.org/pub/linux/utils/kernel/cpufreq/${pkgname}-${pkgver}.tar.bz2
+        cpufreq.rcd
+        cpufreq.confd)
+options=(!libtool)
+md5sums=('fdd833ce70a9ae40ae8bce5b18f2becf'
+         '7f2b5085df44d2df3e7c2d0b9f6dab08'
+         'baae1f2abffc6bef2bd32a8dd8263c09')
+
+build()
+{
+  cd "${srcdir}/${pkgname}-${pkgver}"
+
+  make -j1 || return 1
+  make INSTALL="/bin/install -c" mandir=/usr/share/man DESTDIR="${pkgdir}" install || return 1
+
+  install -D -m755 ${srcdir}/cpufreq.rcd "${pkgdir}/etc/rc.d/cpufreq" || return 1
+  install -D -m644 ${srcdir}/cpufreq.confd "${pkgdir}/etc/conf.d/cpufreq" || return 1
+}
diff --git a/abs/extra-testing/cpufrequtils/cpufreq.confd b/abs/extra-testing/cpufrequtils/cpufreq.confd
new file mode 100644
index 0000000..2189097
--- /dev/null
+++ b/abs/extra-testing/cpufrequtils/cpufreq.confd
@@ -0,0 +1,14 @@
+#configuration for cpufreq control
+
+# valid governors:
+#  ondemand, performance, powersave,
+#  conservative, userspace
+#governor="ondemand"
+
+# limit frequency range (optional)
+# valid suffixes: Hz, kHz (default), MHz, GHz, THz
+#min_freq="2.25GHz"
+#max_freq="3GHz"
+
+# use freq to set up the exact cpu frequency using it with userspace governor
+#freq=
diff --git a/abs/extra-testing/cpufrequtils/cpufreq.rcd b/abs/extra-testing/cpufrequtils/cpufreq.rcd
new file mode 100644
index 0000000..9bc19b1
--- /dev/null
+++ b/abs/extra-testing/cpufrequtils/cpufreq.rcd
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/cpufreq ] && . /etc/conf.d/cpufreq
+
+case "$1" in
+  start)
+    stat_busy "Setting cpufreq governing rules"
+
+	params=""
+	if [ -n "$governor" ]; then
+		mod="cpufreq_$governor"
+		params="-g $governor"
+		grep -qw "$governor" /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors || modprobe -q $mod
+		if [ $? -eq 0 ]; then
+			if [ "$min_freq" != "" ]; then
+				params="$params -d $min_freq"
+			fi
+			if [ "$max_freq" != "" ]; then
+				params="$params -u $max_freq"
+			fi
+		else
+			stat_busy "    Cannot load governor module '$governor'"
+			stat_fail
+			exit
+		fi
+	fi
+
+	if [ "$params" != "" ]; then
+		CPUS=$(sed -ne 's/^processor.* \([0-9]\+\)$/\1/p' /proc/cpuinfo)
+		stat_append ", cpu"
+		for cpu in $CPUS; do
+			stat_append " $cpu"
+			cpufreq-set -c $cpu $params
+			if [ "$freq" != "" ]; then
+				cpufreq-set -c $cpu -f $freq
+			fi
+		done
+		stat_done
+	else
+		stat_busy "    Invalid configuration in /etc/conf.d/cpufreq"
+		stat_fail
+	fi
+	;;
+  stop)
+	# nothing to do
+	;;
+  restart)
+	$0 start
+	;;
+  set)
+	# TODO: make callable... "cpufreq set 800MHz"
+	;;
+  *)
+	echo "usage: $0 {start|stop|restart}"  
+esac
+exit 0
-- 
cgit v0.12