Skip to content

Commit ab5910b

Browse files
authored
Merge pull request #104 from basecamp/rz/fix-install-script-103
Fix install script to match actual release asset filenames
2 parents e9d0501 + 35d39b7 commit ab5910b

1 file changed

Lines changed: 16 additions & 42 deletions

File tree

scripts/install.sh

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ case "$OS" in
2020
*) echo "Unsupported OS: $OS"; exit 1 ;;
2121
esac
2222

23+
if [ "$OS" = "windows" ] && [ "$ARCH" = "arm64" ]; then
24+
echo "Windows ARM64 is not currently supported. See https://github.com/basecamp/fizzy-cli/releases for available builds."
25+
exit 1
26+
fi
27+
2328
# Fetch latest version
2429
echo "Fetching latest version..."
2530
VERSION=$(curl -sI "https://github.com/$REPO/releases/latest" | grep -i '^location:' | sed 's/.*tag\///' | tr -d '\r\n' || true)
@@ -29,32 +34,31 @@ if [ -z "$VERSION" ]; then
2934
fi
3035
echo "Latest version: $VERSION"
3136

32-
# Download archive
33-
EXT="tar.gz"
37+
# Download binary
38+
BINARY_NAME="fizzy-${OS}-${ARCH}"
3439
if [ "$OS" = "windows" ]; then
35-
EXT="zip"
40+
BINARY_NAME="fizzy-${OS}-${ARCH}.exe"
3641
fi
3742

38-
ARCHIVE="fizzy_${VERSION#v}_${OS}_${ARCH}.${EXT}"
39-
DOWNLOAD_URL="https://github.com/$REPO/releases/download/${VERSION}/${ARCHIVE}"
40-
CHECKSUMS_URL="https://github.com/$REPO/releases/download/${VERSION}/checksums.txt"
43+
DOWNLOAD_URL="https://github.com/$REPO/releases/download/${VERSION}/${BINARY_NAME}"
44+
CHECKSUMS_URL="https://github.com/$REPO/releases/download/${VERSION}/SHA256SUMS-${OS}-${ARCH}.txt"
4145

4246
TMPDIR=$(mktemp -d)
4347
trap 'rm -rf "$TMPDIR"' EXIT
4448

45-
echo "Downloading $ARCHIVE..."
46-
curl -fsSL "$DOWNLOAD_URL" -o "$TMPDIR/$ARCHIVE"
49+
echo "Downloading $BINARY_NAME..."
50+
curl -fsSL "$DOWNLOAD_URL" -o "$TMPDIR/$BINARY_NAME"
4751
curl -fsSL "$CHECKSUMS_URL" -o "$TMPDIR/checksums.txt"
4852

4953
# Verify SHA256
5054
echo "Verifying checksum..."
5155
cd "$TMPDIR"
52-
EXPECTED=$(awk -v f="$ARCHIVE" '$2 == f {print $1}' checksums.txt)
56+
EXPECTED=$(awk '{print $1}' checksums.txt)
5357
if [ -z "$EXPECTED" ]; then
54-
echo "ERROR: Archive not found in checksums file"
58+
echo "ERROR: Checksum not found"
5559
exit 1
5660
fi
57-
ACTUAL=$(sha256sum "$ARCHIVE" 2>/dev/null || shasum -a 256 "$ARCHIVE" | awk '{print $1}')
61+
ACTUAL=$(sha256sum "$BINARY_NAME" 2>/dev/null || shasum -a 256 "$BINARY_NAME" | awk '{print $1}')
5862
ACTUAL=$(echo "$ACTUAL" | awk '{print $1}')
5963
if [ "$EXPECTED" != "$ACTUAL" ]; then
6064
echo "ERROR: Checksum mismatch!"
@@ -64,43 +68,13 @@ if [ "$EXPECTED" != "$ACTUAL" ]; then
6468
fi
6569
echo "Checksum verified."
6670

67-
# Verify cosign signature (if cosign available)
68-
if command -v cosign >/dev/null 2>&1; then
69-
SIG_URL="https://github.com/$REPO/releases/download/${VERSION}/checksums.txt.sig"
70-
CERT_URL="https://github.com/$REPO/releases/download/${VERSION}/checksums.txt.pem"
71-
if curl -fsSL "$SIG_URL" -o checksums.txt.sig 2>/dev/null && \
72-
curl -fsSL "$CERT_URL" -o checksums.txt.pem 2>/dev/null; then
73-
echo "Verifying cosign signature..."
74-
if cosign verify-blob \
75-
--certificate checksums.txt.pem \
76-
--signature checksums.txt.sig \
77-
--certificate-identity-regexp="https://github.com/$REPO/.github/workflows/release.yml@refs/tags/" \
78-
--certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
79-
checksums.txt 2>/dev/null; then
80-
echo "Signature verified."
81-
else
82-
echo "ERROR: Signature verification failed"
83-
exit 1
84-
fi
85-
fi
86-
fi
87-
88-
# Extract
89-
echo "Extracting..."
90-
if [ "$EXT" = "zip" ]; then
91-
unzip -q "$ARCHIVE" -d extract
92-
else
93-
mkdir -p extract
94-
tar -xzf "$ARCHIVE" -C extract
95-
fi
96-
9771
# Install
9872
mkdir -p "$INSTALL_DIR"
9973
BINARY="fizzy"
10074
if [ "$OS" = "windows" ]; then
10175
BINARY="fizzy.exe"
10276
fi
103-
cp "extract/${BINARY}" "$INSTALL_DIR/${BINARY}"
77+
cp "$BINARY_NAME" "$INSTALL_DIR/${BINARY}"
10478
chmod +x "$INSTALL_DIR/${BINARY}"
10579

10680
echo ""

0 commit comments

Comments
 (0)