Skip to content

Commit 19628dd

Browse files
author
Andrei Zavada
committed
another go at making make rel relocatable again
1 parent 8d775a8 commit 19628dd

File tree

6 files changed

+41
-36
lines changed

6 files changed

+41
-36
lines changed

rel/files/riak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ function maybe_su {
5353

5454
case "$1" in
5555
start)
56-
maybe_su $RELX_RIAK $* -pa {{runner_patch_dir}} \
56+
maybe_su $RELX_RIAK $* -pa {{platform_patch_dir}} \
5757
&& write_pid_file
5858
test -r $PID_DIR/riak.pid && exit 0
5959
;;
6060
console|foreground)
61-
maybe_su $RELX_RIAK $* -pa {{runner_patch_dir}}
61+
maybe_su $RELX_RIAK $* -pa {{platform_patch_dir}}
6262
;;
6363
stop)
6464
maybe_su $RELX_RIAK $* \

rel/files/riak-admin

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
# Identify the script name
66
SCRIPT="riak-admin"
77

8-
RPC_HOP="{{platform_bin_dir}}/riak rpc"
9-
RPCt_HOP="{{platform_bin_dir}}/riak rpcterms"
8+
PLATFORM_BASE_DIR=${PLATFORM_BASE_DIR:-$(cd $(dirname "$0")/.. && pwd -P)}
9+
RPC_HOP="${PLATFORM_BASE_DIR}/bin/riak rpc"
10+
RPCt_HOP="${PLATFORM_BASE_DIR}/bin/riak rpcterms"
1011

