Fix installer script structure
This commit is contained in:
parent
34108f78d8
commit
1c29cdd89c
2 changed files with 52 additions and 43 deletions
scripts/Windows/Scripts
|
@ -1,50 +1,50 @@
|
|||
. "$PSScriptRoot/Config.ps1";
|
||||
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the name of the software.
|
||||
#>
|
||||
function Get-SoftwareName {
|
||||
$path = ${Function:Install-Software}.File;
|
||||
|
||||
if ($path -ne "$PSCommandPath") {
|
||||
Split-Path -Leaf (Split-Path -Parent $path);
|
||||
} else {
|
||||
$null;
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the software.
|
||||
#>
|
||||
function Install-Software { }
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configures the system for the software.
|
||||
#>
|
||||
function Set-SoftwareConfiguration { }
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configures a user for the software.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the user to configure.
|
||||
#>
|
||||
function Set-SoftwareUserConfiguration {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $Name
|
||||
)
|
||||
}
|
||||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||
$userArgument = "name";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the name of the software.
|
||||
#>
|
||||
function Get-SoftwareName {
|
||||
$path = ${Function:Install-Software}.File;
|
||||
|
||||
if ($path -ne "$PSCommandPath") {
|
||||
Split-Path -Leaf (Split-Path -Parent $path);
|
||||
} else {
|
||||
$null;
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the software.
|
||||
#>
|
||||
function Install-Software { }
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configures the system for the software.
|
||||
#>
|
||||
function Set-SoftwareConfiguration { }
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configures a user for the software.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the user to configure.
|
||||
#>
|
||||
function Set-SoftwareUserConfiguration {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $Name
|
||||
)
|
||||
}
|
||||
|
||||
function Start-SoftwareInstaller {
|
||||
param(
|
||||
[InstallerAction] $Action,
|
||||
|
@ -68,7 +68,6 @@ $null = New-Module {
|
|||
|
||||
foreach ($user in Get-Users) {
|
||||
$Arguments.Add($userArgument, $user);
|
||||
|
||||
Start-SoftwareInstaller -Action ([InstallerAction]::ConfigureUser) @Arguments;
|
||||
}
|
||||
} elseif ($action -eq ([InstallerAction]::ConfigureUser)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue