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

52 lines
1.6 KiB
PowerShell

& {
. "$PSScriptRoot/../../lib/Restoration.ps1";
. "$PSScriptRoot/../../lib/SoftwareManagement.ps1";
. "$PSScriptRoot/../../../lib/Software.ps1";
. "$PSScriptRoot/../../../lib/System.ps1";
$path = "$env:AppData/osu";
Start-SoftwareInstaller @args `
-UserBackup {
param(
[string] $Name,
[hashtable] $Arguments
)
Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "$Name" `
-Include @(
"files",
"rulesets",
"screenshots",
"client.realm",
"framework.ini",
"game.ini",
"input.json"
);
} `
-UserConfigurator {
param(
[string] $Name,
[hashtable] $Arguments
)
$file = "osu!lazer.exe";
$processName = "osu!";
$dir = New-TemporaryDirectory;
Push-Location $dir;
Invoke-WebRequest "https://github.com/ppy/osu/releases/latest/download/install.exe" -OutFile $file;
Start-Process -FilePath $file;
while (-not (Get-Process -ErrorAction SilentlyContinue $processName)) {
Start-Sleep 1;
}
Start-Sleep 10;
Get-Process $processName | Stop-Process -Force;
Pop-Location;
Remove-Item -Recurse $dir;
Remove-DesktopIcon "*osu*";
Expand-BackupArtifacts -User $Arguments.Name -Path "$Name" -Target $path;
};
} @args;