PortValhalla/scripts/Windows/Software/chocolatey/Main.ps1

31 lines
918 B
PowerShell

using namespace Microsoft.Win32;
. "$PSScriptRoot/../../../lib/Software.ps1";
. "$PSScriptRoot/../../../Common/Software/powershell/Profile.ps1";
Start-SoftwareInstaller -Force @args `
-Configurator {
param([string] $Name)
[string] $backup = $null;
$nativeProfile = powershell -c '$PROFILE';
if (Test-Path -PathType Leaf $nativeProfile) {
$backup = "${nativeProfile}_";
Move-Item $nativeProfile $backup;
}
$null = New-Item -Force $nativeProfile;
choco install -y --force chocolatey;
Add-PowerShellProfileStatement `
-System `
-Category "$Name" `
-Script (Get-Content $nativeProfile | Out-String) `
-Append;
if ($backup) {
Move-Item $backup $nativeProfile;
}
Import-Module "$env:ChocolateyInstall/helpers/chocolateyProfile.psm1";
};