53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
set -euo pipefail
|
||
|
|
||
|
set -x
|
||
|
|
||
|
function parse-nuget-name-version-from-file() {
|
||
|
package=$1
|
||
|
filename=${package##*/}
|
||
|
|
||
|
version_suffix=$(echo "$filename" | grep -Eo '\.[[:digit:]]+.*\.nupkg')
|
||
|
version=$(echo "$version_suffix" | sed -Ee 's/^\.//' -e 's/\.nupkg$//')
|
||
|
name=${filename:0:(${#filename}-${#version_suffix})}
|
||
|
|
||
|
echo "$name" "$version"
|
||
|
}
|
||
|
|
||
|
bootstrap_dir=$(readlink -f "$1")
|
||
|
|
||
|
version=$(jq -r '.tools.dotnet' "$bootstrap_dir"/global.json)
|
||
|
|
||
|
date=$(date +%F)
|
||
|
|
||
|
mkdir -p "dotnet-arm64-prebuilts-$date"
|
||
|
|
||
|
pushd "dotnet-arm64-prebuilts-$date"
|
||
|
|
||
|
# Binaries can be at one of several different URLs:
|
||
|
# wget https://dotnetcli.azureedge.net/dotnet/Sdk/$version/dotnet-sdk-$version-linux-arm64.tar.gz
|
||
|
wget https://dotnetbuilds.azureedge.net/public/Sdk/$version/dotnet-sdk-$version-linux-arm64.tar.gz
|
||
|
|
||
|
for archive in "$bootstrap_dir"/packages/archive/*.tar.gz; do
|
||
|
mapfile -t linux_x64_packages < <(tar tf "$archive" | grep linux-x64)
|
||
|
|
||
|
for package in "${linux_x64_packages[@]}"; do
|
||
|
if [[ "$package" = *'.Intermediate.'* ]]; then
|
||
|
continue;
|
||
|
fi
|
||
|
|
||
|
read -r name version < <(parse-nuget-name-version-from-file "$package")
|
||
|
|
||
|
arm_name=${name/linux-x64/linux-arm64}
|
||
|
|
||
|
# https://gist.github.com/omajid/c04b6025de49d0b7b18ab4a7e789484e
|
||
|
nappo download --verbose "$arm_name" "$version"
|
||
|
|
||
|
done
|
||
|
done
|
||
|
|
||
|
popd
|
||
|
|
||
|
tar czf "dotnet-arm64-prebuilts-$date.tar.gz" "dotnet-arm64-prebuilts-$date"
|