60 lines
1.8 KiB
Bash
Executable file
60 lines
1.8 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# This script adds hanoi to a riak github repo. Run it in the riak repo
|
|
# directory.
|
|
#
|
|
# First it adds hanoi, then runs "make all devrel" and then enables the
|
|
# hanoi storage backend in the resulting dev nodes.
|
|
#
|
|
# This script is intended to be temporary. Once hanoi is made into a proper
|
|
# riak citizen, this script will no longer be needed.
|
|
|
|
set -e
|
|
|
|
wd=`pwd`
|
|
if [ `basename $wd` != riak ]; then
|
|
echo "This doesn't appear to be a riak repo directory. Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -d dev ]; then
|
|
echo
|
|
echo 'NOTE: THIS SCRIPT WILL DELETE YOUR EXISTING DEV DIRECTORY!'
|
|
while [ 1 ]; do
|
|
printf '\n%s' ' Do you wish to proceed? [no] '
|
|
read answer
|
|
answer=${answer:-n}
|
|
case $answer in
|
|
[Nn]*) exit 0 ;;
|
|
[Yy]*) break ;;
|
|
*) echo 'Please answer y or n.' ;;
|
|
esac
|
|
done
|
|
fi
|
|
|
|
./rebar get-deps
|
|
|
|
file=./deps/riak_kv/src/riak_kv.app.src
|
|
if ! grep -q hanoi $file ; then
|
|
echo
|
|
echo "Modifying $file, saving the original as ${file}.orig ..."
|
|
perl -i.orig -pe '/\bos_mon,/ && print qq( hanoi,\n)' $file
|
|
fi
|
|
|
|
file=./deps/riak_kv/rebar.config
|
|
if ! grep -q hanoi $file ; then
|
|
echo
|
|
echo "Modifying $file, saving the original as ${file}.orig ..."
|
|
perl -i.orig -pe '/\bsext\b/ && print qq( {hanoi, ".*", {git, "git\@github.com:basho/hanoi.git", "master"}},\n)' $file
|
|
fi
|
|
|
|
./rebar get-deps
|
|
|
|
rm -rf dev
|
|
make all devrel
|
|
|
|
echo
|
|
echo 'Modifying all dev/dev*/etc/app.config files, saving originals with .orig suffix...'
|
|
perl -i.orig -ne 'if (/\bstorage_backend,/) { s/(storage_backend, )[^\}]+/\1riak_kv_hanoi_backend/; print } elsif (/\{eleveldb,/) { $eleveldb++; print } elsif ($eleveldb && /^\s+\]\},/) { $eleveldb = 0; print; print qq(\n {hanoi, [\n {data_root, "./data/hanoi"}\n ]},\n\n) } else { print }' dev/dev*/etc/app.config
|
|
|
|
exit 0
|