bfc2fdb
diff -up net-tools-1.60/netplug-1.2.9/scripts/rc.netplugd.netplugd_init net-tools-1.60/netplug-1.2.9/scripts/rc.netplugd
bfc2fdb
--- net-tools-1.60/netplug-1.2.9/scripts/rc.netplugd.netplugd_init	2005-01-08 06:43:03.000000000 +0100
bfc2fdb
+++ net-tools-1.60/netplug-1.2.9/scripts/rc.netplugd	2009-11-10 15:18:48.000000000 +0100
bfc2fdb
@@ -1,5 +1,12 @@
bfc2fdb
 #!/bin/sh
bfc2fdb
 #
bfc2fdb
+### BEGIN INIT INFO
bfc2fdb
+# Provides: netplugd
bfc2fdb
+# Short-Description: start and stop network plug daemon
bfc2fdb
+# Description: netplugd is a daemon for managing non-static network
bfc2fdb
+#              interfaces.
bfc2fdb
+### END INIT INFO
bfc2fdb
+#
bfc2fdb
 # netplugd     This shell script takes care of starting and stopping
bfc2fdb
 #              the network plug management daemon.
bfc2fdb
 #
bfc2fdb
@@ -17,48 +24,94 @@
2a549cc
 # Source networking configuration.
2a549cc
 . /etc/sysconfig/network
2a549cc
 
2a549cc
-# Check that networking is up.
2a549cc
-[ ${NETWORKING} = "no" ] && exit 0
bfc2fdb
+[ -f /etc/sysconfig/netplugd ] && . /etc/sysconfig/netplugd
bfc2fdb
+
bfc2fdb
 
2a549cc
-[ -x /sbin/netplugd ] || exit 0
bfc2fdb
+prog=netplugd
bfc2fdb
+exec=/sbin/netplugd
6138eac
+config=/etc/netplug.d/netplugd.conf
bfc2fdb
+lockfile=/var/lock/subsys/netplugd
bfc2fdb
+pidfile=/var/run/netplugd.pid
bfc2fdb
+
bfc2fdb
+check() {
bfc2fdb
+	# Check that we're a privileged user
bfc2fdb
+	[ `id -u` = 0 ] || exit 4
bfc2fdb
+	
bfc2fdb
+	# Check if netplugd is executable
bfc2fdb
+	[ -x $exec ] || exit 5
bfc2fdb
+}
bfc2fdb
 
bfc2fdb
-if [ -f /etc/sysconfig/netplugd ]; then
bfc2fdb
-    . /etc/sysconfig/netplugd
bfc2fdb
+start () {
bfc2fdb
+        check
bfc2fdb
+
bfc2fdb
+	[ ${NETWORKING} = "no" ] && exit 1
bfc2fdb
+	[ -f $config ] || exit 6
bfc2fdb
+
bfc2fdb
+	echo -n $"Starting $prog: "
bfc2fdb
+	daemon $exec ${NETPLUGDARGS} -p $pidfile
bfc2fdb
+	RETVAL=$?
bfc2fdb
+	echo
bfc2fdb
+
bfc2fdb
+	[ $RETVAL -eq 0 ] && touch $lockfile
bfc2fdb
+	return $RETVAL
bfc2fdb
+}
bfc2fdb
+
bfc2fdb
+stop () {
bfc2fdb
+        check
bfc2fdb
+
bfc2fdb
+	echo -n $"Shutting down $prog: "
bfc2fdb
+	killproc $prog
bfc2fdb
+	RETVAL=$?
bfc2fdb
+	echo
bfc2fdb
+
bfc2fdb
+	[ $RETVAL -eq 0 ] && rm -f $lockfile
bfc2fdb
+	return $RETVAL
bfc2fdb
+}
bfc2fdb
+
bfc2fdb
+restart() {
bfc2fdb
+	stop
bfc2fdb
+	start
bfc2fdb
+}
bfc2fdb
+
bfc2fdb
+rh_status() {
bfc2fdb
+    status $prog
bfc2fdb
+}
bfc2fdb
+
bfc2fdb
+rh_status_q() {
bfc2fdb
+    rh_status >/dev/null 2>&1
bfc2fdb
+}
bfc2fdb
+
bfc2fdb
+if [ $# -gt 1 ]; then
bfc2fdb
+    exit 2
2a549cc
 fi
bfc2fdb
 
bfc2fdb
-# See how we were called.
2a549cc
 case "$1" in
2a549cc
   start)
bfc2fdb
-	# Start daemon.
bfc2fdb
-	echo -n $"Starting network plug daemon: "
bfc2fdb
-	daemon /sbin/netplugd ${NETPLUGDARGS} -p /var/run/netplugd.pid
bfc2fdb
-	RETVAL=$?
bfc2fdb
-	echo
bfc2fdb
-	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd
bfc2fdb
+	rh_status_q && exit 0
bfc2fdb
+	start
bfc2fdb
 	;;
bfc2fdb
   stop)
bfc2fdb
-	# Stop daemon.
bfc2fdb
-	echo -n $"Shutting down network plug daemon: "
bfc2fdb
-	killproc netplugd
bfc2fdb
-	RETVAL=$?
bfc2fdb
-	echo
bfc2fdb
-	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd
bfc2fdb
+	rh_status_q || exit 0
bfc2fdb
+	stop
bfc2fdb
 	;;
bfc2fdb
-  status)
bfc2fdb
-	status netplugd
bfc2fdb
-	RETVAL=$?
bfc2fdb
+  restart|force-reload)
bfc2fdb
+	restart
bfc2fdb
 	;;
bfc2fdb
-  restart|reload)
bfc2fdb
-	$0 stop
bfc2fdb
-	$0 start
bfc2fdb
+  reload)
bfc2fdb
+        rh_status_q || exit 7
bfc2fdb
+        restart
bfc2fdb
+        ;;
bfc2fdb
+  condrestart|try-restart)
bfc2fdb
+	rh_status_q || exit 0
bfc2fdb
+	restart
bfc2fdb
 	;;
bfc2fdb
-  condrestart)
bfc2fdb
-	[ -f /var/lock/subsys/netplugd ] && restart || :
bfc2fdb
+  status)
bfc2fdb
+	rh_status
2a549cc
 	;;
2a549cc
   *)
bfc2fdb
-	echo $"Usage: $0 {start|stop|status|restart}"
2a549cc
-	RETVAL=1
bfc2fdb
+	echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
bfc2fdb
+	exit 2
2a549cc
 	;;
2a549cc
 esac
2a549cc
 
bfc2fdb
-exit $RETVAL
bfc2fdb
+exit $?