[KEERO-96] Implemented standalone SQL Server 2012 installer
This commit is contained in:
parent
75d2bc2111
commit
c2c7aa7be8
|
@ -184,7 +184,23 @@ function New-OptionParser() {
|
|||
$Option.Validate()
|
||||
$CommandLine = $CommandLine + $Option.ToString()
|
||||
}
|
||||
return $CommandLine -join ' '
|
||||
return $CommandLine
|
||||
}
|
||||
|
||||
$OptionParser | Add-Member ScriptMethod ExecuteBinary {
|
||||
param($Binary, [hashtable]$Options = @{}, $CommandLineSuffix = @())
|
||||
|
||||
$Binary = Get-Item $Binary
|
||||
$CommandLine = $this.Parse($Options)
|
||||
if ($CommandLineSuffix) {
|
||||
$CommandLine = $CommandLine + $CommandLineSuffix
|
||||
}
|
||||
|
||||
Write-Host "Executing: $($Binary.FullName) $($CommandLine -join ' ')"
|
||||
$process = [System.Diagnostics.Process]::Start($Binary, $CommandLine)
|
||||
$process.WaitForExit()
|
||||
$process.Refresh()
|
||||
return $process.ExitCode
|
||||
}
|
||||
|
||||
return $OptionParser
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
cd %~dp0
|
||||
powershell.exe -ExecutionPolicy Unrestricted .\SQLServerInstaller.ps1 %*
|
|
@ -0,0 +1,26 @@
|
|||
param(
|
||||
[parameter(Mandatory = $true)]
|
||||
[string]$Mode,
|
||||
[parameter(Mandatory = $true)]
|
||||
[string]$SetupRoot
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Import-Module '.\SQLServerInstaller.psm1'
|
||||
|
||||
$SupportedModes = @('STANDALONE')
|
||||
|
||||
if (-not ($SupportedModes -contains $Mode)) {
|
||||
throw "Installation mode '$Mode' is not supported. Supported modes are: $($SupportedModes -join ', ')"
|
||||
}
|
||||
|
||||
$SetupDir = Get-Item $SetupRoot
|
||||
$SetupExe = $SetupDir.GetFiles("setup.exe")[0]
|
||||
|
||||
$parser = New-OptionParserInstall
|
||||
|
||||
if ($Mode -eq 'STANDALONE') {
|
||||
$parser.ExecuteBinary($SetupExe.FullName, @{"QS" = $null})
|
||||
}
|
||||
|
Loading…
Reference in New Issue