diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 7d2794a6..5c4ca19e 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -1,4 +1,4 @@ . "$PSScriptRoot/Manage.ps1"; -Invoke-WindowsRestore; - +$context = [Context]::new(); +Invoke-WindowsRestore $context; diff --git a/scripts/Windows/OS/Manage.ps1 b/scripts/Windows/OS/Manage.ps1 index 1b859339..f80428d4 100644 --- a/scripts/Windows/OS/Manage.ps1 +++ b/scripts/Windows/OS/Manage.ps1 @@ -29,7 +29,7 @@ function Invoke-WindowsBackup([Context] $context) { $context.Backup($backupRoot, "$backupRoot.7z", @("-sdel")); } -function Invoke-WindowsRestore() { +function Invoke-WindowsRestore([Context] $context) { function Read-Path() { $backupPath = Read-Host -Prompt "Please enter the path to the archive load the backup from."; @@ -43,7 +43,7 @@ function Invoke-WindowsRestore() { $backupPath = Read-Path; $context = [Context]::new(); - $context.BackupName = "PortValhalla"; + $context.BackupName ??= "PortValhalla"; $context.RootDir = $context.GetTempDirectory(); $context.Restore($backupPath, $context.BackupRoot()); Remove-Item -Recurse $context.RootDir;