2020-09-22 11:37:33 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-03-17 11:53:55 +00:00
|
|
|
ABRA_VERSION="0.6.0"
|
2021-03-14 12:39:11 +00:00
|
|
|
GIT_URL="https://git.autonomic.zone/coop-cloud/abra"
|
|
|
|
ABRA_SRC="$GIT_URL/raw/tag/$ABRA_VERSION/abra"
|
2021-04-07 12:33:17 +00:00
|
|
|
ABRA_DIR="${ABRA_DIR:+$ABRA_DIR}"
|
2020-09-22 11:37:33 +00:00
|
|
|
|
2021-03-14 12:39:11 +00:00
|
|
|
function install_abra_release {
|
2020-09-22 11:37:33 +00:00
|
|
|
mkdir -p "$HOME/.local/bin"
|
2021-01-01 21:44:21 +00:00
|
|
|
curl "$ABRA_SRC" > "$HOME/.local/bin/abra"
|
2020-09-22 11:37:33 +00:00
|
|
|
chmod +x "$HOME/.local/bin/abra"
|
2021-03-01 10:38:15 +00:00
|
|
|
echo "abra installed to $HOME/.local/bin/abra"
|
2020-09-22 11:37:33 +00:00
|
|
|
}
|
|
|
|
|
2021-03-14 12:39:11 +00:00
|
|
|
function install_abra_dev {
|
2021-04-07 12:33:17 +00:00
|
|
|
mkdir -p "$ABRA_DIR/"
|
|
|
|
if [[ ! -d "$ABRA_DIR/src" ]]; then
|
|
|
|
git clone "$GIT_URL" "$ABRA_DIR/src"
|
2021-03-16 05:51:10 +00:00
|
|
|
fi
|
2021-04-07 12:33:17 +00:00
|
|
|
(cd "$ABRA_DIR/src" && git pull origin main && cd - || exit)
|
2021-03-14 12:39:11 +00:00
|
|
|
mkdir -p "$HOME/.local/bin"
|
2021-04-07 12:33:17 +00:00
|
|
|
ln -sf "$ABRA_DIR/src/abra" "$HOME/.local/bin/abra"
|
2021-03-16 05:51:10 +00:00
|
|
|
echo "abra installed to $HOME/.local/bin/abra (development bleeding edge)"
|
2021-03-14 12:39:11 +00:00
|
|
|
}
|
|
|
|
|
2020-09-22 11:37:33 +00:00
|
|
|
function run_installation {
|
2021-03-14 12:39:11 +00:00
|
|
|
if [ "$1" = "--dev" ]; then
|
|
|
|
install_abra_dev
|
|
|
|
else
|
|
|
|
install_abra_release
|
|
|
|
fi
|
2020-09-22 11:37:33 +00:00
|
|
|
}
|
|
|
|
|
2021-03-14 12:39:11 +00:00
|
|
|
run_installation "$@"
|
2020-09-22 11:37:33 +00:00
|
|
|
exit 0
|