Make the install script action agnostic
This commit is contained in:
parent
3c36299efb
commit
f31eed5616
3 changed files with 117 additions and 47 deletions
scripts/Common/Scripts
|
@ -2,6 +2,12 @@ using namespace Microsoft.Win32;
|
|||
using namespace System.Security.AccessControl;
|
||||
using namespace System.Security.Principal;
|
||||
|
||||
enum WindowsInstallerStage {
|
||||
Initialize
|
||||
Run
|
||||
Completed
|
||||
}
|
||||
|
||||
enum SetupStage {
|
||||
Configure
|
||||
Install
|
||||
|
@ -18,6 +24,7 @@ enum UserStage {
|
|||
$null = New-Module {
|
||||
[string] $configRoot = "HKLM:\Software\PortValhalla";
|
||||
[string] $stageOption = "Stage";
|
||||
[string] $setupStageOption = "SetupStage";
|
||||
[string] $userOption = "SetupUser";
|
||||
[string] $userStageOption = "UserStage";
|
||||
[string] $accountOption = "MSAccount";
|
||||
|
@ -272,11 +279,44 @@ $null = New-Module {
|
|||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the name of the current setup stage.
|
||||
Gets the name of the current stage of the Windows install script action.
|
||||
#>
|
||||
function Get-Stage {
|
||||
$stage = Get-SetupOption $stageOption;
|
||||
|
||||
if ($null -ne $stage) {
|
||||
$stage = [WindowsInstallerStage]$stage;
|
||||
}
|
||||
|
||||
return $stage;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the name of the current stage of the Windows install script action.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the stage to set.
|
||||
#>
|
||||
function Set-Stage {
|
||||
param(
|
||||
$Name
|
||||
)
|
||||
|
||||
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
|
||||
$Name = ([WindowsInstallerStage]$Name).ToString();
|
||||
}
|
||||
|
||||
$null = Set-SetupOption $stageOption $Name;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the name of the current setup stage.
|
||||
#>
|
||||
function Get-SetupStage {
|
||||
$stage = Get-SetupOption $setupStageOption;
|
||||
|
||||
if ($null -ne $stage) {
|
||||
$stage = [SetupStage]$stage;
|
||||
}
|
||||
|
@ -291,7 +331,7 @@ $null = New-Module {
|
|||
.PARAMETER Name
|
||||
The name to set the current stage to.
|
||||
#>
|
||||
function Set-Stage {
|
||||
function Set-SetupStage {
|
||||
param(
|
||||
$Name
|
||||
)
|
||||
|
@ -300,7 +340,7 @@ $null = New-Module {
|
|||
$Name = ([SetupStage]$Name).ToString();
|
||||
}
|
||||
|
||||
$null = Set-SetupOption $stageOption $Name;
|
||||
$null = Set-SetupOption $setupStageOption $Name;
|
||||
}
|
||||
|
||||
<#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue