Something went wrong. Try again.
Browse and listen to thousands of radio stations across the globe right from your terminal 🌎 📻 🎵✨
radio rust tokio web-radio command-line-tool tui
Something went wrong. Try again.
tunein-cli install.sh
2.5 kB · 89 lines
Shell
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990#!/bin/bash
readonly MAGENTA="$(tput setaf 5 2>/dev/null || echo '')"readonly GREEN="$(tput setaf 2 2>/dev/null || echo '')"readonly CYAN="$(tput setaf 6 2>/dev/null || echo '')"readonly NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
# Define the release informationRELEASE_URL="https://api.github.com/repos/tsirysndr/tunein-cli/releases/latest"
# Determine the operating systemOS=$(uname -s)if [ "$OS" = "Darwin" ]; then # Determine the CPU architecture ARCH=$(uname -m) if [ "$ARCH" = "arm64" ]; then ASSET_NAME="_aarch64-apple-darwin.tar.gz" else ASSET_NAME="_x86_64-apple-darwin.tar.gz" fielif [ "$OS" = "Linux" ]; then # Determine the CPU architecture ARCH=$(uname -m) if [ "$ARCH" = "aarch64" ]; then ASSET_NAME="_aarch64-unknown-linux-gnu.tar.gz" elif [ "$ARCH" = "x86_64" ]; then ASSET_NAME="_x86_64-unknown-linux-gnu.tar.gz" else echo "Unsupported architecture: $ARCH" exit 1 fielse echo "Unsupported operating system: $OS" exit 1fi
# Retrieve the download URL for the desired assetDOWNLOAD_URL=$(curl -sSL $RELEASE_URL | grep -o "browser_download_url.*$ASSET_NAME\"" | cut -d ' ' -f 2)
ASSET_NAME=$(basename $DOWNLOAD_URL)
# Define the installation directoryINSTALL_DIR="/usr/local/bin"
DOWNLOAD_URL=`echo $DOWNLOAD_URL | tr -d '\"'`
# Download the assetcurl -SL $DOWNLOAD_URL -o /tmp/$ASSET_NAME
# Extract the assettar -xzf /tmp/$ASSET_NAME -C /tmp
# Set the correct permissions for the binarychmod +x /tmp/tunein
# Move the extracted binary to the installation directory# use sudo if OS is Linuxif [ "$OS" = "Linux" ]; then if command -v sudo >/dev/null 2>&1; then sudo mv /tmp/tunein $INSTALL_DIR else mv /tmp/tunein $INSTALL_DIR fielse mv /tmp/tunein $INSTALL_DIRfi
# Clean up temporary filesrm /tmp/$ASSET_NAME
cat << EOF${CYAN} ______ ____ _______ ____ /_ __/_ _____ ___ / _/__ / ___/ / / _/ / / / // / _ \\/ -_)/ // _ \\ / /__/ /___/ / /_/ \\_,_/_//_/\\__/___/_//_/ \\___/____/___/ ${NO_COLOR}Browse and listen to thousands of radio stations across the globe right from your terminal 🌎 📻 🎵✨
${GREEN}https://github.com/tsirysndr/tunein${NO_COLOR}
Please file an issue if you encounter any problems!
===============================================================================
Installation completed! 🎉
EOF