This commit includes the following capabilties for OpenWrt: - Guest detection - SSH key replacement - Change host name - Rsync
20 lines
500 B
Ruby
20 lines
500 B
Ruby
module VagrantPlugins
|
|
module GuestOpenWrt
|
|
module Cap
|
|
class ChangeHostName
|
|
def self.change_host_name(machine, name)
|
|
comm = machine.communicate
|
|
|
|
if !comm.test("uci get system.@system[0].hostname | grep '^#{name}$'", sudo: false)
|
|
comm.execute <<~EOH
|
|
uci set system.@system[0].hostname='#{name}'
|
|
uci commit system
|
|
/etc/init.d/system reload
|
|
EOH
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|