forked from supabase/postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move supautils download script to external file
- Loading branch information
Showing
2 changed files
with
34 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
set -e | ||
# Ensure mandatory environment variables are set | ||
: "${supautils_release:?Environment variable supautils_release is required}" | ||
: "${postgresql_major:?Environment variable postgresql_major is required}" | ||
: "${supautils_release_arm64_deb_checksum:?Environment variable supautils_release_arm64_deb_checksum is required}" | ||
: "${supautils_release_amd64_deb_checksum:?Environment variable supautils_release_amd64_deb_checksum is required}" | ||
|
||
# Fallback to uname -m if TARGETARCH is not set | ||
TARGETARCH=${TARGETARCH:-$(uname -m)} | ||
|
||
if [ "$TARGETARCH" = "amd64" ]; then | ||
CHECKSUM="${supautils_release_amd64_deb_checksum}" | ||
ARCH="amd64" | ||
elif [ "$TARGETARCH" = "arm64" ]; then | ||
CHECKSUM="${supautils_release_arm64_deb_checksum}" | ||
ARCH="arm64" | ||
else | ||
echo "Unsupported architecture: $TARGETARCH" >&2 | ||
exit 1 | ||
fi | ||
CHECKSUM=$(echo $CHECKSUM | sed "s/^sha256://") | ||
curl -fsSL -o /tmp/supautils.deb \ | ||
"https://github.com/supabase/supautils/releases/download/v${supautils_release}/supautils-v${supautils_release}-pg${postgresql_major}-$ARCH-linux-gnu.deb" | ||
CHECKSUM_LINE=$(echo "$CHECKSUM /tmp/supautils.deb") | ||
echo "$CHECKSUM_LINE" | sha256sum -c - |