#!/bin/sh

set -ex

MACHINE_TYPE=`uname -m`
if [ $MACHINE_TYPE = 'x86_64' ]; then
  ARCH=x64
else
  ARCH=x32
fi

mkdir -p /usr/local
cd /usr/local
wget -qO- https://cli-assets.heroku.com/heroku-cli/channels/stable/heroku-cli-linux-$ARCH.tar.gz | tar xz
rm -rf /usr/local/heroku
mv /usr/local/heroku-cli-v* /usr/local/heroku
ln -sf /usr/local/heroku/bin/heroku /usr/bin/heroku
