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
# 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
rm -rf /opt/couchdb/erl_crash.dump
if test -d "/opt/couchdb/etc"; then
rm -rf "/opt/couchdb/etc"
if test -d "/var/log/couchdb"; then
rm -rf "/var/log/couchdb"
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"
# 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
if getent group couchdb > /dev/null; then
delgroup couchdb >/dev/null 2>&1
# The node name is embedded in the _dbs
# documents, so we must not reset it if
# we preserved the data.
db_reset couchdb/nodename
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