Class: PEBuild::Cap::RunInstall::Windows

Inherits:
Object
  • Object
show all
Extended by:
OnMachine
Defined in:
lib/pe_build/cap/run_install/windows.rb

Class Method Summary collapse

Methods included from OnMachine

on_machine

Class Method Details

.run_install(machine, installer_path, answers, **options) ⇒ void

This method returns an undefined value.

Run the PE installer on Windows systems

Parameters:

  • machine (Vagrant::Machine)

    The Vagrant machine on which to run the installation.

  • installer_dir (String)

    A path to the PE installer.

  • answers (Hash[String => String})

    A hash of options that will be passed to msiexec as key=value pairs.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pe_build/cap/run_install/windows.rb', line 15

def self.run_install(machine, installer_path, answers, **options)
  install_options = answers.map{|e| e.join('=')}.join(' ')
  # Lots of PowerShell commands can handle UNIX-style paths. msiexec can't.
  installer_path = installer_path.gsub('/', '\\')

  cmd = <<-EOS
$params = @(
"/qn",
"/i `"#{installer_path}`"",
"/l*v puppet-enterprise-installer.log",
"#{install_options}"
)

(Start-Process -FilePath "msiexec.exe" -ArgumentList $params -Wait -Passthru).ExitCode
EOS

  machine.ui.info "Running: #{cmd}"

  on_machine(machine, cmd)
end