Accept context for windows restoration
This commit is contained in:
parent
db17c2c42c
commit
4338ba08eb
2 changed files with 4 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
. "$PSScriptRoot/Manage.ps1";
|
. "$PSScriptRoot/Manage.ps1";
|
||||||
|
|
||||||
Invoke-WindowsRestore;
|
$context = [Context]::new();
|
||||||
|
Invoke-WindowsRestore $context;
|
||||||
|
|
|
@ -29,7 +29,7 @@ function Invoke-WindowsBackup([Context] $context) {
|
||||||
$context.Backup($backupRoot, "$backupRoot.7z", @("-sdel"));
|
$context.Backup($backupRoot, "$backupRoot.7z", @("-sdel"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-WindowsRestore() {
|
function Invoke-WindowsRestore([Context] $context) {
|
||||||
function Read-Path()
|
function Read-Path()
|
||||||
{
|
{
|
||||||
$backupPath = Read-Host -Prompt "Please enter the path to the archive load the backup from.";
|
$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;
|
$backupPath = Read-Path;
|
||||||
$context = [Context]::new();
|
$context = [Context]::new();
|
||||||
$context.BackupName = "PortValhalla";
|
$context.BackupName ??= "PortValhalla";
|
||||||
$context.RootDir = $context.GetTempDirectory();
|
$context.RootDir = $context.GetTempDirectory();
|
||||||
$context.Restore($backupPath, $context.BackupRoot());
|
$context.Restore($backupPath, $context.BackupRoot());
|
||||||
Remove-Item -Recurse $context.RootDir;
|
Remove-Item -Recurse $context.RootDir;
|
||||||
|
|
Loading…
Reference in a new issue