Skip to content

Instantly share code, notes, and snippets.

@leepike
Created October 10, 2014 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leepike/44b1786a2ffc616efc69 to your computer and use it in GitHub Desktop.
Save leepike/44b1786a2ffc616efc69 to your computer and use it in GitHub Desktop.
Script to switch swap Cabal sandboxes for different versions of GHC.
# 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