diff options
author | Mikolaj Golub <trociny@FreeBSD.org> | 2014-08-01 19:02:54 +0000 |
---|---|---|
committer | Mikolaj Golub <trociny@FreeBSD.org> | 2014-08-01 19:02:54 +0000 |
commit | c54c93b42c06aca539afa3d5ee67719f0b9e513e (patch) | |
tree | 8a33d442201af5600dba485ef09ecbf6ac68c1e2 /databases | |
parent | eb9f4ce13318e7ab30b1795e7dd151fa8a15f4c1 (diff) | |
download | ports-c54c93b42c06aca539afa3d5ee67719f0b9e513e.tar.gz ports-c54c93b42c06aca539afa3d5ee67719f0b9e513e.zip |
- make cowboy correctly parse target URI that has method in uppercase;
- sbin/leofs script improvements: on start wait for a node to begin
responding to ping, white-space cleanup;
- rc script cleanup.
Notes
Notes:
svn path=/head/; revision=363753
Diffstat (limited to 'databases')
-rw-r--r-- | databases/leofs/Makefile | 2 | ||||
-rw-r--r-- | databases/leofs/files/leofs.in | 12 | ||||
-rw-r--r-- | databases/leofs/files/patch-deps-cowboy-src-cowboy_protocol.erl | 17 | ||||
-rw-r--r-- | databases/leofs/files/sbin-leofs.in | 88 |
4 files changed, 76 insertions, 43 deletions
diff --git a/databases/leofs/Makefile b/databases/leofs/Makefile index 9492435e42ff..408d0193eaf9 100644 --- a/databases/leofs/Makefile +++ b/databases/leofs/Makefile @@ -3,7 +3,7 @@ PORTNAME= leofs PORTVERSION= 1.0.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= databases MAINTAINER= trociny@FreeBSD.org diff --git a/databases/leofs/files/leofs.in b/databases/leofs/files/leofs.in index 04a090440d8a..efc7eb29e8fb 100644 --- a/databases/leofs/files/leofs.in +++ b/databases/leofs/files/leofs.in @@ -13,7 +13,7 @@ # leofs_servers (list): Specify servers to run as a space separated # list of possible values: # gateway, -# manager_master, +# manager, # manager_slave, # storage. # The aliase ALL may be used to run all servers. @@ -53,7 +53,7 @@ leofs_start() local s for s in ${leofs_servers}; do - echo -n "Starting ${s}... " + echo -n "Starting leofs ${s}... " %%PREFIX%%/sbin/leofs ${s} start if [ $? = 0 ]; then echo "done." @@ -70,7 +70,7 @@ leofs_stop() local status=0 for s in ${leofs_servers}; do - echo -n "Stopping ${s}... " + echo -n "Stopping leofs ${s}... " %%PREFIX%%/sbin/leofs ${s} stop if [ $? = 0 ]; then echo "done." @@ -89,10 +89,10 @@ leofs_status() for s in ${leofs_servers}; do %%PREFIX%%/sbin/leofs ${s} ping > /dev/null 2>&1 if [ $? != 0 ]; then - echo "${s} is not running." + echo "leofs ${s} is not running." status=1 else - echo "${s} is running." + echo "leofs ${s} is running." fi done @@ -114,7 +114,7 @@ for s in ${leofs_servers}; do gateway|manager|manager_slave|storage) ;; *) - warn "unknown leo server: ${s}" + warn "unknown leofs server: ${s}" exit 1 ;; esac diff --git a/databases/leofs/files/patch-deps-cowboy-src-cowboy_protocol.erl b/databases/leofs/files/patch-deps-cowboy-src-cowboy_protocol.erl new file mode 100644 index 000000000000..241fb80ca13d --- /dev/null +++ b/databases/leofs/files/patch-deps-cowboy-src-cowboy_protocol.erl @@ -0,0 +1,17 @@ +Make cowboy correctly parse target URI that has method in uppercase. + +--- deps/cowboy/src/cowboy_protocol.erl.orig 2013-06-20 19:44:36.000000000 +0300 ++++ deps/cowboy/src/cowboy_protocol.erl 2014-07-31 23:10:11.000000000 +0300 +@@ -214,8 +214,12 @@ + parse_version(Rest, State, Method, <<"*">>, <<>>); + parse_uri(<< "http://", Rest/bits >>, State, Method) -> + parse_uri_skip_host(Rest, State, Method); ++parse_uri(<< "HTTP://", Rest/bits >>, State, Method) -> ++ parse_uri_skip_host(Rest, State, Method); + parse_uri(<< "https://", Rest/bits >>, State, Method) -> + parse_uri_skip_host(Rest, State, Method); ++parse_uri(<< "HTTPS://", Rest/bits >>, State, Method) -> ++ parse_uri_skip_host(Rest, State, Method); + parse_uri(Buffer, State, Method) -> + parse_uri_path(Buffer, State, Method, <<>>). + diff --git a/databases/leofs/files/sbin-leofs.in b/databases/leofs/files/sbin-leofs.in index a85b19139269..da346499ee33 100644 --- a/databases/leofs/files/sbin-leofs.in +++ b/databases/leofs/files/sbin-leofs.in @@ -153,13 +153,13 @@ setusercontext() if [ ${user} = ${LEOFS_USER} ] then - return + return fi if [ ${user} != root ] then - echo "Must be run as ${LEOFS_USER} user or root (or set LEOFS_USER)" >&2 - exit 1 + echo "Must be run as ${LEOFS_USER} user or root (or set LEOFS_USER)" >&2 + exit 1 fi # Restart as LEOFS_USER @@ -187,17 +187,17 @@ gen_config() args=`PATH=${ERTS_PATH}:${PATH} \ ${LEOFS_BASEDIR}/bin/cuttlefish \ - -i ${LEOFS_BASEDIR}/etc/${LEOFS_SERVER}.schema \ - -c ${LEOFS_ETCDIR}/${LEOFS_SERVER}.conf \ - -d ${cfg_dir}` + -i ${LEOFS_BASEDIR}/etc/${LEOFS_SERVER}.schema \ + -c ${LEOFS_ETCDIR}/${LEOFS_SERVER}.conf \ + -d ${cfg_dir}` app_config=`echo ${args} | sed -nEe 's/^.*(app\.[0-9.]*\.config).*$/\1/p'` vm_args=`echo ${args} | sed -nEe 's/^.*(vm\.[0-9.]*\.args).*$/\1/p'` if [ -z "${app_config}" -o -z "${vm_args}" ] then - echo "Failed to parse ${LEOFS_SERVER}.conf" >&2 - exit 1 + echo "Failed to parse ${LEOFS_SERVER}.conf" >&2 + exit 1 fi # Sanity check the app.config file @@ -248,10 +248,10 @@ make_env() snmp_cfg=`sed -nEe 's/^-config *(.*)$/\1.config/p' ${LEOFS_DBDIR}/etc/vm.args` sed -nEe 's:^.*dir, *"((%%LEOFS_DBDIR%%|%%LEOFS_LOGDIR%%)[^"]*)".*$:\1:p' \ - ${LEOFS_DBDIR}/etc/app.config ${snmp_cfg} | sort -u | + ${LEOFS_DBDIR}/etc/app.config ${snmp_cfg} | sort -u | while read dir do - mkdir -p "${dir}" + mkdir -p "${dir}" done } @@ -268,15 +268,15 @@ nodetool() name_arg=`egrep '^-s?name' ${vmargs_path}` if [ -z "${name_arg}" ] then - echo "vm.args needs either -name or -sname parameter" >&2 - exit 1 + echo "vm.args needs either -name or -sname parameter" >&2 + exit 1 fi cookie_arg=`grep '^-setcookie' ${vmargs_path}` if [ -z "${cookie_arg}" ] then - echo "vm.args needs a -setcookie parameter" 2>&2 - exit 1 + echo "vm.args needs a -setcookie parameter" 2>&2 + exit 1 fi ${ERTS_PATH}/escript ${ERTS_PATH}/nodetool ${name_arg} ${cookie_arg} ${cmd} @@ -293,17 +293,17 @@ check_node() if [ "${expected_state}" = DOWN ] then - if [ ${status} -eq 0 ] - then - echo "Node is already running" >&2 - exit 1 - fi + if [ ${status} -eq 0 ] + then + echo "Node is already running" >&2 + exit 1 + fi else - if [ ${status} -ne 0 ] - then - echo "Node is not running" >&2 - exit 1 - fi + if [ ${status} -ne 0 ] + then + echo "Node is not running" >&2 + exit 1 + fi fi } @@ -318,15 +318,15 @@ remsh() name_arg=`egrep '^-s?name' ${vmargs_path}` if [ -z "${name_arg}" ] then - echo "vm.args needs either -name or -sname parameter" >&2 - exit 1 + echo "vm.args needs either -name or -sname parameter" >&2 + exit 1 fi cookie_arg=`grep '^-setcookie' ${vmargs_path}` if [ -z "${cookie_arg}" ] then - echo "vm.args needs a -setcookie parameter" 2>&2 - exit 1 + echo "vm.args needs a -setcookie parameter" 2>&2 + exit 1 fi # Extract the name type and name from the name_arg for remsh @@ -558,6 +558,8 @@ register_cmd restart #------------------------------------------------------------------------------- cmd_start() { + local i res + case "$1" in help_summary) echo "Launch the application" @@ -577,7 +579,21 @@ cmd_start() export HEART_COMMAND="${PROGPATH} ${LEOFS_SERVER} start" ${ERTS_PATH}/run_erl -daemon ${LEOFS_PIPE} ${LEOFS_LOGDIR} \ - "exec ${PROGPATH} ${LEOFS_SERVER} console $@" 2>&1 + "exec ${PROGPATH} ${LEOFS_SERVER} console $@" 2>&1 + res=$? + + if [ "${res}" -ne 0 ] + then + exit ${res} + fi + + # Wait up to 1 minute for the node to start responding on ping. + for i in `jot 60` + do + nodetool ping >/dev/null 2>&1 || exit 0 + sleep 1 + done + exit 1 } register_cmd start @@ -610,19 +626,19 @@ cmd_stop() if [ "${res}" -ne 0 ] then - if [ -z "${pid}" ] - then - echo "${LEOFS_SERVER} is not running" - else - echo "Failed to stop ${LEOFS_SERVER}" - fi + if [ -z "${pid}" ] + then + echo "${LEOFS_SERVER} is not running" + else + echo "Failed to stop ${LEOFS_SERVER}" + fi exit ${res} fi # Wait up to 1 minute for the process to terminate. for i in `jot 60` do - kill -0 ${pid} 2>/dev/null || exit 0 + kill -0 ${pid} 2>/dev/null || exit 0 sleep 1 done echo "Failed to terminate the ${LEOFS_SERVER} process (pid ${pid})" |