Blob Blame History Raw
diff -up ebtables-v2.0.9-1/ebtables.sysv.lsb ebtables-v2.0.9-1/ebtables.sysv
--- ebtables-v2.0.9-1/ebtables.sysv.lsb	2010-01-15 11:39:31.000000000 +0100
+++ ebtables-v2.0.9-1/ebtables.sysv	2010-01-15 12:52:24.000000000 +0100
@@ -18,9 +18,9 @@ source /etc/sysconfig/network
 # Check that networking is up.
 [ ${NETWORKING} = "no" ] && exit 0
 
-[ -x __EXEC_PATH__/ebtables ] || exit 1
-[ -x __EXEC_PATH__/ebtables-save ] || exit 1
-[ -x __EXEC_PATH__/ebtables-restore ] || exit 1
+[ -x __EXEC_PATH__/ebtables ] || exit 5
+[ -x __EXEC_PATH__/ebtables-save ] || exit 5
+[ -x __EXEC_PATH__/ebtables-restore ] || exit 5
 
 RETVAL=0
 prog="ebtables"
@@ -39,6 +39,7 @@ config=__SYSCONFIG__/$prog-config
 [ -f "$config" ] && . "$config"
 
 start() {
+	[ "$EUID" != "0" ] && exit 4
 	echo -n $"Starting $desc ($prog): "
 	if [ "$EBTABLES_BINARY_FORMAT" = "yes" ]; then
 		for table in $(ls __SYSCONFIG__/ebtables.* 2>/dev/null | sed -e 's/.*ebtables\.//' -e '/save/d' ); do
@@ -50,7 +51,7 @@ start() {
 
 	if [ $RETVAL -eq 0 ]; then
 		success "$prog startup"
-		rm -f /var/lock/subsys/$prog
+		touch "/var/lock/subsys/$prog"
 	else
 		failure "$prog startup"
 	fi
@@ -58,6 +59,7 @@ start() {
 }
 
 stop() {
+	[ "$EUID" != "0" ] && exit 4
 	echo -n $"Stopping $desc ($prog): "
 	for table in $(grep '^ebtable_' /proc/modules | sed -e 's/ebtable_\([^ ]*\).*/\1/'); do
 		__EXEC_PATH__/ebtables -t $table --init-table || RETVAL=1
@@ -71,7 +73,7 @@ stop() {
 
 	if [ $RETVAL -eq 0 ]; then
 		success "$prog shutdown"
-		rm -f /var/lock/subsys/$prog
+		rm -f "/var/lock/subsys/$prog"
 	else
 		failure "$prog shutdown"
 	fi
@@ -79,11 +81,13 @@ stop() {
 }
 
 restart() {
+	[ "$EBTABLES_SAVE_ON_RESTART" = "yes" ] && save
 	stop
 	start
 }
 
 save() {
+	[ "$EUID" != "0" ] && exit 4
 	echo -n $"Saving $desc ($prog): "
 	if [ "$EBTABLES_TEXT_FORMAT" = "yes" ]; then
 		if [ -e __SYSCONFIG__/ebtables ]; then
@@ -116,30 +120,34 @@ save() {
 
 case "$1" in
   start)
+	[ -f "/var/lock/subsys/$prog" ] && exit 0
 	start
 	;;
   stop)
 	[ "$EBTABLES_SAVE_ON_STOP" = "yes" ] && save
 	stop
 	;;
-  restart|reload)
-	[ "$EBTABLES_SAVE_ON_RESTART" = "yes" ] && save
+  restart|force-reload)
 	restart
 	;;
-  condrestart)
-	[ -e /var/lock/subsys/$prog ] && restart
-	RETVAL=$?
+  reload)
+	[ ! -f "/var/lock/subsys/$prog" ] && exit 7
+	restart
+	;;
+  condrestart|try-restart)
+	[ ! -e "/var/lock/subsys/$prog" ] && exit 0
+	restart
 	;;
   save)
 	save
 	;;
   status)
+	[ -f "/var/lock/subsys/$prog" ] && RETVAL=0 || RETVAL=3
 	__EXEC_PATH__/ebtables-save
-	RETVAL=$?
 	;;
   *)
 	echo $"Usage $0 {start|stop|restart|condrestart|save|status}"
-	RETVAL=1
+	RETVAL=2
 esac
 
 exit $RETVAL