use basename for setting hostname
This commit is contained in:
parent
bcf3a4b3d1
commit
a139dd2b59
|
@ -8,8 +8,8 @@ module VagrantPlugins
|
||||||
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
||||||
basename = name.split(".", 2)[0]
|
basename = name.split(".", 2)[0]
|
||||||
comm.sudo <<-EOH.gsub(/^ {14}/, '')
|
comm.sudo <<-EOH.gsub(/^ {14}/, '')
|
||||||
echo '#{name}' > /etc/HOSTNAME
|
echo '#{basename}' > /etc/HOSTNAME
|
||||||
hostname '#{name}'
|
hostname '#{basename}'
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
|
|
Loading…
Reference in New Issue