From 17a417e13530325e7e6a5ebb5277f2c42685a74a Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 7 Mar 2014 21:24:40 +0000
Subject: lm_sensors: update to 3.3.5 and update bin path. refs #961

---
 abs/extra/lm_sensors/PKGBUILD                    |  65 +++++--------
 abs/extra/lm_sensors/daemonarg.patch             |  50 ----------
 abs/extra/lm_sensors/fancontrol.rc               |  35 -------
 abs/extra/lm_sensors/fancontrol.service          |   9 --
 abs/extra/lm_sensors/healthd                     |   2 +-
 abs/extra/lm_sensors/healthd.conf                |   2 +-
 abs/extra/lm_sensors/healthd.rc                  |  36 -------
 abs/extra/lm_sensors/healthd.service             |   2 +-
 abs/extra/lm_sensors/linux_3.0.patch             |  11 ---
 abs/extra/lm_sensors/lm_sensors-fancontrol.patch |  29 ++++++
 abs/extra/lm_sensors/sensord.conf                |   9 +-
 abs/extra/lm_sensors/sensord.rc                  |  37 -------
 abs/extra/lm_sensors/sensord.service             |   9 --
 abs/extra/lm_sensors/sensors.rc                  | 119 -----------------------
 14 files changed, 66 insertions(+), 349 deletions(-)
 delete mode 100644 abs/extra/lm_sensors/daemonarg.patch
 delete mode 100644 abs/extra/lm_sensors/fancontrol.rc
 delete mode 100644 abs/extra/lm_sensors/fancontrol.service
 delete mode 100644 abs/extra/lm_sensors/healthd.rc
 delete mode 100644 abs/extra/lm_sensors/linux_3.0.patch
 create mode 100644 abs/extra/lm_sensors/lm_sensors-fancontrol.patch
 delete mode 100644 abs/extra/lm_sensors/sensord.rc
 delete mode 100644 abs/extra/lm_sensors/sensord.service
 delete mode 100644 abs/extra/lm_sensors/sensors.rc

diff --git a/abs/extra/lm_sensors/PKGBUILD b/abs/extra/lm_sensors/PKGBUILD
index 9635bb1..78f622e 100644
--- a/abs/extra/lm_sensors/PKGBUILD
+++ b/abs/extra/lm_sensors/PKGBUILD
@@ -1,8 +1,8 @@
-# $Id: PKGBUILD 170399 2012-11-07 01:42:13Z eric $
+# $Id$
 # Maintainer: Eric Bélanger <eric@archlinux.org>
 
 pkgname=lm_sensors
-pkgver=3.3.3
+pkgver=3.3.5
 pkgrel=1
 pkgdesc="Collection of user space tools for general SMBus access and hardware monitoring"
 arch=('i686' 'x86_64')
@@ -12,50 +12,39 @@ depends=('perl' 'sysfsutils')
 makedepends=('rrdtool')
 optdepends=('rrdtool: for logging with sensord')
 backup=('etc/sensors3.conf' 'etc/healthd.conf' 'etc/conf.d/sensord')
