Sacrifice to the AV Gods test 24-03-28 branch (#1766)

* Remove the Non-existing 'WPFMiscTweaksPower' found in the 'preset.json' File (#1763)

* Compile Winutil

* Update of Test-WinUtilPackageManager and Install-WinUtilWinget (#1757)

* Updated Install-WinUtilWinget and Test-WinUtilPackageManager

- Updated Test-WinUtilPackageManager to better handle the -Winget param and return a more verbose status.
- Moved many of the "is installed"/"is not installed" outputs to the Test-WinUtilPackageManager function.
- Changed Install-WinUtilWinget to use the GitHub install method as the primary method, and on error use the Chocolatey install method.
- Updated various functions to use the Test-WinUtilPackageManager function.

* Update Install-WinUtilWinget.ps1

- Changed handling of Test-WinUtilPackageManager in Install-WinUtilWinget, to prevent Test-WinUtilPackageManager from printing out to terminal twice.

* Compile Winutil

* Update Paint.NET Winget name. (#1758)

Paint.NET's winget package name changed.

* Compile Winutil

* Fixed Programms names and urls and github actions (#1759)

* Compile Winutil

* trying to fix github actions

* Update applications.json

* Compile Winutil

* updated winget package PaintDotNet

* Compile Winutil

* Update functions.Tests.ps1

* fixing typos in unittesting

* fixed the issue that made pester not to work

* Compile Winutil

* found a bug and fixed it

* Compile Winutil

---------

Co-authored-by: YusufKhalifadev <YusufKhalifadev@users.noreply.github.com>

* Detect free space of installation drive and compare it with the ISO size and delete temporary MicroWin files from previous runs (#1761)

* Detect free space of installation drive

Compare the size of the ISO file with the free space of the installation drive (or the drive containing the User files) and, if the free size is below a certain threshold, the script will throw either a warning or an error

* Delete temporary files from previous runs

* Add Simple Feature to keep the Service Startup upon Applying Service Tweaks, but not when Undoing it (#1760)

Added a new parameter that gives freedom of control on whether to disable this feature or not, and of course the simple feature in question.

The way it works is by Getting the service using its name, and see if the Startup Value of this service is equal to the default type that Windows comes with it, if not (The User has changed it in the past), then WinUtil won't change it by default (The KeepServiceStartup is true by default), this is a more desirable behaviour when compared to how it previously worked.

These changes were tested by the Author of this commit, Please read the commit patches for exact details on the changes.

* Compile Winutil

* Sacrifice to the AV Gods

Remove Self Elevation and Disable UAC

---------

Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Rux <jonathan.e.rux@ruxunderscore.com>
Co-authored-by: YusufKhalifadev <yusufkhalifadev@gmail.com>
Co-authored-by: YusufKhalifadev <YusufKhalifadev@users.noreply.github.com>
Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>
This commit is contained in:
Chris Titus
2024-03-30 11:46:29 -05:00
committed by GitHub
parent c3b12e89f8
commit 4a7c8a35bf
19 changed files with 452 additions and 332 deletions

View File

@ -16,10 +16,7 @@ function Invoke-WPFGetInstalled {
return
}
if(!(Get-Command -Name winget -ErrorAction SilentlyContinue) -and $checkbox -eq "winget"){
Write-Host "==========================================="
Write-Host "-- Winget is not installed ---"
Write-Host "==========================================="
if(((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget"){
return
}
@ -46,4 +43,4 @@ function Invoke-WPFGetInstalled {
Write-Host "Done..."
$sync.ProcessRunning = $false
}
}
}

View File

@ -90,6 +90,29 @@ function Invoke-WPFGetIso {
return
}
# Detect the file size of the ISO and compare it with the free space of the system drive
$isoSize = (Get-Item -Path $filePath).Length
Write-Debug "Size of ISO file: $($isoSize) bytes"
# Use this procedure to get the free space of the drive depending on where the user profile folder is stored.
# This is done to guarantee a dynamic solution, as the installation drive may be mounted to a letter different than C
$driveSpace = (Get-Volume -DriveLetter ([IO.Path]::GetPathRoot([Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)).Replace(":\", "").Trim())).SizeRemaining
Write-Debug "Free space on installation drive: $($driveSpace) bytes"
if ($driveSpace -lt ($isoSize * 2))
{
# It's not critical and we _may_ continue. Output a warning
Write-Warning "You may not have enough space for this operation. Proceed at your own risk."
}
elseif ($driveSpace -lt $isoSize)
{
# It's critical and we can't continue. Output an error
Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations."
return
}
else
{
Write-Host "You have enough space for this operation."
}
try {
Write-Host "Mounting Iso. Please wait."
$mountedISO = Mount-DiskImage -PassThru "$filePath"
@ -123,6 +146,19 @@ function Invoke-WPFGetIso {
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
}
# Detect if the folders already exist and remove them
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
{
try {
Write-Host "Deleting temporary files from previous run. Please wait..."
Remove-Item -Path $sync.MicrowinMountDir.Text -Recurse -Force
Remove-Item -Path $sync.MicrowinScratchDir.Text -Recurse -Force
}
catch {
Write-Host "Could not delete temporary files. You need to delete those manually."
}
}
Write-Host "Setting up mount dir and scratch dirs"
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"

View File

@ -5,10 +5,7 @@ function Invoke-WPFInstallUpgrade {
Invokes the function that upgrades all installed programs using winget
#>
if(!(Get-Command -Name winget -ErrorAction SilentlyContinue)){
Write-Host "==========================================="
Write-Host "-- Winget is not installed ---"
Write-Host "==========================================="
if((Test-WinUtilPackageManager -winget) -eq "not-installed"){
return
}
@ -24,4 +21,4 @@ function Invoke-WPFInstallUpgrade {
Write-Host "-- Updates started ---"
Write-Host "-- You can close this window if desired ---"
Write-Host "==========================================="
}
}