Created
September 10, 2014 15:09
-
-
Save npf/26b2c25f20a1cd5a827b to your computer and use it in GitHub Desktop.
Wrapper around VBoxManage for vagrant to store VM disks in a different storage than VirtualBox's default.
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
#!/bin/bash | |
VBOXMANAGE=/usr/bin/VBoxManage | |
VBOXVMDIR="$HOME/VirtualBox VMs" | |
VAGRANTVMDIR="/tmp/vagrant" | |
LOGFILE=/tmp/vagrant/vboxmanage.$(date +%s) | |
echo "$0 $@" >> $LOGFILE | |
if [ "$1" == "import" ]; then | |
declare -a ARGS | |
while [ $# -gt 0 ]; do | |
ARGS=(${ARGS[@]} ${1/$VBOXVMDIR/$VAGRANTVMDIR}) | |
shift | |
done | |
echo "===> $VBOXMANAGE ${ARGS[@]}" >> $LOGFILE | |
exec $VBOXMANAGE "${ARGS[@]}" | |
fi | |
exec $VBOXMANAGE "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment