PortValhalla/scripts/Windows/Software/RetroArch/Install.ps1

35 lines
1.3 KiB
PowerShell

#!/bin/pwsh
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
$null = New-Module {
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1";
$path = "C:/tools/RetroArch-Win64";
$softwareName = "RetroArch";
function Backup-RetroArch([Context] $context) {
Write-Host "Backing up RetroArch";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
function Restore-RetroArch([Context] $context) {
Write-Host "Restoring RetroArch";
Write-Information "Installing RetroArch";
choco install -y --ignore-checksums retroarch;
Write-Information "Restoring files";
$context.Restore($context.SoftwareArchive($softwareName), $path);
Write-Information "Adding cloud sync folders";
$context.AddNextcloudSync(
"$path\saves",
"/Saved Games/RetroArch/Saves");
$context.AddNextcloudSync(
"$path\system",
"/Saved Games/RetroArch/System");
Write-Information "Creating a Start Menu Icon";
Install-ChocolateyShortcut -ShortcutFilePath "$((Get-KnownFolder "Common Programs").Path)/RetroArch.lnk" -TargetPath ((Get-Item "$path\retroarch.exe").FullName);
}
}