1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lxd_ynh.git synced 2024-09-03 19:45:53 +02:00

Merge pull request #51 from YunoHost-Apps/testing

Add auto update go version
This commit is contained in:
Kayou 2022-08-05 13:19:51 +02:00 committed by GitHub
commit 2bbf6dbb92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,6 +94,53 @@ echo "... conf/$src.src updated"
done done
#=================================================
# Update Go
#=================================================
go_url="https://go.dev/dl/?mode=json"
go_version=$(curl --silent "$go_url" | jq -r '.[] | .version' | sort -V | tail -1)
go_arch=($(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | .arch'))
for arch in "${go_arch[@]}"
do
filename=$(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | select(.arch == "'$arch'") | .filename')
checksum=$(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | select(.arch == "'$arch'") | .sha256')
case $arch in
*"amd64"*)
src="amd64"
;;
*"386"*)
src="i386"
;;
*"arm64"*)
src="arm64"
;;
*"armv6l"*)
src="arm"
;;
*)
src=""
;;
esac
if [ -z "$src" ]; then
continue
fi
# Rewrite source file
cat <<EOT > conf/go.$src.src
SOURCE_URL=https://go.dev/dl/$filename
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true
EOT
echo "... conf/go.$src.src updated"
done
#================================================= #=================================================
# SPECIFIC UPDATE STEPS # SPECIFIC UPDATE STEPS
#================================================= #=================================================