[
    {
        "UpdateStageName": "RAGE:MP Download",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "Executable",
        "UpdateSourceData": "powershell.exe",
        "UpdateSourceArgs": "-NoProfile -Command \"$ProgressPreference='SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; cd ragemp; $baseURL = 'https://cdn.rage.mp/updater/prerelease_server/'; $xmlURL = 'https://cdn.rage.mp/updater/prerelease_server/data.xml?item=All'; [xml]$data = (New-Object System.Net.WebClient).DownloadString($xmlURL); foreach ($file in $data.SelectNodes('//file[contains(text(), \\\"server-files\\\")]')) { $filePath = $file.InnerText; if ($filePath -eq 'server-files\\linux_x64.tar.gz') { continue }; $downloadURL = $baseURL + ($filePath -replace '\\\\', '/'); $localFilePath = Join-Path -Path $PWD -ChildPath $filePath; $localDir = [System.IO.Path]::GetDirectoryName($localFilePath); if (-not (Test-Path -Path $localDir)) { New-Item -ItemType Directory -Path $localDir -Force | Out-Null }; Invoke-WebRequest -Uri $downloadURL -OutFile $localFilePath | Out-Null }\"",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "RAGE:MP Download",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "Executable",
        "UpdateSourceData": "/bin/bash",
        "UpdateSourceArgs": "-c \"cd ragemp/server-files && wget -q -N https://cdn.rage.mp/updater/prerelease/server-files/linux_x64.tar.gz && tar -xzf linux_x64.tar.gz --strip-components=1 && rm -f linux_x64.tar.gz >/dev/null 2>&1\"",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Resources Directory Creation",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "CreateDirectory",
        "UpdateSourceArgs": "{{$FullBaseDir}}dotnet/resources",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Config File Download",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "FetchURL",
        "UpdateSourceData": "https://raw.githubusercontent.com/CubeCoders/AMPTemplates/main/ragempconf.json",
        "UpdateSourceTarget": "{{$FullBaseDir}}",
        "UpdateSourceArgs": "conf.json",
        "OverwriteExistingFiles": false,
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Create .NET SDK Directory",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "CreateDirectory",
        "UpdateSourceArgs": "{{$FullBaseDir}}dotnet-sdk",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": ".NET SDK Download",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "Executable",
        "UpdateSourceData": "/bin/bash",
        "UpdateSourceArgs": "-c \"cd \\\"{{$FullBaseDir}}\\\" && if [[ -x dotnet-sdk/dotnet ]]; then echo \\\".NET SDK 3.1.201 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/Sdk/3.1.201/dotnet-sdk-3.1.201-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-sdk/* >/dev/null 2>&1 && tar -xzf dotnet.tar.gz -C dotnet-sdk >/dev/null 2>&1 && rm -f dotnet.tar.gz >/dev/null 2>&1 && echo \\\".NET SDK 3.1.201 (for .NET Runtime 3.1.3) downloaded\\\"; fi\"",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": ".NET SDK Download",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "Executable",
        "UpdateSourceData": "powershell.exe",
        "UpdateSourceArgs": "-NoProfile -Command \"$ProgressPreference='SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Set-Location -Path '{{$FullBaseDir}}'; if (Test-Path 'dotnet-sdk/dotnet.exe') { Write-Output \\\".NET SDK 3.1.201 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/Sdk/3.1.201/dotnet-sdk-3.1.201-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-sdk/*' -Recurse -Force -ErrorAction SilentlyContinue; Expand-Archive -Path \\\"dotnet.zip\\\" -DestinationPath \\\"dotnet-sdk\\\" -Force *> $null; if ( Test-Path dotnet.zip ) { Remove-Item dotnet.zip -Force -ErrorAction SilentlyContinue *> $null }; Write-Output \\\".NET SDK 3.1.201 (for .NET Runtime 3.1.3) downloaded\\\" }\"",
        "SkipOnFailure": false
    }
]