Merge pull request #41 from robcoward/master
Added support for windows guests
This commit is contained in:
commit
0b3b8ae2e7
|
@ -8,10 +8,14 @@ module VagrantPlugins
|
||||||
|
|
||||||
if (machine.communicate.test("uname -s | grep SunOS"))
|
if (machine.communicate.test("uname -s | grep SunOS"))
|
||||||
realhostfile = '/etc/inet/hosts'
|
realhostfile = '/etc/inet/hosts'
|
||||||
|
move_cmd = 'mv'
|
||||||
|
elsif (machine.communicate.test("test -d $Env:SystemRoot"))
|
||||||
|
realhostfile = 'C:\Windows\System32\Drivers\etc\hosts'
|
||||||
|
move_cmd = 'mv -force'
|
||||||
else
|
else
|
||||||
realhostfile = '/etc/hosts'
|
realhostfile = '/etc/hosts'
|
||||||
|
move_cmd = 'mv'
|
||||||
end
|
end
|
||||||
|
|
||||||
# download and modify file with Vagrant-managed entries
|
# download and modify file with Vagrant-managed entries
|
||||||
file = @global_env.tmp_path.join("hosts.#{machine.name}")
|
file = @global_env.tmp_path.join("hosts.#{machine.name}")
|
||||||
machine.communicate.download(realhostfile, file)
|
machine.communicate.download(realhostfile, file)
|
||||||
|
@ -19,7 +23,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
# upload modified file and remove temporary file
|
# upload modified file and remove temporary file
|
||||||
machine.communicate.upload(file, '/tmp/hosts')
|
machine.communicate.upload(file, '/tmp/hosts')
|
||||||
machine.communicate.sudo("mv /tmp/hosts #{realhostfile}")
|
machine.communicate.sudo("#{move_cmd} /tmp/hosts #{realhostfile}")
|
||||||
# i have no idea if this is a windows competibility issue or not, but sometimes it dosen't work on my machine
|
# i have no idea if this is a windows competibility issue or not, but sometimes it dosen't work on my machine
|
||||||
begin
|
begin
|
||||||
FileUtils.rm(file)
|
FileUtils.rm(file)
|
||||||
|
|
Loading…
Reference in New Issue