[ovs-dev,2/2] openvswitch-switch.postinst: Avoid getting redirected to systemctl.
diff mbox

Message ID 1497870359-24320-2-git-send-email-guru@ovn.org
State Deferred
Headers show

Commit Message

Guru Shetty June 19, 2017, 11:05 a.m. UTC
When the openvswitch-switch package is installed, postinst script
is used to make a call to /etc/init.d/openvswitch-switch with
"restart" as the command. openvswitch-switch.init inturn would carefully
restart OVS by saving the openflow flows and replacing the kernel
module only when needed.

With recent versions of Ubuntu and Debian, any call of "restart"
no longer calls the "restart" of openvswitch-switch.init but instead
calls a runtime generated systemd file which inturn makes a "stop"
call followed by a "start" call. This would mean that we would neither
save flows or replace the kernel module.

This commit tries to solve this problem by getting rid of '#DEBHELPER'
and replacing "restart" with "ovsrestart" so that we skip systemd
generated files.

VMware-BZ: #1890631
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
 debian/openvswitch-switch.postinst | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff mbox

diff --git a/debian/openvswitch-switch.postinst b/debian/openvswitch-switch.postinst
index 2464572..3fc0361 100755
--- a/debian/openvswitch-switch.postinst
+++ b/debian/openvswitch-switch.postinst
@@ -54,6 +54,14 @@  export OVS_MISSING_KMOD_OK
+if [ -x "/etc/init.d/openvswitch-switch" ]; then
+        update-rc.d openvswitch-switch defaults >/dev/null
+        if [ -n "$2" ]; then
+                _dh_action=ovsrestart
+        else
+                _dh_action=start
+        fi
+        invoke-rc.d openvswitch-switch $_dh_action || exit $?
 exit 0