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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#!/bin/bash
# Copyright 2010 Cloudant
#
# 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.
function quit {
exit
}
PREFIX="/opt/bigcouch"
BIGCOUCH_USER=`whoami`
ABSPATH="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
DIRPATH=`dirname "$ABSPATH"`
while [ $# -gt 0 ]
do
case $1
in
-p)
PREFIX=$2
shift 2
;;
-t)
TEMPLATE=$2
shift 2
;;
-d)
DATA=$2
shift 2
;;
-v)
VIEW=$2
shift 2
;;
-u)
BIGCOUCH_USER=$2
shift 2
;;
*)
echo "usage: $0 [-p {prefix} -t {template} -d {data_dir} -v {view_dir} -u {user}]"
quit
;;
esac
done
if test ! -n "$DATA"; then DATA="$PREFIX/var/lib"; fi
if test ! -n "$VIEW"; then VIEW="$PREFIX/var/lib"; fi
echo "==> configuring bigcouch in rel/bigcouch.config"
cat > rel/bigcouch.config << EOF
{prefix, "$PREFIX"}.
{data_dir, "$DATA"}.
{view_dir, "$VIEW"}.
{user, "$BIGCOUCH_USER"}.
{node_name, "-name bigcouch"}.
{cluster_port, 5984}.
{backend_port, 5986}.
EOF
cat > install.mk << EOF
# The contents of this file are auto-generated by configure
prefix = $PREFIX
data_dir = $DATA
view_dir = $VIEW
user = $BIGCOUCH_USER
EOF
# finally, a few config files for local development nodes
for i in 1 2 3; do
cat > rel/dev$i.config << EOF
{prefix, "$DIRPATH/rel/dev$i"}.
{data_dir, "$DIRPATH/rel/tmpdata/dev$i"}.
{view_dir, "$DIRPATH/rel/tmpdata/dev$i"}.
{node_name, "-name dev$i@127.0.0.1"}.
{cluster_port, `expr 10000 \* $i + 5984`}.
{backend_port, `expr 10000 \* $i + 5986`}.
EOF
done
./rebar get-deps && mkdir -p apps/couch/ebin && cat rel/bigcouch.config
|