add change_host_name support for gentoo

This commit is contained in:
Benedikt Böhm 2012-03-01 13:57:44 +01:00 committed by Mitchell Hashimoto
parent 275241caf6
commit aa06f06d1a
1 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,14 @@ module Vagrant
vm.channel.sudo("/etc/init.d/net.eth#{network[:interface]} start")
end
end
def change_host_name(name)
if !vm.channel.test("sudo hostname --fqdn | grep '#{name}'")
vm.channel.sudo("echo 'hostname=#{name.split('.')[0]}' > /etc/conf.d/hostname")
vm.channel.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
vm.channel.sudo("hostname #{name.split('.')[0]}")
end
end
end
end
end