[
    {
        "UpdateStageName": "SPT-AKI Installation",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "Executable",
        "UpdateSourceData": "powershell.exe",
        "UpdateSourceArgs": "-NoProfile -Command \"$ProgressPreference='SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Set-Location -Path 'tarkov'; Remove-Item srv -Recurse -Force -ErrorAction SilentlyContinue | Out-Null; $env:GIT_LFS_SKIP_SMUDGE = '1'; git clone --branch 3.11.4 https://github.com/sp-tarkov/server.git srv 1> $null; if ($LASTEXITCODE -eq 0) { Remove-Item Env:\\GIT_LFS_SKIP_SMUDGE; if (Test-Path 'node/node.exe') { $InstalledVersion = & node/node.exe --version } else { $InstalledVersion = '' }; if ( [string]::IsNullOrWhiteSpace($NodeVersion) ) { $NodeVersion = (Get-Content srv/project/.nvmrc -TotalCount 1).Trim() }; if ( $NodeVersion -notmatch '^v\\d+\\.\\d+\\.\\d+$' ) { Write-Output 'Invalid Node.js version format specified'; exit 1 } elseif ( $InstalledVersion -ne $NodeVersion ) { if ( Test-Path node.zip ) { Remove-Item node.zip -Force -ErrorAction SilentlyContinue *> $null }; try { Invoke-WebRequest -UseBasicParsing -Uri https://nodejs.org/download/release/$NodeVersion/node-$NodeVersion-win-x64.zip -OutFile node.zip -ErrorAction Stop } catch { Write-Output \\\"Download of required Node.js dependency failed from the Node.js CDN. This is a fault with the CDN, not AMP. Aborting\\\"; exit 1; }; Expand-Archive -Path \\\"node.zip\\\" -DestinationPath \\\".\\\" -Force *> $null; if ( Test-Path node.zip ) { Remove-Item node.zip -Force -ErrorAction SilentlyContinue *> $null }; if (Test-Path \\\"node-*\\\") { Remove-Item -Recurse -Force node -ErrorAction SilentlyContinue *> $null; Get-ChildItem -Directory | Where-Object { $_.Name -like \\\"node-*\\\" } | Rename-Item -NewName \\\"node\\\" *> $null } }; Set-Location -Path 'srv/project'; git lfs install 1> $null; if ($LASTEXITCODE -eq 0) { git lfs pull 1> $null; if ($LASTEXITCODE -eq 0) { $env:PATH='{{$FullRootDir}}node;' + $env:PATH; & node ../../node/node_modules/npm/bin/npm-cli.js install 1> $null; & node ../../node/node_modules/npm/bin/npm-cli.js run build:release -- --arch=x64 --platform=win32 1> $null; Copy-Item build/* '{{$FullBaseDir}}' -Recurse -Force -ErrorAction SilentlyContinue | Out-Null; Set-Location -Path '{{$FullBaseDir}}'; Remove-Item '{{$FullRootDir}}srv' -Recurse -Force -ErrorAction SilentlyContinue | Out-Null } } }\"",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "SPT-AKI Installation",
        "UpdateSourcePlatform": "Linux",
        "UpdateSourceArch": "x86_64",
        "UpdateSource": "Executable",
        "UpdateSourceData": "/bin/bash",
        "UpdateSourceArgs": "-c \"cd tarkov && rm -rf srv; GIT_LFS_SKIP_SMUDGE=1 git clone --branch 3.11.4 https://github.com/sp-tarkov/server.git srv >/dev/null && if [[ -x node/bin/node ]]; then InstalledVersion=$(node/bin/node --version); else InstalledVersion=\\\"\\\"; fi; [[ -z \\\"$NodeVersion\\\" ]] && read -r NodeVersion < srv/project/.nvmrc; if [[ ! \\\"$NodeVersion\\\" =~ ^v[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then echo \\\"Invalid Node.js version format specified\\\" && exit 1; elif [[ \\\"$InstalledVersion\\\" != \\\"$NodeVersion\\\" ]]; then [[ -f node.tar.gz ]] && rm -f node.tar.gz >/dev/null 2>&1; wget -qO node.tar.gz https://nodejs.org/download/release/$NodeVersion/node-$NodeVersion-linux-x64.tar.gz || { echo \\\"Download of required Node.js dependency failed from the Node.js CDN. This is a fault with the CDN, not AMP. Aborting\\\"; exit 1; }; mkdir -p node && rm -rf node/* >/dev/null 2>&1 && tar -xzf node.tar.gz -C node --strip-components=1 >/dev/null 2>&1 && rm -f node.tar.gz >/dev/null 2>&1; fi; cd srv/project && git-lfs install >/dev/null && git-lfs pull >/dev/null && export PATH={{$FullRootDir}}node/bin:$PATH && npm install >/dev/null && npm run build:release -- --arch=x64 --platform=linux >/dev/null && \\cp -rf build/* \\\"{{$FullBaseDir}}\\\" >/dev/null 2>&1 && cd \\\"{{$FullBaseDir}}\\\" && rm -rf \\\"{{$FullRootDir}}srv\\\" >/dev/null 2>&1 && chmod +x SPT.Server.exe >/dev/null 2>&1\"",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "SPT-AKI Installation",
        "UpdateSourcePlatform": "Linux",
        "UpdateSourceArch": "aarch64",
        "UpdateSource": "Executable",
        "UpdateSourceData": "/bin/bash",
        "UpdateSourceArgs": "-c \"cd tarkov && rm -rf srv; GIT_LFS_SKIP_SMUDGE=1 git clone --branch 3.11.4 https://github.com/sp-tarkov/server.git srv >/dev/null && if [[ -x node/bin/node ]]; then InstalledVersion=$(node/bin/node --version); else InstalledVersion=\\\"\\\"; fi; [[ -z \\\"$NodeVersion\\\" ]] && read -r NodeVersion < srv/project/.nvmrc; if [[ ! \\\"$NodeVersion\\\" =~ ^v[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then echo \\\"Invalid Node.js version format specified\\\" && exit 1; elif [[ \\\"$InstalledVersion\\\" != \\\"$NodeVersion\\\" ]]; then [[ -f node.tar.gz ]] && rm -f node.tar.gz >/dev/null 2>&1; wget -qO node.tar.gz https://nodejs.org/download/release/$NodeVersion/node-$NodeVersion-linux-arm64.tar.gz || { echo \\\"Download of required Node.js dependency failed from the Node.js CDN. This is a fault with the CDN, not AMP. Aborting\\\"; exit 1; }; mkdir -p node && rm -rf node/* >/dev/null 2>&1 && tar -xzf node.tar.gz -C node --strip-components=1 >/dev/null 2>&1 && rm -f node.tar.gz >/dev/null 2>&1; fi; cd srv/project && git-lfs install >/dev/null && git-lfs pull >/dev/null && export PATH={{$FullRootDir}}node/bin:$PATH && npm install >/dev/null && npm run build:release -- --arch=arm64 --platform=linux >/dev/null && \\cp -rf build/* \\\"{{$FullBaseDir}}\\\" >/dev/null 2>&1 && cd \\\"{{$FullBaseDir}}\\\" && rm -rf \\\"{{$FullRootDir}}srv\\\" >/dev/null 2>&1 && chmod +x SPT.Server.exe >/dev/null 2>&1\"",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Fika Server Mod Download",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "FetchURLFromJQ",
        "UpdateSourceData": "https://api.github.com/repos/project-fika/Fika-Server/releases/tags/v2.4.8",
        "UpdateSourceArgs": "$.assets[0].browser_download_url",
        "UpdateSourceTarget": "{{$FullBaseDir}}",
        "UnzipUpdateSource": true,
        "OverwriteExistingFiles": true,
        "DeleteAfterExtract": true,
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Fika Server Tools Download",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "GithubRelease",
        "UpdateSourceArgs": "project-fika/Fika-ServerTools",
        "UpdateSourceData": "FikaServerTools_main-windows64.zip",
        "UpdateSourceTarget": "{{$FullBaseDir}}user/mods/fika-server",
        "UnzipUpdateSource": true,
        "OverwriteExistingFiles": true,
        "DeleteAfterExtract": true,
        "UpdateSourceConditionSetting": "natPunchServer_enable",
        "UpdateSourceConditionValue": "true",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Fika Server Tools Download",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "GithubRelease",
        "UpdateSourceArgs": "project-fika/Fika-ServerTools",
        "UpdateSourceData": "FikaServerTools_main-linux64.zip",
        "UpdateSourceTarget": "{{$FullBaseDir}}user/mods/fika-server",
        "UnzipUpdateSource": true,
        "OverwriteExistingFiles": true,
        "DeleteAfterExtract": true,
        "UpdateSourceConditionSetting": "natPunchServer_enable",
        "UpdateSourceConditionValue": "true",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Make Fika Server Tools Executable",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "SetExecutableFlag",
        "UpdateSourceArgs": "{{$FullBaseDir}}user/mods/fika-server/FikaServerTools",
        "UpdateSourceConditionSetting": "natPunchServer_enable",
        "UpdateSourceConditionValue": "true",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Remove Fika Server Tools",
        "UpdateSourcePlatform": "Windows",
        "UpdateSource": "Executable",
        "UpdateSourceData": "cmd.exe",
        "UpdateSourceArgs": "/C del /Q /F tarkov\\server\\user\\mods\\fika-server\\FikaServerTools* > NUL 2>&1",
        "UpdateSourceConditionSetting": "natPunchServer_enable",
        "UpdateSourceConditionValue": "false",
        "SkipOnFailure": true
    },
    {
        "UpdateStageName": "Remove Fika Server Tools",
        "UpdateSourcePlatform": "Linux",
        "UpdateSource": "Executable",
        "UpdateSourceData": "/bin/bash",
        "UpdateSourceArgs": "-c \"rm -f tarkov/server/user/mods/fika-server/FikaServerTools* >/dev/null 2>&1\"",
        "UpdateSourceConditionSetting": "natPunchServer_enable",
        "UpdateSourceConditionValue": "false",
        "SkipOnFailure": true
    },
    {
        "UpdateStageName": "Server Startup",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "StartApplication",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Wait For Server Startup",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "WaitForStartupComplete",
        "SkipOnFailure": false
    },
    {
        "UpdateStageName": "Server Shutdown",
        "UpdateSourcePlatform": "All",
        "UpdateSource": "ShutdownApplication",
        "SkipOnFailure": false
    }
]