From 7275419c1ae24476d182e6926651daec8979856d Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 2 Jul 2023 13:50:19 +0200 Subject: [PATCH] Add a script for installing TrackMania Nations --- scripts/Windows/Collections/Personal.ps1 | 1 + .../Software/TrackMania Nations Forever/Manage.ps1 | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/scripts/Windows/Collections/Personal.ps1 b/scripts/Windows/Collections/Personal.ps1 index f8d77b93..9f47acaa 100644 --- a/scripts/Windows/Collections/Personal.ps1 +++ b/scripts/Windows/Collections/Personal.ps1 @@ -31,4 +31,5 @@ function Restore-PersonalApps([Context] $context) { Restore-Nextcloud $context; Restore-Git $context; Restore-LogitechGHUB $context; + Restore-TmNations $context; } diff --git a/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 b/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 index 26ed0888..64695317 100644 --- a/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 +++ b/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 @@ -8,4 +8,17 @@ $null = New-Module { Write-Host "Backing up TrackMania Nations Forever"; $context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"")); } + + function Restore-TmNations([Context] $context) { + $feature = "DirectPlay"; + Write-Host "Restoring TrackMania Nations Forever"; + + if (-not (Get-WindowsOptionalFeature -Online -FeatureName $feature).State) { + Enable-WindowsOptionalFeature -Online -FeatureName $feature; + } + + winget install -e --id Nadeo.TrackManiaNationsForever; + Remove-Item "$env:PUBLIC\Desktop\*TmNationsForever*"; + $context.Restore($context.SoftwareArchive($softwareName), $path); + } }