Created
July 22, 2013 16:56
-
-
Save xrd/6055536 to your computer and use it in GitHub Desktop.
Upgrade vagrant boxes directory to 1.2
This file contains hidden or 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 | |
| LOG_RESTORE_SCRIPT=vagrant-update.`date +%Y-%m-%d`-$$.log.sh | |
| cd ~/.vagrant.d/boxes | |
| echo "#/bin/bash" >> $LOG_RESTORE_SCRIPT | |
| echo "cd ~/.vagrant.d/boxes" >> $LOG_RESTORE_SCRIPT | |
| for x in `ls | grep -v '\.log\.sh'`; do | |
| if [ ! -d "$x/virtualbox" ]; then | |
| echo "# Processing: " $x | tee -a $LOG_RESTORE_SCRIPT | |
| mkdir -p $x/virtualbox | |
| for y in `ls $x`; do | |
| mv $x/$y $x/virtualbox/$y | |
| echo "mv $x/virtualbox/$y $x/$y" >> $LOG_RESTORE_SCRIPT | |
| done | |
| # Put the metadata.json file in there | |
| echo '{"provider":"virtualbox"}' > $x/virtualbox/metadata.json | |
| echo "rm $x/virtualbox/metadata.json" >> $LOG_RESTORE_SCRIPT | |
| else | |
| echo "# Skipping already converted updated directory [$x]" | |
| fi | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script upgrades your .vagrant.d/boxes directory to the 1.2 vagrant format, and writes a log file of the changes, a file which also can be run to restore the changes if you want to revert.