Install cabal binary:
wget -qO- https://gist.githubusercontent.com/joehand/24f15a88c13dc628fd3dc459d9810429/raw/f02b5278a15a3fa2ce834e4647f78a4a8f45f957/install-cabal.sh | bash
| #!/bin/bash | |
| # gets latest cabal release zip for platform and extracts runnable binary into ~/.cabal | |
| # usage: wget -qO- https://raw.githubusercontent.com/cabal-club/cabal-cli/master/bin/install.sh | bash | |
| # based on https://github.com/jpillora/installer/blob/master/scripts/download.sh | |
| CABAL_DIR="$HOME/.cabal/releases" | |
| function cleanup { | |
| rm -rf $CABAL_DIR/tmp.zip > /dev/null | |
| } | |
| function fail { | |
| cleanup | |
| msg=$1 | |
| echo "============" | |
| echo "Error: $msg" 1>&2 | |
| exit 1 | |
| } | |
| function install { | |
| # bash check | |
| [ ! "$BASH_VERSION" ] && fail "Please use bash instead" | |
| GET="" | |
| if which curl > /dev/null; then | |
| GET="curl" | |
| GET="$GET --fail -# -L" | |
| elif which wget > /dev/null; then | |
| GET="wget" | |
| GET="$GET -qO-" | |
| else | |
| fail "neither wget/curl are installed" | |
| fi | |
| case `uname -s` in | |
| Darwin) OS="macos";; | |
| Linux) OS="linux";; | |
| *) fail "unsupported os: $(uname -s)";; | |
| esac | |
| if uname -m | grep 64 > /dev/null; then | |
| ARCH="x64" | |
| else | |
| fail "only arch x64 is currently supported for single file install. please use npm instead. your arch is: $(uname -m)" | |
| fi | |
| echo "Fetching latest Cabal release version from GitHub" | |
| LATEST=$($GET -qs https://api.github.com/repos/cabal-club/cabal-cli/releases/latest | grep tag_name | head -n 1 | cut -d '"' -f 4); | |
| mkdir -p $CABAL_DIR || fail "Could not create directory $CABAL_DIR, try manually downloading zip and extracting instead." | |
| cd $CABAL_DIR | |
| RELEASE="cabal-${LATEST:1}-${OS}-${ARCH}" | |
| URL="https://github.com/cabal-club/cabal-cli/releases/download/${LATEST}/${RELEASE}.zip" | |
| which unzip > /dev/null || fail "unzip is not installed" | |
| echo "Downloading $URL" | |
| bash -c "$GET $URL" > $CABAL_DIR/tmp.zip || fail "download failed" | |
| unzip -o -qq $CABAL_DIR/tmp.zip || fail "unzip failed" | |
| BIN="$CABAL_DIR/$RELEASE/cabal" | |
| chmod +x $BIN || fail "chmod +x failed" | |
| cleanup | |
| printf "Cabal $LATEST has been downloaded successfully. Execute it with this command:\n\n${BIN}\n\nAdd it to your PATH with this command (add this to .bash_profile/.bashrc):\n\nexport PATH=\"\$PATH:$CABAL_DIR/$RELEASE\"\n" | |
| } | |
| install |
Questions I have:
~/.cabal/releasesthe best place to install?npm? (e.g. zeit/now installs the binary when you do npm install)