add winget installation module

This commit is contained in:
Baipyrus 2024-11-24 21:14:10 +01:00
parent 5090a04e95
commit 3a849a448f
3 changed files with 35 additions and 0 deletions

View File

@ -1,6 +1,10 @@
Import-Module ./util/windows.psm1
Import-Module ./util/winget.psm1
# (Optionally) Install required Software
InstallWinget
# Define paths for tools and configurations
$dotfilesRepo = "$env:TMP\dotfiles"
$alacrittyConfigDir = "$env:APPDATA\alacritty"

11
util/winget.list Normal file
View File

@ -0,0 +1,11 @@
Git.Git
Microsoft.OpenJDK.21
Alacritty.Alacritty
OpenJS.NodeJS.LTS
Chocolatey.Chocolatey
Microsoft.DotNet.SDK.8
Microsoft.PowerShell
GoLang.Go
Python.Python.3.12
Rustlang.Rustup
rjpcomputing.luaforwindows

20
util/winget.psm1 Normal file
View File

@ -0,0 +1,20 @@
function InstallWinget
{
# Reference: https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
$progressPreference = 'silentlyContinue'
Write-Host "Installing WinGet PowerShell module from PSGallery..."
Install-PackageProvider -Name NuGet -Force | Out-Null
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..."
Repair-WinGetPackageManager
}
function WingetInstall
{
$install = Read-Host "Install WinGet now? [Y/n]"
if ($install.ToLower() -ne 'n')
{ InstallWinget
}
winget.exe install -s winget --accept-source-agreements (Get-Content ./util/winget.list)
}