-options=('!emptydirs')
-source=(http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-${pkgver}.tar.bz2{,.sig} \
-	sensors.rc fancontrol.rc healthd healthd.conf healthd.rc sensord.conf \
-        sensord.rc fancontrol.service sensord.service healthd.service \
-        daemonarg.patch linux_3.0.patch)
-sha1sums=('b55c06f425993e42f13553f204066c446da36fd3'
-          '035a721f20e4ad568f4fdde2d7c25d906c192458'
-          'b2e664b9b87759991f02d0a1e8cac5e95098c0a5'
-          'a068ac0a3115a6191a487e11422506baa922b40a'
-          'afaad558d2ad4732aa53b69afa23ccf37bc67ab1'
-          '6c4e8a2d89dd2fd3ca2f0f4f3b1230111e01b0fc'
-          'de5a46afc39a77ae8721246a0223baf21a2d4c9c'
-          'de8d4d65406815c389f8a04e2a8508a1ae6749c8'
-          '72a60251d1d55a67307dab4105d9f3f01a080af4'
-          '7a4a4d1442aeeba0ba8aefb742a3ef187b593f4c'
-          'eff43b4882d25dae7dd0b33eb2e33b0836a5cc51'
-          'a7a20eb3c799d70287e6c7968a7ab42165925293'
-          '34241388c4001bfb6e49b7e10da1217e29a258d6'
-          '5662828085cdd981f0dc7cf8f79d3d6e2b72f50c')
+source=(http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-${pkgver}.tar.bz2{,.sig}
+	healthd healthd.conf healthd.service sensord.conf
+        lm_sensors-fancontrol.patch)
+sha1sums=('179989a52bae8f01ba8ed77e8a15af6ec653d89e'
+          'SKIP'
+          '1c91ae403d3cd02b6177ad1f1b2f2c3a7a3257f5'
+          '1edd4d72ade22adfc128fb8d670e85c633fd1d18'
+          'd72ec328e9303acef86342483b6f8537de6117d9'
+          'f4b5f21fdb3b2a55aa353afa1603f953b207b73b'
+          'b0bc977348610d6a008d75a43f65800251c4c9f7')
 
-build() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-  sed -i -e 's|/etc/sysconfig|/etc/conf.d|' \
-         -e 's|/etc/init.d/lm_sensors|/etc/rc.d/sensors|' prog/{detect/sensors-detect,init/lm_sensors.service}
-  sed -i 's@\(/bin/systemctl\|/lib/systemd/system\)@/usr\1@g' prog/detect/sensors-detect
+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 -p1 < ../daemonarg.patch
-  patch -p0 < ../linux_3.0.patch
+  patch -p0 -i "${srcdir}/lm_sensors-fancontrol.patch"
+}
+
+build() {
+  cd ${pkgname}-${pkgver}
   make PREFIX=/usr
 }
 
 package() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
+  cd ${pkgname}-${pkgver}
   make PROG_EXTRA=sensord BUILD_STATIC_LIB=0 \
-    PREFIX=/usr MANDIR=/usr/share/man DESTDIR="${pkgdir}" install
-  install -D -m644 prog/init/lm_sensors.service "${pkgdir}/usr/lib/systemd/system/lm_sensors.service"
-  install -D -m755 "${srcdir}/sensors.rc" "${pkgdir}/etc/rc.d/sensors"
-  install -D -m755 "${srcdir}/fancontrol.rc" "${pkgdir}/etc/rc.d/fancontrol"
-  install -D -m755 "${srcdir}/healthd" "${pkgdir}/usr/sbin/healthd"
-  install -D -m755 "${srcdir}/healthd.rc" "${pkgdir}/etc/rc.d/healthd"
+    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 -m755 "${srcdir}/sensord.rc" "${pkgdir}/etc/rc.d/sensord"
   install -D -m644 "${srcdir}/sensord.conf" "${pkgdir}/etc/conf.d/sensord"
-  install -D -m644 "${srcdir}/fancontrol.service" "${pkgdir}/usr/lib/systemd/system/fancontrol.service"
-  install -D -m644 "${srcdir}/sensord.service" "${pkgdir}/usr/lib/systemd/system/sensord.service"
+ 
   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/abs/extra/lm_sensors/daemonarg.patch b/abs/extra/lm_sensors/daemonarg.patch
