Fix incorrect variable overrides

This commit is contained in:
Manuel Thalmann 2023-06-08 02:28:33 +02:00
parent 24ef21e8d4
commit e0fd6a6de7
11 changed files with 111 additions and 69 deletions

View file

@ -1,7 +1,19 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "$env:LOCALAPPDATA/LGHUB";
$softwareName = "LGHub";
function Invoke-BackupLGHub([Context] $context) { $null = New-Module {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db*", "-i!icon_cache")); $path = "$env:LOCALAPPDATA/LGHUB";
$softwareName = "LGHub";
function Invoke-BackupLGHub([Context] $context) {
$hubName = "lghub.exe";
$mainProcesses = Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq "$hubName" };
$lghub = $mainProcesses[0].Path;
$hubProcesses = ($mainProcesses + (Get-Process | Where-Object { @("$hubName", "lghub_agent.exe", "lghub_system_tray.exe") -contains [System.IO.Path]::GetFileName($_.Path) }));
$hubProcesses | Foreach-Object { $_.Kill() };
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db*", "-i!icon_cache"));
if ($lghub) {
& "$lghub";
}
}
} }

View file

@ -1,7 +1,10 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "$HOME/Documents/ManiaPlanet";
$softwareName = "ManiaPlanet";
function Invoke-BackupManiaPlanet([Context] $context) { $null = New-Module {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"")); $path = "$HOME/Documents/ManiaPlanet";
$softwareName = "ManiaPlanet";
function Invoke-BackupManiaPlanet([Context] $context) {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
} }

View file

@ -1,16 +1,19 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$softwareName = "PuTTY";
$configFile = "${softwareName}.reg";
function New-TempDirectory() { $null = New-Module {
$tempDir = Join-Path $([System.IO.Path]::GetTempPath()) $([System.IO.Path]::GetRandomFileName()); $softwareName = "PuTTY";
$null = New-Item -ItemType Directory $tempDir; $configFile = "$($softwareName).reg";
return $tempDir;
}
function Invoke-BackupPuTTY([Context] $context) { function New-TempDirectory() {
$tempDir = New-TempDirectory; $tempDir = Join-Path $([System.IO.Path]::GetTempPath()) $([System.IO.Path]::GetRandomFileName());
$fileName = Join-Path "$tempDir" $configFile; $null = New-Item -ItemType Directory $tempDir;
& reg export "HKCU\Software\SimonTatham" "$fileName" /y; return $tempDir;
$context.Backup($tempDir, $context.SoftwareArchive($softwareName), @()); }
function Invoke-BackupPuTTY([Context] $context) {
$tempDir = New-TempDirectory;
$fileName = Join-Path "$tempDir" $configFile;
& reg export "HKCU\Software\SimonTatham" "$fileName" /y;
$context.Backup($tempDir, $context.SoftwareArchive($softwareName), @());
}
} }

View file

@ -1,7 +1,10 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "C:/tools/RetroArch-Win64";
$softwareName = "RetroArch";
function Invoke-BackupRetroArch([Context] $context) { $null = New-Module {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"")); $path = "C:/tools/RetroArch-Win64";
$softwareName = "RetroArch";
function Invoke-BackupRetroArch([Context] $context) {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
} }

View file

@ -1,7 +1,10 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "$HOME/Documents/TmForever";
$softwareName = "TmNationsForever";
function Invoke-BackupTmNations([Context] $context) { $null = New-Module {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"")); $path = "$HOME/Documents/TmForever";
$softwareName = "TmNationsForever";
function Invoke-BackupTmNations([Context] $context) {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
} }

View file

@ -1,7 +1,10 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "$HOME/Documents/TrackMania";
$softwareName = "TmUnitedForever";
function Invoke-BackupTmUnited([Context] $context) { $null = New-Module {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"")); $path = "$HOME/Documents/TrackMania";
$softwareName = "TmUnitedForever";
function Invoke-BackupTmUnited([Context] $context) {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
} }

View file

