post_install() {
    id couchdb &>/dev/null || \
        useradd -r -c "CouchDB daemon" -g daemon -d /var/lib/couchdb -s /bin/false couchdb
    chown couchdb.daemon /etc/couchdb/local.ini
    chown -R couchdb.daemon /var/lib/couchdb
}

pre_upgrade() {
    id couchdb &>/dev/null || \
        useradd -r -c "CouchDB daemon" -g daemon -d /var/lib/couchdb -s /bin/false couchdb
}

post_upgrade() {
    chown couchdb.daemon /etc/couchdb/local.ini
    chown -R couchdb.daemon /var/lib/couchdb
}
