blob: 49ae092b31a0bc71bdb6f0edca91df650fb0317a [file] [log] [blame]
#!/bin/sh -e
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
. /usr/share/debconf/confmodule
case $1 in
purge)
rm -rf /opt/couchdb/erl_crash.dump
if test -d "/opt/couchdb/etc"; then
rm -rf "/opt/couchdb/etc"
fi
if test -d "/var/log/couchdb"; then
rm -rf "/var/log/couchdb"
fi
db_input high couchdb/postrm_remove_databases || true
db_go || true
db_get couchdb/postrm_remove_databases || true
if [ "$RET" = "true" ]; then
if test -d "/var/lib/couchdb"; then
rm -rf "/var/lib/couchdb"
fi
# If we didn't delete the data, we should
# keep the uid and gid too.
if getent passwd couchdb > /dev/null; then
deluser couchdb >/dev/null 2>&1
fi
if getent group couchdb > /dev/null; then
delgroup couchdb >/dev/null 2>&1
fi
# The node name is embedded in the _dbs
# documents, so we must not reset it if
# we preserved the data.
db_reset couchdb/nodename
fi
pkill -u couchdb >/dev/null 2>&1 || true
db_reset couchdb/mode
db_reset couchdb/cookie
db_reset couchdb/adminpass
db_reset couchdb/adminpass_again
db_reset couchdb/bindaddress
;;
esac
#DEBHELPER#