2024-08-07 18:30:12 +00:00
|
|
|
param (
|
|
|
|
$Action,
|
|
|
|
[hashtable] $Arguments
|
|
|
|
)
|
|
|
|
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
|
|
|
. "$PSScriptRoot/../../Scripts/Scripting.ps1";
|
|
|
|
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
2024-08-07 18:30:12 +00:00
|
|
|
|
|
|
|
Start-SoftwareInstaller @PSBoundParameters `
|
|
|
|
-Installer {
|
|
|
|
param(
|
|
|
|
[scriptblock] $Installer
|
|
|
|
)
|
|
|
|
|
|
|
|
& $Installer -Action ([InstallerAction]::Configure);
|
|
|
|
} `
|
|
|
|
-Configurator {
|
|
|
|
param(
|
|
|
|
[hashtable] $Arguments
|
|
|
|
)
|
|
|
|
|
|
|
|
[string] $globalDir = $null;
|
|
|
|
$indicator = "# Profile Files";
|
|
|
|
|
|
|
|
if ($Arguments.Linux) {
|
|
|
|
$globalDir = '"/etc/powershell/conf.d"';
|
|
|
|
} else {
|
|
|
|
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
|
|
|
}
|
|
|
|
|
|
|
|
[System.Collections.ArrayList] $files = @($PROFILE);
|
|
|
|
|
|
|
|
if (Test-Command powershell) {
|
|
|
|
$null = $files.Add((powershell -c '$PROFILE'));
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($file in $files) {
|
|
|
|
if (-not ((Test-Path -PathType Leaf $file) -and ((Get-Content $file) -contains $indicator))) {
|
|
|
|
Write-PSScript -FileName $file -Script (@(
|
|
|
|
$indicator,
|
|
|
|
"`$globalDir = $globalDir",
|
|
|
|
({
|
|
|
|
$profileRoot = Split-Path -Parent $PROFILE;
|
|
|
|
|
|
|
|
$profilePaths = @(
|
|
|
|
"$profileRoot/conf.d/*.ps1",
|
|
|
|
"$globalDir/*.ps1"
|
|
|
|
)
|
|
|
|
|
|
|
|
foreach ($profilePath in $profilePaths) {
|
|
|
|
if (Test-Path $profilePath) {
|
|
|
|
Get-Item $profilePath | ForEach-Object { . $_; };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).ToString()) -join "`n") `
|
|
|
|
-Append;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|