Skip to content

Commit c8d28f9

Browse files
committed
Fix install.sh version parsing on macOS
The sed regex used \s which is not portable — macOS sed does not support it in extended regex mode. Replaced with POSIX-compatible [[:space:]] character class. This caused the full grep line to be used as the version string, producing malformed download URLs. Also reverted the checksum generation to use direct globs instead of find to avoid ./ path prefixes in the checksums file. Made-with: Cursor
1 parent c078504 commit c8d28f9

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ jobs:
223223
- name: Generate checksums
224224
run: |
225225
cd artifacts
226-
find . -maxdepth 1 -type f \( -name '*.tar.gz' -o -name '*.zip' -o -name 'chronos-linux-*' -o -name 'chronos-darwin-*' -o -name 'chronos-windows-*' \) -exec sha256sum {} + | sort > checksums-sha256.txt
226+
sha256sum chronos-*.tar.gz chronos-*.zip chronos-linux-* chronos-darwin-* chronos-windows-* 2>/dev/null | sort > checksums-sha256.txt || true
227+
if [ ! -s checksums-sha256.txt ]; then
228+
echo "WARNING: No files matched for checksums"
229+
exit 1
230+
fi
227231
echo "=== SHA-256 Checksums ==="
228232
cat checksums-sha256.txt
229233

install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Usage:
66
# curl -fsSL https://raw.githubusercontent.com/spawn08/chronos/main/install.sh | bash
7-
# curl -fsSL https://raw.githubusercontent.com/spawn08/chronos/main/install.sh | bash -s -- v0.2.0
7+
# curl -fsSL https://raw.githubusercontent.com/spawn08/chronos/main/install.sh | bash -s -- v0.2.1
88
# curl -fsSL https://raw.githubusercontent.com/spawn08/chronos/main/install.sh | bash -s -- --dir /opt/bin
99
#
1010
# Supported platforms:
@@ -91,9 +91,9 @@ get_latest_version() {
9191
local version
9292

9393
if command -v curl &>/dev/null; then
94-
version=$(curl -fsSL "$url" 2>/dev/null | grep '"tag_name"' | head -1 | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/')
94+
version=$(curl -fsSL "$url" 2>/dev/null | grep '"tag_name"' | head -1 | sed -E 's/.*"tag_name":[[:space:]]*"([^"]+)".*/\1/')
9595
elif command -v wget &>/dev/null; then
96-
version=$(wget -qO- "$url" 2>/dev/null | grep '"tag_name"' | head -1 | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/')
96+
version=$(wget -qO- "$url" 2>/dev/null | grep '"tag_name"' | head -1 | sed -E 's/.*"tag_name":[[:space:]]*"([^"]+)".*/\1/')
9797
else
9898
error "Neither curl nor wget found. Please install one of them."
9999
exit 1

0 commit comments

Comments
 (0)