Add "short" hostname to "/etc/hosts" mimicking Debian behaviour. [closes GH-456]

This commit is contained in:
Dan Carley 2011-08-05 10:52:33 +01:00 committed by Mitchell Hashimoto
parent 6428d7fa2f
commit 1ec225e052
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ module Vagrant
if !ssh.test?("sudo hostname | grep '#{name}'")
ssh.exec!("sudo sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network")
ssh.exec!("sudo hostname #{name}")
ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts")
ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
end
end
end