Browse Source

fix: update architecture naming in installation scripts

- Changed architecture identifiers from 'x64' to 'x86_64' and 'x86' to 'i386' in both PowerShell and shell scripts for consistency with standard naming conventions.
- Updated binary naming in the installation scripts to include the latest release tag for better version tracking.
- Enhanced error handling in the shell script to display available assets when a binary is not found.
pull/122/head v0.0.32
煎饼果子卷鲨鱼辣椒 5 months ago
parent
commit
a0d84c8290
  1. 10
      scripts/install.ps1
  2. 15
      scripts/install.sh

10
scripts/install.ps1

@ -56,9 +56,9 @@ trap {
# Detect system architecture # Detect system architecture
function Get-SystemArch { function Get-SystemArch {
if ([Environment]::Is64BitOperatingSystem) { if ([Environment]::Is64BitOperatingSystem) {
return "x64"
return "x86_64"
} else { } else {
return "x86"
return "i386"
} }
} }
@ -103,10 +103,8 @@ function Install-CursorModifier {
# Look for Windows binary with our architecture # Look for Windows binary with our architecture
$possibleNames = @( $possibleNames = @(
"cursor-id-modifier_windows_$($arch).exe",
"cursor-id-modifier_windows_$($arch).exe",
"cursor-id-modifier_Windows_$($arch).exe",
"cursor-id-modifier_Windows_$($arch).exe"
"cursor-id-modifier_$($latestRelease.tag_name)_windows_$($arch).exe",
"cursor-id-modifier_windows_$($arch).exe"
) )
$asset = $null $asset = $null

15
scripts/install.sh

@ -33,21 +33,18 @@ detect_system() {
case "$(uname -m)" in case "$(uname -m)" in
x86_64) x86_64)
arch="x64"
[ "$os" = "darwin" ] && suffix="_intel"
arch="x86_64"
;; ;;
aarch64|arm64) aarch64|arm64)
arch="arm64" arch="arm64"
[ "$os" = "darwin" ] && suffix="_apple_silicon"
;; ;;
i386|i686) i386|i686)
arch="x86"
[ "$os" = "darwin" ] && { echo -e "${RED}32-bit not supported on macOS${NC}"; exit 1; }
arch="i386"
;; ;;
*) echo -e "${RED}Unsupported architecture${NC}"; exit 1;; *) echo -e "${RED}Unsupported architecture${NC}"; exit 1;;
esac esac
echo "$os $arch $suffix"
echo "$os $arch"
} }
# Download with progress # Download with progress
@ -90,14 +87,16 @@ main() {
LATEST_URL="https://api.github.com/repos/yuaotian/go-cursor-help/releases/latest" LATEST_URL="https://api.github.com/repos/yuaotian/go-cursor-help/releases/latest"
# Construct binary name # Construct binary name
BINARY_NAME="cursor-id-modifier_${OS}_${ARCH}${SUFFIX}"
BINARY_NAME="cursor-id-modifier_${latestRelease.tag_name}_${OS}_${ARCH}"
echo -e "${BLUE}Looking for asset: $BINARY_NAME${NC}" echo -e "${BLUE}Looking for asset: $BINARY_NAME${NC}"
# Get download URL directly # Get download URL directly
DOWNLOAD_URL=$(curl -s "$LATEST_URL" | tr -d '\n' | grep -o "\"browser_download_url\": \"[^\"]*${BINARY_NAME}[^\"]*\"" | cut -d'"' -f4)
DOWNLOAD_URL=$(curl -s "$LATEST_URL" | grep -o "\"browser_download_url\": \"[^\"]*${BINARY_NAME}[^\"]*\"" | cut -d'"' -f4)
if [ -z "$DOWNLOAD_URL" ]; then if [ -z "$DOWNLOAD_URL" ]; then
echo -e "${RED}Error: Could not find appropriate binary for $OS $ARCH${NC}" echo -e "${RED}Error: Could not find appropriate binary for $OS $ARCH${NC}"
echo -e "${YELLOW}Available assets:${NC}"
curl -s "$LATEST_URL" | grep "browser_download_url" | cut -d'"' -f4
exit 1 exit 1
fi fi

Loading…
Cancel
Save