guests/arch: Search for FQDN hostname
This commit is contained in:
parent
3eebff5bf3
commit
10b12ce393
|
@ -5,19 +5,19 @@ module VagrantPlugins
|
||||||
def self.change_host_name(machine, name)
|
def self.change_host_name(machine, name)
|
||||||
comm = machine.communicate
|
comm = machine.communicate
|
||||||
|
|
||||||
if !comm.test("hostname | grep -w '#{name}'")
|
if !comm.test("hostname -f | grep '^#{name}$'")
|
||||||
basename = name.split(".", 2)[0]
|
basename = name.split(".", 2)[0]
|
||||||
comm.sudo <<-EOH
|
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
||||||
hostnamectl set-hostname '#{name}'
|
hostnamectl set-hostname '#{basename}'
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
# Remove comments and blank lines from /etc/hosts
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
||||||
}
|
}
|
||||||
EOH
|
EOH
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Connection=ethernet
|
||||||
|
Description='A basic IPv6 ethernet connection'
|
||||||
|
Interface=<%= options[:device] %>
|
||||||
|
IP6=static
|
||||||
|
Address=('<%= options[:ip]%>/<%= options[:netmask] %>')
|
||||||
|
<% if options[:gateway] %>
|
||||||
|
Gateway='<%= options[:gateway] %>'
|
||||||
|
<% end %>
|
Loading…
Reference in New Issue