From 4a23017987d20b3017beeff7b55f32563ab70ed1 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 f7c117a6..8f26ff2a 100644 --- a/scripts/Windows/OS/Manage.ps1 +++ b/scripts/Windows/OS/Manage.ps1 @@ -50,6 +50,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;";