[
    {
        "UpdateStageName": "SteamCMD Server Download",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "SteamCMD",
        "UpdateSourceData": "302550",
        "UpdateSourceArgs": "244210",
        "ForceDownloadPlatform": "Windows",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Modded Server Download",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "GithubRelease",
        "UpdateSourceArgs": "compujuckel/AssettoServer",
        "UpdateSourceData": "assetto-server-win-x64.zip",
        "UpdateSourceTarget": "{{$FullBaseDir}}",
        "UnzipUpdateSource": true,
        "OverwriteExistingFiles": true,
        "DeleteAfterExtract": true,
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Modded Server Download",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "GithubRelease",
        "UpdateSourceArgs": "compujuckel/AssettoServer",
        "UpdateSourceData": "assetto-server-linux-x64.tar.gz",
        "UpdateSourceTarget": "{{$FullBaseDir}}",
        "UnzipUpdateSource": true,
        "OverwriteExistingFiles": true,
        "DeleteAfterExtract": true,
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Modded Server Overwrite",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "Executable",
        "UpdateSourceData": "cmd.exe",
        "UpdateSourceArgs": "/C move /Y assetto-corsa\\302550\\AssettoServer.exe assetto-corsa\\302550\\acServer.exe",
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Modded Server Overwrite",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "Executable",
        "UpdateSourceData": "/bin/bash",
        "UpdateSourceArgs": "-c \"mv -f ./assetto-corsa/302550/AssettoServer ./assetto-corsa/302550/acServer && chmod +x ./assetto-corsa/302550/acServer\"",
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "SteamCMD Component Download",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "SteamCMD",
        "UpdateSourceData": "1007",
        "UpdateSourceTarget": "302550",
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Create Dotnet Directory",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "CreateDirectory",
        "UpdateSourceArgs": "{{$FullBaseDir}}dotnet",
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "ASP.NET Core Runtime Download",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "Executable",
        "UpdateSourceData": "/bin/bash",
        "UpdateSourceArgs": "-c \"DotnetVersion=\\\"{{DotnetVersion}}\\\"; cd \\\"{{$FullBaseDir}}\\\" && if [[ -x dotnet/dotnet ]]; then InstalledVersion=$(dotnet/dotnet --list-runtimes | sed -n \\\"s/^Microsoft\\.AspNetCore\\.App \\([0-9.]*\\) .*/\\1/p\\\" | head -n1); else InstalledVersion=\\\"\\\"; fi; if [[ -z \\\"$DotnetVersion\\\" ]]; then DotnetVersion=$(wget -qO- https://builds.dotnet.microsoft.com/dotnet/release-metadata/7.0/releases.json | jq -r \\\".[\\\\\\\"latest-runtime\\\\\\\"]\\\"); fi; if [[ ! \\\"$DotnetVersion\\\" =~ ^[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then echo \\\"Invalid ASP.NET Core Runtime version format specified\\\" && exit 1; elif [[ \\\"$InstalledVersion\\\" == \\\"$DotnetVersion\\\" ]]; then echo \\\"ASP.NET Core Runtime v$DotnetVersion already installed. Skipping\\\" && exit 0; else [[ -f dotnet.tar.gz ]] && rm -f dotnet.tar.gz >/dev/null 2>&1; wget -qO dotnet.tar.gz https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/$DotnetVersion/aspnetcore-runtime-$DotnetVersion-linux-x64.tar.gz || { echo \\\"Download failed from the Microsoft CDN. This is a fault with the CDN, not AMP. Aborting\\\"; exit 1; }; rm -rf dotnet/* >/dev/null 2>&1 && tar -xzf dotnet.tar.gz -C dotnet >/dev/null 2>&1 && rm -f dotnet.tar.gz >/dev/null 2>&1 && echo \\\"ASP.NET Core Runtime v$DotnetVersion downloaded\\\"; fi\"",
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "ASP.NET Core Runtime Download",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "Executable",
        "UpdateSourceData": "powershell.exe",
        "UpdateSourceArgs": "-NoProfile -Command \"$ProgressPreference='SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $DotnetVersion='{{DotnetVersion}}'; Set-Location -Path '{{$FullBaseDir}}'; if (Test-Path 'dotnet/dotnet.exe') { $InstalledVersion = (& dotnet/dotnet.exe --list-runtimes | Where-Object { $_ -like 'Microsoft.AspNetCore.App*' } | Select-Object -First 1).Split()[1] } else { $InstalledVersion = '' }; if ( [string]::IsNullOrWhiteSpace($DotnetVersion) ) { $DotnetVersion=(Invoke-RestMethod -UseBasicParsing -Uri https://builds.dotnet.microsoft.com/dotnet/release-metadata/7.0/releases.json).\\\"latest-runtime\\\" }; if ($DotnetVersion -notmatch '^\\d+\\.\\d+\\.\\d+$') { Write-Output \\\"Invalid ASP.NET Core Runtime version format specified\\\"; exit 1 } elseif ( $InstalledVersion -eq $DotnetVersion ) { Write-Output \\\"ASP.NET Core Runtime v$DotnetVersion already installed. Skipping\\\"; exit 0 } else { if ( Test-Path dotnet.zip ) { Remove-Item dotnet.zip -Force -ErrorAction SilentlyContinue *> $null }; try { Invoke-WebRequest -UseBasicParsing -Uri https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/$DotnetVersion/aspnetcore-runtime-$DotnetVersion-win-x64.zip -OutFile dotnet.zip -ErrorAction Stop } catch { Write-Output \\\"Download failed from the Microsoft CDN. This is a fault with the CDN, not AMP. Aborting\\\"; exit 1; }; Remove-Item -Path 'dotnet/*' -Recurse -Force -ErrorAction SilentlyContinue; Expand-Archive -Path \\\"dotnet.zip\\\" -DestinationPath \\\"dotnet\\\" -Force *> $null; if ( Test-Path dotnet.zip ) { Remove-Item dotnet.zip -Force -ErrorAction SilentlyContinue *> $null }; Write-Output \\\"ASP.NET Core Runtime v$DotnetVersion downloaded\\\" }\"",
        "UpdateSourceConditionSetting": "ServerVersion",
        "UpdateSourceConditionValue": "modded",
        "SkipOnFailure": false
    }
]