aboutsummaryrefslogtreecommitdiffstats
path: root/kerl
diff options
context:
space:
mode:
Diffstat (limited to 'kerl')
-rwxr-xr-xkerl45
1 files changed, 42 insertions, 3 deletions
diff --git a/kerl b/kerl
index 4b9833a..3f6c5d1 100755
--- a/kerl
+++ b/kerl
@@ -1,5 +1,6 @@
#! /bin/sh
+# Copyright (c) 2016 Mark Allen
# Copyright (c) 2011, 2012 Spawngrid, Inc
# Copyright (c) 2011 Evax Software <contact(at)evax(dot)org>
#
@@ -24,7 +25,8 @@
#Grep fix for mac pcre errors
GREP_OPTIONS=''
-ERLANG_DOWNLOAD_URL=http://www.erlang.org/download
+ERLANG_DOWNLOAD_URL="http://www.erlang.org/download"
+OTP_GITHUB_URL="https://github.com/erlang/otp"
# Default values
: ${KERL_BASE_DIR:="$HOME"/.kerl}
@@ -103,6 +105,12 @@ else
INSTALL_OPT=-sasl
fi
+if [ -z "$KERL_BUILD_BACKEND" ]; then
+ KERL_BUILD_BACKEND="git"
+else
+ KERL_BUILD_BACKEND="tarball"
+fi
+
KERL_SYSTEM=$(uname -s)
case "$KERL_SYSTEM" in
Darwin|FreeBSD|OpenBSD)
@@ -141,16 +149,47 @@ if [ $# -eq 0 ]; then usage; fi
get_releases()
{
+ if [ "$KERL_BUILD_BACKEND" -eq "git" ]
+ then
+ get_git_releases
+ else
+ get_tarball_releases
+ fi
+}
+
+get_git_releases()
+{
+ git ls-remote --tags "$OTP_GITHUB_URL" \
+ | egrep -o 'OTP[_-][^^{}]+' \
+ | sed $SED_OPT 's/OTP[_-]//' \
+ | sort \
+ | uniq
+}
+
+get_tarball_releases()
+{
curl -L -s $ERLANG_DOWNLOAD_URL/ | \
sed $SED_OPT -e 's/^.*<[aA] [hH][rR][eE][fF]=\"\otp_src_([-0-9A-Za-z_.]+)\.tar\.gz\">.*$/\1/' \
-e '/^R1|^[0-9]/!d' | \
sed -e "s/^R\(.*\)/\1:R\1/" | sed -e "s/^\([^\:]*\)$/\1-z:\1/" | sort | cut -d':' -f2
}
+update_git_remote()
+{
+ cd "$KERL_GIT_BASE_SRC"
+ git checkout master || exit 1
+ git pull origin master || exit 1
+}
+
update_checksum_file()
{
- echo "Getting the checksum file from erlang.org..."
- curl -L $ERLANG_DOWNLOAD_URL/MD5 > "$KERL_DOWNLOAD_DIR"/MD5 || exit 1
+ if [ "$KERL_BUILD_BACKEND" -eq "git" ];
+ then
+ return 0
+ else
+ echo "Getting the checksum file from erlang.org..."
+ curl -L $ERLANG_DOWNLOAD_URL/MD5 > "$KERL_DOWNLOAD_DIR"/MD5 || exit 1
+ fi
}
ensure_checksum_file()