From bd951f510c072fa6945e5056ff35e81b665b7779 Mon Sep 17 00:00:00 2001
From: An-Cheng Huang <ancheng@vyatta.com>
Date: Wed, 8 Sep 2010 18:10:24 -0700
Subject: fix for bug 6159

* divert bash_completion.sh so that completion scripts are only sourced once.
* also move /bin/sh diversion here (from ISO build).
---
 debian/vyatta-bash.preinst | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 debian/vyatta-bash.preinst

diff --git a/debian/vyatta-bash.preinst b/debian/vyatta-bash.preinst
new file mode 100644
index 0000000..ad37015
--- /dev/null
+++ b/debian/vyatta-bash.preinst
@@ -0,0 +1,21 @@
+#! /bin/sh -e
+
+force_divert ()
+{
+  dfile=$1
+  dpkg-divert --remove $dfile || true
+  dpkg-divert --add $dfile || true
+  mv -f $dfile $dfile.distrib >/dev/null 2>&1 || true
+}
+
+# remove dash's divert and create a "local" one
+force_divert /bin/sh
+ln -sf bash /bin/sh
+
+# divert /etc/profile.d/bash_completion.sh so the completion scripts don't
+# get sourced twice.
+force_divert /etc/profile.d/bash_completion.sh
+
+#DEBHELPER#
+
+exit 0
-- 
cgit v1.2.3