guests/rhel: Use FQDN for hostname
Refs: https://lukas.zapletalovi.com/2011/12/setting-hostname-properly-in-fedora-and.html
This commit is contained in:
parent
cf91bcf029
commit
336cb3319c
|
@ -8,10 +8,10 @@ module VagrantPlugins
|
|||
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
||||
basename = name.split(".", 2)[0]
|
||||
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
||||
echo '#{basename}' > /etc/hostname
|
||||
echo '#{name}' > /etc/hostname
|
||||
hostname -F /etc/hostname
|
||||
hostnamectl set-hostname --static '#{basename}'
|
||||
hostnamectl set-hostname --transient '#{basename}'
|
||||
hostnamectl set-hostname --static '#{name}'
|
||||
hostnamectl set-hostname --transient '#{name}'
|
||||
|
||||
# Remove comments and blank lines from /etc/hosts
|
||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
||||
|
|
Loading…
Reference in New Issue