Add scripts for backing up osu!

This commit is contained in:
Manuel Thalmann 2024-08-28 12:47:07 +02:00
parent 3973703d1f
commit cb64f234af
2 changed files with 63 additions and 15 deletions

View file

@ -5,10 +5,41 @@ param(
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; . "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters ` & {
-Installer { param($Parameters)
Install-ChocoPackage osu; . "$PSScriptRoot/../../Scripts/Restoration.ps1";
Remove-DesktopIcon "*osu*"; Export-ModuleMember -Function @();
};
# ToDo: Add restoration $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";
};
} $PSBoundParameters;

View file

@ -3,13 +3,30 @@ param(
[hashtable] $Arguments [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 `
-UserConfigurator { -UserBackup {
Install-WingetPackage "ppy.osu"; param([hashtable] $Arguments)
Remove-DesktopIcon "*osu*"; Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "osu!lazer" `
}; -Include @(
"files",
# ToDo: Add restoration "rulesets",
"screenshots",
"framework.ini",
"game.ini",
"input.json"
);
} `
-UserConfigurator {
param([hashtable] $Arguments)
Install-WingetPackage "ppy.osu" -ArgumentList "--scope","user";
Remove-DesktopIcon "*osu*";
Expand-BackupArtifacts -User $Arguments.Name -Path "osu!lazer" -Target $path;
};
} $PSBoundParameters;