Last active
August 29, 2015 14:01
-
-
Save dtchepak/d7c1ef15872c43ca304b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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