Skip to content

Instantly share code, notes, and snippets.

@npf
Created September 10, 2014 15:09
Show Gist options
  • Save npf/26b2c25f20a1cd5a827b to your computer and use it in GitHub Desktop.
Save npf/26b2c25f20a1cd5a827b to your computer and use it in GitHub Desktop.

Revisions

  1. npf created this gist Sep 10, 2014.
    16 changes: 16 additions & 0 deletions VBoxManage
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/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 "$@"