From 3dda019cacc96704728c3c29e77227ee2ed7d0aa Mon Sep 17 00:00:00 2001 From: Bob Maerten Date: Fri, 13 Jul 2012 15:07:56 +0200 Subject: [PATCH] change_host_name should change mailname too On Debian systems config.hostname directive should change /etc/mailname in order to prevent problems with default mailer trying to contact default vm's name. --- plugins/guests/debian/guest.rb | 1 + plugins/guests/ubuntu/guest.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/guests/debian/guest.rb b/plugins/guests/debian/guest.rb index 411e0f329..2734c2601 100644 --- a/plugins/guests/debian/guest.rb +++ b/plugins/guests/debian/guest.rb @@ -62,6 +62,7 @@ module VagrantPlugins vm.channel.sudo("sed -r -i 's/^(127[.]0[.]1[.]1[[:space:]]+).*$/\\1#{name} #{name.split('.')[0]}/' /etc/hosts") vm.channel.sudo("sed -i 's/.*$/#{name.split('.')[0]}/' /etc/hostname") vm.channel.sudo("hostname -F /etc/hostname") + vm.channel.sudo("hostname --fqdn > /etc/mailname") end end end diff --git a/plugins/guests/ubuntu/guest.rb b/plugins/guests/ubuntu/guest.rb index 818c83550..3999aef7e 100644 --- a/plugins/guests/ubuntu/guest.rb +++ b/plugins/guests/ubuntu/guest.rb @@ -18,6 +18,7 @@ module VagrantPlugins vm.channel.sudo("sed -i 's/.*$/#{name}/' /etc/hostname") vm.channel.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts") vm.channel.sudo("service hostname start") + vm.channel.sudo("hostname --fqdn > /etc/mailname") end end end