lib/vagrant-vbguest/installers/linux.rb in vagrant-vbguest-0.6.0 vs lib/vagrant-vbguest/installers/linux.rb in vagrant-vbguest-0.6.1

- old
+ new

@@ -37,18 +37,26 @@ '/mnt' end # a generic way of installing GuestAdditions assuming all # dependencies on the guest are installed + # @param [Hash] opts Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends + # @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed + # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. + # @yieldparam [String] data Data for the given output. def install(opts=nil, &block) vm.ui.warn I18n.t("vagrant.plugins.vbguest.installer.generic_linux_installer") if self.class == Linux upload(iso_file) - mount_iso - execute_installer - unmount_iso + mount_iso(opts, &block) + execute_installer(opts, &block) + unmount_iso(opts, &block) end + # @param [Hash] opts Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends + # @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed + # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. + # @yieldparam [String] data Data for the given output. def running?(opts=nil, &block) opts = { :sudo => true }.merge(opts || {}) vm.channel.test('lsmod | grep vboxsf', opts, &block) @@ -67,38 +75,61 @@ end end @guest_version end + # @param [Hash] opts Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends + # @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed + # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. + # @yieldparam [String] data Data for the given output. def rebuild(opts=nil, &block) vm.channel.sudo('/etc/init.d/vboxadd setup', opts, &block) end + # @param [Hash] opts Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends + # @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed + # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. + # @yieldparam [String] data Data for the given output. def start(opts=nil, &block) opts = {:error_check => false}.merge(opts || {}) vm.channel.sudo('/etc/init.d/vboxadd start', opts, &block) end # A generic helper method to execute the installer. The iso file # has to be mounted on +mount_point+. # This also yields a installation warning to the user. + # + # @param [Hash] opts Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends + # @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed + # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. + # @yieldparam [String] data Data for the given output. def execute_installer(opts=nil, &block) installer = File.join(mount_point, 'VBoxLinuxAdditions.run') yield_installation_waring(installer) vm.channel.sudo("#{installer} --nox11", opts, &block) end # A generic helper method for mounting the GuestAdditions iso file # on most linux system. # Mounts the given uploaded file from +tmp_path+ on +mount_point+. + # + # @param [Hash] opts Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends + # @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed + # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. + # @yieldparam [String] data Data for the given output. def mount_iso(opts=nil, &block) vm.channel.sudo("mount #{tmp_path} -o loop #{mount_point}", opts, &block) end # A generic helper method for un-mounting the GuestAdditions iso file # on most linux system # Unmounts the +mount_point+. + # + # @param [Hash] opts Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends + # @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed + # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. + # @yieldparam [String] data Data for the given output. def unmount_iso(opts=nil, &block) vm.channel.sudo("umount #{mount_point}", opts, &block) end end end \ No newline at end of file