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.
This commit is contained in:
Bob Maerten 2012-07-13 15:07:56 +02:00
parent 244882bd75
commit 3dda019cac
2 changed files with 2 additions and 0 deletions

View File

@ -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

View File

@ -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