From 28b053173fc4a4d2e59f22aa5a1a5b569b3e6bad Mon Sep 17 00:00:00 2001
From: Martin Pitt <mpitt@debian.org>
Date: Thu, 20 Sep 2012 08:49:43 +0200
Subject: [PATCH] debian/maintscripts-functions: Only try to remove the
 tsearch_data directory  if it already exists. Thanks Peter Palfrader.
 (Closes: #688105)

---
 debian/changelog              | 2 ++
 debian/maintscripts-functions | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 6d075401..961ab88b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ postgresql-common (136) UNRELEASED; urgency=low
     cleaning up after itself, and faster as well.
   * pg_ctlcluster: Fix log output to stderr if the log file started out being
     empty. Add test case to t/030_errors.t.
+  * debian/maintscripts-functions: Only try to remove the tsearch_data
+    directory  if it already exists. Thanks Peter Palfrader. (Closes: #688105)
 
   [ Christoph Berg ]
   * pg_buildext: Fix supported-versions not to die when the last version is
diff --git a/debian/maintscripts-functions b/debian/maintscripts-functions
index 7aa0605c..775c58fa 100644
--- a/debian/maintscripts-functions
+++ b/debian/maintscripts-functions
@@ -18,7 +18,9 @@ _unlink_manpages() {
 }
 
 _remove_tsearch() {
-    find /usr/share/postgresql/$1/tsearch_data -type l \( -name '*.dict' -o -name '*.affix' \) -exec rm '{}' \;
+   if [ -e /usr/share/postgresql/$1/tsearch_data ]; then
+       find /usr/share/postgresql/$1/tsearch_data -type l \( -name '*.dict' -o -name '*.affix' \) -exec rm '{}' \;
+   fi
 }
 
 # arguments: <major version> <most recently configured package version>
-- 
GitLab