Update boundary usage in the sed regexp to update the hosts file

This commit is contained in:
Laurent Raufaste 2013-10-08 20:14:22 -04:00
parent 06aaa6e6ea
commit 157a7081ba
1 changed files with 2 additions and 2 deletions

View File

@ -22,8 +22,8 @@ module VagrantPlugins
# hosts should resemble:
# 127.0.0.1 localhost host.fqdn.com host
# 127.0.1.1 host.fqdn.com host
comm.sudo("sed -ri 's@^((\\b[0-9]{1,3}\.){3}[0-9]{1,3})\\b.*(localhost).*$@\\1\\t#{name} #{name.split('.')[0]} \\3@g' /etc/hosts")
comm.sudo("sed -ri 's@^((\\b[0-9]{1,3}\.){3}[0-9]{1,3})\\b.*(precise64).*$@\\1\\t#{name} #{name.split('.')[0]}@g' /etc/hosts")
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+(precise64)\\b.*$@\\1\\t#{name} #{name.split('.')[0]}@g' /etc/hosts")
if comm.test("[ `lsb_release -c -s` = hardy ]")
# hostname.sh returns 1, so I grep for the right name in /etc/hostname just to have a 0 exitcode