Skip to content

Instantly share code, notes, and snippets.

View npf's full-sized avatar
🚲

Pierre Neyron npf

🚲
View GitHub Profile
@npf
npf / VBoxManage
Created September 10, 2014 15:09
Wrapper around VBoxManage for vagrant to store VM disks in a different storage than VirtualBox's default.
#!/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})
@npf
npf / VBoxManage
Created September 10, 2014 15:05
Wrapper around VBoxManage for vagrant to use linked clones
#!/bin/bash
VBOXMANAGE=/usr/bin/VBoxManage
LOGFILE=/tmp/vagrant/vboxmanage.$(date +%s)
mkdir -p ${LOGFILE%/*}
if [ "$1" == "import" -a "$2" != "-n" ]; then
echo -e "Initial command:\n $ $0 $@" >> $LOGFILE
declare -a opts=("$@") ;
for ((i=0;i<${#opts[@]};i++)); do
case "${opts[$i]}" in
--vmname)