From 2cf84dc44c458f7353abf76ebc03e9c4a0ed5b8b Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 3 Sep 2024 12:02:48 +0200 Subject: [PATCH] Add a backup script for reWASD --- scripts/Windows/Software/reWASD/Manage.ps1 | 50 ++++++++++++++++------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/scripts/Windows/Software/reWASD/Manage.ps1 b/scripts/Windows/Software/reWASD/Manage.ps1 index b7f016e8..937768c8 100644 --- a/scripts/Windows/Software/reWASD/Manage.ps1 +++ b/scripts/Windows/Software/reWASD/Manage.ps1 @@ -3,20 +3,42 @@ param( [hashtable] $Arguments ) -. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1"; -. "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; -. "$PSScriptRoot/../../../Common/Scripts/System.ps1"; +& { + param($Parameters) + . "$PSScriptRoot/../../Scripts/Restoration.ps1"; + . "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1"; + . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; + . "$PSScriptRoot/../../../Common/Scripts/System.ps1"; -Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - Write-Host "Downloading reWASD…"; - $dir = New-TemporaryDirectory; - $file = Start-BrowserDownload -URL "https://rewasd.com/" -ButtonSelector 'a.btn-default[href="#"]' -OutDir $dir -Timeout 1; + $path = "$env:Public/Documents/reWASD"; - Write-Host "Installing reWASD…"; - Start-Process -Wait -FilePath $($file.FullName) -ArgumentList "/S"; - Remove-Item -Recurse $dir; - Remove-DesktopIcon "*reWASD*"; - }; + Start-SoftwareInstaller @Parameters ` + -Backup { + Add-BackupArtifacts -Path "reWASD" -Source $path ` + -Exclude @( + "Logs", + "Presets", + "Profiles/Desktop", + "Profiles/Duality", + "Profiles/Fortnite", + "Profiles/PS4 Remote*", + "Profiles/Switch console", + "Profiles/Switch to Xbox 360", + "Profiles/Valorant", + "Profiles/xCloud" + ); + } ` + -Installer { + Write-Host "Downloading reWASD…"; + $dir = New-TemporaryDirectory; + $file = Start-BrowserDownload -URL "https://rewasd.com/" -ButtonSelector 'a.btn-default[href="#"]' -OutDir $dir -Timeout 1; -# ToDo: Add restoration + Write-Host "Installing reWASD…"; + Start-Process -Wait -FilePath $($file.FullName) -ArgumentList "/S"; + Remove-Item -Recurse $dir; + Remove-DesktopIcon "*reWASD*"; + } ` + -Configurator { + Expand-BackupArtifacts -Path "reWASD" -Target $path; + }; +} $PSBoundParameters;