2012-07-23 22:39:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# You need to use this script once to build a set of devrels for prior
|
2012-09-17 21:14:55 +00:00
|
|
|
# releases of Riak (for mixed version / upgrade testing). You should
|
2012-07-23 22:39:43 +00:00
|
|
|
# create a directory and then run this script from within that directory.
|
|
|
|
# I have ~/test-releases that I created once, and then re-use for testing.
|
|
|
|
#
|
2012-07-23 22:45:08 +00:00
|
|
|
# See rtdev-setup-releases.sh as an example of setting up mixed version layout
|
2012-07-23 22:39:43 +00:00
|
|
|
# for testing.
|
|
|
|
|
|
|
|
# Different versions of Riak were released using different Erlang versions,
|
|
|
|
# make sure to build with the appropriate version.
|
|
|
|
|
|
|
|
# This is based on my usage of having multiple Erlang versions in different
|
|
|
|
# directories. If using kerl or whatever, modify to use kerl's activate logic.
|
|
|
|
# Or, alternatively, just substitute the paths to the kerl install paths as
|
|
|
|
# that should work too.
|
|
|
|
|
2012-07-27 21:52:27 +00:00
|
|
|
R14B03=${R14B03:-$HOME/erlang-R14B03}
|
2012-08-21 17:32:25 +00:00
|
|
|
R14B04=${R14B04:-$HOME/erlang-R14B04}
|
|
|
|
R15B01=${R15B01:-$HOME/erlang-R15B01}
|
2012-07-24 01:35:38 +00:00
|
|
|
|
2012-08-21 18:32:48 +00:00
|
|
|
checkbuild()
|
|
|
|
{
|
|
|
|
ERLROOT=$1
|
2012-09-17 21:14:55 +00:00
|
|
|
|
2012-08-21 18:32:48 +00:00
|
|
|
if [ ! -d $ERLROOT ]; then
|
2012-09-17 21:14:55 +00:00
|
|
|
echo -n " - $ERLROOT cannot be found, install with kerl? [Y|n]: "
|
2012-08-21 18:32:48 +00:00
|
|
|
read ans
|
|
|
|
if [[ $ans == n || $ans == N ]]; then
|
2012-09-17 21:14:55 +00:00
|
|
|
echo
|
|
|
|
echo " [ERROR] Can't build $ERLROOT without kerl, aborting!"
|
2012-08-21 18:32:48 +00:00
|
|
|
exit 1
|
2012-09-17 21:14:55 +00:00
|
|
|
else
|
|
|
|
if [ ! -x kerl ]; then
|
|
|
|
echo " - Fetching kerl."
|
|
|
|
curl -O https://raw.github.com/spawngrid/kerl/master/kerl > /dev/null 2>&1; chmod a+x kerl
|
|
|
|
fi
|
2012-08-21 18:32:48 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-07-24 01:35:38 +00:00
|
|
|
kerl()
|
|
|
|
{
|
|
|
|
RELEASE=$1
|
|
|
|
BUILDNAME=$2
|
|
|
|
|
2012-09-17 21:14:55 +00:00
|
|
|
echo " - Building Erlang $RELEASE (this could take a while)"
|
|
|
|
./kerl build $RELEASE $BUILDNAME > /dev/null 2>&1
|
|
|
|
echo " - Installing $RELEASE into $HOME/$BUILDNAME"
|
|
|
|
./kerl install $BUILDNAME $HOME/$BUILDNAME > /dev/null 2>&1
|
2012-07-24 01:35:38 +00:00
|
|
|
}
|
2012-07-23 22:39:43 +00:00
|
|
|
|
|
|
|
build()
|
|
|
|
{
|
|
|
|
SRCDIR=$1
|
|
|
|
ERLROOT=$2
|
2012-09-17 21:14:55 +00:00
|
|
|
DOWNLOAD=$3
|
2012-09-17 21:33:50 +00:00
|
|
|
GITURL=$4
|
2012-07-23 22:39:43 +00:00
|
|
|
|
2012-09-17 21:14:55 +00:00
|
|
|
echo "Building $SRCDIR:"
|
|
|
|
|
|
|
|
checkbuild $ERLROOT
|
2012-07-24 01:35:38 +00:00
|
|
|
if [ ! -d $ERLROOT ]; then
|
2012-08-21 18:32:48 +00:00
|
|
|
BUILDNAME=`basename $ERLROOT`
|
|
|
|
RELEASE=`echo $BUILDNAME | awk -F- '{ print $2 }'`
|
|
|
|
kerl $RELEASE $BUILDNAME
|
2012-07-24 01:35:38 +00:00
|
|
|
fi
|
|
|
|
|
2012-09-17 21:14:55 +00:00
|
|
|
if [ -n "$DOWNLOAD" ]; then
|
|
|
|
echo " - Fetching $DOWNLOAD"
|
|
|
|
wget -q -c $DOWNLOAD
|
|
|
|
|
|
|
|
TARBALL=`basename $DOWNLOAD`
|
|
|
|
echo " - Expanding $TARBALL"
|
|
|
|
tar xzf $TARBALL > /dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
2012-09-17 21:33:50 +00:00
|
|
|
if [ -n "$GITURL" ]; then
|
|
|
|
echo " - Cloning $GITURL"
|
|
|
|
git clone $GITURL $SRCDIR > /dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
2012-09-17 21:14:55 +00:00
|
|
|
echo " - Building devrel in $SRCDIR (this could take a while)"
|
2012-07-23 22:39:43 +00:00
|
|
|
cd $SRCDIR
|
|
|
|
|
2012-07-24 01:35:38 +00:00
|
|
|
RUN="env PATH=$ERLROOT/bin:$ERLROOT/lib/erlang/bin:$PATH \
|
2012-07-23 22:39:43 +00:00
|
|
|
C_INCLUDE_PATH=$ERLROOT/usr/include \
|
|
|
|
LD_LIBRARY_PATH=$ERLROOT/usr/lib"
|
2012-09-17 21:14:55 +00:00
|
|
|
$RUN make all devrel > /dev/null 2>&1
|
2012-07-23 22:39:43 +00:00
|
|
|
cd ..
|
2012-09-17 21:14:55 +00:00
|
|
|
echo " - $SRCDIR built."
|
2012-07-23 22:39:43 +00:00
|
|
|
}
|
|
|
|
|
2012-09-17 21:14:55 +00:00
|
|
|
build "riak-1.0.3" $R14B03 http://s3.amazonaws.com/downloads.basho.com/riak/1.0/1.0.3/riak-1.0.3.tar.gz
|
|
|
|
echo
|
|
|
|
build "riak-1.1.4" $R14B04 http://s3.amazonaws.com/downloads.basho.com/riak/1.1/1.1.4/riak-1.1.4.tar.gz
|
|
|
|
echo
|
|
|
|
build "riak-1.2.0" $R15B01 http://s3.amazonaws.com/downloads.basho.com/riak/1.2/1.2.0/riak-1.2.0.tar.gz
|
|
|
|
echo
|