PortValhalla/scripts/Windows/Software/osu!lazer/Manage.ps1

26 lines
No EOL
996 B
PowerShell

. "$PSScriptRoot/../../Scripts/Context.ps1";
$null = New-Module {
$path = "$env:APPDATA/osu";
$softwareName = "osu!lazer";
function Backup-OsuLazer([Context] $context) {
Write-Host "Backing up osu!lazer";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
}
function Restore-OsuLazer([Context] $context) {
Write-Host "Restoring osu!lazer";
Write-Information "Restoring files";
$context.Restore($context.SoftwareArchive($softwareName), $path);
Write-Information "Installing osu!lazer";
$installerName = "osu!lazer.exe";
$tempDir = $context.GetTempDirectory();
Push-Location $tempDir;
Invoke-WebRequest "https://github.com/ppy/osu/releases/latest/download/install.exe" -OutFile $installerName;
Start-Process -Wait -FilePath $installerName;
Pop-Location;
Remove-Item -Recurse $tempDir;
}
}