Class: PEBuild::Cap::StageInstaller::POSIX
- Inherits:
-
Object
- Object
- PEBuild::Cap::StageInstaller::POSIX
- Extended by:
- OnMachine
- Defined in:
- lib/pe_build/cap/stage_installer/posix.rb
Overview
Download PE installers to a POSIX VM
Class Method Summary collapse
-
.stage_installer(machine, uri, dest_dir = '.') ⇒ void
Download an installer to a remote VM.
Methods included from OnMachine
Class Method Details
.stage_installer(machine, uri, dest_dir = '.') ⇒ void
This method returns an undefined value.
Download an installer to a remote VM
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pe_build/cap/stage_installer/posix.rb', line 17 def self.stage_installer(machine, uri, dest_dir='.') filename = File.basename(uri.path) installer_dir = filename.gsub(/.tar(?:\.gz)?/, '') # GNU tar will attempt to guess the file format. Other versions of tar, # such as those shipped with Solaris, take the approach that trying to # interpret unknown binaries is none of their business. tar_flags = if filename.end_with?('.tar.gz') 'xzf' else 'xf' end unless machine.communicate.test("test -d #{dest_dir}/#{installer_dir}") machine.ui.info I18n.t('pebuild.cap.stage_installer.downloading_installer', :url => uri) # Download and stage the installer without using sudo, so that root # doesn't own the resulting directory. This allows files to be uploaded # later. on_machine(machine, "curl -fsSLk #{uri} -o #{dest_dir}/#{filename}", sudo: false) on_machine(machine, "tar #{tar_flags} #{dest_dir}/#{filename} -C #{dest_dir}", sudo: false) end end |