vagrant/plugins/guests/ubuntu/guest.rb

22 lines
752 B
Ruby
Raw Normal View History

module VagrantPlugins
module GuestUbuntu
class Guest < VagrantPlugins::GuestDebian::Guest
def mount_shared_folder(name, guestpath, options)
# Mount it like normal
super
# Emit an upstart event if upstart is available
2012-02-11 18:36:27 +00:00
vm.channel.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{guestpath}")
end
def change_host_name(name)
2012-01-07 04:03:56 +00:00
if !vm.channel.test("sudo hostname | grep '#{name}'")
vm.channel.sudo("sed -i 's/.*$/#{name}/' /etc/hostname")
vm.channel.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
vm.channel.sudo("service hostname start")
end
end
end
end
end