42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo="${AYUGRAM_REPO:-AyuGram/AyuGramDesktop}"
|
|
tag="${1:?release tag required}"
|
|
version="${tag#v}"
|
|
|
|
tmp="$(mktemp -d)"
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
|
|
archive="${tmp}/AyuGramDesktop-${version}-full.tar.gz"
|
|
url="https://github.com/${repo}/releases/download/${tag}/AyuGramDesktop-${version}-full.tar.gz"
|
|
|
|
echo "Downloading upstream full source archive to resolve its pinned tde2e..." >&2
|
|
curl -fsSL --retry 5 --retry-all-errors -o "$archive" "$url"
|
|
|
|
dockerfile="$(tar -tzf "$archive" | grep -E '(^|/)Telegram/build/docker/centos_env/Dockerfile$' | head -n1 || true)"
|
|
|
|
if [[ -z "$dockerfile" ]]; then
|
|
echo "Could not find upstream centos_env Dockerfile in the full release archive." >&2
|
|
exit 1
|
|
fi
|
|
|
|
content="$(tar -xOf "$archive" "$dockerfile")"
|
|
|
|
# Upstream's build environment pins tdlib/tde2e to an exact commit.
|
|
td_commit="$(awk '
|
|
/git remote add origin https:\/\/github.com\/tdlib\/td\.git/ { in_td=1; next }
|
|
in_td && /git fetch --depth=1 origin [0-9a-f]{40}/ {
|
|
match($0, /[0-9a-f]{40}/, m)
|
|
print m[0]
|
|
exit
|
|
}
|
|
' <<<"$content")"
|
|
|
|
if [[ -z "$td_commit" ]]; then
|
|
echo "Could not resolve tdlib/tde2e commit from upstream build Dockerfile." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "$td_commit"
|