-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·151 lines (134 loc) · 3.22 KB
/
configure
File metadata and controls
executable file
·151 lines (134 loc) · 3.22 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
# 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.
OS=`uname -s`
ARCH=`uname -m`
VERSION=`git describe --tags`
# PREFIX is by default the current directory
PREFIX="/opt/rcouch"
RCOUCH_USER=`whoami`
ABSPATH="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
if test ! -n "$DIRPATH"; then DIRPATH=`dirname "$ABSPATH"`; fi
basename=`basename $0`
display_error () {
if test -n "$1"; then
echo $1 >&2
fi
echo >&2
echo "Try \`"$basename" -h' for more information." >&2
false
}
display_help ()
{
cat << EOF
Usage: $basename [OPTION]
-p PREFIX prefix path
-d DATA set the database directory ($PREFIX/var/lib)
-l LOG set the log directory ($PREFIX/var/log)
-v VIEW set the view directory ($PREFIX/var/lib)
-u USER set the user directory
-r RUN set the run directory ($PREFIX/var/run)
-s SYSCONF sett the sysconf directory ($PREFIX/etc)
EOF
}
CURL_BIN=`which curl`
if ! test -n "CURL_BIN"; then
display_error "Error: curl is required. Add it to 'PATH'"
exit 1
fi
while [ $# -gt 0 ]
do
case $1
in
-p)
PREFIX=$2
shift 2
;;
-d)
DATA=$2
shift 2
;;
-l)
LOG=$2
shift 2
;;
-v)
VIEW=$2
shift 2
;;
-u)
RCOUCH_USER=$2
shift 2
;;
-r)
RUN=$2
shift 2
;;
-R)
RCOUCH_USER=rcouch
shift 1
;;
-s)
SYSCONF=$2
shift 2
;;
*)
display_help
exit
;;
esac
done
if test ! -n "$DATA"; then DATA="$PREFIX/var/lib"; fi
if test ! -n "$VIEW"; then VIEW="$PREFIX/var/lib"; fi
if test ! -n "$SYSCONF"; then SYSCONF="$PREFIX/etc"; fi
if test ! -n "$RUN"; then RUN="$PREFIX/var/run"; fi
if test ! -n "$LOG"; then LOG="$PREFIX/var/log"; fi
echo "==> configuring rcouch in rel/rcouch.config"
cat > rel/rcouch.config << EOF
{prefix, "$PREFIX"}.
{data_dir, "$DATA"}.
{view_dir, "$VIEW"}.
{sysconf_dir, "$SYSCONF"}.
{run_dir, "$RUN"}.
{log_dir, "$LOG"}.
{user, "$RCOUCH_USER"}.
{node_name, "-sname rcouch"}.
{couchdb_port, 5984}.
{ssl_port, 6986}.
EOF
cat > config.mk << EOF
# The contents of this file are auto-generated by configure
PREFIX = $PREFIX
DATADIR = $DATA
VIEWDIR = $VIEW
SYSCONF_DIR = $SYSCONF
RUNDIR = $RUN
LOGDIR = $LOG
RCOUCH_USER = $RCOUCH_USER
OS = $OS
ARCH = $ARCH
VERSION = $VERSION
EOF
# finally, a few config files for local development nodes
cat > rel/dev.config << EOF
{prefix, "$DIRPATH/rel/dev"}.
{data_dir, "$DIRPATH/rel/tmpdata/dev"}.
{view_dir, "$DIRPATH/rel/tmpdata/dev"}.
{sysconf_dir, "$DIRPATH/rel/dev/etc"}.
{run_dir, "$DIRPATH/rel/dev/var/run"}.
{log_dir, "$DIRPATH/rel/dev/var/log"}.
{user, "$RCOUCH_USER"}.
{node_name, "-name dev@127.0.0.1"}.
{couchdb_port, 15984}.
{ssl_port, 16986}.
EOF
cat rel/rcouch.config