Files
grok-bot-bin/scripts/update.sh
T
s1d3sw1ped_bot 33e191de2b
Build Arch package / build (push) Failing after 11s
pkgbuild: Add grok-bot-bin from official .deb
Temporary Arch/CachyOS packaging until upstream ships a native package.
Pulls Cursor's amd64 deb by commit from the linux-x64 update feed.
Includes update script and Gitea Actions for bump + makepkg release.
2026-09-02 01:10:40 +00:00

43 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Bump PKGBUILD/.SRCINFO when Cursor publishes a newer linux-x64 Grok Bot.
set -euo pipefail
cd "$(dirname "$0")/.."
FEED='https://api2.cursor.sh/updates/api/update/linux-x64/sand/0.0.0/00000000-0000-0000-0000-000000000000/stable'
resp=$(curl -fsSL "$FEED")
version=$(jq -r .version <<<"$resp")
commit=$(jq -r .url <<<"$resp" | sed -E 's#.*/stable/([^/]+)/.*#\1#')
current=$(sed -n 's/^pkgver=//p' PKGBUILD)
if [[ -z "$version" || "$version" == "null" || ! "$commit" =~ ^[0-9a-f]{40}$ ]]; then
echo "Could not parse update feed: $resp" >&2
exit 1
fi
if [[ "$version" == "$current" ]]; then
echo "Up to date at $version"
exit 0
fi
echo "Bump $current -> $version (commit $commit)"
deb_url="https://downloads.cursor.com/grokbot/stable/${commit}/linux/x64/grok-bot_${version}_amd64.deb"
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
curl -fsSL --retry 3 "$deb_url" -o "$tmp"
sha=$(sha256sum "$tmp" | cut -d' ' -f1)
sed -i \
-e "s/^pkgver=.*/pkgver=${version}/" \
-e "s/^_commit=.*/_commit=${commit}/" \
-e "s/^sha256sums=.*/sha256sums=('${sha}')/" \
PKGBUILD
# Refresh .SRCINFO source URL + hashes without requiring makepkg.
sed -i \
-e "s/^\\tpkgver = .*/\\tpkgver = ${version}/" \
-e "s#^\\tsource = https://downloads.cursor.com/grokbot/stable/.*/linux/x64/grok-bot_.*_amd64.deb#\\tsource = https://downloads.cursor.com/grokbot/stable/${commit}/linux/x64/grok-bot_${version}_amd64.deb#" \
-e "s/^\\tnoextract = grok-bot_.*_amd64.deb/\\tnoextract = grok-bot_${version}_amd64.deb/" \
-e "s/^\\tsha256sums = .*/\\tsha256sums = ${sha}/" \
.SRCINFO
echo "Updated PKGBUILD and .SRCINFO to ${version} sha256=${sha}"