Skip to content

Instantly share code, notes, and snippets.

@dtchepak
Last active August 29, 2015 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtchepak/d7c1ef15872c43ca304b to your computer and use it in GitHub Desktop.
Save dtchepak/d7c1ef15872c43ca304b to your computer and use it in GitHub Desktop.
#!/bin/sh
# Attempts to build a cabal binary package and symlink it in ~/.cabal/bin/
# Don't do this for binaries that rely on other assets! (such as pandoc)
# USE AT YOUR OWN RISK!
set -e
ws="[^a-zA-Z0-9\-\.]"
if [ "$#" -ne 1 ]
then
echo "Usage $0 (packagename)"
exit 1
elif [[ "$1" =~ $ws ]]
then
echo "$0: packagename should only contain alphanumerics, '-' or '.'"
exit 2
fi
mkdir $1
cd $1
cabal sandbox init
cabal install $1
ln -s "$(pwd)/.cabal-sandbox/bin/$1" ~/.cabal/bin/
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment