]> git.pld-linux.org Git - packages/openvswitch.git/commitdiff
- add some PLD magic
authorJan Rękorajski <baggins@pld-linux.org>
Mon, 19 Mar 2012 21:11:13 +0000 (21:11 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    openvswitch.init -> 1.2

openvswitch.init

index 3fcdc5c2e6bae6b553c8ce6a6651f25094a7b2dc..a739ccff660969a117f794c51b710760d1a1bbb9 100644 (file)
@@ -7,8 +7,8 @@
 
 ### BEGIN INIT INFO
 # Provides:          openvswitch-switch
-# Required-Start:
-# Required-Stop:
+# Required-Start:    $network $named $remote_fs $syslog
+# Required-Stop:     $remote_fs
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: Open vSwitch switch
@@ -42,9 +42,22 @@ else
 fi
 
 start () {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/openvswitch ]; then
+               msg_already_running "Open vSwitch switch"
+               return
+       fi
+
+       show "Loading Open vSwitch kernel modules"
+       busy
        if ! $ovs_ctl load-kmod; then
-               return 1
+               fail
+               RETVAL=1
+               return
        fi
+       ok
+       msg_starting "Open vSwitch switch"
+       busy
        $ovs_ctl ${1:-start} \
                --system-id=random \
                --force-corefiles=$FORCE_COREFILES \
@@ -52,45 +65,57 @@ start () {
                --ovs-vswitchd-priority=$VSWITCHD_PRIORITY \
                --mlockall=$VSWITCHD_MLOCKALL \
                $OPENVSWITCH_OPTIONS
-
-       $ovs_ctl --protocol=gre enable-protocol
-
-       touch /var/lock/subsys/openvswitch
+       RETVAL=$?
+       if [ $RETVAL -eq 0 ]; then
+               $ovs_ctl --protocol=gre enable-protocol
+               [ $? -eq 0 ] || RETVAL=$?
+       fi
+       if [ $RETVAL -eq 0 ]; then
+               ok
+               touch /var/lock/subsys/openvswitch
+       else
+               fail
+       fi
 }
 
 stop () {
+       if [ ! -f /var/lock/subsys/openvswitch ]; then
+               msg_not_running "Open vSwitch switch"
+               return
+       fi
+
+       msg_stopping "Open vSwitch switch"
+       busy
        $ovs_ctl stop
+       ok
        rm -f /var/lock/subsys/openvswitch
 }
 
-case $1 in
-    start)
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
         start
         ;;
-    stop)
+  stop)
         stop
         ;;
-    restart)
+  restart)
         stop
         start
         ;;
-    reload|force-reload)
-        # Nothing to do.
-        ;;
-    status)
+  status)
         $ovs_ctl status
         ;;
-    version)
+  version)
         $ovs_ctl version
         ;;
-    force-reload-kmod)
+  force-reload-kmod)
         start force-reload-kmod
         ;;
-    help)
-        printf "$0 [start|stop|restart|reload|force-reload|status|version|force-reload-kmod]\n"
-        ;;
-    *)
-        printf "Unknown command: $1\n"
-        exit 1
-        ;;
+  *)
+       msg_usage "$0 {start|stop|restart|status|version|force-reload-kmod}"
+       exit 3
 esac
+
+exit $RETVAL
This page took 0.202219 seconds and 4 git commands to generate.