#!/bin/bash
ABRA_VERSION="9.0.0"
GIT_URL="https://git.autonomic.zone/coop-cloud/abra"
ABRA_SRC="$GIT_URL/raw/tag/$ABRA_VERSION/abra"
ABRA_DIR="${ABRA_DIR:-$HOME/.abra}"
function install_abra_release {
mkdir -p "$HOME/.local/bin"
curl "$ABRA_SRC" > "$HOME/.local/bin/abra"
chmod +x "$HOME/.local/bin/abra"
echo "abra installed to $HOME/.local/bin/abra"
}
function install_abra_dev {
mkdir -p "$ABRA_DIR/"
if [[ ! -d "$ABRA_DIR/src" ]]; then
git clone "$GIT_URL" "$ABRA_DIR/src"
fi
(cd "$ABRA_DIR/src" && git pull origin main && cd - || exit)
ln -sf "$ABRA_DIR/src/abra" "$HOME/.local/bin/abra"
echo "abra installed to $HOME/.local/bin/abra (development bleeding edge)"
function run_installation {
if [ "$1" = "--dev" ]; then
install_abra_dev
else
install_abra_release
run_installation "$@"
exit 0