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

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

post_upgrade() {
	mkdir -p $pkgdir/var/run/couchdb
	chown -R couchdb.daemon /etc/couchdb
	chown -R couchdb.daemon /var/{lib,log,run}/couchdb
}
