* Gerfried Fuchs <[email protected]> [2014-02-14 08:08:14 CET]:
>  Please find attach a proposed patch for the issue.  I hope we can get
> around at work to test it properly within the next few days, but from
> what I can tell this should be a good approach.

 And a patch on top of that.  I had the false impression that return is
able to return a string too, but that's not possible with in shell.
Thus the new patch with edit the varible directly inside the function,
which I actually tried to avoid, but that's not really possible within
shell scripts it seems.

 Enjoy,
Rhonda
-- 
Fühlst du dich mutlos, fass endlich Mut, los      |
Fühlst du dich hilflos, geh raus und hilf, los    | Wir sind Helden
Fühlst du dich machtlos, geh raus und mach, los   | 23.55: Alles auf Anfang
Fühlst du dich haltlos, such Halt und lass los    |
>From 668707eadf4cb546f782917d57eb7c7c024f51ca Mon Sep 17 00:00:00 2001
From: Gerfried Fuchs <[email protected]>
Date: Sun, 16 Feb 2014 10:54:52 +0100
Subject: [PATCH 2/2] return in shell scripts only work with numeric values

This fixes the error in the first patch.  I would have liked it to not
have to edit the variable within the functions for easier reading, but
unfortunately shell doesn't offer that possibility.
---
 debian/src/sysv-rc/etc/init.d/rc | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/debian/src/sysv-rc/etc/init.d/rc b/debian/src/sysv-rc/etc/init.d/rc
index 7767778..9d8024f 100644
--- a/debian/src/sysv-rc/etc/init.d/rc
+++ b/debian/src/sysv-rc/etc/init.d/rc
@@ -128,7 +128,7 @@ esac
 kill_test_add() {
 	script=$1
 	# Check if the script is there.
-	[ ! -f $script ] && return ""
+	[ ! -f $script ] && return
 
 	#
 	# Find stop script in previous runlevel but
@@ -142,14 +142,14 @@ kill_test_add() {
 	# and _no_ start script there, we don't
 	# have to re-stop the service.
 	#
-	[ -f $previous_stop ] && [ ! -f $previous_start ] && return ""
+	[ -f $previous_stop ] && [ ! -f $previous_start ] && return
 
 	# Stop the service.
-	return $script
+	SCRIPTS="$SCRIPTS $script"
 }
 start_test_add() {
 	script=$1
-	[ ! -f $script ] && return ""
+	[ ! -f $script ] && return
 
 	suffix=${script#/etc/rc$runlevel.d/S[0-9][0-9]}
 	if [ "$previous" != N ]
@@ -166,7 +166,7 @@ start_test_add() {
 		# have to re-start the service.
 		#
 		if [ start = "$ACTION" ] ; then
-			[ -f $previous_start ] && [ ! -f $stop ] && return ""
+			[ -f $previous_start ] && [ ! -f $stop ] && return
 		else
 			# Workaround for the special
 			# handling of runlevels 0 and 6.
@@ -176,11 +176,11 @@ start_test_add() {
 			# and _no_ start script there, we don't
 			# have to re-stop the service.
 			#
-			[ -f $previous_stop ] && [ ! -f $previous_start ] && return ""
+			[ -f $previous_stop ] && [ ! -f $previous_start ] && return
 		fi
 
 	fi
-	return $script
+	SCRIPTS="$SCRIPTS $script"
 }
 
 # Is there an rc directory for this new runlevel?
@@ -221,10 +221,10 @@ then
 			fi
 			if [ "$level" = "$CURLEVEL" ]
 			then
-				SCRIPTS="$SCRIPTS $(kill_test_add $s)"
+				kill_test_add $s
 				continue
 			fi
-			SCRIPTS="$SCRIPTS $(kill_test_add $s)"
+			kill_test_add $s
 
 			startup stop $SCRIPTS
 			CURLEVEL=$level
@@ -257,10 +257,10 @@ then
 			fi
 			if [ "$level" = "$CURLEVEL" ]
 			then
-				SCRIPTS="$SCRIPTS $(start_test_add $s)"
+				start_test_add $s
 				continue
 			fi
-			SCRIPTS="$SCRIPTS $(start_test_add $s)"
+			start_test_add $s
 
 			startup $ACTION $SCRIPTS
 			CURLEVEL=$level
-- 
1.8.5.3

_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-sysvinit-devel

Reply via email to