Update run script

This commit is contained in:
2024-10-01 17:58:41 -05:00
parent b508fd7777
commit b1ef5ba837
+19 -40
View File
@@ -1,31 +1,16 @@
#!/bin/bash
#!/bin/sh
# Determine the platform
OS=$(uname)
ARCH=$(uname -m)
set -e
# Set the download URL based on the platform
if [[ "$OS" == "Linux" ]]; then
if [[ "$ARCH" == "x86_64" ]]; then
PLATFORM="linux-amd64"
elif [[ "$ARCH" == "aarch64" ]]; then
PLATFORM="linux-arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
elif [[ "$OS" == "Darwin" ]]; then
if [[ "$ARCH" == "x86_64" ]]; then
PLATFORM="darwin-amd64"
elif [[ "$ARCH" == "arm64" ]]; then
PLATFORM="darwin-arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
if [ "$OS" = "Windows_NT" ]; then
target="x86_64-pc-windows-msvc"
else
echo "Unsupported OS: $OS"
exit 1
case $(uname -sm) in
"Darwin x86_64") target="x86_64-apple-darwin" ;;
"Darwin arm64") target="aarch64-apple-darwin" ;;
"Linux aarch64") target="aarch64-unknown-linux-gnu" ;;
*) target="x86_64-unknown-linux-musl" ;;
esac
fi
# Fetch the latest release download URL
@@ -33,20 +18,14 @@ REPO="Xevion/spotify-player-quickauth"
API_URL="https://api.github.com/repos/$REPO/releases/latest"
DOWNLOAD_URL=$(curl -s $API_URL | grep "browser_download_url.*$PLATFORM" | cut -d '"' -f 4)
if [[ -z "$DOWNLOAD_URL" ]]; then
echo "Failed to find a download URL for platform: $PLATFORM"
exit 1
if [ -z "$DOWNLOAD_URL" ]; then
echo "No release could be found for the current platform"
exit 1
fi
# # Download the executable
# EXECUTABLE="spotify-player-quickauth"
# curl -L -o $EXECUTABLE $DOWNLOAD_URL
# # Make the executable runnable
# chmod +x $EXECUTABLE
# # Run the executable
# ./$EXECUTABLE
# # Delete the executable
# rm $EXECUTABLE
# Download the executable
EXECUTABLE="spotify-player-quickauth.tmp"
curl -L -o $EXECUTABLE $DOWNLOAD_URL
chmod +x $EXECUTABLE
./$EXECUTABLE
rm $EXECUTABLE