[DRE-commits] [redmine] 04/19: Reimplement removing instances
Antonio Terceiro
terceiro at moszumanska.debian.org
Mon Feb 15 12:31:24 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository redmine.
commit 9657415b207ee0a45baaacd61937db92afcc43b7
Author: Antonio Terceiro <terceiro at debian.org>
Date: Mon Feb 15 08:30:37 2016 -0200
Reimplement removing instances
Greatly simplified wrt previous versions
---
debian/config | 18 ------------------
debian/postinst | 12 ------------
debian/postrm | 8 +++-----
debian/templates | 10 ++--------
4 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/debian/config b/debian/config
index 3ec21de..e4f36bf 100644
--- a/debian/config
+++ b/debian/config
@@ -10,7 +10,6 @@ if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
dbc_dbtypes="sqlite3, pgsql, mysql"
. /usr/share/dbconfig-common/dpkg/config
- db_set redmine/old-instances ""
db_get redmine/current-instances || true
original_instances="$RET"
@@ -51,23 +50,6 @@ if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
dbc_go redmine/instances/$inst "$@"
done
- # determine which instances were removed and store in redmine/old-instances
- removed_instances=""
- separator=""
- for orig in $original_instances; do
- removed='true'
- for curr in $current_instances; do
- if [ "$orig" = "$curr" ]; then
- removed='false'
- break
- fi
- done
- if [ "$removed" = 'true' ]; then
- removed_instances="${separator}$removed_instances"
- separator=" "
- fi
- done
- db_set redmine/old-instances "$removed_instances"
fi
fi
diff --git a/debian/postinst b/debian/postinst
index d0b19e7..7ad0a31 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -65,22 +65,10 @@ manage_instance() {
su www-data -s /bin/sh -c "REDMINE_INSTANCE=$instance REDMINE_LANG=$REDMINE_LANG bundle exec rake redmine:load_default_data"
}
-remove_instance() {
- local instance="$1"
- # TODO
- echo "Removing instance $instance ..."
-}
-
db_get redmine/current-instances || true
instances="$RET"
for inst in $instances; do
manage_instance "$inst" "$@"
done
-db_get redmine/old-instances || true
-removed_instances="$RET"
-for inst in $removed_instances; do
- remove_instance "$inst" "$@"
-done
-
##DEBHELPER##
diff --git a/debian/postrm b/debian/postrm
index 02d782a..1bd4f54 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -6,11 +6,9 @@ set -e
if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
. /usr/share/dbconfig-common/dpkg/postrm
- db_get redmine/current-instances || true
- instances="$RET"
-
- # remove all instances
- for inst in "$instances"; do
+ # remove both current and old instances
+ instances=$(ls -1 /etc/redmine/*/database.yml | xargs dirname | xargs -n 1 basename)
+ for inst in $instances; do
dbc_go redmine/instances/$inst "$@"
done
fi
diff --git a/debian/templates b/debian/templates
index ed9cab8..7a81cec 100644
--- a/debian/templates
+++ b/debian/templates
@@ -1,10 +1,3 @@
-Template: redmine/old-instances
-Type: string
-_Description: Redmine instances to be deconfigured:
- Configuration files for these instances will be removed.
- .
- Database (de)configuration will be asked accordingly.
-
Template: redmine/current-instances
Type: string
Default: default
@@ -14,6 +7,8 @@ _Description: Redmine instances to be configured or upgraded:
Each instance has its configuration files in /etc/redmine/<instance-identifier>/
.
To deconfigure an instance, remove its identifier from this list.
+ Configuration files and data from removed instances will not be deleted until
+ the package is purged, but they will be no longer managed automatically.
Template: redmine/default-language
Type: select
@@ -23,7 +18,6 @@ _Description: Default redmine language:
Template: redmine/missing-redmine-package
Type: error
-#flag:translate!:5
_Description: redmine-${dbtype} package required
Redmine instance ${instance} is configured to use database type ${dbtype},
but the corresponding redmine-${dbtype} package is not installed.
--
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