@ -1,27 +1,30 @@
Import-Module "KnownFolders"; Import-Module "KnownFolders";
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$programs32Path = $(Get-KnownFolder "ProgramFilesX86").Path;
$vsInstaller = "$programs32Path/Microsoft Visual Studio/Installer/vs_installer.exe";
[System.Tuple[string, string, string][]]$versions = @( $null = New-Module {
[System.Tuple]::Create("visualstudio2019enterprise", "VisualStudio.16.Release", "Microsoft.VisualStudio.Product.Enterprise")); $programs32Path = $(Get-KnownFolder "ProgramFilesX86").Path;
$vsInstaller = "$programs32Path/Microsoft Visual Studio/Installer/vs_installer.exe";
function Get-ConfigPath([Context] $context, [string] $packageName) { [System.Tuple[string, string, string][]]$versions = @(
return Join-Path $($context.BackupRoot()) $packageName ".vsconfig"; [System.Tuple]::Create("visualstudio2019enterprise", "VisualStudio.16.Release", "Microsoft.VisualStudio.Product.Enterprise"));
}
function Invoke-BackupVisualStudio([Context] $context) { function Get-ConfigPath([Context] $context, [string] $packageName) {
foreach ($version in $versions) { return Join-Path $($context.BackupRoot()) $packageName ".vsconfig";
$configPath = Get-ConfigPath $context $version[0]; }
$null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)";
Start-Process -FilePath "$vsInstaller" ` function Invoke-BackupVisualStudio([Context] $context) {
-Wait ` foreach ($version in $versions) {
-ArgumentList @( $configPath = Get-ConfigPath $context $version[0];
"export", $null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)";
"--channelId", "$($version[1])",
"--productId", "$($version[2])", Start-Process -FilePath "$vsInstaller" `
"--config", "$configPath", -Wait `
"--quiet"); -ArgumentList @(
"export",
"--channelId", "$($version[1])",
"--productId", "$($version[2])",
"--config", "$configPath",
"--quiet");
}
} }
} }

View file

@ -1,5 +1,8 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$configBaseName = ".gitconfig";
$configPath = Join-Path "$HOME" "$configBaseName";
function Invoke-BackupGit([Context] $context) {} $null = New-Module {
$configBaseName = ".gitconfig";
$configPath = Join-Path "$HOME" "$configBaseName";
function Invoke-BackupGit([Context] $context) {}
}

View file

@ -1,10 +1,13 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "$env:LOCALAPPDATA/osu!";
$softwareName = "osu!";
$genericConfigName = "osu!.User.cfg";
function Invoke-BackupOsu([Context] $context) { $null = New-Module {
$archive = $context.SoftwareArchive($softwareName); $path = "$env:LOCALAPPDATA/osu!";
$context.Backup($path, $archive, @("-i@`"$PSScriptRoot/include.txt`"")); $softwareName = "osu!";
& 7z rn "$archive" "osu!.$env:USERNAME.cfg" $genericConfigName; $genericConfigName = "osu!.User.cfg";
function Invoke-BackupOsu([Context] $context) {
$archive = $context.SoftwareArchive($softwareName);
$context.Backup($path, $archive, @("-i@`"$PSScriptRoot/include.txt`""));
& 7z rn "$archive" "osu!.$env:USERNAME.cfg" $genericConfigName;
}
} }

View file

@ -1,7 +1,10 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "$env:APPDATA/osu";
$softwareName = "osu!lazer";
function Invoke-BackupOsuLazer([Context] $context) { $null = New-Module {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db")); $path = "$env:APPDATA/osu";
$softwareName = "osu!lazer";
function Invoke-BackupOsuLazer([Context] $context) {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
}
} }

View file

@ -1,7 +1,10 @@
. "$PSScriptRoot/../../Scripts/Context.ps1"; . "$PSScriptRoot/../../Scripts/Context.ps1";
$path = "$env:PUBLIC/Documents/reWASD";
$softwareName = "reWASD";
function Invoke-BackupReWASD([Context] $context) { $null = New-Module {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-x@`"$PSScriptRoot/exclude.txt`"")); $path = "$env:PUBLIC/Documents/reWASD";
$softwareName = "reWASD";
function Invoke-BackupReWASD([Context] $context) {
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-x@`"$PSScriptRoot/exclude.txt`""));
}
} }