Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ide/jetbrains/image/download.sh
2499 views
1
#!/bin/bash
2
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
# Licensed under the GNU Affero General Public License (AGPL).
4
# See License.AGPL.txt in the project root for license information.
5
6
mkdir backend && cd backend || exit
7
8
# get latest info from latest properties file for preview env
9
if [ "$PARSE_URL_FROM_LATEST_INFO" = "true" ]; then
10
TEMP_FILENAME=$(mktemp)
11
PLUGIN_PLATFORM_VERSION=$(grep platformVersion= "../components-ide-jetbrains-backend-plugin--latest-info/gradle-latest.properties" | sed 's/platformVersion=//' | sed 's/-EAP-CANDIDATE-SNAPSHOT//') # Example: PLUGIN_PLATFORM_VERSION: 223.7571
12
13
curl -sL "https://data.services.jetbrains.com/products/releases?code=$PRODUCT_CODE&type=eap,rc,release&platform=linux" > "$TEMP_FILENAME"
14
IDE_BUILD_VERSION=$(jq -r -c "first(.${PRODUCT_CODE}[] | select(.build | contains(\"$PLUGIN_PLATFORM_VERSION\")) | .build)" < "$TEMP_FILENAME") # Example: IDE_BUILD_VERSION: 223.7571.176
15
rm "$TEMP_FILENAME"
16
17
if [ -n "$IDE_BUILD_VERSION" ]; then
18
JETBRAINS_BACKEND_URL="https://download.jetbrains.com/product?type=release,rc,eap&distribution=linux&code=$PRODUCT_CODE&build=$IDE_BUILD_VERSION"
19
else
20
JETBRAINS_BACKEND_URL="https://download.jetbrains.com/product?type=release,rc,eap&distribution=linux&code=$PRODUCT_CODE"
21
fi
22
fi
23
24
echo "Downloading from $JETBRAINS_BACKEND_URL"
25
26
curl -sSLo backend.tar.gz "$JETBRAINS_BACKEND_URL" && tar -xf backend.tar.gz --strip-components=1 && rm backend.tar.gz
27
# enable shared indexes by default
28
printf '\nshared.indexes.download.auto.consent=true' >> "bin/idea.properties"
29
30