Merge pull request #2041 from Boohbah/arch-change-host-name

guests/arch: Use hostnamectl in cap/change_host_name.rb
This commit is contained in:
Mitchell Hashimoto 2013-08-09 17:47:11 -07:00
commit 2866476fb4
1 changed files with 1 additions and 2 deletions

View File

@ -6,8 +6,7 @@ module VagrantPlugins
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
# Only do this if the hostname is not already set # Only do this if the hostname is not already set
if !comm.test("sudo hostname | grep '#{name}'") if !comm.test("sudo hostname | grep '#{name}'")
comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/rc.conf") comm.sudo("hostnamectl set-hostname #{name}")
comm.sudo("hostname #{name}")
comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts") comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts")
end end
end end