[packages/lm_sensors] style fixes

glen glen at pld-linux.org
Fri Dec 11 17:15:12 CET 2015


commit c56172b0180430f2e6b2ca7e58beb85f61dc33ab
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Fri Dec 11 18:14:11 2015 +0200

    style fixes

 fancontrol.init | 80 ++++++++++++++++++++++++++++-----------------------------
 lm_sensors.init |  3 +++
 sensord.init    |  5 ++--
 3 files changed, 45 insertions(+), 43 deletions(-)
---
diff --git a/fancontrol.init b/fancontrol.init
old mode 100644
new mode 100755
index e073ed6..adf814c
--- a/fancontrol.init
+++ b/fancontrol.init
@@ -10,8 +10,6 @@
 #		damadge could occur. For this, be sure, to run init first
 #		and be sure the configuration is correct.
 #
-# $Id$
-#
 # TODO:
 # - check this, case this is my first 'advanced' init script
 # - maybe add some more stop control, like re-running fancontrol and killing
@@ -27,42 +25,45 @@
 start() {
 	# sensors deamon needs to be started
 	# or at least proper modules loaded (provided by sensorsd deamon)
-	if [ -f /var/lock/subsys/sensord ]; then
-		# Check if the service is already running?
-		if [ ! -f /var/lock/subsys/fancontrol ]; then
-			# Fancontrol needs to check system for pwm control
-			if [ ! -f /etc/sysconfig/fancontrol ]; then
-				nls "Fancontrol not initialized."
-				nls "Try \`%s init' before start." "$0"
-				exit 6
-			fi
-
-			msg_starting fancontrol
-			# won't start without an output
-			daemon --fork 'fancontrol >/dev/null'
-			RETVAL=$?
-			[ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
-		else
-			msg_already_running fancontrol
-		fi
-	else
+	if [ ! -f /var/lock/subsys/sensord ]; then
 		echo "Start sensors daemon first"
-		exit 1
+		RETVAL=1
+		return
+	fi
+
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/fancontrol ]; then
+		msg_already_running fancontrol
+		return
+	fi
+
+	# Fancontrol needs to check system for pwm control
+	if [ ! -f /etc/sysconfig/fancontrol ]; then
+		nls "Fancontrol not initialized."
+		nls "Try \`%s init' before start." "$0"
+		exit 6
 	fi
+
+	msg_starting fancontrol
+	# won't start without an output
+	daemon --fork 'fancontrol >/dev/null'
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
 }
 
 stop() {
-	if [ -f /var/lock/subsys/fancontrol ]; then
-		# Stop daemons.
-		msg_stopping fancontrol
-		# it's crucial to be sure it ended ok, otherwise we get
-		# the fans set and the computer working without any control
-		# and that could cause MASSIVE damage
-		killproc --waitforname fancontrol --waitfortime 30 fancontrol -TERM
-		rm -f /var/lock/subsys/fancontrol
-	else
+	if [ ! -f /var/lock/subsys/fancontrol ]; then
 		msg_not_running fancontrol
+		return
 	fi
+
+	# Stop daemons.
+	msg_stopping fancontrol
+	# it's crucial to be sure it ended ok, otherwise we get
+	# the fans set and the computer working without any control
+	# and that could cause MASSIVE damage
+	killproc --waitforname fancontrol --waitfortime 30 fancontrol -TERM
+	rm -f /var/lock/subsys/fancontrol
 }
 
 restart() {
@@ -73,28 +74,25 @@ restart() {
 # See how we were called.
 case "$1" in
   start)
-  	start
+	start
 	;;
   stop)
-  	stop
+	stop
 	;;
   restart)
-  	restart
+	restart
 	;;
   init)
-  	pwmconfig
-  	exit $?
-  	;;
+	pwmconfig
+	exit $?
+	;;
   status)
 	status fancontrol
 	RETVAL=$?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|status|init}"
+	msg_usage "$0 {start|stop|restart|init|status}"
 	exit 3
 esac
 
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh
diff --git a/lm_sensors.init b/lm_sensors.init
old mode 100644
new mode 100755
index f4c0e32..396327d
--- a/lm_sensors.init
+++ b/lm_sensors.init
@@ -24,9 +24,11 @@ start() {
 		msg_already_running "lm_sensors"
 		return
 	fi
+
 	for module in $BUS_MODULES $HWMON_MODULES ; do
 		_modprobe single $module
 	done
+
 	sensors -s
 	touch /var/lock/subsys/lm_sensors
 }
@@ -41,6 +43,7 @@ stop() {
 		msg_not_running
 		return
 	fi
+
 	msg_stopping "lm_sensors"
 	for module in $HWMON_MODULES $BUS_MODULES ; do
 		/sbin/modprobe -r $module >/dev/null 2>&1
diff --git a/sensord.init b/sensord.init
old mode 100644
new mode 100755
index 4afd772..641c118
--- a/sensord.init
+++ b/sensord.init
@@ -25,6 +25,7 @@ start() {
 		msg_already_running "sensors daemon"
 		return
 	fi
+
 	msg_starting "sensors daemon"
 	daemon sensord \
 		${INTERVAL:+-i $INTERVAL} \
@@ -51,10 +52,10 @@ RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-  	start
+	start
 	;;
   stop)
-  	stop
+	stop
 	;;
   status)
 	status sensord
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lm_sensors.git/commitdiff/b25344ea06c5f9c752f1bc164f75286868ccd9fe



More information about the pld-cvs-commit mailing list