From e4b0ffb89160f6d62843df47f5ee1b0d7022dc3d Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 28 Aug 2024 04:40:32 +0200 Subject: [PATCH] Allow users to restore a backup --- scripts/Windows/OS/Manage.ps1 | 13 +++++++++++++ scripts/Windows/Scripts/PowerManagement.ps1 | 1 + 2 files changed, 14 insertions(+) diff --git a/scripts/Windows/OS/Manage.ps1 b/scripts/Windows/OS/Manage.ps1 index cff16d4c..6b7fb0d5 100644 --- a/scripts/Windows/OS/Manage.ps1 +++ b/scripts/Windows/OS/Manage.ps1 @@ -51,6 +51,19 @@ $null = New-Module { break; } ([WindowsInstallerStage]::Initialize) { + $env:BACKUP_ARCHIVE = pwsh -Command Write-Host ( + Read-Host ( + & { + switch ($Action) { + ([WindowsInstallerAction]::Backup) { + "Please select the path you wish to store your backup at" + } + ([WindowsInstallerAction]::Install) { + "Please select an archive you wish to restore from, if you wish to restore from a backup" + } + } + })); + Set-Stage ([WindowsInstallerStage]::Run); break; } diff --git a/scripts/Windows/Scripts/PowerManagement.ps1 b/scripts/Windows/Scripts/PowerManagement.ps1 index 83e6579a..ee4f38b3 100644 --- a/scripts/Windows/Scripts/PowerManagement.ps1 +++ b/scripts/Windows/Scripts/PowerManagement.ps1 @@ -53,6 +53,7 @@ $null = New-Module { function Get-StartupCommand { ($env:PWSH_PATH ? "`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" : "") + ($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "") + + ($env:BACKUP_ARCHIVE ? "`$env:BACKUP_ARCHIVE = $(ConvertTo-Injection (Resolve-Path $env:BACKUP_ARCHIVE));" : "") + "`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection (Resolve-Path $env:INSTALLER_SCRIPT));" + "`$env:CONFIG_MODULE = $(ConvertTo-Injection (Resolve-Path $env:CONFIG_MODULE));" + "& `$env:INSTALLER_SCRIPT;";