Add scripts for backing up osu!

This commit is contained in:
Manuel Thalmann 2024-08-28 12:47:07 +02:00
parent 5b550789da
commit 4e545ebcb9
2 changed files with 74 additions and 27 deletions

View file

@ -5,10 +5,41 @@ param(
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
& {
param($Parameters)
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
Export-ModuleMember -Function @();
$getInstallPath = {
return "$((Get-KnownFolder -SpecialFolder ProgramFilesX86).Path)/osu!";
}
Start-SoftwareInstaller @Parameters `
-Installer {
Install-ChocoPackage osu;
Remove-DesktopIcon "*osu*";
} `
-Backup {
Add-BackupArtifacts -Source (& $getInstallPath) -Path "osu!" `
-Include @(
"Screenshots",
"Skins",
"Songs",
"osu!.cfg",
"scores.db"
);
} `
-Configurator {
Expand-BackupArtifacts -Path "osu!" -Target (& $getInstallPath);
} `
-UserBackup {
param([hashtable] $Arguments)
$name = $Arguments.Name;
Add-BackupArtifacts -Source "$(& $getInstallPath)/osu!.$name.cfg" -User $name -Path "osu!/osu!.cfg";
} `
-UserConfigurator {
param([hashtable] $Arguments)
$name = $Arguments.Name;
Expand-BackupArtifacts -User $name -Path "osu!/osu!.cfg" -Target "$(& $getInstallPath)/osu!.$name.cfg";
};
# ToDo: Add restoration
} $PSBoundParameters;

View file

@ -3,10 +3,26 @@ param(
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
& {
param($Parameters)
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
$path = "$env:AppData/osu";
Start-SoftwareInstaller @PSBoundParameters `
Start-SoftwareInstaller @Parameters `
-UserBackup {
param([hashtable] $Arguments)
Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "osu!lazer" `
-Include @(
"files",
"rulesets",
"screenshots",
"framework.ini",
"game.ini",
"input.json"
);
} `
-UserConfigurator {
$file = "osu!lazer.exe";
$processName = "osu!";
@ -26,6 +42,6 @@ Start-SoftwareInstaller @PSBoundParameters `
Remove-Item -Recurse $dir;
Remove-DesktopIcon "*osu*";
Expand-BackupArtifacts -User $Arguments.Name -Path "osu!lazer" -Target $path;
};
# ToDo: Add restoration
} $PSBoundParameters;