Skip to content

Instantly share code, notes, and snippets.

@kusold
Created April 30, 2012 15:20
Show Gist options
  • Save kusold/2559195 to your computer and use it in GitHub Desktop.
Save kusold/2559195 to your computer and use it in GitHub Desktop.
Switch Grail's Versions using Symlinks.
#!/bin/sh
##
## Switches grails versions by changing the the symlink ~/grails to a
## ~/grails-$VERSION
##
## Author: Dan Lynn ([email protected])
## Modified: Mike Kusold ([email protected])
if [ -z "$1" ]; then
cat <<End-of-message
Usage:
$0 [version]
The version argument must be a valid grails installation and comes in the standard grails versioning scheme.
Examples:
$0 1.3.7
$0 1.1.1
End-of-message
exit 1
fi
DIRNAME="/usr/share/grails"
NEW_GRAILS_HOME="$DIRNAME/$1"
if [ ! -d $NEW_GRAILS_HOME ]; then
echo "$NEW_GRAILS_HOME doesn't exist!" >&2
exit 1
fi
rm "/usr/bin/grails"
rm "/usr/bin/grails-debug"
rm "/usr/bin/startGrails"
rm -r "/usr/share/grails/current"
ln -s $NEW_GRAILS_HOME/bin/grails "/usr/bin/grails"
ln -s $NEW_GRAILS_HOME/bin/grails-debug "/usr/bin/grails-debug"
ln -s $NEW_GRAILS_HOME/bin/startGrails "/usr/bin/startGrails"
ln -s $NEW_GRAILS_HOME "/usr/share/grails/current"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment