Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 121 lines (108 sloc) 3.023 kb
#!/bin/bash
#
# This is the successor to ./boot.rb. To remove the dependancy on ruby, we
# are converting to rebar. However, rebar does not allow for an easy way
# to change a system that's running. Generating a release does a fine
# job of creating a start up script, but it cannot be regenerated without
# trashing the existing release. The bins for the deps are not put into
# the primary ebin folder, so those get lost. Thus, this is a dev boot
# script that will allow one to start the system in a dev-friendly mode,
# and still be able to run rebar and reload the resulting code.
#
# The ironic twist is this will only work if you've done a rebar generate.
function help_dump {
echo "usage: devboot [-c cookiename] [-s shortname | -n longname] [-f configfile] [-nb | -b bootfile]"
echo ""
echo "-c defaults to \"OpenACDDev\""
echo "-s and -n override each nother. Defaults to \"-s openacddev\""
echo "-b defaults to rel/openacd/releases/1/openacd"
echo "-nb disables use of a boot file. -b and -nb override eachother."
echo "-f defaults to \"single\""
echo "-e defaults to \"erl\""
}
EBIN="ebin"
COOKIE="OpenACDDev"
NAMETYPE="-sname"
NODENAME="openacddev"
CONFIG="single"
BOOT="-boot rel/openacd/releases/1/openacd"
ERL_PATH="erl"
OPENACD_RUN_DIR="rel/openacd/run"
export OPENACD_RUN_DIR
deps=`ls deps`
morepa=""
for deps_file in $deps
do
morepa="$morepa -pa deps/$deps_file/ebin"
done
args=("$@")
argstring=""
i=0
while [ $i -lt ${#args[@]} ]
do
case ${args[${i}]} in
"-s")
NAMETYPE="-sname"
let i=$i+1
NODENAME="${args[${i}]}";;
"-n")
NAMETYPE="-name"
let i=$i+1
NODENAME="${args[${i}]}";;
"-b")
let i=$i+1
BOOT="-boot ${args[${i}]}";;
"-nb")
BOOT="";;
"-c")
let i=$i+1
COOKIE="${args[${i}]}";;
"-f")
let i=$i+1
CONFIG="${args[${i}]}";;
"-e")
let i=$i+1
ERL_PATH="${args[${i}]}";;
*)
help_dump
exit 0
esac
argstring="$argstring ${args[${i}]}"
let i=$i+1
done
if [ ! -f $CONFIG ] && [ ! -f "${CONFIG}.config" ]; then
SUFFIX=`echo "${CONFIG}" | awk -F . '{print $NF}'`
CONFIGNODENAME=`erl -eval "io:format(\"~s\",[node()]),halt(1)" $NAMETYPE $NODENAME -noshell`
if [ $SUFFIX = 'config' ]; then
FILE=$CONFIG
else
FILE="${CONFIG}.config"
fi
cat > $FILE <<single.config
%% This file was generated by devboot.
%% If you are comfortable editing erlang application configuration scripts
%% there is no harm in editing the file.
[{'OpenACD', [
{nodes, ['$CONFIGNODENAME']},
{console_loglevel, info},
{logfiles, [{"full.log", debug}, {"console.log", info}]}
]},
{sasl, [
{errlog_type, error} % disable SASL progress reports
]}].
single.config
fi
if [ ! -f "key" ]; then
echo "RSA key does not exist, generating..."
ssh-keygen -t rsa -f key -N ""
RES=$?
if [ $RES != 0 ]; then
echo "Key generation failed with error $RES!"
exit $RES
fi
fi
export OPENACD_RUN_DIR=`pwd`
CMD="$ERL_PATH +K true -pa $EBIN $morepa -setcookie $COOKIE $NAMETYPE $NODENAME -config $CONFIG $BOOT"
#echo $CMD
exec $CMD
exit 0
Jump to Line
Something went wrong with that request. Please try again.