mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
change_host_name cap for TinyCore Linux
This commit is contained in:
parent
bde0e3fb2a
commit
fd25cbefe1
1 changed files with 14 additions and 0 deletions
14
plugins/guests/tinycore/cap/change_host_name.rb
Normal file
14
plugins/guests/tinycore/cap/change_host_name.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
module VagrantPlugins
|
||||
module GuestTinyCore
|
||||
module Cap
|
||||
class ChangeHostName
|
||||
def self.change_host_name(machine, name)
|
||||
if !machine.communicate.test("hostname | grep '^#{name}$'")
|
||||
machine.communicate.sudo("sh -c 'echo \"#{name}\" > /etc/hostname'")
|
||||
machine.communicate.sudo("/usr/bin/sethostname #{name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue