~statik/ubuntu/karmic/couchdb/fix-bug427036

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh -e

# Copyright 2009, Noah Slater <nslater@tumbolia.org>

# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice and this
# notice are preserved.

case $1 in
    configure)
        if ! getent passwd couchdb > /dev/null; then
            adduser --system --quiet \
                --home /var/lib/couchdb --no-create-home \
                --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb
        fi
        if test "`id -u couchdb`" -eq 0; then
            echo "The couchdb administrative user must not be root." >&2
            false
        fi
        if test "`id -g couchdb`" -eq 0; then
            echo "The couchdb administrative group must not be root." >&2
            false
        fi
        chown -R couchdb:couchdb /etc/couchdb
        chown -R couchdb:couchdb /var/lib/couchdb
        chown -R couchdb:couchdb /var/log/couchdb
        chmod 0775 /etc/couchdb
        chmod 0774 /etc/couchdb/default.ini
        chmod 0770 /etc/couchdb/local.ini
        chmod -R 0770 /var/lib/couchdb
        chmod -R 0770 /var/log/couchdb
        ;;
esac

#DEBHELPER#