2024-01-30 16:19:10 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-01-30 20:59:19 +03:00
|
|
|
set -e
|
|
|
|
|
|
|
|
clear() {
|
|
|
|
rm -rf "$TEMPDIR"
|
|
|
|
}
|
|
|
|
TEMPDIR="$(mktemp -d)"
|
|
|
|
trap clear EXIT
|
2024-01-30 16:19:10 +03:00
|
|
|
|
|
|
|
# loading json from file https://music-desktop-application.s3.yandex.net/stable/download.json
|
2024-01-30 20:59:19 +03:00
|
|
|
curl -s https://music-desktop-application.s3.yandex.net/stable/download.json > "$TEMPDIR"/download.json
|
2024-01-30 16:19:10 +03:00
|
|
|
|
2024-01-30 20:59:19 +03:00
|
|
|
exe_link=$(jq -r '.windows' "$TEMPDIR"/download.json)
|
|
|
|
version="$(echo "$exe_link" | grep -oP '(?<=x64_).*(?=.exe)')"
|
|
|
|
exe_name="$(basename "$exe_link")"
|
2024-01-30 16:19:10 +03:00
|
|
|
|
|
|
|
echo "Windows url: $exe_link"
|
|
|
|
echo "Version: $version"
|
|
|
|
echo "Exe name: $exe_name"
|
|
|
|
|
2024-01-30 20:59:19 +03:00
|
|
|
curl "$exe_link" > "$TEMPDIR/$exe_name"
|
2024-01-30 16:19:10 +03:00
|
|
|
|
2024-01-30 20:59:19 +03:00
|
|
|
exe_sha256="$(sha256sum "$TEMPDIR/$exe_name" | awk '{print $1}')"
|
2024-01-30 16:19:10 +03:00
|
|
|
|
|
|
|
echo "Exe sha256: $exe_sha256"
|
|
|
|
|
|
|
|
rm -rf ./version_info.json
|
|
|
|
|
|
|
|
echo "{
|
|
|
|
\"version\": \"$version\",
|
|
|
|
\"exe_name\": \"$exe_name\",
|
|
|
|
\"exe_link\": \"$exe_link\",
|
|
|
|
\"exe_sha256\": \"$exe_sha256\"
|
|
|
|
}" > ./version_info.json
|
|
|
|
|
|
|
|
rm -rf ./PKGBUILD
|
|
|
|
cp ./templates/PKGBUILD ./PKGBUILD
|
|
|
|
|
|
|
|
sed -i "s#%version%#$version#g" ./PKGBUILD
|
|
|
|
sed -i "s#%release%#1#g" ./PKGBUILD
|
|
|
|
sed -i "s#%exe_name%#$exe_name#g" ./PKGBUILD
|
|
|
|
sed -i "s#%exe_link%#$exe_link#g" ./PKGBUILD
|
|
|
|
sed -i "s#%exe_sha256%#$exe_sha256#g" ./PKGBUILD
|