From 548c907a4fdfbf72b2c45e20caa1e24678b158d7 Mon Sep 17 00:00:00 2001 From: odino Date: Tue, 25 Dec 2018 02:22:26 +0400 Subject: [PATCH] Installer, closes #3 --- docs/installer.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 docs/installer.sh diff --git a/docs/installer.sh b/docs/installer.sh new file mode 100644 index 00000000..e493f89a --- /dev/null +++ b/docs/installer.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Let's grab the latest release +OS="linux" + +if [[ "$OSTYPE" == "darwin" ]]; then + OS="darwin" +elif [[ "$OSTYPE" == "cygwin"* ]]; then + OS="windows" +elif [[ "$OSTYPE" == "win32" ]]; then + OS="windows" +elif [[ "$OSTYPE" == "msys" ]]; then + OS="windows" +elif [[ "$OSTYPE" == "freebsd"* ]]; then + OS="freebds" +fi + +ARCH="386" +MACHINE_TYPE=`uname -m` +if [ ${MACHINE_TYPE} == 'x86_64' ]; then + ARCH="amd64" +fi + +echo "Trying to detect the details of your architecture." +echo "" +echo "If these don't seem correct, head over to https://github.com/abs-lang/abs/releases" +echo "and download the right binary for your architecture." +echo "" +echo "OS: $OS" +echo "ARCH: $ARCH" +echo "" +echo "Are these correct? [y/N]" + +while read line +do + INPUT=$(echo $line | awk '{print toupper($0)}') + if [[ $INPUT == "Y" ]]; then + break; + fi + if [[ $INPUT == "YES" ]]; then + break; + fi + echo Exited + exit 1 +done < "/dev/stdin" + +INSTALLER_PATH=$(dirname $(mktemp -u)) +BIN=abs-preview-0-$OS-amd64 +cd $INSTALLER_PATH && \ +wget https://github.com/abs-lang/abs/releases/download/preview-0/$BIN && \ +chmod +x $BIN && \ +mv $BIN /usr/local/bin/abs && \ +echo "installation completed"