deleted file mode 100644
index 4b80cef..0000000
--- a/abs/extra/lm_sensors/daemonarg.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-diff -ru lm_sensors-3.1.2-1/prog/pwm/fancontrol lm_sensors-3.1.2-1_pyropeter/usr/sbin/fancontrol
---- lm_sensors-3.1.2-1/prog/pwm/fancontrol	2010-02-03 03:45:15.000000000 +0100
-+++ lm_sensors-3.1.2-1_pyropeter/prog/pwm/fancontrol	2010-03-07 01:37:09.000000000 +0100
-@@ -5,7 +5,9 @@
- #
- # Version 0.70
- #
--# Usage: fancontrol [CONFIGFILE]
-+# Usage: fancontrol [-D] [CONFIGFILE]
-+#
-+# (-D causes fancontrol to 'fork' to the background after some tests)
- #
- # Dependencies:
- #   bash, egrep, sed, cut, sleep, readlink, lm_sensors :)
-@@ -43,6 +45,12 @@
- #DEBUG=1
- MAX=255
- 
-+DAEMON=0
-+if [ "$1" = "-D" ]; then
-+	DAEMON=1
-+	shift
-+fi
-+
- declare -i pwmval
- 
- function LoadConfig {
-@@ -303,7 +311,6 @@
- 	echo "File $PIDFILE exists, is fancontrol already running?"
- 	exit 1
- fi
--echo $$ > "$PIDFILE"
- 
- # $1 = pwm file name
- function pwmdisable()
-@@ -475,6 +482,14 @@
- 	let fcvcount=$fcvcount+1
- done
- 
-+if [ "$DAEMON" -gt 0 ]; then
-+	echo "Forking..."
-+	$0 $* &> /dev/null &
-+	exit 0
-+fi
-+
-+echo $$ > "$PIDFILE"
-+
- echo 'Starting automatic fan control...'
- 
- # main loop calling the main function at specified intervals
diff --git a/abs/extra/lm_sensors/fancontrol.rc b/abs/extra/lm_sensors/fancontrol.rc
deleted file mode 100644
index 8e98d06..0000000
--- a/abs/extra/lm_sensors/fancontrol.rc
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=$(pidof -o %PPID -x /usr/sbin/fancontrol)
-case "$1" in
-  start)
-    stat_busy "Starting fancontrol"
-    [ -z "$PID" ] && /usr/sbin/fancontrol -D &>/dev/null
-    if [ $? -gt 0 -o -n "$PID" ]; then
-      stat_fail
-    else
-      add_daemon fancontrol
-      stat_done
-    fi
-    ;;
-  stop)
-    stat_busy "Stopping fancontrol"
-    [ ! -z "$PID" ]  && kill $PID &> /dev/null
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      rm_daemon fancontrol
-      stat_done
-    fi
-    ;;
-  restart)
-    $0 stop
-    $0 start
-    ;;
-  *)
-    echo "usage: $0 {start|stop|restart}"  
-esac
-exit 0
diff --git a/abs/extra/lm_sensors/fancontrol.service b/abs/extra/lm_sensors/fancontrol.service
deleted file mode 100644
index c86b498..0000000
--- a/abs/extra/lm_sensors/fancontrol.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Fan control daemon
-
-[Service]
-PIDFile=/var/run/fancontrol.pid
-ExecStart=/usr/sbin/fancontrol
-
-[Install]
-WantedBy=multi-user.target
diff --git a/abs/extra/lm_sensors/healthd b/abs/extra/lm_sensors/healthd
index 5ffed56..b1e2fd6 100644
--- a/abs/extra/lm_sensors/healthd
+++ b/abs/extra/lm_sensors/healthd
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 #
-# /usr/sbin/healthd
+# /usr/bin/healthd
 #
 
 . /etc/healthd.conf
diff --git a/abs/extra/lm_sensors/healthd.conf b/abs/extra/lm_sensors/healthd.conf
index a8b2c3f..8df3e39 100644
--- a/abs/extra/lm_sensors/healthd.conf
+++ b/abs/extra/lm_sensors/healthd.conf
@@ -1,5 +1,5 @@
 #
-# /etc/conf.d/healthd
+# /etc/healthd.conf
 #
 
 # reset any pending alarms on startup
