Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Script to copy hosts database over to VMs on OS X #28
After a little digging…
It is standalone to ievms because you may need to update the VM hosts without doing a rebuild of the VM. It looks like it could integrate with ievms, but I really can't tell if ievms is setting up the guest additions, they seem disabled initially? Perhaps I'm needlessly reinstalling them.
The script relies on your hosts file being set up in a particular way (e.g. using 127.0.0.1 addresses for local domain names). The VM in question also needs to be running.
The script creates a batch file to add the hosts to the host file on the VM. The batch file means that the original can be appended to or overwritten. The default is to overwrite - it suits my purpose but may be unwise for a novice user?
It's full of comments so hack away at it, I use Mac OS 10.6.8 to make it, copying to the Vista & Win 7 versions that ievms uses.
I'm sticking it in my Dropbox for now.
Try hosts-to-vm.sh IE7 IE8 IE9 in your Terminal.
It's hard to make VirtualBox automatically install the Guest Additions, so ievms simply mounts the ISO upon first boot to make it easier/remind you to do it. It's really a chicken-or-egg type scenario since we could install Guest Additions via ievms... but only if Guest Additions are already installed LOL.
Thanks for the gist though - it looks very useful if we can make sure it gets run correctly.
Personally I think the hosts-to-vm is a nice add on it ievms, but since it takes the host's IP & inserts that in to the Windows hosts file it could be fragile for people who use VM's in a different mode, eg internal or bridged networking. The dependance on the guest additions is a pain that means it can't really run without user intervention.
The only solution I can think of is to have a post-setup script to install the hosts & any other tweaks such as removing the guest additions disk from the VM, & maybe adding local host bookmarks & links to relevant IE debugger tools the Windows desktop, basically anything to avoid using Windows :)
Feel free to tweak it, or add it alongside ievms if you want. The comments in the script are overkill, but I was too lazy to move it out to a read me.
Cheers for the handy tool.