Use internal OS detection

This commit is contained in:
Manuel Thalmann 2024-08-07 21:35:03 +02:00
parent a34aa6c143
commit b477870829

View file

@ -16,14 +16,10 @@ Start-SoftwareInstaller @PSBoundParameters `
& $Installer -Action ([InstallerAction]::Configure);
} `
-Configurator {
param(
[hashtable] $Arguments
)
[string] $globalDir = $null;
$indicator = "# Profile Files";
if ($Arguments.Linux) {
if (-not $IsWindows) {
$globalDir = '"/etc/powershell/conf.d"';
} else {
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
@ -33,22 +29,22 @@ Start-SoftwareInstaller @PSBoundParameters `
Add-PowerShellProfileStatement `
-DefaultUser `
-Script (@(
$indicator,
"`$globalDir = $globalDir",
({
$profileRoot = Split-Path -Parent $PROFILE;
$indicator,
"`$globalDir = $globalDir",
({
$profileRoot = Split-Path -Parent $PROFILE;
$profilePaths = @(
"$profileRoot/conf.d/*.ps1",
"$globalDir/*.ps1"
)
$profilePaths = @(
"$profileRoot/conf.d/*.ps1",
"$globalDir/*.ps1"
)
foreach ($profilePath in $profilePaths) {
if (Test-Path $profilePath) {
Get-Item $profilePath | ForEach-Object { . $_; };
}
foreach ($profilePath in $profilePaths) {
if (Test-Path $profilePath) {
Get-Item $profilePath | ForEach-Object { . $_; };
}
}).ToString()) -join "`n") `
-Append;
}
}).ToString()) -join "`n") `
-Append;
}
};