aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md25
-rwxr-xr-xkerl61
2 files changed, 75 insertions, 11 deletions
diff --git a/README.md b/README.md
index dc7fc0e..83c8e45 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ kerl
Easy building and installing of Erlang/OTP instances
-Kerl aims to be shell agnostic and its only dependency, excluding what's required to actually build Erlang/OTP, is curl.
+Kerl aims to be shell agnostic and its only dependencies, excluding what's required to actually build Erlang/OTP, are curl and git.
Downloading
===========
@@ -48,12 +48,15 @@ You can verify it's been registered:
$ ./kerl list builds
R14B02
-Now install it to some location:
+Now install it to some location, optionally with agner support by adding KERL_INSTALL_AGNER=yes to you $HOME/.kerlrc file:
$ ./kerl install R14B02 /path/to/install/dir/
- Installing Erlang/OTP R14B02 in /path/to/install/dir/
+ Installing Erlang/OTP R14B02 in /path/to/install/dir...
+ Installing agner in /path/to/install/dir...
You can activate this installation running the following command:
. /path/to/install/dir/activate
+ Later on, you can leave the installation typing:
+ kerl_deactivate
Here again you can check the installation's been registered:
@@ -64,11 +67,16 @@ And at last activate it:
$ . /path/to/install/dir/activate
-You're now ready to work with R14B02
+You're now ready to work with R14B02:
$ erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.8.3
+ $ agner version
+ 0.4.15
+
+When your done just type:
+ $ kerl_deactivate
Tuning
======
@@ -77,8 +85,9 @@ You can tune kerl using the .kerlrc file in your $HOME directory.
You can set the following variables:
-- KERL_DOWNLOAD_DIR (where to put downloaded files)
-- KERL_BUILD_DIR (where to hold the builds)
-- KERL_CONFIGURE_OPTIONS (options to pass to Erlang's ./configure script)
-- KERL_MAKE_OPTIONS (options to pass to make, e.g. -j2)
+- KERL_DOWNLOAD_DIR where to put downloaded files, defaults to $HOME/.kerl/archives
+- KERL_BUILD_DIR where to hold the builds, defaults to $HOME/.kerl/builds
+- KERL_CONFIGURE_OPTIONS options to pass to Erlang's ./configure script, e.g. --without-termcap
+- KERL_MAKE_OPTIONS options to pass to make, e.g. -j2
+- KERL_INSTALL_AGNER if non-empty will cause agner to be installed along
diff --git a/kerl b/kerl
index 3c0c5ee..48b96ad 100755
--- a/kerl
+++ b/kerl
@@ -28,6 +28,7 @@ KERL_DOWNLOAD_DIR=$KERL_BASE_DIR/archives
KERL_BUILD_DIR=$KERL_BASE_DIR/builds
KERL_CONFIGURE_OPTIONS=
KERL_MAKE_OPTIONS=
+KERL_INSTALL_AGNER=
# ensure the base dir exsists
mkdir -p $KERL_BASE_DIR
@@ -139,7 +140,7 @@ do_install() {
exit 1
fi
absdir=`cd "$2" && pwd`
- echo "Installing Erlang/OTP $1 in $absdir"
+ echo "Installing Erlang/OTP $1 in $absdir..."
cd $KERL_BUILD_DIR/otp_src_$1
./configure --prefix="$absdir" > /dev/null 2>&1
make install > /dev/null 2>&1
@@ -148,9 +149,64 @@ do_install() {
exit 1
fi
list_add installations "$1 $absdir";
- echo "export PATH=$absdir/bin:\$PATH" > $absdir/activate
+ cat <<ACTIVATE > "$absdir/activate"
+# credits to virtualenv
+kerl_deactivate() {
+ if [ -n "\$_KERL_SAVED_PATH" ]; then
+ PATH="\$_KERL_SAVED_PATH"
+ export PATH
+ unset _KERL_SAVED_PATH
+ fi
+ if [ -n "\$_KERL_SAVED_AGNER_BIN" ]; then
+ AGNER_BIN="\$_KERL_SAVED_AGNER_BIN"
+ export AGNER_BIN
+ unset _KERL_SAVED_AGNER_BIN
+ fi
+ if [ -n "\$_KERL_SAVED_AGNER_PREFIX" ]; then
+ AGNER_PREFIX="\$_KERL_SAVED_AGNER_PREFIX"
+ export AGNER_PREFIX
+ unset _KERL_SAVED_AGNER_PREFIX
+ fi
+ if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then
+ hash -r
+ fi
+ if [ ! "\$1" = "nondestructive" ]; then
+ unset -f kerl_deactivate
+ fi
+}
+kerl_deactivate nondestructive
+_KERL_SAVED_PATH="\$PATH"
+export _KERL_SAVED_PATH
+_KERL_SAVED_AGNER_BIN="\$AGNER_BIN"
+export _KERL_SAVED_AGNER_BIN
+_KERL_SAVED_AGNER_PREFIX="\$AGNER_PREFIX"
+export _KERL_SAVED_AGNER_PREFIX
+PATH="$absdir/bin:\$PATH"
+export PATH
+AGNER_BIN="$absdir/bin"
+export AGNER_BIN
+AGNER_PREFIX="$absdir/agner"
+export AGNER_PREFIX
+if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then
+ hash -r
+fi
+ACTIVATE
+ if [ -n "$KERL_INSTALL_AGNER" ]; then
+ echo "Installing agner in $absdir..."
+ . "$absdir/activate" && cd "$absdir" && \
+ git clone https://github.com/agner/agner.git agner_build > /dev/null 2>&1 && \
+ cd agner_build && make > /dev/null 2>&1 && \
+ ./agner install agner > /dev/null 2>&1
+ if [ "$?" -eq 1 ]; then
+ echo "Couldn' install agner in $absdir"
+ exit 1
+ fi
+ fi
+ rm -Rf "$absdir/agner_build"
echo "You can activate this installation running the following command:"
echo ". $absdir/activate"
+ echo "Later on, you can leave the installation typing:"
+ echo "kerl_deactivate"
}
list_print() {
@@ -244,4 +300,3 @@ case "$1" in
echo "unkwnown command: $1"; usage; exit 1
;;
esac
-