Skip to content

Commit

Permalink
Added utility scripts (#401)
Browse files Browse the repository at this point in the history
For querying IntelliJ sha256sums.
  • Loading branch information
freemanjp authored Jul 7, 2024
1 parent 9121932 commit 9eda8f0
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
60 changes: 60 additions & 0 deletions intellij_version_latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

download_url='https://data.services.jetbrains.com/products/releases?latest=true&type=release'

query_utlimate_editions() {
curl -s "$download_url&code=IIU" | jq -r '
(
.IIU[] |
.version as $version |
.downloads.linux |
[
$version,
"Ultimate",
.checksumLink
]
) | @tsv'
}

query_community_editions() {
curl -s "$download_url&code=IIC" | jq -r '
(
.IIC[] |
.version as $version |
.downloads.linux |
[
$version,
"Community",
.checksumLink
]
) | @tsv'
}

query_versions() {
(
query_utlimate_editions
query_community_editions
) | sort -V
}

query_checksums() {
IFS=$'\t'
while read -r -a columns; do
local version="${columns[0]}"
local edition="${columns[1]}"
local checksum_url="${columns[2]}"

# Fetch the checksum using curl
local response
response="$(curl -s "$checksum_url")"
checksum="${response%% *}" # Extract the checksum part (everything before the first space)

# Output the Version, Edition, and Checksum as a tab-separated value
echo -e "${version}\t${edition}\t${checksum}"
done
}

(
echo 'Version Edition SHA256'
query_versions | query_checksums
) | column -t
60 changes: 60 additions & 0 deletions intellij_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

download_url='https://data.services.jetbrains.com/products/releases?type=release'

query_utlimate_editions() {
curl -s "$download_url&code=IIU" | jq -r '
(
.IIU[] |
.version as $version |
.downloads.linux |
[
$version,
"Ultimate",
.checksumLink
]
) | @tsv'
}

query_community_editions() {
curl -s "$download_url&code=IIC" | jq -r '
(
.IIC[] |
.version as $version |
.downloads.linux |
[
$version,
"Community",
.checksumLink
]
) | @tsv'
}

query_versions() {
(
query_utlimate_editions
query_community_editions
) | sort -V
}

query_checksums() {
IFS=$'\t'
while read -r -a columns; do
local version="${columns[0]}"
local edition="${columns[1]}"
local checksum_url="${columns[2]}"

# Fetch the checksum using curl
local response
response="$(curl -s "$checksum_url")"
checksum="${response%% *}" # Extract the checksum part (everything before the first space)

# Output the Version, Edition, and Checksum as a tab-separated value
echo -e "${version}\t${edition}\t${checksum}"
done
}

(
echo 'Version Edition SHA256'
query_versions | query_checksums
) | column -t

0 comments on commit 9eda8f0

Please sign in to comment.