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

32 lines
918 B
PowerShell
Raw Normal View History

using namespace Microsoft.Win32;
2024-11-01 12:12:16 +00:00
. "$PSScriptRoot/../../../lib/Software.ps1";
2024-10-13 13:35:24 +00:00
. "$PSScriptRoot/../../../Common/Software/powershell/Profile.ps1";
2024-10-13 23:55:19 +00:00
Start-SoftwareInstaller -Force @args `
-Configurator {
param([string] $Name)
2024-08-07 19:50:21 +00:00
[string] $backup = $null;
$nativeProfile = powershell -c '$PROFILE';
2024-08-07 19:50:21 +00:00
if (Test-Path -PathType Leaf $nativeProfile) {
$backup = "${nativeProfile}_";
Move-Item $nativeProfile $backup;
}
2024-08-07 19:50:21 +00:00
$null = New-Item -Force $nativeProfile;
choco install -y --force chocolatey;
2024-08-07 19:50:21 +00:00
Add-PowerShellProfileStatement `
2024-10-17 02:09:18 +00:00
-System `
-Category "$Name" `
2024-08-07 19:50:21 +00:00
-Script (Get-Content $nativeProfile | Out-String) `
-Append;
2024-08-07 19:50:21 +00:00
if ($backup) {
Move-Item $backup $nativeProfile;
}
Import-Module "$env:ChocolateyInstall/helpers/chocolateyProfile.psm1";
};