Created
November 3, 2016 14:17
-
-
Save yellow5/21d0ae7d71bede7a0909844eafb8d3f9 to your computer and use it in GitHub Desktop.
Script to reload a locally managed vagrant base box with a VMware Fusion provider.
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 | |
# Save the current directory. | |
pushd ./ | |
# Change to the directory that contains the VM. | |
cd ~/Documents/Virtual\ Machines.localized/Debian\ Jessie\ 64\ -\ Base.vmwarevm/ | |
# Defragment and shrink the virtual disk. | |
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d Virtual\ Disk.vmdk | |
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k Virtual\ Disk.vmdk | |
# Move the previous box to a backup and create a new one. | |
mv jessie64.box ../jessie64.box.bak | |
tar cvzf jessie64.box ./* | |
# Update the base box with vagrant. | |
vagrant box add --provider vmware_fusion --force debian/jessie64 jessie64.box | |
# Restore the shell to the directory where execution started. | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment