diff options
Diffstat (limited to 'main/lm_sensors')
-rw-r--r-- | main/lm_sensors/APKBUILD | 74 | ||||
-rw-r--r-- | main/lm_sensors/fancontrol.initd | 33 | ||||
-rw-r--r-- | main/lm_sensors/lm_sensors-3.1.0-sensors-detect-alpine.patch | 39 | ||||
-rw-r--r-- | main/lm_sensors/lm_sensors.initd | 105 | ||||
-rw-r--r-- | main/lm_sensors/sensord.confd | 3 | ||||
-rw-r--r-- | main/lm_sensors/sensord.initd | 33 | ||||
-rw-r--r-- | main/lm_sensors/sensors.install | 12 |
7 files changed, 299 insertions, 0 deletions
diff --git a/main/lm_sensors/APKBUILD b/main/lm_sensors/APKBUILD new file mode 100644 index 000000000..83b16539e --- /dev/null +++ b/main/lm_sensors/APKBUILD @@ -0,0 +1,74 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=lm_sensors +pkgver=3.3.0 +pkgrel=0 +pkgdesc="Collection of user space tools for general SMBus access and hardware monitoring." +url="http://www.lm-sensors.org/" +arch="all" +license="GPL" +depends="sysfsutils rrdtool" +makedepends="perl rrdtool-dev bison flex" +subpackages="$pkgname-dev $pkgname-doc $pkgname-detect" +#install=sensors.install +source="http://dl.lm-sensors.org/lm-sensors/releases/$pkgname-$pkgver.tar.bz2 + lm_sensors-3.1.0-sensors-detect-alpine.patch + fancontrol.initd + lm_sensors.initd + sensord.confd + sensord.initd + " + +_builddir="$srcdir"/$pkgname-$pkgver + +prepare() { + cd "$_builddir" + sed -i -e 's:^# \(PROG_EXTRA\):\1:' Makefile + # Respect LDFLAGS + sed -i -e 's/\$(LIBDIR)$/\$(LIBDIR) \$(LDFLAGS)/g' Makefile + sed -i -e 's/\$(LIBSHSONAME) -o/$(LIBSHSONAME) \$(LDFLAGS) -o/g' \ + lib/Module.mk + + # do not check for libiconv in ldconfig cache + sed -i -e 's/^LIBICONV.*/LIBICONV ?=/' prog/sensors/Module.mk || return 1 + + for i in ../*.patch; do + msg "Applying $i" + patch -p1 < $i || return 1 + done +} + +build() { + cd "$_builddir" + export CFLAGS="$CFLAGS -fno-stack-protector" + make PREFIX=/usr user || return 1 +} + +package() { + cd "$_builddir" + make user_install \ + PREFIX=/usr \ + MANDIR=/usr/share/man \ + DESTDIR="$pkgdir" || return 1 + + cd "$srcdir" + install -Dm755 fancontrol.initd "$pkgdir"/etc/init.d/fancontrol + install -Dm755 lm_sensors.initd "$pkgdir"/etc/init.d/lm_sensors + install -Dm755 sensord.initd "$pkgdir"/etc/init.d/sensord + install -Dm755 sensord.confd "$pkgdir"/etc/conf.d/sensord +} + +detect() { + depends="perl" + pkgdesc="Detection/migration scripts for lm_sensors" + mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/sbin + cd "$pkgdir" + mv usr/bin/sensors-conf-convert "$subpkgdir"/usr/bin/ + mv usr/sbin/sensors-detect "$subpkgdir"/usr/bin/ +} + +md5sums="5eb18d7531ead4f54f28a1133a606535 lm_sensors-3.3.0.tar.bz2 +b6e7de1a1768f7a6ea2e00c226331877 lm_sensors-3.1.0-sensors-detect-alpine.patch +58f4c9193a903711ace7fa0754693bd2 fancontrol.initd +2c7e97203da2c39bc9fbfc2a4849cfd4 lm_sensors.initd +82e075236a61334abb3adf46280380d3 sensord.confd +6f3a880988e7cdbcb20870e3c6d1e554 sensord.initd" diff --git a/main/lm_sensors/fancontrol.initd b/main/lm_sensors/fancontrol.initd new file mode 100644 index 000000000..fb163abc2 --- /dev/null +++ b/main/lm_sensors/fancontrol.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/lm_sensors/files/fancontrol-init.d,v 1.1 2007/05/17 07:31:41 phreak Exp $ + +CONFIG=/etc/fancontrol +PID=/var/run/fancontrol.pid + +depend() { + after lm_sensors +} + +checkconfig() { + if [ ! -f ${CONFIG} ]; then + eerror "Configuration file ${CONFIG} not found" + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting fancontrol" + start-stop-daemon --start --quiet --background --pidfile ${PID} \ + --exec /usr/sbin/fancontrol -- ${CONFIG} + eend ${?} +} + +stop() { + ebegin "Stopping fancontrol" + start-stop-daemon --stop --pidfile ${PID} + eend ${?} +} diff --git a/main/lm_sensors/lm_sensors-3.1.0-sensors-detect-alpine.patch b/main/lm_sensors/lm_sensors-3.1.0-sensors-detect-alpine.patch new file mode 100644 index 000000000..9271c6bac --- /dev/null +++ b/main/lm_sensors/lm_sensors-3.1.0-sensors-detect-alpine.patch @@ -0,0 +1,39 @@ +diff -ru lm_sensors-3.1.0.orig/prog/detect/sensors-detect lm_sensors-3.1.0/prog/detect/sensors-detect +--- lm_sensors-3.1.0.orig/prog/detect/sensors-detect 2009-04-14 07:14:22.000000000 +0000 ++++ lm_sensors-3.1.0/prog/detect/sensors-detect 2009-04-14 07:44:48.000000000 +0000 +@@ -5282,19 +5282,24 @@ + } + } + +- my $have_sysconfig = -d '/etc/sysconfig'; +- printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ", +- (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'), +- ($have_sysconfig ? 'YES/no' : 'yes/NO'); ++ my $config = '/etc/conf.d/lm_sensors'; ++ my $have_config = -f $config; ++ printf "Do you want to \%s \%s? (\%s): ", ++ (-e $config ? 'overwrite' : 'generate'), ++ $config, ++ ($have_config ? 'YES/no' : 'yes/NO'); + $_ = <STDIN>; +- if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { +- unless ($have_sysconfig) { +- mkdir('/etc/sysconfig', 0777) +- or die "Sorry, can't create /etc/sysconfig ($!)"; +- } +- open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors") +- or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)"; ++ if (($have_config and not m/^\s*n/i) or m/^\s*y/i) { ++ open(local *SYSCONFIG, ">$config") ++ or die "Sorry, can't create $config ($!)"; + print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n"; ++ print SYSCONFIG ++ "\n". ++ "# Load modules at startup\n". ++ "LOADMODULES=yes\n\n". ++ "# Initialize sensors at startup\n". ++ "INITSENSORS=yes\n\n"; ++ + print SYSCONFIG <<'EOT'; + # This file is sourced by /etc/init.d/lm_sensors and defines the modules to + # be loaded/unloaded. diff --git a/main/lm_sensors/lm_sensors.initd b/main/lm_sensors/lm_sensors.initd new file mode 100644 index 000000000..18fb35370 --- /dev/null +++ b/main/lm_sensors/lm_sensors.initd @@ -0,0 +1,105 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3-init.d,v 1.1 2008/03/17 07:59:28 dberkholz Exp $ + +checkconfig() { + if [ ! -f /etc/conf.d/lm_sensors ]; then + eerror "/etc/conf.d/lm_sensors does not exist, try running sensors-detect" + return 1 + fi + + if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then + if [ -z "${MODULE_0}" ]; then + eerror "MODULE_0 is not set in /etc/conf.d/lm_sensors, try running sensors-detect" + return 1 + fi + fi +} + +start() { + checkconfig || return 1 + + if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then + einfo "Loading lm_sensors modules..." + + mount | grep sysfs >/dev/null 2>&1 + if [ ${?} = 0 ]; then + if ! ( [ -e /sys/i2c ] || [ -e /sys/bus/i2c ] ); then + ebegin " Loading i2c-core" + modprobe i2c-core >/dev/null 2>&1 + if [ ${?} != 0 ]; then + eerror " Could not load i2c-core!" + eend 1 + fi + ( [ -e /sys/i2c ] || [ -e /sys/bus/i2c ] ) || return 1 + eend 0 + fi + elif ! [ -e /proc/sys/dev/sensors ]; then + ebegin " Loading i2c-proc" + modprobe i2c-proc >/dev/null 2>&1 + if [ ${?} != 0 ]; then + eerror " Could not load i2c-proc!" + eend 1 + fi + [ -e /proc/sys/dev/sensors ] || return 1 + eend 0 + fi + + i=0 + while true; do + module=`eval echo '$'MODULE_${i}` + module_args=`eval echo '$'MODULE_${i}_ARGS` + if [ -z "${module}" ]; then + break + fi + ebegin " Loading ${module}" + modprobe ${module} ${module_args} >/dev/null 2>&1 + eend $? + i=$(($i+1)) + done + fi + + if [ "${INITSENSORS}" = "yes" ]; then + if ! [ -f /etc/sensors3.conf ]; then + eerror "/etc/sensors3.conf does not exist!" + return 1 + fi + + ebegin "Initializing sensors" + /usr/bin/sensors -s >/dev/null 2>&1 + eend ${?} + fi +} + +stop() { + checkconfig || return 1 + + if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then + einfo "Unloading lm_sensors modules..." + + # find the highest possible MODULE_ number + i=0 + while true; do + module=`eval echo '$'MODULE_${i}` + if [ -z "${module}" ] ; then + break + fi + i=$(($i+1)) + done + + while [ ${i} -gt 0 ]; do + i=$(($i-1)) + module=`eval echo '$'MODULE_${i}` + ebegin " Unloading ${module}" + rmmod ${module} >/dev/null 2>&1 + eend $? + done + + if [ -e /proc/sys/dev/sensors ] ; then + ebegin " Unloading i2c-proc" + rmmod i2c-proc >/dev/null 2>&1 + eend $? + fi + fi +} diff --git a/main/lm_sensors/sensord.confd b/main/lm_sensors/sensord.confd new file mode 100644 index 000000000..d82841aeb --- /dev/null +++ b/main/lm_sensors/sensord.confd @@ -0,0 +1,3 @@ +# Extra options to pass to the sensord daemon, +# see sensord(8) for more information +SENSORD_OPTIONS="" diff --git a/main/lm_sensors/sensord.initd b/main/lm_sensors/sensord.initd new file mode 100644 index 000000000..cb99dce3f --- /dev/null +++ b/main/lm_sensors/sensord.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/lm_sensors/files/sensord-init.d,v 1.1 2007/05/17 07:31:41 phreak Exp $ + +CONFIG=/etc/sensors.conf + +depend() { + need logger + use lm_sensors +} + +checkconfig() { + if [ ! -f ${CONFIG} ]; then + eerror "Configuration file ${CONFIG} not found" + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting sensord" + start-stop-daemon --start --exec /usr/sbin/sensord \ + -- --config-file ${CONFIG} ${SENSORD_OPTIONS} + eend ${?} +} + +stop() { + ebegin "Stopping sensord" + start-stop-daemon --stop --pidfile /var/run/sensord.pid + eend ${?} +} diff --git a/main/lm_sensors/sensors.install b/main/lm_sensors/sensors.install new file mode 100644 index 000000000..d593f8414 --- /dev/null +++ b/main/lm_sensors/sensors.install @@ -0,0 +1,12 @@ +post_install() { + echo ">>> to control the lm_sensors daemon type" + echo ">>> \"/etc/rc.d/sensors start|stop|restart\" " + echo ">>> --------------------------------------" + echo ">>> before you can use the fancontrol daemon" + echo ">>> first create a fancontrol config file, use \"pwmconfig\"" + echo ">>> then type \"/etc/rc.d/fancontrol start|stop|restart\" " + echo ">>> --------------------------------------" + echo ">>> to decode memory SPD timings modprobe eeprom module" + echo ">>> and get this perl script from" + echo ">>> \"http://www.lm-sensors.org/browser/lm-sensors/trunk/prog/eeprom/decode-dimms.pl\"" +} |