Add log messages for all installation steps

This commit is contained in:
Manuel Thalmann 2023-06-30 14:23:20 +02:00
parent 9ffa903626
commit c6907d6eec
12 changed files with 31 additions and 0 deletions

View file

@ -12,6 +12,7 @@ $null = New-Module {
function Stop-LogitechGHUB() {
[OutputType([string])]
param();
Write-Host "Killing Logitech G HUB process";
$hubName = Get-LogitechGHUBName;
$lghubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path;
@ -23,18 +24,26 @@ $null = New-Module {
}
function Backup-LogitechGHUB([Context] $context) {
Write-Host "Backing Up Logitech G HUB";
$hubPath = Stop-LogitechGHUB;
Write-Information "Backing up important files";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db", "-i!icon_cache"));
if ($hubPath) {
Write-Information "Restarting Logitech G HUB";
Start-Process $hubPath;
}
}
function Restore-LogitechGHUB([Context] $context) {
Write-Host "Restoring Logitech G HUB";
Write-Information "Installing the app";
choco install -y lghub;
$hubPath = Stop-LogitechGHUB;
Write-Information "Restoring important files";
$context.Restore($context.SoftwareArchive($softwareName), $path);
Write-Information "Restarting Logitech G HUB";
Start-Process $hubPath;
}
}

View file

@ -5,6 +5,7 @@ $null = New-Module {
$softwareName = "ManiaPlanet";
function Backup-ManiaPlanet([Context] $context) {
Write-Information "Backing up ManiaPlanet";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
}

View file

@ -3,12 +3,16 @@
$null = New-Module {
function Restore-Nextcloud([Context] $context) {
if (-not (choco list --exact nextcloud-client)) {
Write-Information "Installing Nextcloud Client";
choco install nextcloud-client -y --params="'/KeepUpdateCheck'";
}
Write-Information "Ensuring all Let's Encrypt certificates are cached";
$null = Invoke-WebRequest https://valid-isrgrootx1.letsencrypt.org/;
if (-not (Test-Path $context.GetNextcloudConfigFile())) {
Write-Information "Setting up Nextcloud configuration";
while (-not (Test-Path $context.GetNextcloudConfigFile())) {
Write-Host "Nextcloud has been installed!";
Read-Host "Please log in in the Nextcloud app and hit enter to continue";

View file

@ -5,6 +5,7 @@ $null = New-Module {
$configFile = "$($softwareName).reg";
function Backup-PuTTY([Context] $context) {
Write-Host "Backing up PuTTY";
$tempDir = $context.GetTempDirectory();
$fileName = Join-Path "$tempDir" $configFile;
& reg export "HKCU\Software\SimonTatham" "$fileName" /y;

View file

@ -5,6 +5,7 @@ $null = New-Module {
$softwareName = "RetroArch";
function Backup-RetroArch([Context] $context) {
Write-Host "Backing up RetroArch";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
}

View file

@ -5,6 +5,7 @@ $null = New-Module {
$softwareName = "TmNationsForever";
function Backup-TmNations([Context] $context) {
Write-Host "Backing up TrackMania Nations Forever";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
}

View file

@ -5,6 +5,7 @@ $null = New-Module {
$softwareName = "TmUnitedForever";
function Backup-TmUnited([Context] $context) {
Write-Host "Backing up TrackMania United Forever";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
}

View file

@ -13,7 +13,11 @@ $null = New-Module {
}
function Backup-VisualStudio([Context] $context) {
Write-Host "Backing up Visual Studio";
foreach ($version in $versions) {
Write-Information "Backing up $($version[1]): $($version[2])";
$configPath = Get-ConfigPath $context $version[0];
$null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)";

View file

@ -4,9 +4,12 @@ $null = New-Module {
function Backup-Git([Context] $context) {}
function Restore-Git([Context] $context) {
Write-Host "Restoring git";
$script = New-TemporaryFile;
$script = Rename-Item $script "$($script.Name).sh" -PassThru;
Write-Information "Preparing setup script";
Set-Content $script (
[string]::Join(
"`n",
@ -14,6 +17,7 @@ $null = New-Module {
"bash `"$PSScriptRoot/../../../Common/Config/git/install.sh`"",
"bach rm ~/.bashrc")));
Write-Information "Running prepared script";
Start-Process -Wait $script;
Remove-Item $script;
}

View file

@ -6,8 +6,11 @@ $null = New-Module {
$genericConfigName = "osu!.User.cfg";
function Backup-Osu([Context] $context) {
Write-Host "Backing up osu!";
$archive = $context.SoftwareArchive($softwareName);
Write-Information "Backing up important files";
$context.Backup($path, $archive, @("-i@`"$PSScriptRoot/include.txt`""));
Write-Information "Renaming user configuration to $genericConfigName";
& 7z rn "$archive" "osu!.$env:USERNAME.cfg" $genericConfigName;
}
}

View file

@ -5,6 +5,7 @@ $null = New-Module {
$softwareName = "osu!lazer";
function Backup-OsuLazer([Context] $context) {
Write-Host "Backing up osu!lazer";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
}
}

View file

@ -5,6 +5,7 @@ $null = New-Module {
$softwareName = "reWASD";
function Backup-reWASD([Context] $context) {
Write-Host "Backing up reWASD";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-x@`"$PSScriptRoot/exclude.txt`""));
}
}