Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions proto/update_google_rpc_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,29 @@
# The file is very stable and hasn't changed in many years, but we enforce
# freshness of this copy using a GitHub Actions workflow just in case.

set -e
set -eu

STATUS_PROTO_URL="https://raw.githubusercontent.com/googleapis/googleapis/refs/heads/master/google/rpc/status.proto"
THIS_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
DEST_FILE="$THIS_DIR/google/rpc/status.proto"

wget "$STATUS_PROTO_URL" -O "$THIS_DIR/google/rpc/status.proto"
TMP_FILE="$(mktemp)"
trap 'rm -f "$TMP_FILE"' EXIT

if command -v curl >/dev/null 2>&1; then
curl -fLsS "$STATUS_PROTO_URL" -o "$TMP_FILE"
elif command -v wget >/dev/null 2>&1; then
wget -q "$STATUS_PROTO_URL" -O "$TMP_FILE"
else
echo "Neither curl nor wget is available to download status.proto" >&2
exit 1
fi

# Basic sanity check: make sure we actually got a .proto file and not, say,
# an HTML error/rate-limit page served with a 200-ish status.
if ! grep -q '^syntax' "$TMP_FILE"; then
echo "Downloaded file does not look like a valid .proto file (missing 'syntax' line); aborting" >&2
exit 1
fi

mv "$TMP_FILE" "$DEST_FILE"
Loading