[ovs-dev] [PATCH v2 4/5] debian: Add a package for OVN central components.

Gurucharan Shetty guru at ovn.org
Wed Dec 16 22:47:10 UTC 2015


Signed-off-by: Gurucharan Shetty <guru at ovn.org>
---
v1-v2:
change name from openvswitch-ovn-central to ovn-central
---
 debian/.gitignore           |    1 +
 debian/automake.mk          |    7 ++++++
 debian/control              |   16 +++++++++++++
 debian/ovn-central.dirs     |    1 +
 debian/ovn-central.init     |   53 +++++++++++++++++++++++++++++++++++++++++++
 debian/ovn-central.install  |    3 +++
 debian/ovn-central.manpages |    3 +++
 debian/ovn-central.postinst |   49 +++++++++++++++++++++++++++++++++++++++
 debian/ovn-central.postrm   |   48 +++++++++++++++++++++++++++++++++++++++
 debian/ovn-central.template |    5 ++++
 debian/rules                |    3 +++
 11 files changed, 189 insertions(+)
 create mode 100644 debian/ovn-central.dirs
 create mode 100755 debian/ovn-central.init
 create mode 100644 debian/ovn-central.install
 create mode 100644 debian/ovn-central.manpages
 create mode 100755 debian/ovn-central.postinst
 create mode 100755 debian/ovn-central.postrm
 create mode 100644 debian/ovn-central.template

diff --git a/debian/.gitignore b/debian/.gitignore
index a7a2be8..40fea69 100644
--- a/debian/.gitignore
+++ b/debian/.gitignore
@@ -20,5 +20,6 @@
 /openvswitch-vtep
 /ovn-common
 /ovn-host
+/ovn-central
 /python-openvswitch
 /tmp
diff --git a/debian/automake.mk b/debian/automake.mk
index 422cdc9..01697b6 100644
--- a/debian/automake.mk
+++ b/debian/automake.mk
@@ -50,6 +50,13 @@ EXTRA_DIST += \
 	debian/openvswitch-vtep.init \
 	debian/openvswitch-vtep.install \
 	debian/openvswitch-vtep.manpages \
+	debian/ovn-central.dirs \
+	debian/ovn-central.init \
+	debian/ovn-central.install \
+	debian/ovn-central.manpages \
+	debian/ovn-central.postinst \
+	debian/ovn-central.postrm \
+	debian/ovn-central.template \
 	debian/ovn-common.install \
 	debian/ovn-common.manpages \
 	debian/ovn-host.dirs \
diff --git a/debian/control b/debian/control
index 725f552..2e315e2 100644
--- a/debian/control
+++ b/debian/control
@@ -128,6 +128,22 @@ Description: OVN host components
  ovn-host provides the userspace components and utilities for
  OVN that can be run on every host/hypervisor.
 
+Package: ovn-central
+Architecture: linux-any
+Depends: openvswitch-switch (= ${binary:Version}),
+         openvswitch-common (= ${binary:Version}),
+         ovn-common (= ${binary:Version}),
+         ${misc:Depends},
+         ${shlibs:Depends}
+Description: OVN central components
+ OVN, the Open Virtual Network, is a system to support virtual network
+ abstraction.  OVN complements the existing capabilities of OVS to add
+ native support for virtual network abstractions, such as virtual L2 and L3
+ overlays and security groups.
+ .
+ ovn-central provides the userspace daemons, utilities and
+ databases for OVN that is run at a central location.
+
 Package: openvswitch-ipsec
 Architecture: linux-any
 Depends: ipsec-tools (>=0.8~alpha20101208),