11-
ERTS_PATH="{{platform_base_dir}}/`(cd {{platform_base_dir}} && ls -d erts-*)`/bin"
12-
COOKIE=`egrep '^[ \t]*distributed_cookie[ \t]*=[ \t]*' {{platform_etc_dir}}/riak.conf 2> /dev/null | cut -d = -f 2 | tr -d ' '`
12+
ERTS_VER=$(cd ${PLATFORM_BASE_DIR} && ls -d erts-*)
13+
ERTS_PATH="${PLATFORM_BASE_DIR}/$ERTS_VER/bin"
14+
COOKIE=`egrep '^[ \t]*distributed_cookie[ \t]*=[ \t]*' ${PLATFORM_BASE_DIR}/etc/riak.conf 2> /dev/null | cut -d = -f 2 | tr -d ' '`
1315
NODE={{node}}
1416
HOST=${NODE#*@}
1517

16-
BOOT_FILE="{{runner_base_dir}}/releases/{{release_version}}/start_clean"
18+
BOOT_FILE="${PLATFORM_BASE_DIR}/releases/{{release_version}}/start_clean"
1719

1820
usage() {
1921
echo "Usage: $SCRIPT { cluster | join | leave | backup | restore | test | "
@@ -871,7 +873,7 @@ case "$1" in
871873
OLDNODE=$1
872874
NEWNODE=$2
873875
$ERTS_PATH/erl -noshell \
874-
-pa {{runner_patch_dir}} \
876+
-pa {{platform_patch_dir}} \
875877
-boot $BOOT_FILE \
876878
$CONFIG_ARGS \
877879
-eval "riak_kv_console:$ACTION(['$OLDNODE', '$NEWNODE'])" \
@@ -892,7 +894,7 @@ case "$1" in
892894
FILENAME=$3
893895

894896
$ERTS_PATH/erl -noshell -name riak_kv_backup@$HOST -setcookie $COOKIE \
895-
-pa {{runner_patch_dir}} \
897+
-pa {{platform_patch_dir}} \
896898
-boot $BOOT_FILE \
897899
-eval "riak_kv_backup:$ACTION('$NODE', \"$FILENAME\")" -s init stop
898900
;;
@@ -912,7 +914,7 @@ case "$1" in
912914
TYPE=$4
913915

914916
$ERTS_PATH/erl -noshell -name riak_kv_backup@$HOST -setcookie $COOKIE \
915-
-pa {{runner_patch_dir}} \
917+
-pa {{platform_patch_dir}} \
916918
-boot $BOOT_FILE \
917919
-eval "riak_kv_backup:$ACTION('$NODE', \"$FILENAME\", \"$TYPE\")" -s init stop
918920
;;
@@ -925,7 +927,7 @@ case "$1" in
925927
# Parse out the node name to pass to the client
926928

927929
$ERTS_PATH/erl -noshell -name riak_test@$HOST -setcookie $COOKIE \
928-
-pa {{runner_patch_dir}} \
930+
-pa {{platform_patch_dir}} \
929931
-boot $BOOT_FILE \
930932
-eval "case catch(riak:client_test(\"$NODE\")) of \
931933
ok -> init:stop(); \
@@ -960,7 +962,7 @@ case "$1" in
960962
RAND=$(($(($$ % 1000)) + 1))
961963
# Using np_etop instead of riak_etop to follow node_package convention
962964
$ERTS_PATH/erl -noshell -noinput \
963-
-pa {{runner_base_dir}} \
965+
-pa {{platform_base_dir}} \
964966
-boot $BOOT_FILE \
965967
-hidden -name np_etop$RAND@$HOST -setcookie $COOKIE \
966968
-s etop -s erlang halt -output text \

rel/files/riak-chkconfig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
# -*- tab-width:4;indent-tabs-mode:nil -*-
33
# ex: ts=4 sw=4 et
44

5-
ERTS_PATH="{{runner_base_dir}}/`(cd {{runner_base_dir}} && ls -d erts-*)`/bin"
6-
COOKIE=`egrep '^[ \t]*distributed_cookie[ \t]*=[ \t]*' {{platform_etc_dir}}/riak.conf 2> /dev/null | cut -d = -f 2 | tr -d ' '`
5+
PLATFORM_BASE_DIR=${RCS_PATH:-$(cd $(dirname "$0")/.. && pwd -P)}
6+
7+
ERTS_VER=$(cd ${PLATFORM_BASE_DIR} && ls -d erts-*)
8+
ERTS_PATH="${PLATFORM_BASE_DIR}/$ERTS_VER/bin"
9+
COOKIE=`egrep '^[ \t]*distributed_cookie[ \t]*=[ \t]*' ${PLATFORM_BASE_DIR}/etc/riak.conf 2> /dev/null | cut -d = -f 2 | tr -d ' '`
710
NODE={{node}}
811
HOST=${NODE#*@}
912

10-
BOOT_FILE="{{runner_base_dir}}/releases/{{release_version}}/start_clean"
13+
BOOT_FILE="${PLATFORM_BASE_DIR}/releases/{{release_version}}/start_clean"
1114

12-
CONFIG_PATH=`ls -1r {{platform_gen_dir}}/generated.conf/app.*.config | head -n1`
13-
VMARGS_PATH=`ls -1r {{platform_gen_dir}}/generated.conf/vm.*.args | head -n1`
15+
CONFIG_PATH=`ls -1r ${PLATFORM_BASE_DIR}/releases/{{release_version}}/generated.conf/app.*.config | head -n1`
16+
VMARGS_PATH=`ls -1r ${PLATFORM_BASE_DIR}/releases/{{release_version}}/generated.conf/vm.*.args | head -n1`
1417

1518
CODE=" try
1619
{ok, _} = file:consult(\"$CONFIG_PATH\"),

rel/files/riak-debug

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,11 @@ exit
135135
###
136136

137137
# These paths may be overridden with environment variables.
138+
PLATFORM_BASE_DIR=${PLATFORM_LIB_DIR:-$(cd $(dirname "$0")/.. && pwd -P)}
139+
138140
RUNNER_BASE_DIR=$(cd `dirname $0` && /bin/pwd -P)/..
139141
riak_base_dir=$RUNNER_BASE_DIR
140-
riak_bin_dir={{platform_script_dir}}
142+
riak_bin_dir={{platform_bin_dir}}
141143
riak_etc_dir={{platform_etc_dir}}
142144
riak_sbin_dir=/usr/sbin
143145

rel/files/riak-repl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# Identify the script name
66
SCRIPT=`basename $0`
77

8-
RPC_HOP="{{platform_bin_dir}}/riak rpc"
8+
PLATFORM_BASE_DIR=${RCS_PATH:-$(cd $(dirname "$0")/.. && pwd -P)}
9+
10+
RPC_HOP="${PLATFORM_BASE_DIR}/bin/riak rpc"
911

1012
V2REPLDEP="DEPRECATION NOTICE: The replication protocol you are currently using in this cluster has been deprecated and will be unsupported and removed some time after the Riak Enterprise 2.1 release. Please upgrade to the latest replication protocol as soon as possible. If you need assistance migrating contact Basho Client Services or follow the instructions in our documentation ( http://docs.basho.com/riakee/latest/cookbooks/Multi-Data-Center-Replication-UpgradeV2toV3/ )."
1113

rel/vars.config

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
{rel_vsn, "{{release_version}}"}.
55

66
%% Platform-specific installation paths
7-
{platform_base_dir, "${RIAK_PATH:-/opt/riak}"}.
8-
{platform_bin_dir, "{{platform_base_dir}}/bin"}.
9-
{platform_data_dir, "{{platform_base_dir}}/data"}.
10-
{platform_etc_dir, "{{platform_base_dir}}/etc"}.
11-
{platform_lib_dir, "{{platform_base_dir}}/lib"}.
12-
{platform_log_dir, "{{platform_base_dir}}/log"}.
13-
{platform_gen_dir, "{{platform_base_dir}}/releases/{{release_version}}"}.
7+
{platform_base_dir, "${RIAK_PATH:-$RELEASE_ROOT_DIR}"}.
8+
{platform_bin_dir, "{{platform_base_dir}}/bin"}.
9+
{platform_data_dir, "{{platform_base_dir}}/data"}.
10+
{platform_etc_dir, "{{platform_base_dir}}/etc"}.
11+
{platform_lib_dir, "{{platform_base_dir}}/lib"}.
12+
{platform_log_dir, "{{platform_base_dir}}/log"}.
13+
{platform_gen_dir, "{{platform_base_dir}}/releases/{{release_version}}"}.
14+
{platform_patch_dir, "{{platform_lib_dir}}/patches"}.
1415

1516
%%
1617
%% etc/app.config
@@ -40,16 +41,11 @@
4041
%%
4142
%% bin/riak
4243
%%
43-
{runner_script_dir, "{{platform_bin_dir}}"}.
44-
{runner_base_dir, "{{platform_base_dir}}"}.
45-
{runner_etc_dir, "{{platform_etc_dir}}"}.
46-
{runner_log_dir, "{{platform_log_dir}}"}.
47-
{runner_lib_dir, "{{platform_lib_dir}}"}.
48-
{runner_patch_dir, "{{platform_lib_dir}}/patches"}.
49-
{pipe_dir, "{{platform_base_dir}}/tmp/riak"}.
50-
{pid_dir, "{{platform_base_dir}}/var/run/riak"}.
51-
{runner_wait_process, "riak_core_node_watcher"}.
52-
{runner_ulimit_warn, 65536}.
44+
45+
%% relocatable releases don't call the launcher script, because
46+
%% launcher script requires a riak user to exist.
47+
%%{pipe_dir, "$PLATFORM_BASE_DIR/tmp/riak"}.
48+
%%{pid_dir, "$PLATFORM_BASE_DIR/var/run/riak"}.
5349

5450
%%
5551
%% cuttlefish

0 commit comments

Comments
 (0)