Fixed binaries

This commit is contained in:
2025-01-04 21:24:45 -07:00
parent 6032b9ab17
commit 9a2eb9b1a6
7 changed files with 66 additions and 60 deletions

View File

@ -1,4 +1,5 @@
#!/bin/bash
# Define the version of the binary to download
VERSION="v1.7.27"
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
@ -62,23 +63,35 @@ esac
echo "Detected OS: $OS"
echo "Detected Architecture: $ARCH"
# Use tw directory in script location
BINARY="${SCRIPT_DIR}/tw/${OS}-${ARCH}"
if [ "$OS" = "windows" ]; then
BINARY="${BINARY}.exe"
fi
# Function to construct the binary download URL based on version, OS, and architecture
get_binary_url() {
echo "https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/$VERSION/tailwindcss-extra-$OS-$ARCH"
}
echo "Looking for binary at: $BINARY"
# Create the 'tw' directory for storing the downloaded binary
TW_DIR="${SCRIPT_DIR}/tw"
mkdir -p "$TW_DIR"
# Check if binary exists
# Set the binary path
BINARY="${TW_DIR}/tailwindcss-extra-${OS}-${ARCH}"
# Check if the binary is already downloaded, otherwise download it
if [ ! -f "$BINARY" ]; then
echo "Binary not found: $BINARY"
echo "Contents of ${SCRIPT_DIR}/tw/:"
ls -la "${SCRIPT_DIR}/tw/"
echo "Binary not found, downloading version $VERSION..."
DOWNLOAD_URL=$(get_binary_url)
if [ -z "$DOWNLOAD_URL" ]; then
echo "No suitable release found for this OS and architecture."
exit 1
fi
# Download the binary
curl -L "$DOWNLOAD_URL" -o "$BINARY"
echo "Downloaded binary to: $BINARY"
fi
# Make binary executable
# Make the binary executable
chmod +x "$BINARY"
echo "Using binary: $BINARY"