Skip to content

Instantly share code, notes, and snippets.

@binq
Created February 24, 2015 20:32
Show Gist options
  • Save binq/1d362bf1374872c70f6e to your computer and use it in GitHub Desktop.
Save binq/1d362bf1374872c70f6e to your computer and use it in GitHub Desktop.
#!/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