diff --git a/helpers/linux-install-tools b/helpers/linux-install-tools index 06d8ec3..0a227c5 100644 --- a/helpers/linux-install-tools +++ b/helpers/linux-install-tools @@ -1,46 +1,74 @@ #!/bin/bash -for tool in $(jq -r '.[]' ./toolchain.json); do - TOOL_NAME=$(echo "$tool" | jq '.name') - [ -z $TOOL_NAME ] && exit 1 +IFS=$'\n' +for tool in $(jq -cr '.[]' ./toolchain.json); do + TOOL_NAME=$(echo "$tool" | jq -r '.name') + [ -z "$TOOL_NAME" ] && echo "Invalid syntax" && exit 1 + echo "==============================" + echo "Installing $TOOL_NAME..." + echo "==============================" + + TOOL_MANIFEST_URL=$(echo "$tool" | jq -r '.url') + if [ -z "$TOOL_MANIFEST_URL" ]; then + echo "No manifest found, skipping tool" + continue + fi - TOOL_MANIFEST_URL=$(echo "$tool" | jq '.url') - [ -z $TOOL_MANIFEST_URL ] && exit 1 TOOL_MANIFEST=$(curl -s $TOOL_MANIFEST_URL) - for version in $(echo "$tool" | jq -r '.versions[]'); do - for check_version in $(echo "$TOOL_MANIFEST" | jq -r '.[]'); do - if [[ $(echo "$check_version" | jq '.version') != $version ]]; then + echo "Installing version $version" + found=false + + for check_version in $(echo "$TOOL_MANIFEST" | jq -cr '.[]'); do + if [[ "$(echo "$check_version" | jq -r '.version')" != $version ]]; then continue fi - for check_file in $(echo "$check_version" | jq -r '.files[]'); do - TOOL_PLATFORM=$(echo "$tool" | jq '.platform') - TOOL_ARCH=$(echo "$tool" | jq '.arch') - TOOL_PLATFORM_VERSION=$(echo "$tool" | jq '.platform_version') + for check_file in $(echo "$check_version" | jq -cr '.files[]'); do + TOOL_PLATFORM=$(echo "$tool" | jq -r '.platform') + TOOL_ARCH=$(echo "$tool" | jq -r '.arch') + TOOL_PLATFORM_VERSION=$(echo "$tool" | jq -r '.platform_version') - if [ ! -z $TOOL_PLATFORM ]; then - [ $TOOL_PLATFORM != $(echo "$check_file" | jq '.platform') ] && continue + if [ -n "$TOOL_PLATFORM" ]; then + [ $TOOL_PLATFORM != $(echo "$check_file" | jq -r '.platform') ] && continue fi - if [ ! -z $TOOL_ARCH ]; then - [ $TOOL_ARCH != $(echo "$check_file" | jq '.arch') ] && continue + if [ -n "$TOOL_ARCH" ]; then + [ $TOOL_ARCH != $(echo "$check_file" | jq -r '.arch') ] && continue fi - if [ ! -z $TOOL_PLATFORM_VERSION ]; then - [ $TOOL_PLATFORM_VERSION != $(echo "$check_file" | jq '.platform_version') ] && continue + if [ -n "$TOOL_PLATFORM_VERSION" ]; then + [ $TOOL_PLATFORM_VERSION != $(echo "$check_file" | jq -r '.platform_version') ] && continue + fi + + found=true + FILENAME=$(echo "$check_file" | jq -r '.filename') + DOWNLOAD_URL=$(echo "$check_file" | jq -r '.download_url') + + echo "Downloading package from $DOWNLOAD_URL" + curl -sL -o /tmp/build/$FILENAME $DOWNLOAD_URL + if [ $? -ne 0 ]; then + echo "Unable to download package" && exit 1 fi - FILENAME=$(echo "$check_file" | jq '.filename') - DOWNLOAD_URL=$(echo "$check_file" | jq '.download_url') - curl -o /tmp/build/$FILENAME $DOWNLOAD_URL || exit 1 mkdir -p /tmp/build/$FILENAME-dir tar -xzf /tmp/build/$FILENAME -C /tmp/build/$FILENAME-dir + if [ $? -ne 0 ]; then + echo "Unable to extract package" && exit 1 + fi + rm /tmp/build/$FILENAME - cd /tmp/build/$FILENAME-dir || exit 1 + cd /tmp/build/$FILENAME-dir + + echo "Setting up package $FILENAME" bash ./setup.sh cd .. rm -rf $FILENAME-dir break done + break done + + [ $found == false ] && echo "Unable to find package" && exit 1 done done + +exit 0 diff --git a/ubuntu-22.04/toolchain.json b/ubuntu-22.04/toolchain.json index 0f06bf7..6536ae5 100644 --- a/ubuntu-22.04/toolchain.json +++ b/ubuntu-22.04/toolchain.json @@ -6,23 +6,10 @@ "platform_version": "22.04", "arch": "x64", "versions": [ - "3.7.*", - "3.8.*", - "3.9.*", "3.10.*", "3.11.*", - "3.12.*" - ] - }, - { - "name": "PyPy", - "arch": "x64", - "platform" : "linux", - "versions": [ - "3.7", - "3.8", - "3.9", - "3.10" + "3.12.*", + "3.13.*" ] }, {