Debian bug #681880.
CC: [email protected]
Reported-by: Bastian Blank <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
---
REPORTING-BUGS | 2 +-
debian/automake.mk | 1 +
debian/openvswitch-switch.dirs | 1 +
debian/openvswitch-switch.postinst | 15 +++++++++++
debian/openvswitch-switch.postrm | 4 +-
debian/openvswitch-switch.prerm | 50 ++++++++++++++++++++++++++++++++++++
6 files changed, 70 insertions(+), 3 deletions(-)
create mode 100755 debian/openvswitch-switch.prerm
diff --git a/REPORTING-BUGS b/REPORTING-BUGS
index 86510d2..af0096b 100644
--- a/REPORTING-BUGS
+++ b/REPORTING-BUGS
@@ -32,7 +32,7 @@ The following are also handy sometimes:
your OS (e.g. "Centos 5.0").
* The contents of the vswitchd configuration database (usually
- /etc/openvswitch/conf.db).
+ /etc/openvswitch/conf.db or /var/lib/openvswitch/conf.db).
* The output of "ovs-dpctl show".
diff --git a/debian/automake.mk b/debian/automake.mk
index b6cb12e..b025cdd 100644
--- a/debian/automake.mk
+++ b/debian/automake.mk
@@ -44,6 +44,7 @@ EXTRA_DIST += \
debian/openvswitch-switch.manpages \
debian/openvswitch-switch.postinst \
debian/openvswitch-switch.postrm \
+ debian/openvswitch-switch.prerm \
debian/openvswitch-switch.template \
debian/openvswitch-switch.links \
debian/openvswitch-test.dirs \
diff --git a/debian/openvswitch-switch.dirs b/debian/openvswitch-switch.dirs
index 0b1f281..ccbbbf7 100644
--- a/debian/openvswitch-switch.dirs
+++ b/debian/openvswitch-switch.dirs
@@ -1,2 +1,3 @@
/etc/openvswitch
+/var/lib/openvswitch
/usr/share/openvswitch/switch
diff --git a/debian/openvswitch-switch.postinst
b/debian/openvswitch-switch.postinst
index 7b9d7bc..38e1eee 100755
--- a/debian/openvswitch-switch.postinst
+++ b/debian/openvswitch-switch.postinst
@@ -33,6 +33,21 @@ case "$1" in
fi
done
fi
+
+ # Ensure that /etc/openvswitch/conf.db links to /var/lib/openvswitch,
+ # moving an existing file if there is one.
+ #
+ # Ditto for .conf.db.~lock~.
+ for base in conf.db .conf.db.~lock~; do
+ new=/var/lib/openvswitch/$base
+ old=/etc/openvswitch/$base
+ if test -f $old && test ! -e $new; then
+ mv $old $new
+ fi
+ if test ! -e $old && test ! -h $old; then
+ ln -s $new $old
+ fi
+ done
;;
abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/openvswitch-switch.postrm b/debian/openvswitch-switch.postrm
index 88bf9fc..ff4ae4a 100755
--- a/debian/openvswitch-switch.postrm
+++ b/debian/openvswitch-switch.postrm
@@ -21,8 +21,8 @@ set -e
case "$1" in
purge)
- rm -f /etc/openvswitch/conf.db
- rm -f /etc/openvswitch/.conf.db.~lock~
+ rm -f /etc/openvswitch/conf.db /etc/openvswitch/.conf.db.~lock~
+ rm -f /var/lib/openvswitch/conf.db /var/lib/openvswitch/.conf.db.~lock~
rm -f /etc/default/openvswitch-switch
rm -f /var/log/openvswitch/ovs-vswitchd.log* || true
rm -f /var/log/openvswitch/ovsdb-server.log* || true
diff --git a/debian/openvswitch-switch.prerm b/debian/openvswitch-switch.prerm
new file mode 100755
index 0000000..9221ef1
--- /dev/null
+++ b/debian/openvswitch-switch.prerm
@@ -0,0 +1,50 @@
+#!/bin/sh
+# prerm script for openvswitch-switch
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ upgrade)
+ # Ensure that conf.db and its lockfile in /etc/openvswitch are not
+ # dangling symlinks, because this caused ovsdb-server to hang at
+ # startup in versions of OVS older than 1.4.2+git20120612-7.
+ for base in conf.db .conf.db.~lock~; do
+ fn=/etc/openvswitch/$base
+ if test -h $fn && test ! -e $fn; then
+ rm -f $fn
+ fi
+ done
+ ;;
+
+ remove|deconfigure)
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm 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
--
1.7.2.5
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev