Improve performance

This commit is contained in:
Manuel Thalmann 2024-09-08 17:41:30 +02:00
parent eae19dab1f
commit 4b09cd1f87
3 changed files with 24 additions and 49 deletions

View file

@ -458,21 +458,6 @@ $null = New-Module {
Set-SetupOption $finishedOption $true;
}
<#
.SYNOPSIS
Checks whether the specified software collection is enabled.
.PARAMETER Name
The name of the collection to check.
#>
function Test-Collection {
param(
[string] $Name
)
Get-Config "$(Get-ConfigRootName).software.$Name";
}
<#
.SYNOPSIS
Checks whether the running system is a QEMU virtual machine.

View file

@ -28,20 +28,7 @@ $null = New-Module {
$configArgs = @("--system");
}
<#
.SYNOPSIS
Gets the specified git configuration.
.PARAMETER Name
THe name of the configuration to get.
#>
function Get-GitConfig {
param(
[string] $Name
)
Get-Config "$root.git.$Name";
}
$config = Get-Config "$root.git";
<#
.SYNOPSIS
@ -52,7 +39,7 @@ $null = New-Module {
}
if ((-not $IsWindows) -or $User) {
$branch = Get-GitConfig "defaultBranch";
$branch = $config.defaultBranch;
if ($branch) {
Set-GitConfig "init.defaultBranch" $branch;
@ -76,8 +63,8 @@ $null = New-Module {
. {
$dir = New-TemporaryDirectory;
$key = "flow";
$mainBranch = Get-GitConfig "$key.mainBranch";
$devBranch = Get-GitConfig "$key.devBranch";
$mainBranch = $config."$key".mainBranch;
$devBranch = $config."$key".devBranch;
& {
git -C "$dir" init;
@ -103,7 +90,7 @@ $null = New-Module {
};
# Aliases
[PSCustomObject] $aliases = Get-GitConfig "aliases";
[PSCustomObject] $aliases = $config.aliases;
if ($aliases) {
foreach ($alias in ($aliases | Get-Member -MemberType Properties)) {

View file

@ -24,13 +24,16 @@ function Deploy-SoftwareAction {
$install = $true;
}
$hardware = Get-Config "valhalla.hardware";
$collections = Get-Config "valhalla.windows.software";
# Drivers
& {
$driverPath = "$PSScriptRoot/../Drivers";
$mbPath = "$driverPath/ROG Zenith Extreme Alpha";
if ($install) {
if (Get-Config "valhalla.hardware.elgatoWave") {
if ($hardware.elgatoWave) {
if (-not (Test-ChocoPackage wavelink)) {
Install-ChocoPackage wavelink -ArgumentList '--install-arguments="/norestart"';
Remove-DesktopIcon "*Wave Link*";
@ -40,7 +43,7 @@ function Deploy-SoftwareAction {
}
}
foreach ($component in (Get-Config "valhalla.hardware.components")) {
foreach ($component in $hardware.components) {
switcH ($component) {
("ROG Zenith Extreme Alpha") {
& "$mbPath/MarvellEthernet/Manage.ps1" @arguments;
@ -56,22 +59,22 @@ function Deploy-SoftwareAction {
}
if ($install) {
if (Get-Config "valhalla.hardware.amdCPU") {
if ($hardware.amdCPU) {
Install-ChocoPackage amd-ryzen-master;
# ToDo: backup Ryzen energy saving plan
}
if (Get-Config "valhalla.hardware.nvidiaGPU") {
if ($hardware.nvidiaGPU) {
Install-ChocoPackage geforce-game-ready-driver;
Remove-DesktopIcon "*Geforce*";
}
if (Get-Config "valhalla.hardware.corsairDevice") {
if ($hardware.corsairDevice) {
Install-ChocoPackage icue;
}
}
if (Get-Config "valhalla.hardware.eyeX") {
if ($hardware.eyeX) {
& "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
}
};
@ -83,12 +86,12 @@ function Deploy-SoftwareAction {
# Windows Config
& "$softwarePath/Windows/Manage.ps1" @arguments;
if (Get-Config "valhalla.hardware.logitechG") {
if ($hardware.logitechG) {
& "$softwarePath/LGHub/Manage.ps1" @arguments;
}
# Essentials
if (Test-Collection "essential") {
if ($collections.essential) {
& "$softwarePath/aliae/Main.ps1" @arguments;
& "$softwarePath/git/Manage.ps1" @arguments;
& "$softwarePath/OpenSSH/Manage.ps1" @arguments;
@ -116,7 +119,7 @@ function Deploy-SoftwareAction {
}
# Common Software
if (Test-Collection "common") {
if ($collections.common) {
& "$softwarePath/WinSCP/Manage.ps1" @arguments;
& "$softwarePath/Thunderbird/Manage.ps1" @arguments;
& "$softwarePath/PuTTY/Manage.ps1" @arguments;
@ -138,7 +141,7 @@ function Deploy-SoftwareAction {
}
}
if (Test-Collection "desktopExperience") {
if ($collections.desktopExperience) {
if ($install) {
# Fonts
Install-ChocoPackage nerd-fonts-CascadiaCode;
@ -171,7 +174,7 @@ function Deploy-SoftwareAction {
Remove-DesktopIcon "GIMP*";
Remove-DesktopIcon "GPU-Z*";
Remove-DesktopIcon "WinDirStat*";
Remove-DesktopIcon "*HWMonior*";
Remove-DesktopIcon "*HWMonitor*";
Remove-DesktopIcon "ImgBurn*";
Remove-DesktopIcon "InkScape*";
Remove-DesktopIcon "Krita*";
@ -193,12 +196,12 @@ function Deploy-SoftwareAction {
& "$softwarePath/Firefox/Manage.ps1" @arguments;
& "$softwarePath/MSEdgeRedirect/Manage.ps1" @arguments;
if (Test-Collection "fileSync") {
if ($collections.fileSync) {
& "$softwarePath/Nextcloud/Main.ps1" @arguments;
}
}
if (Test-Collection "socialMedia") {
if ($collections.socialMedia) {
if ($install) {
Install-ChocoPackage `
signal `
@ -215,7 +218,7 @@ function Deploy-SoftwareAction {
}
}
if (Test-Collection "media") {
if ($collections.media) {
if ($install) {
Install-ChocoPackage `
k-litecodecpackmega `
@ -231,7 +234,7 @@ function Deploy-SoftwareAction {
}
}
if (Test-Collection "coding") {
if ($collections.coding) {
if ($install) {
Install-ChocoPackage `
@ -257,7 +260,7 @@ function Deploy-SoftwareAction {
}
# Gaming
if (Test-Collection "gaming") {
if ($collections.gaming) {
if ($install) {
Install-ChocoPackage `
goggalaxy `