Add further log messages

This commit is contained in:
Manuel Thalmann 2023-06-22 19:02:02 +02:00
parent ad078d0dc8
commit 6237f28b39
3 changed files with 11 additions and 0 deletions

View file

@ -3,7 +3,10 @@
. "$PSScriptRoot/../../../scripts/Windows/OS/Manage.ps1";
$null = New-Module {
Write-Host "Starting Backup of Windows";
$context = [Context]::new();
$context.BackupName = $env:BACKUP_NAME ?? $(Read-Host -Prompt "Please enter a backup name");
Invoke-WindowsBackup $context;
Write-Host "Never forget to store the backup somewhere safe!";
Write-Host "I mean... what kind of a dumbass would ever forget to do so, right?";
}

View file

@ -13,6 +13,7 @@
. "$PSScriptRoot/../Software/VisualStudio/Manage.ps1";
function Invoke-WindowsBackup([Context] $context) {
Write-Information "Backing up Windows";
$backupRoot = $context.BackupRoot();
Invoke-FileBackup $context;
Invoke-BackupGit $context;
@ -30,6 +31,8 @@ function Invoke-WindowsBackup([Context] $context) {
}
function Invoke-WindowsRestore([Context] $context) {
Write-Host "Restoring Windows";
function Read-Path()
{
$backupPath = Read-Host -Prompt "Please enter the path to the archive load the backup from.";
@ -45,6 +48,7 @@ function Invoke-WindowsRestore([Context] $context) {
}
}
Write-Information "Determining Backup Archive Path";
$backupPath = Read-Path;
$context = [Context]::new();
$context.BackupName ??= "PortValhalla";

View file

@ -12,12 +12,16 @@ function Get-BackupCandidates() {
}
function Invoke-FileBackup([Context] $context) {
Write-Host "Backing up Personal Files";
foreach ($candidate in Get-BackupCandidates) {
$context.Backup($candidate[1], $context.FileArchivePath($candidate[0]), $candidate[2]);
}
}
function Invoke-FileRestore([Context] $context) {
Write-Host "Restoring Personal Files";
foreach ($candidate in Get-BackupCandidates) {
$archivePath = $context.FileArchivePath($candidate[0]);