diff --git a/abs/extra/lm_sensors/healthd.rc b/abs/extra/lm_sensors/healthd.rc
deleted file mode 100644
index f50f4a6..0000000
--- a/abs/extra/lm_sensors/healthd.rc
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=$(pidof -x -o %PPID /usr/sbin/healthd)
-case "${1}" in
-  start)
-    stat_busy "Starting Health Daemon"
-    [ -z "${PID}" ] && /usr/sbin/healthd &> /dev/null
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      echo "${PID}" > /var/run/healthd.pid
-      add_daemon healthd
-      stat_done
-    fi
-    ;;
-  stop)
-    stat_busy "Stopping Health Daemon"
-    [ ! -z "${PID}" ] && kill ${PID} &> /dev/null
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      rm_daemon healthd
-      stat_done
-    fi
-    ;;
-  restart) 
-    $0 stop 
-    sleep 2
-    $0 start 
-    ;;
-  *) echo "usage: $0 {start|stop|restart}"
-esac
-exit 0
diff --git a/abs/extra/lm_sensors/healthd.service b/abs/extra/lm_sensors/healthd.service
index 59d3270..1933192 100644
--- a/abs/extra/lm_sensors/healthd.service
+++ b/abs/extra/lm_sensors/healthd.service
@@ -3,7 +3,7 @@ Description=A daemon which can be used to alert you in the event of a hardware h
 
 [Service]
 Type=forking
-ExecStart=/usr/sbin/healthd
+ExecStart=/usr/bin/healthd
 
 [Install]
 WantedBy=multi-user.target
