[DRE-commits] [redmine] 01/01: Pass instance list to postrm to ensure removal works when things are broken
Marc Dequènes
duck at moszumanska.debian.org
Mon Nov 20 09:14:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
duck pushed a commit to branch master
in repository redmine.
commit c5ab794c3b33825d2adc294fe1d7c77e6fe9a50b
Author: Marc Dequènes (Duck) <Duck at DuckCorp.org>
Date: Mon Nov 20 15:20:18 2017 +0900
Pass instance list to postrm to ensure removal works when things are broken
---
debian/changelog | 2 ++
debian/postrm | 2 +-
debian/prerm | 7 +++++++
debian/tests/control | 4 ++++
debian/tests/install-break-purge | 12 ++++++++++++
5 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index ba1a0cd..52856bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ redmine (3.4.2-1) UNRELEASED; urgency=medium
* Priority 'extra' is deprecated, switch to 'optional'.
* Bumped Standards-Version.
* Reload all Passenger instances (Closes: #879104).
+ * Pass instance list to postrm to ensure removal works when things are
+ broken (found in #868955).
[ Lucas Kanashiro ]
* debian/copyright: fix path of redcloth3.rb file
diff --git a/debian/postrm b/debian/postrm
index 1fb1624..c863c18 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -7,7 +7,7 @@ if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
. /usr/share/dbconfig-common/dpkg/postrm
# remove both current and old instances
- instances=$(ls -1 /etc/redmine/*/database.yml | xargs dirname | xargs -n 1 basename)
+ instances=$(cat /etc/redmine/.instances)
for inst in $instances; do
dbc_go redmine/instances/$inst "$@"
diff --git a/debian/prerm b/debian/prerm
index cc39863..06b9cc1 100644
--- a/debian/prerm
+++ b/debian/prerm
@@ -13,6 +13,13 @@ if [ -f /usr/share/dbconfig-common/dpkg/prerm ]; then
for inst in "$instances"; do
dbc_go redmine/instances/$inst "$@"
done
+
+ # remember the instance list for postrm
+ # (the dbconf DB is cleaned already,
+ # listing the /etc/redmine subdirectories might not match reality
+ # and we should always be able to uninstall no matter how broken things are)
+ mkdir -p /etc/redmine
+ echo "$instances" >/etc/redmine/.instances
fi
##DEBHELPER##
diff --git a/debian/tests/control b/debian/tests/control
index d1acd92..78e301d 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -21,3 +21,7 @@ Restrictions: needs-root
Tests: install-purge-install
Depends: redmine
Restrictions: needs-root
+
+Tests: install-break-purge
+Depends: redmine
+Restrictions: needs-root
diff --git a/debian/tests/install-break-purge b/debian/tests/install-break-purge
new file mode 100755
index 0000000..373f380
--- /dev/null
+++ b/debian/tests/install-break-purge
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+exec 2>&1
+set -exu
+
+export DEBIAN_FRONTEND=noninteractive
+
+# if install failed for some reason or the user broke the configuration
+# we should still be able to cleanup things
+rm -rf /etc/redmine
+
+apt-get purge -qy redmine
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/redmine.git
More information about the Pkg-ruby-extras-commits
mailing list