diff --git a/debian/ovn-central.dirs b/debian/ovn-central.dirs
new file mode 100644
index 0000000..6394883
--- /dev/null
+++ b/debian/ovn-central.dirs
@@ -0,0 +1 @@
+/usr/share/ovn/central
diff --git a/debian/ovn-central.init b/debian/ovn-central.init
new file mode 100755
index 0000000..a75192f
--- /dev/null
+++ b/debian/ovn-central.init
@@ -0,0 +1,53 @@
+#! /bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          ovn-central
+# Required-Start:    openvswitch-switch $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: OVN central components
+# Description:       ovn-central provides the userspace daemons,
+#                    utilities and databases for OVN that is run at a central
+#                    location.
+### END INIT INFO
+
+test -x /usr/bin/ovn-northd  || exit 0
+test -x /usr/share/openvswitch/scripts/ovn-ctl || exit 0
+
+_SYSTEMCTL_SKIP_REDIRECT=yes
+
+. /usr/share/openvswitch/scripts/ovs-lib
+if [ -e /etc/default/ovn-central ]; then
+    . /etc/default/ovn-central
+fi
+
+start () {
+    set /usr/share/openvswitch/scripts/ovn-ctl ${1-start_northd}
+    set "$@" $OVN_CTL_OPTS
+    "$@" || exit $?
+}
+
+case $1 in
+    start)
+        start
+        ;;
+    stop)
+        /usr/share/openvswitch/scripts/ovn-ctl stop_northd
+        ;;
+    restart)
+        start restart_northd
+        ;;
+    reload | force-reload)
+        ;;
+    status)
+        /usr/share/openvswitch/scripts/ovn-ctl status_northd
+        exit $?
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|reload|force-reload|restart|status}" >&2
+        exit 1
+        ;;
+esac
+
+exit 0
diff --git a/debian/ovn-central.install b/debian/ovn-central.install
new file mode 100644
index 0000000..733d3fc
--- /dev/null
+++ b/debian/ovn-central.install
@@ -0,0 +1,3 @@
+usr/bin/ovn-northd
+usr/share/openvswitch/ovn-nb.ovsschema
+usr/share/openvswitch/ovn-sb.ovsschema
diff --git a/debian/ovn-central.manpages b/debian/ovn-central.manpages
new file mode 100644
index 0000000..60ac082
--- /dev/null
+++ b/debian/ovn-central.manpages
@@ -0,0 +1,3 @@
+ovn/ovn-nb.5
+ovn/ovn-sb.5
+ovn/northd/ovn-northd.8
diff --git a/debian/ovn-central.postinst b/debian/ovn-central.postinst
new file mode 100755
index 0000000..bdf5c4a
--- /dev/null
+++ b/debian/ovn-central.postinst
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for ovn-central
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+	DEFAULT=/etc/default/ovn-central
+	TEMPLATE=/usr/share/ovn/central/default.template
+	if ! test -e $DEFAULT; then
+	    cp $TEMPLATE $DEFAULT
+	else
+            for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
+            do
+                if ! grep $var $DEFAULT >/dev/null 2>&1; then
+	            echo >> $DEFAULT
+	            sed -n "/$var:/,/$var=/p" $TEMPLATE >> $DEFAULT
+                fi
+            done
+	fi
+        ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+        ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+        ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/ovn-central.postrm b/debian/ovn-central.postrm
new file mode 100755
index 0000000..0e654a3
--- /dev/null
+++ b/debian/ovn-central.postrm
@@ -0,0 +1,48 @@
+#!/bin/sh
+# postrm script for ovn-central
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge)
+        rm -f /etc/default/ovn-central
+        rm -f /etc/openvswitch/ovnnb.db*
+        rm -f /etc/openvswitch/.ovnnb.db.~lock~
+        rm -f /etc/openvswitch/ovnsb.db*
+        rm -f /etc/openvswitch/.ovnsb.db.~lock~
+        rm -f /var/log/openvswitch/ovn-northd.log* || true
+        ;;
+
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+        ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+        ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/ovn-central.template b/debian/ovn-central.template
new file mode 100644
index 0000000..7cea13e
--- /dev/null
+++ b/debian/ovn-central.template
@@ -0,0 +1,5 @@
+# This is a POSIX shell fragment                -*- sh -*-
+
+# OVN_CTL_OPTS: Extra options to pass to ovs-ctl.  This is, for example,
+# a suitable place to specify --ovn-northd-wrapper=valgrind.
+# OVN_CTL_OPTS=
diff --git a/debian/rules b/debian/rules
index f95f509..cc17cd0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -57,6 +57,9 @@ override_dh_install:
 	# ovn-host
 	cp debian/ovn-host.template debian/ovn-host/usr/share/ovn/host/default.template
 
+	# ovn-central
+	cp debian/ovn-central.template debian/ovn-central/usr/share/ovn/central/default.template
+
 	# openvswitch-datapath-source
 	cp debian/rules.modules debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
 	chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
-- 
1.7.9.5




More information about the dev mailing list