PortValhalla/scripts/Windows/Software/reWASD/Manage.ps1

32 lines
1.1 KiB
PowerShell
Raw Normal View History

2023-07-12 20:37:31 +00:00
#!/bin/pwsh
2023-06-08 00:28:33 +00:00
$null = New-Module {
2024-08-07 19:05:32 +00:00
. "$PSScriptRoot/../../../Common/Scripts/BrowserAutomation.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
2023-07-18 13:19:42 +00:00
2023-06-08 00:28:33 +00:00
$path = "$env:PUBLIC/Documents/reWASD";
$softwareName = "reWASD";
2023-06-30 10:19:54 +00:00
function Backup-reWASD([Context] $context) {
Write-Host "Backing up reWASD";
2023-06-08 00:28:33 +00:00
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-x@`"$PSScriptRoot/exclude.txt`""));
}
2023-07-02 14:05:04 +00:00
function Restore-reWASD([Context] $context) {
Write-Host "Restoring reWASD";
2023-07-15 17:52:34 +00:00
$tempDir = $context.GetTempDirectory();
Write-Information "Downloading reWASD";
2024-08-07 12:28:26 +00:00
$file = Start-BrowserDownload $context "https://rewasd.com/" 'a.btn-default[href="#"]' $tempDir;
2023-07-15 17:52:34 +00:00
Write-Information "Installing reWASD";
Start-Process -Wait -FilePath $file.FullName -ArgumentList "/S";
Write-Information "Restoring files";
2024-03-24 17:17:18 +00:00
$context.Restore($context.SoftwareArchive($softwareName), $path, @("-aos"));
2023-07-16 10:46:00 +00:00
Write-Information "Removing desktop icon";
$context.RemoveDesktopIcon("*reWASD*");
2023-07-16 21:06:43 +00:00
Remove-Item -Recurse $tempDir;
2023-07-02 14:05:04 +00:00
}
2023-06-07 20:21:01 +00:00
}