Allow setup without backup archive
This commit is contained in:
parent
b40ba593a3
commit
0a5c50a446
1 changed files with 11 additions and 2 deletions
|
@ -34,7 +34,7 @@ function Invoke-WindowsRestore([Context] $context) {
|
|||
{
|
||||
$backupPath = Read-Host -Prompt "Please enter the path to the archive load the backup from.";
|
||||
|
||||
if (-not (Test-Path -PathType Leaf $backupPath))
|
||||
if (-not $backupPath -or (-not (Test-Path -PathType Leaf $backupPath)))
|
||||
{
|
||||
Write-Host "No file could be found at the specified path.";
|
||||
return Read-Path;
|
||||
|
@ -45,6 +45,15 @@ function Invoke-WindowsRestore([Context] $context) {
|
|||
$context = [Context]::new();
|
||||
$context.BackupName ??= "PortValhalla";
|
||||
$context.RootDir = $context.GetTempDirectory();
|
||||
$context.Restore($backupPath, $context.BackupRoot());
|
||||
|
||||
if (-not $backupPath)
|
||||
{
|
||||
New-Item -ItemType Directory "$backupPath";
|
||||
}
|
||||
else
|
||||
{
|
||||
$context.Restore($backupPath, $context.BackupRoot());
|
||||
}
|
||||
|
||||
Remove-Item -Recurse $context.RootDir;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue