[nut/f15] service startup not reported correctly in netclient mode (#732151)

Michal Hlavinka mhlavink at fedoraproject.org
Mon Aug 22 15:12:22 UTC 2011


commit f5a7a68172ae6b461e333c53a3e723f64d723b82
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Mon Aug 22 17:12:07 2011 +0200

    service startup not reported correctly in netclient mode (#732151)

 nut.spec |    5 ++++-
 ups.init |   17 +++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/nut.spec b/nut.spec
index e086576..d288843 100644
--- a/nut.spec
+++ b/nut.spec
@@ -14,7 +14,7 @@
 Summary: Network UPS Tools
 Name: nut
 Version: 2.6.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 Group: Applications/System
 License: GPLv2+
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -384,6 +384,9 @@ rm -rf %{buildroot}
 %{_libdir}/pkgconfig/libupsclient.pc
 
 %changelog
+* Mon Aug 22 2011 Michal Hlavinka <mhlavink at redhat.com> - 2.6.1-4
+- service startup not reported correctly in netclient mode (#732151)
+
 * Tue Aug 16 2011 Michal Hlavinka <mhlavink at redhat.com> - 2.6.1-3
 - update requirements of packages
 
diff --git a/ups.init b/ups.init
index 16cb21f..a765391 100644
--- a/ups.init
+++ b/ups.init
@@ -38,6 +38,7 @@ else
 fi
 
 start() {
+	RETVAL=0
 	if [ "$MODE" = "standalone" -o "$MODE" = "netserver" -o "$MODE" = "serveronly" ]; then
 		echo -n $"Starting UPS driver controller: "
 		daemon /sbin/upsdrvctl start > /dev/null 2>&1 && success || failure
@@ -47,16 +48,18 @@ start() {
 		prog="upsd"
 		echo -n $"Starting $prog: "
 		daemon /usr/sbin/upsd $UPSD_OPTIONS > /dev/null 2>&1 && success || failure
+		RET=$?
 		if [ "$RETVAL" = 0 ]; then
-			RETVAL=$?
+			RETVAL=$RET
 		fi
 		echo
 	fi
 	if [ "$MODE" = "standalone" -o "$MODE" = "netserver" -o "$MODE" = "netclient" ]; then
 		echo -n $"Starting UPS monitor: "
 		daemon --pidfile /var/run/nut/upsmon.pid /usr/sbin/upsmon > /dev/null 2>&1 && success || failure
+		RET=$?
 		if [ "$RETVAL" = 0 ]; then
-			RETVAL=$?
+			RETVAL=$RET
 		fi
 		echo
 	fi
@@ -64,22 +67,28 @@ start() {
 }
 
 stop() {
+	RETVAL=0
 	if [ "$MODE" = "standalone" -o "$MODE" = "netserver" -o "$MODE" = "netclient" ]; then
 		echo -n $"Stopping UPS monitor: "
 		killproc -p /var/run/nut/upsmon.pid upsmon
+		RETVAL=$?
 		echo
 	fi
 	if [ "$MODE" = "standalone" -o "$MODE" = "netserver" -o "$MODE" = "serveronly" ]; then
 		prog="upsd"
 		echo -n $"Stopping $prog: "
 		killproc upsd > /dev/null 2>&1 && success || failure
-		RETVAL=$?
+		RET=$?
+		if [ "$RETVAL" = 0 ]; then
+			 RETVAL=$RET
+		fi
 		echo
 
 		echo -n $"Shutting down UPS driver controller: "
 		/sbin/upsdrvctl stop > /dev/null 2>&1 && success || failure
+		RET=$?
 		if [ "$RETVAL" = 0 ]; then
-			RETVAL=$?
+			RETVAL=$RET
 		fi
 		echo
 	fi


More information about the scm-commits mailing list