Merge pull request #2384 from nmische/ubuntu_hostname_fix
guests/ubuntu: Fixing so localhost hosts file entry is not lost when updating hostname....
This commit is contained in:
commit
079a6edade
|
@ -22,7 +22,7 @@ module VagrantPlugins
|
||||||
# hosts should resemble:
|
# hosts should resemble:
|
||||||
# 127.0.0.1 localhost host.fqdn.com host
|
# 127.0.0.1 localhost host.fqdn.com host
|
||||||
# 127.0.1.1 host.fqdn.com host
|
# 127.0.1.1 host.fqdn.com host
|
||||||
comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(localhost)\\b.*$@\\1\\t#{name} #{name.split('.')[0]} \\3@g' /etc/hosts")
|
comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(localhost)\\b.*$@\\1\\t\\3 #{name} #{name.split('.')[0]}@g' /etc/hosts")
|
||||||
comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(#{old.split('.')[0]})\\b.*$@\\1\\t#{name} #{name.split('.')[0]}@g' /etc/hosts")
|
comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(#{old.split('.')[0]})\\b.*$@\\1\\t#{name} #{name.split('.')[0]}@g' /etc/hosts")
|
||||||
|
|
||||||
if comm.test("[ `lsb_release -c -s` = hardy ]")
|
if comm.test("[ `lsb_release -c -s` = hardy ]")
|
||||||
|
|
Loading…
Reference in New Issue