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