Use internal OS detection
This commit is contained in:
parent
a34aa6c143
commit
b477870829
1 changed files with 15 additions and 19 deletions
|
@ -16,14 +16,10 @@ Start-SoftwareInstaller @PSBoundParameters `
|
||||||
& $Installer -Action ([InstallerAction]::Configure);
|
& $Installer -Action ([InstallerAction]::Configure);
|
||||||
} `
|
} `
|
||||||
-Configurator {
|
-Configurator {
|
||||||
param(
|
|
||||||
[hashtable] $Arguments
|
|
||||||
)
|
|
||||||
|
|
||||||
[string] $globalDir = $null;
|
[string] $globalDir = $null;
|
||||||
$indicator = "# Profile Files";
|
$indicator = "# Profile Files";
|
||||||
|
|
||||||
if ($Arguments.Linux) {
|
if (-not $IsWindows) {
|
||||||
$globalDir = '"/etc/powershell/conf.d"';
|
$globalDir = '"/etc/powershell/conf.d"';
|
||||||
} else {
|
} else {
|
||||||
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
||||||
|
@ -33,22 +29,22 @@ Start-SoftwareInstaller @PSBoundParameters `
|
||||||
Add-PowerShellProfileStatement `
|
Add-PowerShellProfileStatement `
|
||||||
-DefaultUser `
|
-DefaultUser `
|
||||||
-Script (@(
|
-Script (@(
|
||||||
$indicator,
|
$indicator,
|
||||||
"`$globalDir = $globalDir",
|
"`$globalDir = $globalDir",
|
||||||
({
|
({
|
||||||
$profileRoot = Split-Path -Parent $PROFILE;
|
$profileRoot = Split-Path -Parent $PROFILE;
|
||||||
|
|
||||||
$profilePaths = @(
|
$profilePaths = @(
|
||||||
"$profileRoot/conf.d/*.ps1",
|
"$profileRoot/conf.d/*.ps1",
|
||||||
"$globalDir/*.ps1"
|
"$globalDir/*.ps1"
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach ($profilePath in $profilePaths) {
|
foreach ($profilePath in $profilePaths) {
|
||||||
if (Test-Path $profilePath) {
|
if (Test-Path $profilePath) {
|
||||||
Get-Item $profilePath | ForEach-Object { . $_; };
|
Get-Item $profilePath | ForEach-Object { . $_; };
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).ToString()) -join "`n") `
|
}
|
||||||
-Append;
|
}).ToString()) -join "`n") `
|
||||||
|
-Append;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue