Create universal TrackMania script
This commit is contained in:
parent
1dcba0a71a
commit
1e3fd33924
|
@ -291,8 +291,8 @@ function Deploy-SoftwareAction {
|
|||
Remove-DesktopIcon "EA.*";
|
||||
}
|
||||
|
||||
& "$softwarePath/TrackMania Nations Forever/Manage.ps1" @arguments;
|
||||
& "$softwarePath/TrackMania United Forever/Manage.ps1" @arguments;
|
||||
& "$softwarePath/TrackMania Nations Forever/Main.ps1" @arguments;
|
||||
& "$softwarePath/TrackMania United Forever/Main.ps1" @arguments;
|
||||
& "$softwarePath/ManiaPlanet/Manage.ps1" @arguments;
|
||||
& "$softwarePath/osu!/Manage.ps1" @arguments;
|
||||
& "$softwarePath/osu!lazer/Manage.ps1" @arguments;
|
||||
|
|
21
scripts/Windows/Software/TrackMania Nations Forever/Main.ps1
Normal file
21
scripts/Windows/Software/TrackMania Nations Forever/Main.ps1
Normal file
|
@ -0,0 +1,21 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../TrackMania United Forever/Manage.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
$parameters = Get-TMForeverInstallerComponents `
|
||||
-IconName "TmNationsForever" `
|
||||
-UserDirectory "$HOME/Documents/TmForever" `
|
||||
-Installer {
|
||||
Install-WingetPackage Nadeo.TrackManiaNationsForever;
|
||||
};
|
||||
|
||||
foreach ($key in $PSBoundParameters.Keys) {
|
||||
$parameters.Add($key, $PSBoundParameters[$key]);
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @parameters;
|
|
@ -1,54 +0,0 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
|
||||
& {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
$path = "$HOME/Documents/TmForever";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
foreach ($feature in @("DirectPlay", "NetFx3")) {
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Information "Enabling the ``$feature`` feature…";
|
||||
choco install --source windowsFeatures -y $feature;
|
||||
}
|
||||
}
|
||||
|
||||
Install-WingetPackage Nadeo.TrackManiaNationsForever;
|
||||
Remove-DesktopIcon "*TmNationsForever*";
|
||||
} `
|
||||
-UserBackup {
|
||||
param(
|
||||
[string] $Name,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$name = $Arguments.Name;
|
||||
|
||||
Add-BackupArtifacts -User $name -Source $path -Path "$Name" `
|
||||
-Include @(
|
||||
"ChallengeMusics",
|
||||
"MediaTracker",
|
||||
"MenuMusics",
|
||||
"Painter",
|
||||
"Scores",
|
||||
"Skins",
|
||||
"Tracks"
|
||||
);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param(
|
||||
[string] $Name,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$user = $Arguments.Name;
|
||||
Expand-BackupArtifacts -User $user -Path "$Name" -Target $path;
|
||||
};
|
||||
} $PSBoundParameters;
|
30
scripts/Windows/Software/TrackMania United Forever/Main.ps1
Normal file
30
scripts/Windows/Software/TrackMania United Forever/Main.ps1
Normal file
|
@ -0,0 +1,30 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/Manage.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
|
||||
$parameters = Get-TMForeverInstallerComponents `
|
||||
-IconName "TmUnitedForever" `
|
||||
-UserDirectory "$HOME/Documents/TrackMania" `
|
||||
-Installer {
|
||||
$file = "TmUnitedForever.exe";
|
||||
$dir = New-TemporaryDirectory;
|
||||
|
||||
$null = Push-Location $dir;
|
||||
Write-Host "Downloading TrackMania United Forever…";
|
||||
Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file";
|
||||
|
||||
Write-Host "Starting installation…";
|
||||
Start-Process -Wait -FilePath "$file" -ArgumentList "/Silent";
|
||||
$null = Pop-Location;
|
||||
Remove-Item -Recurse $dir;
|
||||
};
|
||||
|
||||
foreach ($key in $PSBoundParameters.Keys) {
|
||||
$parameters.Add($key, $PSBoundParameters[$key]);
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @parameters;
|
|
@ -1,20 +1,32 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
|
||||
& {
|
||||
param($Parameters)
|
||||
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
||||
$path = "$HOME/Documents/TrackMania";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
$file = "TmUnitedForever.exe";
|
||||
$dir = New-TemporaryDirectory;
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Generates the components for installing a TrackMania Forever game.
|
||||
|
||||
.PARAMETER Installer
|
||||
The script to execute for installing the game.
|
||||
|
||||
.PARAMETER UserDirectory
|
||||
The directory containing the user data.
|
||||
#>
|
||||
function Get-TMForeverInstallerComponents {
|
||||
param(
|
||||
[string] $IconName,
|
||||
[string] $UserDirectory,
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
@{
|
||||
arguments = @{
|
||||
iconName = $IconName;
|
||||
userDirectory = $UserDirectory;
|
||||
installer = $Installer;
|
||||
};
|
||||
installer = {
|
||||
param([hashtable] $Arguments)
|
||||
$iconName = $Arguments.IconName;
|
||||
|
||||
foreach ($feature in @("DirectPlay", "NetFx3")) {
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
|
@ -23,39 +35,34 @@ param(
|
|||
}
|
||||
}
|
||||
|
||||
$null = Push-Location $dir;
|
||||
Write-Host "Downloading TrackMania United Forever…";
|
||||
Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file";
|
||||
|
||||
Write-Host "Starting installation…";
|
||||
Start-Process -Wait -FilePath $file -ArgumentList "/Silent";
|
||||
Remove-DesktopIcon "*TmUnitedForever*";
|
||||
$null = Pop-Location;
|
||||
|
||||
Remove-Item -Recurse $dir;
|
||||
} `
|
||||
-UserBackup {
|
||||
& $Arguments.Installer;
|
||||
Remove-DesktopIcon "*$iconName*";
|
||||
};
|
||||
userBackup = {
|
||||
param(
|
||||
[string] $Name,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "$Name" `
|
||||
Add-BackupArtifacts -User $Arguments.Name -Source $Arguments.UserDirectory -Path "$Name" `
|
||||
-Include @(
|
||||
"ChallengeMusics",
|
||||
"MediaTracker",
|
||||
"MenuMusics",
|
||||
"Painter",
|
||||
"Scores",
|
||||
"Skins",
|
||||
"Tracks"
|
||||
);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
};
|
||||
userConfigurator = {
|
||||
param(
|
||||
[string] $Name,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
Expand-BackupArtifacts -User $Arguments.Name -Path "$Name" -Target $path;
|
||||
$user = $Arguments.Name;
|
||||
Expand-BackupArtifacts -User $user -Path "$Name" -Target $path;
|
||||
};
|
||||
} $PSBoundParameters;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue