Created
February 24, 2015 20:32
-
-
Save binq/1d362bf1374872c70f6e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# echo COMMAND: ${COMMAND:?"Need to set COMMAND non-empty"} | |
# echo NODD: ${NODD:?"Need to set NODD non-empty"} | |
# echo NEVEN: ${NEVEN:?"Need to set NEVEN non-empty"} | |
BASE="/Users/vansonsamuel/Vagrant" | |
HOME="/Users/vansonsamuel/Vagrant/centos-6.5" | |
function destroy { | |
TARG="$BASE/centos-6.5-$1" | |
if [ -d "$TARG" ]; then | |
cd "$TARG" && vagrant destroy -f && cd .. && rm -Rf "$TARG" | |
fi | |
} | |
function build { | |
TARG="$BASE/centos-6.5-$1" | |
destroy "$1" | |
mkdir "$TARG" | |
cp -R "$HOME/Vagrantfile" "$TARG" | |
cp -R "$HOME/chef_config.rb" "$TARG" | |
cp -R "$HOME/cookbooks" "$TARG" | |
cd "$TARG" | |
echo -e "cd $TARG && vagrant up\n" | |
} | |
function go { | |
case "$1" in | |
build) | |
build "1" | |
build "2" | |
;; | |
destroy) | |
destroy "1" | |
destroy "2" | |
;; | |
*) | |
echo "Invalid command" >&2 | |
exit 1 | |
esac | |
} | |
go "build" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment