[packages/shorewall] unify initscript

glen glen at pld-linux.org
Tue Nov 26 21:48:51 CET 2013


commit 8783a6ec4883aa7b12748443f0e458568b0b1c55
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Nov 26 22:48:41 2013 +0200

    unify initscript

 shorewall.init | 49 +++++++++++++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/shorewall.init b/shorewall.init
index e4ff6bc..e725f39 100755
--- a/shorewall.init
+++ b/shorewall.init
@@ -21,30 +21,40 @@ if is_yes "${NETWORKING}"; then
 		exit 1
 	fi
 else
-        exit 0
+	exit 0
 fi
 
+start() {
+	if [ -f /var/lock/subsys/shorewall ]; then
+		msg_already_running shorewall
+		return
+	fi
+
+	msg_starting "Shorewall"
+	deltext; ok
+	# FIXME: use daemon and handle OK/FAIL
+	exec /sbin/shorewall -q start >/dev/null
+	touch /var/lock/subsys/shorewall
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/shorewall ]; then
+		msg_not_running shorewall
+		return
+	fi
+
+	msg_stopping "Shorewall"
+	deltext; ok
+	# FIXME: use killproc or handle OK/FAIL manually
+	exec /sbin/shorewall stop >/dev/null
+	rm -f /var/lock/subsys/shorewall >/dev/null 2>&1
+}
+
 # See how we were called
 case "$1" in
   start)
-	if [ ! -f /var/lock/subsys/shorewall ]; then
-		msg_starting Shorewall
-		deltext ; ok
-		exec /sbin/shorewall -q start >/dev/null
-		touch /var/lock/subsys/shorewall
-	else
-		msg_already_running shorewall
-	fi
 	;;
   stop)
-	if [ -f /var/lock/subsys/shorewall ]; then
-		msg_stopping Shorewall
-		deltext ; ok
-	        exec /sbin/shorewall stop >/dev/null
-		rm -f /var/lock/subsys/shorewall >/dev/null 2>&1
-	else
-		msg_not_running shorewall
-	fi
 	;;
   status)
 	status shorewall
@@ -52,9 +62,8 @@ case "$1" in
 	exit $?
 	;;
   restart)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
 	;;
   *)
  	msg_usage "$0 {start|stop|restart|status}"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/shorewall.git/commitdiff/8783a6ec4883aa7b12748443f0e458568b0b1c55



More information about the pld-cvs-commit mailing list