From fd25cbefe175cbe15034f8ed2d7ecd12bf176fa3 Mon Sep 17 00:00:00 2001 From: Gurpartap Singh Date: Sun, 7 Sep 2014 02:05:41 +0530 Subject: [PATCH] change_host_name cap for TinyCore Linux --- plugins/guests/tinycore/cap/change_host_name.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/guests/tinycore/cap/change_host_name.rb diff --git a/plugins/guests/tinycore/cap/change_host_name.rb b/plugins/guests/tinycore/cap/change_host_name.rb new file mode 100644 index 000000000..2c16af362 --- /dev/null +++ b/plugins/guests/tinycore/cap/change_host_name.rb @@ -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