Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 152 lines (134 sloc) 3.314 kb
#!/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/{{appid}}"
REFUGE_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)
REFUGE_USER=$2
shift 2
;;
-r)
RUN=$2
shift 2
;;
-R)
REFUGE_USER={{appid}}
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 {{appid}} in rel/{{appid}}.config"
cat > rel/{{appid}}.config << EOF
{prefix, "$PREFIX"}.
{data_dir, "$DATA"}.
{view_dir, "$VIEW"}.
{sysconf_dir, "$SYSCONF"}.
{run_dir, "$RUN"}.
{log_dir, "$LOG"}.
{user, "$REFUGE_USER"}.
{node_name, "-sname {{appid}}"}.
{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
REFUGE_USER = $REFUGE_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, "$REFUGE_USER"}.
{node_name, "-name dev@127.0.0.1"}.
{couchdb_port, 15984}.
{ssl_port, 16986}.
EOF
cat rel/{{appid}}.config
Jump to Line
Something went wrong with that request. Please try again.