Use :SystemRoot to detect Windows, including git-bash. Also use :Windir to ensure we get correct hosts file path
This commit is contained in:
parent
5e785f819d
commit
8f3dd06d8e
|
@ -10,7 +10,8 @@ module VagrantPlugins
|
||||||
realhostfile = '/etc/inet/hosts'
|
realhostfile = '/etc/inet/hosts'
|
||||||
move_cmd = 'mv'
|
move_cmd = 'mv'
|
||||||
elsif (machine.communicate.test("test -d $Env:SystemRoot"))
|
elsif (machine.communicate.test("test -d $Env:SystemRoot"))
|
||||||
realhostfile = 'C:\Windows\System32\Drivers\etc\hosts'
|
realhostfile = "#{ENV['WINDIR']}\\System32\\drivers\\etc\\hosts"
|
||||||
|
|
||||||
move_cmd = 'mv -force'
|
move_cmd = 'mv -force'
|
||||||
else
|
else
|
||||||
realhostfile = '/etc/hosts'
|
realhostfile = '/etc/hosts'
|
||||||
|
@ -38,7 +39,7 @@ module VagrantPlugins
|
||||||
hosts_location = '/etc/hosts'
|
hosts_location = '/etc/hosts'
|
||||||
copy_cmd = 'sudo cp'
|
copy_cmd = 'sudo cp'
|
||||||
# handles the windows hosts file...
|
# handles the windows hosts file...
|
||||||
if ENV['OS'] == 'Windows_NT'
|
if ENV['SystemRoot'] != nil
|
||||||
hosts_location = "#{ENV['WINDIR']}\\System32\\drivers\\etc\\hosts"
|
hosts_location = "#{ENV['WINDIR']}\\System32\\drivers\\etc\\hosts"
|
||||||
copy_cmd = 'cp'
|
copy_cmd = 'cp'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue