Skip to content

Commit

Permalink
Installer, closes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
odino committed Dec 24, 2018
1 parent 2ab6475 commit 548c907
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions docs/installer.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 548c907

Please sign in to comment.