diff --git a/abs/extra/lm_sensors/linux_3.0.patch b/abs/extra/lm_sensors/linux_3.0.patch
deleted file mode 100644
index da02a3d..0000000
--- a/abs/extra/lm_sensors/linux_3.0.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- prog/detect/sensors-detect	2011-08-02 10:23:46.000000000 +0200
-+++ prog/detect/sensors-detect	2011-08-02 10:24:04.000000000 +0200
-@@ -2472,7 +2472,7 @@
- 
- sub initialize_kernel_version
- {
--	`uname -r` =~ /(\d+)\.(\d+)\.(\d+)(.*)/;
-+	`uname -r` =~ /(\d+)\.(\d+)(.*)/;
- 	@kernel_version = ($1, $2, $3, $4);
- 	chomp($kernel_arch = `uname -m`);
- 
diff --git a/abs/extra/lm_sensors/lm_sensors-fancontrol.patch b/abs/extra/lm_sensors/lm_sensors-fancontrol.patch
new file mode 100644
index 0000000..c42d7b8
--- /dev/null
+++ b/abs/extra/lm_sensors/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/abs/extra/lm_sensors/sensord.conf b/abs/extra/lm_sensors/sensord.conf
index a1cf091..133783a 100644
--- a/abs/extra/lm_sensors/sensord.conf
+++ b/abs/extra/lm_sensors/sensord.conf
@@ -1,4 +1,9 @@
 #
-# Parameters to be passed to sensord
+# /etc/conf.d/sensord
 #
-SENSORD_ARGS=""
+
+#Specify the interval between scanning for sensor alarms
+INTERVAL=60s
+
+#Specify the interval between logging all sensor readings
+LOG_INTERVAL=30m
diff --git a/abs/extra/lm_sensors/sensord.rc b/abs/extra/lm_sensors/sensord.rc
deleted file mode 100644
index e3ef4d2..0000000
--- a/abs/extra/lm_sensors/sensord.rc
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-. /etc/conf.d/sensord
-
-PID=$(pidof -o %PPID /usr/sbin/sensord)
-case "$1" in
-  start)
-    stat_busy "Starting sensord"
-    [ -z "$PID" ] && /usr/sbin/sensord ${SENSORD_ARGS}
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      add_daemon sensord
-      stat_done
-    fi
-    ;;
-  stop)
-    stat_busy "Stopping sensord"
-    [ ! -z "$PID" ]  && kill $PID &> /dev/null
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      rm_daemon sensord
-      stat_done
-    fi
-    ;;
-  restart)
-    $0 stop
-    sleep 1
-    $0 start
-    ;;
-  *)
-    echo "usage: $0 {start|stop|restart}"  
-esac
-exit 0
diff --git a/abs/extra/lm_sensors/sensord.service b/abs/extra/lm_sensors/sensord.service
deleted file mode 100644
index 6d272f1..0000000
--- a/abs/extra/lm_sensors/sensord.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Sensor information logging daemon
-
-[Service]
-PIDFile=/var/run/sensord.pid
-ExecStart=/usr/sbin/sensord
-
-[Install]
-WantedBy=multi-user.target
diff --git a/abs/extra/lm_sensors/sensors.rc b/abs/extra/lm_sensors/sensors.rc
deleted file mode 100644
index 4acde22..0000000
--- a/abs/extra/lm_sensors/sensors.rc
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-
-# description: sensors is used for monitoring motherboard sensor values.
-# config: /etc/conf.d/lm_sensors
-
-# See also the lm_sensors homepage at:
-#     http://www2.lm-sensors.nu/~lm78/index.html
-
-# It uses a config file /etc/conf.d/lm_sensors that contains the modules to
-# be loaded/unloaded. That file is sourced into this one.
-
-# The format of that file a shell script that simply defines the modules
-# in order as normal shell variables with the special names:
-#    MODULE_1, MODULE_2, MODULE_3, etc.
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PSENSORS=/usr/bin/sensors
-
-if $(grep -q sysfs /proc/mounts); then
-  WITHSYS=1
-else
-  WITHSYS=0
-fi
-
-if [ $WITHSYS == "0" ]; then
-  # If sensors isn't supported by the kernel, try loading the module...
-  [ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc &>/dev/null
-
-  # Don't bother if /proc/sensors still doesn't exist, kernel doesn't have support for sensors.
-  if ! [ -e /proc/sys/dev/sensors ]; then
-    echo  "lm_sensors: kernel does not have sensors support"
-    stat_fail
-  fi
-
-  # If sensors was not already running, unload the module...
-  [ -e /var/run/daemons/sensors ] || /sbin/modprobe -r i2c-proc &>/dev/null
-fi
-
-if [ -e /etc/conf.d/lm_sensors ]; then
-  CONFIG=/etc/conf.d/lm_sensors
-elif [ -e /etc/sysconfig/lm_sensors ]; then
-  # Moving config to new Arch-specific location
-  mv /etc/sysconfig/lm_sensors /etc/conf.d/lm_sensors
-  CONFIG=/etc/conf.d/lm_sensors
-fi
-
-case "$1" in
-  start)
-    stat_busy "Starting Up Sensors"
-
-    if [ -r "$CONFIG" ]; then
-      . "$CONFIG"
-      modules=$(grep \^MODULE_ $CONFIG | wc -l | tr -d ' ')
-      i=0
-      while [ $i -lt $modules ] ; do
-        module=$(eval echo '$'MODULE_$i)
-       # echo starting module __${module}__ #debug
-        /sbin/modprobe $module &>/dev/null
-        i=$(expr $i + 1)
-      done
-    fi
-
-    $PSENSORS -s
-
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      add_daemon sensors
-      stat_done
-    fi	  
-    ;;
-
-  stop)
-    stat_busy "Shutting Down Sensors"
-
-    if [ -r "$CONFIG" ]; then
-      . "$CONFIG"
-      modules=$(grep \^MODULE_ $CONFIG | wc -l | tr -d ' ')
-      i=$(expr $modules - 1)
-      while [ $i -ge 0 ] ; do
-        module=$(eval echo '$'MODULE_$i)
-      #  echo stoping module __${module}__ #debug
-        /sbin/modprobe -r $module &>/dev/null
-        i=$(expr $i - 1)
-      done
-    fi
-
-    if [ $WITHSYS == "0" ]; then
-      /sbin/modprobe -r i2c-proc &>/dev/null
-    fi
-
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      rm_daemon sensors
-      stat_done
-    fi
-    ;;
-    
-  status)
-    $PSENSORS
-    ;;
-    
-  restart)
-    $0 stop
-    sleep 1
-    $0 start
-    ;;
-
-  condrestart)
-    [ -e /var/run/daemons/sensors ] && $0 restart || :
-    ;;
-
-  *)
-    echo "Usage: $0 {start|stop|restart|status|condrestart}"
-esac
-exit 0
-- 
cgit v0.12

