gentoo/guest: #8406 support systemd when changing hostname
This commit is contained in:
parent
f807e5a8be
commit
e06848a649
|
@ -9,8 +9,14 @@ module VagrantPlugins
|
|||
basename = name.split(".", 2)[0]
|
||||
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
||||
# Set the hostname
|
||||
|
||||
# Use hostnamectl on systemd
|
||||
if [[ `systemctl` =~ -\.mount ]]; then
|
||||
systemctl set-hostname '#{name}'
|
||||
else
|
||||
hostname '#{basename}'
|
||||
echo "hostname=#{basename}" > /etc/conf.d/hostname
|
||||
fi
|
||||
|
||||
# Remove comments and blank lines from /etc/hosts
|
||||
sed -i'' -e 's/#.*$//' /etc/hosts
|
||||
|
|
Loading…
Reference in New Issue