Created
October 10, 2014 06:28
-
-
Save leepike/44b1786a2ffc616efc69 to your computer and use it in GitHub Desktop.
Script to switch swap Cabal sandboxes for different versions of GHC.
This file contains 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
# swith out a cabal sandbox for one version of a compiler for another. | |
#!/bin/bash | |
set -e | |
if [ -z "$2" ]; then | |
echo usage: $0 ghc-version-from ghc-version-to | |
exit 1 | |
fi | |
CONFIG=cabal.sandbox.config | |
SANDBOX=.cabal-sandbox | |
FROMCONFIG=$CONFIG-$1 | |
FROMSANDBOX=$SANDBOX-$1 | |
TOCONFIG=$CONFIG-$2 | |
TOSANDBOX=$SANDBOX-$2 | |
if [ -e "$TOCONFIG" ]; then | |
if [ -d "$TOSANDBOX" ]; then | |
rm -rf dist | |
cp -r $SANDBOX $FROMSANDBOX | |
cp $CONFIG $FROMCONFIG | |
cp -r $TOSANDBOX $SANDBOX | |
cp $TOCONFIG $CONFIG | |
else | |
echo $TOSANDBOX | |
exit 1 | |
fi | |
else | |
echo $TOCONFIG or $TOSANDBOX do not exist | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment