diff options
author | Saren Arterius | 2017-08-26 22:23:54 +0800 |
---|---|---|
committer | Saren Arterius | 2017-08-26 22:30:45 +0800 |
commit | f531c94decbff759fa0a41fe5d505eba015449c3 (patch) | |
tree | 609e1fb21a0dfdd1b0f98f7090536869178d284d | |
download | aur-lm_sensors-max_of_fctemps.tar.gz |
First commit
-rw-r--r-- | .SRCINFO | 36 | ||||
-rw-r--r-- | PKGBUILD | 56 | ||||
-rw-r--r-- | fancontrol-max-of-fctemps.patch | 68 | ||||
-rw-r--r-- | healthd | 53 | ||||
-rw-r--r-- | healthd.conf | 17 | ||||
-rw-r--r-- | healthd.service | 9 | ||||
-rw-r--r-- | lm_sensors-fancontrol.patch | 29 | ||||
-rw-r--r-- | sensord.conf | 9 |
8 files changed, 277 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..bbaf66a393b7 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,36 @@ +pkgbase = lm_sensors-max_of_fctemps + pkgdesc = Collection of user space tools for general SMBus access and hardware monitoring. Patch in http://www.spinics.net/lists/lm-sensors/msg35498.html applied + pkgver = 3.4.0 + pkgrel = 3 + url = http://www.lm-sensors.org/ + arch = i686 + arch = x86_64 + license = GPL + license = LGPL + makedepends = rrdtool + depends = perl + depends = sysfsutils + optdepends = rrdtool: for logging with sensord + provides = lm_sensors + conflicts = lm_sensors + backup = etc/sensors3.conf + backup = etc/healthd.conf + backup = etc/conf.d/sensord + source = lm_sensors-3.4.0::https://github.com/groeck/lm-sensors/archive/V3-4-0.tar.gz + source = healthd + source = healthd.conf + source = healthd.service + source = sensord.conf + source = lm_sensors-fancontrol.patch + source = fancontrol-max-of-fctemps.patch + validpgpkeys = 7CA69F4460F1BDC41FD2C858A5526B9BB3CD4E6A + sha1sums = 4a9026e4db894c98ee7cea0bec1188108e415f71 + sha1sums = 1c91ae403d3cd02b6177ad1f1b2f2c3a7a3257f5 + sha1sums = 1edd4d72ade22adfc128fb8d670e85c633fd1d18 + sha1sums = d72ec328e9303acef86342483b6f8537de6117d9 + sha1sums = f4b5f21fdb3b2a55aa353afa1603f953b207b73b + sha1sums = b0bc977348610d6a008d75a43f65800251c4c9f7 + sha1sums = 7b0b2d20cdac737796aacb51a8a7ceeaa10c7c28 + +pkgname = lm_sensors-max_of_fctemps + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ef2c49e4c1f3 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,56 @@ +# $Id$ +# Maintainer: Eric Bélanger <eric@archlinux.org>, Saren Arterius <saren@wtako.net> + +pkgname=lm_sensors-max_of_fctemps +_pkgname=lm_sensors +pkgver=3.4.0 +pkgrel=3 +pkgdesc="Collection of user space tools for general SMBus access and hardware monitoring. Patch in http://www.spinics.net/lists/lm-sensors/msg35498.html applied" +arch=('i686' 'x86_64') +url="http://www.lm-sensors.org/" +license=('GPL' 'LGPL') +provides=('lm_sensors') +conflicts=('lm_sensors') +depends=('perl' 'sysfsutils') +makedepends=('rrdtool') +optdepends=('rrdtool: for logging with sensord') +backup=('etc/sensors3.conf' 'etc/healthd.conf' 'etc/conf.d/sensord') +source=($_pkgname-$pkgver::https://github.com/groeck/lm-sensors/archive/V${pkgver//\./-}.tar.gz + healthd healthd.conf healthd.service sensord.conf + lm_sensors-fancontrol.patch + fancontrol-max-of-fctemps.patch) +sha1sums=('4a9026e4db894c98ee7cea0bec1188108e415f71' + '1c91ae403d3cd02b6177ad1f1b2f2c3a7a3257f5' + '1edd4d72ade22adfc128fb8d670e85c633fd1d18' + 'd72ec328e9303acef86342483b6f8537de6117d9' + 'f4b5f21fdb3b2a55aa353afa1603f953b207b73b' + 'b0bc977348610d6a008d75a43f65800251c4c9f7' + '7b0b2d20cdac737796aacb51a8a7ceeaa10c7c28') +validpgpkeys=('7CA69F4460F1BDC41FD2C858A5526B9BB3CD4E6A') + +prepare() { + cd ${_pkgname/_/-}-${pkgver//\./-} + sed -i 's|/etc/sysconfig|/etc/conf.d|' prog/{detect/sensors-detect,init/{sensord,lm_sensors}.service} + sed -i 's/EnvironmentFile=/EnvironmentFile=-/' prog/init/lm_sensors.service + patch -p0 -i "${srcdir}/lm_sensors-fancontrol.patch" + patch -p0 -i "${srcdir}/fancontrol-max-of-fctemps.patch" +} + +build() { + cd ${_pkgname/_/-}-${pkgver//\./-} + make PREFIX=/usr +} + +package() { + cd ${_pkgname/_/-}-${pkgver//\./-} + make PROG_EXTRA=sensord BUILD_STATIC_LIB=0 \ + PREFIX=/usr SBINDIR=/usr/bin MANDIR=/usr/share/man DESTDIR="${pkgdir}" install + + install -D -m755 "${srcdir}/healthd" "${pkgdir}/usr/bin/healthd" + + install -D -m644 "${srcdir}/healthd.conf" "${pkgdir}/etc/healthd.conf" + install -D -m644 "${srcdir}/sensord.conf" "${pkgdir}/etc/conf.d/sensord" + + install -D -m644 "${srcdir}/healthd.service" "${pkgdir}/usr/lib/systemd/system/healthd.service" + install -D -m644 prog/init/*.service "${pkgdir}/usr/lib/systemd/system/" +} diff --git a/fancontrol-max-of-fctemps.patch b/fancontrol-max-of-fctemps.patch new file mode 100644 index 000000000000..4c098edc8dd3 --- /dev/null +++ b/fancontrol-max-of-fctemps.patch @@ -0,0 +1,68 @@ +Chusslove Illich (Часлав Илић) +Index: doc/fancontrol.txt +=================================================================== +--- doc/fancontrol.txt (revision 6037) ++++ doc/fancontrol.txt (working copy) +@@ -37,6 +37,10 @@ + Maps pwm outputs to temperature sensors so fancontrol knows which + temperature sensors should be used for calculation of new values for + the corresponding pwm outputs. ++ Several temperature sensors may be mapped to single pwm output ++ as a comma-separated list, in which case the maximum of all readings ++ is taken as the referent temperature. This is useful for a CPU fan ++ on a multi-core CPU with separate temperature sensors per core. + + FCFANS + FCFANS records the association between a pwm and a fan. +Index: prog/pwm/fancontrol +=================================================================== +--- prog/pwm/fancontrol (revision 6037) ++++ prog/pwm/fancontrol (working copy) +@@ -224,12 +224,14 @@ + let fcvcount=0 + while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs + do +- tsen=${AFCTEMP[$fcvcount]} +- if [ ! -r $tsen ] +- then +- echo "Error: file $tsen doesn't exist" >&2 +- outdated=1 +- fi ++ for tsen in $(echo ${AFCTEMP[$fcvcount]} | tr ',' ' ') ++ do ++ if [ ! -r $tsen ] ++ then ++ echo "Error: file $tsen doesn't exist" >&2 ++ outdated=1 ++ fi ++ done + let fcvcount=$fcvcount+1 + done + +@@ -391,12 +393,20 @@ + minpwm=${AFCMINPWM[$fcvcount]} + maxpwm=${AFCMAXPWM[$fcvcount]} + +- read tval < ${tsens} +- if [ $? -ne 0 ] +- then +- echo "Error reading temperature from $DIR/$tsens" +- restorefans 1 +- fi ++ tval=0 ++ for tsen in $(echo ${tsens} | tr ',' ' ') ++ do ++ read tval1 < ${tsen} ++ if [ $? -ne 0 ] ++ then ++ echo "Error reading temperature from $DIR/$tsen" ++ restorefans 1 ++ fi ++ if [ $tval -lt $tval1 ] ++ then ++ tval=$tval1 ++ fi ++ done + + read pwmpval < ${pwmo} + if [ $? -ne 0 ] diff --git a/healthd b/healthd new file mode 100644 index 000000000000..b1e2fd699926 --- /dev/null +++ b/healthd @@ -0,0 +1,53 @@ +#!/bin/bash + +# +# /usr/bin/healthd +# + +. /etc/healthd.conf + +cmd="${ALARM_CMD}" +addr="${ADMIN_EMAIL}" +slp="${ALARM_SLEEP}" +sensors="/usr/bin/sensors" + + +while [ $# -gt 0 ] ; do + case "${1}" in + -c ) cmd="${2}" ; shift 2 ;; + -m ) addr="${2}" ; shift 2 ;; + -s ) slp="${2}" ; shift 2 ;; + * ) shift 1 ;; + esac +done + +case "${ALARM_RESET}" in + yes) /usr/bin/sensors > /dev/null + ;; + no) true + ;; +esac + +[ -n "${cmd}" ] && [ -n "$( which -- "${cmd%% *}" )" ] || \ + [ -n "${addr}" ] || exit 1 + +[ "${slp}" -ge 2 ] || slp=600 + +while true ; do + sleep 15 + message="$( $sensors )" + case "$message" in + '' ) message='Could not get any sensor values !' ;; + *ALARM* ) : ;; + * ) message='' ;; + esac + if [ -n "$message" ]; then + if [ -n "${addr}" ]; then + echo "$message" | mail -s \ + "Sensors ALARM detected at host: $( hostname )" \ + "${addr}" + fi + [ -z "${cmd}" ] || ${cmd} & + sleep ${slp} + fi +done & diff --git a/healthd.conf b/healthd.conf new file mode 100644 index 000000000000..8df3e399de40 --- /dev/null +++ b/healthd.conf @@ -0,0 +1,17 @@ +# +# /etc/healthd.conf +# + +# reset any pending alarms on startup +ALARM_RESET="yes" + +# where to sent mails on alarm +ADMIN_EMAIL="root" + +# Seconds to sleep when alarm detected before checking again +# If you want to fill up your mail inbox set this to 2. ;-) +ALARM_SLEEP=600 + +# command to run in background on each alarm +# N.B.: If you choose to use the beep command, you'll need to install it: pacman -S beep +ALARM_CMD="beep -f 800 -l 500 -d 500 -r 600" diff --git a/healthd.service b/healthd.service new file mode 100644 index 000000000000..1933192d3ef8 --- /dev/null +++ b/healthd.service @@ -0,0 +1,9 @@ +[Unit] +Description=A daemon which can be used to alert you in the event of a hardware health monitoring alarm + +[Service] +Type=forking +ExecStart=/usr/bin/healthd + +[Install] +WantedBy=multi-user.target diff --git a/lm_sensors-fancontrol.patch b/lm_sensors-fancontrol.patch new file mode 100644 index 000000000000..c42d7b8702b4 --- /dev/null +++ b/lm_sensors-fancontrol.patch @@ -0,0 +1,29 @@ +--- prog/pwm/fancontrol 2012-11-07 03:26:37.000000000 +0200 ++++ prog/pwm/fancontrol 2013-03-22 18:15:00.566696011 +0200 +@@ -297,7 +297,7 @@ + cd $DIR + + # Check for configuration change +-if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ] ++if [[ "$DIR" != "/" && ( -z "$DEVPATH" || -z "$DEVNAME" ) ]] + then + echo "Configuration is too old, please run pwmconfig again" >&2 + exit 1 +@@ -337,7 +337,7 @@ + # It didn't work, try pwmN_enable=1 pwmN=255 + echo 1 > $ENABLE 2> /dev/null + echo $MAX > $1 +- if [ `cat $ENABLE` -eq 1 -a `cat $1` -ge 190 ] ++ if [ `cat $ENABLE` -eq 1 ] && [ `cat $1` -ge 190 ] + then + # Success + return 0 +@@ -469,7 +469,7 @@ + else + # calculate the new value from temperature and settings + pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}" +- if [ $pwmpval -eq 0 -o $min_fanval -eq 0 ] ++ if [ $pwmpval -eq 0 ] || [ $min_fanval -eq 0 ] + then # if fan was stopped start it using a safe value + echo $minsa > $pwmo + # Sleep while still handling signals diff --git a/sensord.conf b/sensord.conf new file mode 100644 index 000000000000..133783aa82cd --- /dev/null +++ b/sensord.conf @@ -0,0 +1,9 @@ +# +# /etc/conf.d/sensord +# + +#Specify the interval between scanning for sensor alarms +INTERVAL=60s + +#Specify the interval between logging all sensor readings +LOG_INTERVAL=30m |