#!/bin/sh # postrm script for redmine # # see: dh_installdeb(1) set -e #set -x if [ -f /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule fi case "$1" in upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; remove) if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then db_get redmine/old-instances || true gOldInstances="${RET}" for lInstance in $gOldInstances; do db_get redmine/instances/$lInstance/dbconfig-install || true if [ "$RET" = "true" ]; then ( . /usr/share/dbconfig-common/dpkg/postrm ; dbc_go redmine/instances/$lInstance $@ ) fi done db_get redmine/current-instances || true gInstances="${RET}" for lInstance in $gInstances; do db_get redmine/instances/$lInstance/dbconfig-install || true if [ "$RET" = "true" ]; then ( . /usr/share/dbconfig-common/dpkg/postrm ; dbc_go redmine/instances/$lInstance $@ ) fi done fi ;; purge) db_get redmine/old-instances || true gOldInstances="${RET}" db_get redmine/current-instances || true gInstances="${RET}" if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then for lInstance in $gOldInstances; do db_get redmine/instances/$lInstance/dbconfig-install || true if [ "$RET" = "true" ]; then ( . /usr/share/dbconfig-common/dpkg/postrm ; dbc_go redmine/instances/$lInstance $@ ) fi done for lInstance in $gInstances; do db_get redmine/instances/$lInstance/dbconfig-install || true if [ "$RET" = "true" ]; then ( . /usr/share/dbconfig-common/dpkg/postrm ; dbc_go redmine/instances/$lInstance $@ ) fi done fi if which ucf >/dev/null 2>&1; then for lInstance in $gOldInstances; do ucf --purge /etc/redmine/$lInstance/database.yml ucf --purge /etc/redmine/$lInstance/email.yml ucf --purge /etc/redmine/$lInstance/session.yml done for lInstance in $gInstances; do ucf --purge /etc/redmine/$lInstance/database.yml ucf --purge /etc/redmine/$lInstance/email.yml ucf --purge /etc/redmine/$lInstance/session.yml done fi # package-generated or runtime files are removed rm -f /usr/share/redmine/db/schema.db rm -rf /var/run/redmine rm -rf /var/log/redmine rm -rf /usr/share/redmine/tmp rm -rf /var/lib/redmine/*/sessions rm -rf /var/cache/redmine rm -rf /etc/redmine # user files are not rmdir /var/lib/redmine/*/files || true rmdir /var/lib/redmine/* || true db_purge ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0