| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/bin/bash
- # Define paths
- bin_dir=~/.bin
- bin_file="${bin_dir}/redis"
- # Create directory if it doesn't exist
- mkdir -p "${bin_dir}"
- # Set current working directory
- cd "${bin_dir}"
- if [ ! -f "${bin_file}" ]; then
- notify-send -u normal "⏬ Redis Desktop Manager" "Downloading..."
- # Get latest release info and parse with proper JSON handling
- release_info=$(curl -s https://api.github.com/repos/qishibo/AnotherRedisDesktopManager/releases/latest)
- # Determine system architecture
- arch=$(uname -m)
- if [ "${arch}" = "x86_64" ]; then
- arch_pattern="x86_64"
- elif [ "${arch}" = "aarch64" ]; then
- arch_pattern="arm64"
- else
- echo "Unsupported architecture: ${arch}"
- exit 1
- fi
- # Find appropriate AppImage for this architecture
- filename=$(echo "${release_info}" | jq -r ".assets[].name" | grep "AppImage" | grep "${arch_pattern}")
- echo "Selected filename: ${filename}"
- # Get download URL
- fileurl=$(echo "${release_info}" | jq -r --arg filename "${filename}" '.assets[] | select(.name == $filename) | .browser_download_url')
- echo "Download URL: ${fileurl}"
- # Download and make executable
- if [ -n "${fileurl}" ] && [ "${fileurl}" != "null" ]; then
- wget -q --show-progress -O "${bin_file}" "${fileurl}"
- chmod +x "${bin_file}"
- echo "Successfully downloaded Redis Desktop Manager"
- else
- echo "Failed to find download URL for architecture: ${arch}"
- exit 1
- fi
- fi
- # Execute with parameters if provided
- "${bin_file}" -f ${1:+"-i"} ${1:+"$1"} ${2:+"-o"} ${2:+"$2"}
|