utilites: rename ovs-lib.sh to ovs-lib
authorChris Wright <chrisw@sous-sol.org>
Fri, 9 Dec 2011 07:36:05 +0000 (23:36 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 9 Dec 2011 17:32:06 +0000 (09:32 -0800)
Rename this helper script to simply ovs-lib, since it's primarily
a library of helper functions.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
debian/openvswitch-switch.init
debian/openvswitch-switch.install
rhel/etc_init.d_openvswitch
rhel/openvswitch.spec.in
utilities/.gitignore
utilities/automake.mk
utilities/ovs-ctl.in
utilities/ovs-lib.in [new file with mode: 0644]
utilities/ovs-lib.sh.in [deleted file]
xenserver/etc_init.d_openvswitch
xenserver/openvswitch-xen.spec

index 3d187a05642dbf266a5e40485c436761ee95db1f..6f08c3fab9f9fdfe3603a5c2cb988b83ea895ba4 100755 (executable)
@@ -25,7 +25,7 @@
 
 (test -x /usr/sbin/ovs-vswitchd && test -x /usr/sbin/ovsdb-server) || exit 0
 
-. /usr/share/openvswitch/scripts/ovs-lib.sh
+. /usr/share/openvswitch/scripts/ovs-lib
 test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
 
 if test X"$BRCOMPAT" = Xyes && test ! -x /usr/sbin/ovs-brcompatd; then
index 308c382ade69bb6c270a575a4358ea169694d2ea..a7006ac03b2c752167ead0fd7803939b52f2f57c 100644 (file)
@@ -7,6 +7,6 @@ usr/bin/ovsdb-tool
 usr/sbin/ovs-vswitchd
 usr/sbin/ovsdb-server
 usr/share/openvswitch/scripts/ovs-ctl
-usr/share/openvswitch/scripts/ovs-lib.sh
+usr/share/openvswitch/scripts/ovs-lib
 usr/share/openvswitch/scripts/ovs-save
 usr/share/openvswitch/vswitch.ovsschema
index f1a34c7a9bd6688771de7ad537e57800ea8b596e..9f1506c38697469b96ec81d5d6313e96de287706 100755 (executable)
@@ -27,7 +27,7 @@
 # Short-Description: Open vSwitch switch
 ### END INIT INFO
 
-. /usr/share/openvswitch/scripts/ovs-lib.sh || exit 1
+. /usr/share/openvswitch/scripts/ovs-lib || exit 1
 test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
 
 start () {
index 4d52d3b7ee7b3ef712a16ba656ba7b147dfc016f..3d6cda3b457720ca688e1abfffa38e8a20a38b5b 100644 (file)
@@ -147,7 +147,7 @@ exit 0
 /usr/share/openvswitch/python/
 /usr/share/openvswitch/scripts/ovs-bugtool-*
 /usr/share/openvswitch/scripts/ovs-ctl
-/usr/share/openvswitch/scripts/ovs-lib.sh
+/usr/share/openvswitch/scripts/ovs-lib
 /usr/share/openvswitch/scripts/ovs-save
 /usr/share/openvswitch/scripts/sysconfig.template
 /usr/share/openvswitch/vswitch.ovsschema
index ecc4d5f14f651d84c80a988a3993a49d66ef9c0f..d9d4419afa55b112c11d6cd508ce014d3d8ed7a8 100644 (file)
@@ -12,7 +12,7 @@
 /ovs-ctl
 /ovs-dpctl
 /ovs-dpctl.8
-/ovs-lib.sh
+/ovs-lib
 /ovs-ofctl
 /ovs-ofctl.8
 /ovs-parse-leaks
index 1c8a56b9eaf3f55a8de737d1335200248fe925d8..89078cb813a2330d1d98fbef6a4b874b7714699e 100644 (file)
@@ -14,11 +14,11 @@ bin_SCRIPTS += \
 endif
 noinst_SCRIPTS += utilities/ovs-pki-cgi
 scripts_SCRIPTS += utilities/ovs-ctl utilities/ovs-save
-scripts_DATA += utilities/ovs-lib.sh
+scripts_DATA += utilities/ovs-lib
 
 EXTRA_DIST += \
        utilities/ovs-ctl.in \
-       utilities/ovs-lib.sh.in \
+       utilities/ovs-lib.in \
        utilities/ovs-parse-leaks.in \
        utilities/ovs-pcap.in \
        utilities/ovs-pki-cgi.in \
@@ -49,7 +49,7 @@ DISTCLEANFILES += \
        utilities/ovs-benchmark.1 \
        utilities/ovs-controller.8 \
        utilities/ovs-dpctl.8 \
-       utilities/ovs-lib.sh \
+       utilities/ovs-lib \
        utilities/ovs-ofctl.8 \
        utilities/ovs-parse-leaks \
        utilities/ovs-pcap \
index 8788e4a3e90920e7ac21981c38fbf1ef18328a63..ee6035c078a9815882937056d41b2ffc2f30b6c6 100755 (executable)
@@ -17,7 +17,7 @@ case $0 in
     */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
     *) dir0=./ ;;
 esac
-. "$dir0/ovs-lib.sh" || exit 1
+. "$dir0/ovs-lib" || exit 1
 
 for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do
     case :$PATH: in
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
new file mode 100644 (file)
index 0000000..f53d4af
--- /dev/null
@@ -0,0 +1,172 @@
+# This is a shell function library sourced by some Open vSwitch scripts.
+# It is not intended to be invoked on its own.
+
+# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## ----------------- ##
+## configure options ##
+## ----------------- ##
+
+# All of these should be substituted by the Makefile at build time.
+logdir=${OVS_LOGDIR-'@LOGDIR@'}                 # /var/log/openvswitch
+rundir=${OVS_RUNDIR-'@RUNDIR@'}                 # /var/run/openvswitch
+sysconfdir=${OVS_SYSCONFDIR-'@sysconfdir@'}     # /etc
+etcdir=$sysconfdir/openvswitch                  # /etc/openvswitch
+datadir=${OVS_PKGDATADIR-'@pkgdatadir@'}        # /usr/share/openvswitch
+bindir=${OVS_BINDIR-'@bindir@'}                 # /usr/bin
+sbindir=${OVS_SBINDIR-'@sbindir@'}              # /usr/sbin
+
+VERSION='@VERSION@'
+case @BUILDNR@ in
+    [1-9]*) BUILDNR='+build@BUILDNR@' ;;
+    *) BUILDNR= ;;
+esac
+
+LC_ALL=C; export LC_ALL
+
+## ------------- ##
+## LSB functions ##
+## ------------- ##
+
+# Use the system's own implementations if it has any.
+if test -e /etc/init.d/functions; then
+    . /etc/init.d/functions
+elif test -e /etc/rc.d/init.d/functions; then
+    . /etc/rc.d/init.d/functions
+elif test -e /lib/lsb/init-functions; then
+    . /lib/lsb/init-functions
+fi
+
+# Implement missing functions (e.g. OpenSUSE lacks 'action').
+if type log_success_msg >/dev/null 2>&1; then :; else
+    log_success_msg () {
+        printf '%s.\n' "$*"
+    }
+fi
+if type log_failure_msg >/dev/null 2>&1; then :; else
+    log_failure_msg () {
+        printf '%s ... failed!\n' "$*"
+    }
+fi
+if type log_warning_msg >/dev/null 2>&1; then :; else
+    log_warning_msg () {
+        printf '%s ... (warning).\n' "$*"
+    }
+fi
+if type action >/dev/null 2>&1; then :; else
+    action () {
+       STRING=$1
+       shift
+       "$@"
+       rc=$?
+       if test $rc = 0; then
+            log_success_msg "$STRING"
+       else
+            log_failure_msg "$STRING"
+       fi
+       return $rc
+    }
+fi
+
+## ------- ##
+## Daemons ##
+## ------- ##
+
+pid_exists () {
+    # This is better than "kill -0" because it doesn't require permission to
+    # send a signal (so daemon_status in particular works as non-root).
+    test -d /proc/"$1"
+}
+
+start_daemon () {
+    priority=$1
+    shift
+    daemon=$1
+
+    # drop core files in a sensible place
+    test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD"
+    set "$@" --no-chdir
+    cd "$DAEMON_CWD"
+
+    # log file
+    test -d "$logdir" || install -d -m 755 -o root -g root "$logdir"
+    set "$@" --log-file="$logdir/$daemon.log"
+
+    # pidfile and monitoring
+    test -d "$rundir" || install -d -m 755 -o root -g root "$rundir"
+    set "$@" --pidfile="$rundir/$daemon.pid"
+    set "$@" --detach --monitor
+
+    # priority
+    if test X"$priority" != X; then
+        set nice -n "$priority" "$@"
+    fi
+
+    action "Starting $daemon" "$@"
+}
+
+DAEMON_CWD=/
+stop_daemon () {
+    if test -e "$rundir/$1.pid"; then
+        if pid=`cat "$rundir/$1.pid"`; then
+            for action in TERM .1 .25 .65 1 1 1 1 KILL 1 1 1 1 FAIL; do
+                case $action in
+                    TERM)
+                        action "Killing $1 ($pid)" kill $pid
+                        ;;
+                    KILL)
+                        action "Killing $1 ($pid) with SIGKILL" kill -9 $pid
+                        ;;
+                    FAIL)
+                        log_failure_msg "Killing $1 ($pid) failed"
+                        return 1
+                        ;;
+                    *)
+                        if pid_exists $pid >/dev/null 2>&1; then
+                            sleep $action
+                        else
+                            return 0
+                        fi
+                        ;;
+                esac
+            done
+        fi
+    fi
+    log_success_msg "$1 is not running"
+}
+
+daemon_status () {
+    pidfile=$rundir/$1.pid
+    if test -e "$pidfile"; then
+        if pid=`cat "$pidfile"`; then
+            if pid_exists "$pid"; then
+                echo "$1 is running with pid $pid"
+                return 0
+            else
+                echo "Pidfile for $1 ($pidfile) is stale"
+            fi
+        else
+            echo "Pidfile for $1 ($pidfile) exists but cannot be read"
+        fi
+    else
+        echo "$1 is not running"
+    fi
+    return 1
+}
+
+daemon_is_running () {
+    pidfile=$rundir/$1.pid
+    test -e "$pidfile" && pid=`cat "$pidfile"` && pid_exists "$pid"
+} >/dev/null 2>&1
diff --git a/utilities/ovs-lib.sh.in b/utilities/ovs-lib.sh.in
deleted file mode 100644 (file)
index f53d4af..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-# This is a shell function library sourced by some Open vSwitch scripts.
-# It is not intended to be invoked on its own.
-
-# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-## ----------------- ##
-## configure options ##
-## ----------------- ##
-
-# All of these should be substituted by the Makefile at build time.
-logdir=${OVS_LOGDIR-'@LOGDIR@'}                 # /var/log/openvswitch
-rundir=${OVS_RUNDIR-'@RUNDIR@'}                 # /var/run/openvswitch
-sysconfdir=${OVS_SYSCONFDIR-'@sysconfdir@'}     # /etc
-etcdir=$sysconfdir/openvswitch                  # /etc/openvswitch
-datadir=${OVS_PKGDATADIR-'@pkgdatadir@'}        # /usr/share/openvswitch
-bindir=${OVS_BINDIR-'@bindir@'}                 # /usr/bin
-sbindir=${OVS_SBINDIR-'@sbindir@'}              # /usr/sbin
-
-VERSION='@VERSION@'
-case @BUILDNR@ in
-    [1-9]*) BUILDNR='+build@BUILDNR@' ;;
-    *) BUILDNR= ;;
-esac
-
-LC_ALL=C; export LC_ALL
-
-## ------------- ##
-## LSB functions ##
-## ------------- ##
-
-# Use the system's own implementations if it has any.
-if test -e /etc/init.d/functions; then
-    . /etc/init.d/functions
-elif test -e /etc/rc.d/init.d/functions; then
-    . /etc/rc.d/init.d/functions
-elif test -e /lib/lsb/init-functions; then
-    . /lib/lsb/init-functions
-fi
-
-# Implement missing functions (e.g. OpenSUSE lacks 'action').
-if type log_success_msg >/dev/null 2>&1; then :; else
-    log_success_msg () {
-        printf '%s.\n' "$*"
-    }
-fi
-if type log_failure_msg >/dev/null 2>&1; then :; else
-    log_failure_msg () {
-        printf '%s ... failed!\n' "$*"
-    }
-fi
-if type log_warning_msg >/dev/null 2>&1; then :; else
-    log_warning_msg () {
-        printf '%s ... (warning).\n' "$*"
-    }
-fi
-if type action >/dev/null 2>&1; then :; else
-    action () {
-       STRING=$1
-       shift
-       "$@"
-       rc=$?
-       if test $rc = 0; then
-            log_success_msg "$STRING"
-       else
-            log_failure_msg "$STRING"
-       fi
-       return $rc
-    }
-fi
-
-## ------- ##
-## Daemons ##
-## ------- ##
-
-pid_exists () {
-    # This is better than "kill -0" because it doesn't require permission to
-    # send a signal (so daemon_status in particular works as non-root).
-    test -d /proc/"$1"
-}
-
-start_daemon () {
-    priority=$1
-    shift
-    daemon=$1
-
-    # drop core files in a sensible place
-    test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD"
-    set "$@" --no-chdir
-    cd "$DAEMON_CWD"
-
-    # log file
-    test -d "$logdir" || install -d -m 755 -o root -g root "$logdir"
-    set "$@" --log-file="$logdir/$daemon.log"
-
-    # pidfile and monitoring
-    test -d "$rundir" || install -d -m 755 -o root -g root "$rundir"
-    set "$@" --pidfile="$rundir/$daemon.pid"
-    set "$@" --detach --monitor
-
-    # priority
-    if test X"$priority" != X; then
-        set nice -n "$priority" "$@"
-    fi
-
-    action "Starting $daemon" "$@"
-}
-
-DAEMON_CWD=/
-stop_daemon () {
-    if test -e "$rundir/$1.pid"; then
-        if pid=`cat "$rundir/$1.pid"`; then
-            for action in TERM .1 .25 .65 1 1 1 1 KILL 1 1 1 1 FAIL; do
-                case $action in
-                    TERM)
-                        action "Killing $1 ($pid)" kill $pid
-                        ;;
-                    KILL)
-                        action "Killing $1 ($pid) with SIGKILL" kill -9 $pid
-                        ;;
-                    FAIL)
-                        log_failure_msg "Killing $1 ($pid) failed"
-                        return 1
-                        ;;
-                    *)
-                        if pid_exists $pid >/dev/null 2>&1; then
-                            sleep $action
-                        else
-                            return 0
-                        fi
-                        ;;
-                esac
-            done
-        fi
-    fi
-    log_success_msg "$1 is not running"
-}
-
-daemon_status () {
-    pidfile=$rundir/$1.pid
-    if test -e "$pidfile"; then
-        if pid=`cat "$pidfile"`; then
-            if pid_exists "$pid"; then
-                echo "$1 is running with pid $pid"
-                return 0
-            else
-                echo "Pidfile for $1 ($pidfile) is stale"
-            fi
-        else
-            echo "Pidfile for $1 ($pidfile) exists but cannot be read"
-        fi
-    else
-        echo "$1 is not running"
-    fi
-    return 1
-}
-
-daemon_is_running () {
-    pidfile=$rundir/$1.pid
-    test -e "$pidfile" && pid=`cat "$pidfile"` && pid_exists "$pid"
-} >/dev/null 2>&1
index 8ba8aeeb5679066ee67d6d22e7558c751508ca17..c7d0736aa113411a08a61032e29e8a0b1d2f88f6 100755 (executable)
@@ -27,7 +27,7 @@
 # Short-Description: Open vSwitch switch
 ### END INIT INFO
 
-. /usr/share/openvswitch/scripts/ovs-lib.sh || exit 1
+. /usr/share/openvswitch/scripts/ovs-lib || exit 1
 . /etc/xensource-inventory
 test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
 
index a53fcc73f6e6dde92e4acecec882cd5932506ebf..4dbc71b12b20c0ea98af9da29d9556639132f24c 100644 (file)
@@ -337,7 +337,7 @@ exit 0
 /usr/share/openvswitch/scripts/ovs-bugtool-*
 /usr/share/openvswitch/scripts/ovs-save
 /usr/share/openvswitch/scripts/ovs-ctl
-/usr/share/openvswitch/scripts/ovs-lib.sh
+/usr/share/openvswitch/scripts/ovs-lib
 /usr/share/openvswitch/vswitch.ovsschema
 /usr/sbin/ovs-vlan-bug-workaround
 /usr/sbin/ovs-vswitchd