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

38 lines
1.3 KiB
PowerShell
Raw Normal View History

2023-07-12 20:37:31 +00:00
#!/bin/pwsh
2024-08-07 19:05:32 +00:00
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
2023-06-07 18:24:43 +00:00
2023-06-08 00:28:33 +00:00
$null = New-Module {
$path = "$env:APPDATA/osu";
$softwareName = "osu!lazer";
2023-06-30 10:19:54 +00:00
function Backup-OsuLazer([Context] $context) {
Write-Host "Backing up osu!lazer";
2023-06-08 00:28:33 +00:00
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
}
2023-07-02 13:12:56 +00:00
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";
2023-07-12 16:23:59 +00:00
$processName = "osu!";
2023-07-02 13:12:56 +00:00
$tempDir = $context.GetTempDirectory();
Push-Location $tempDir;
Invoke-WebRequest "https://github.com/ppy/osu/releases/latest/download/install.exe" -OutFile $installerName;
2023-07-13 17:35:19 +00:00
Start-Process -FilePath $installerName;
2023-07-12 16:23:59 +00:00
while (-not (Get-Process -ErrorAction "SilentlyContinue" $processName)) {
Start-Sleep 1;
}
Start-Sleep 10;
Get-Process $processName | Stop-Process -Force;
$context.RemoveDesktopIcon("*osu*");
2023-07-02 13:12:56 +00:00
Pop-Location;
Remove-Item -Recurse $tempDir;
}
2023-07-12 20:44:20 +00:00
}