mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-04-24 08:25:23 +00:00
fix(script): avoid empty version when call release api
Also enhance the way for judging $?
This commit is contained in:
parent
3200271156
commit
9b5912357d
15
scripts/install.sh
Normal file → Executable file
15
scripts/install.sh
Normal file → Executable file
@ -39,14 +39,17 @@ get_downloads_dir() {
|
|||||||
# Get latest version
|
# Get latest version
|
||||||
get_latest_version() {
|
get_latest_version() {
|
||||||
echo -e "${CYAN}ℹ️ Checking latest version...${NC}"
|
echo -e "${CYAN}ℹ️ Checking latest version...${NC}"
|
||||||
local latest_release
|
latest_release=$(curl -s https://api.github.com/repos/yeongpin/cursor-free-vip/releases/latest) || {
|
||||||
latest_release=$(curl -s https://api.github.com/repos/yeongpin/cursor-free-vip/releases/latest)
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -e "${RED}❌ Cannot get latest version information${NC}"
|
echo -e "${RED}❌ Cannot get latest version information${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
VERSION=$(echo "$latest_release" | grep -o '"tag_name": ".*"' | cut -d'"' -f4 | tr -d 'v')
|
VERSION=$(echo "$latest_release" | grep -o '"tag_name": ".*"' | cut -d'"' -f4 | tr -d 'v')
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo -e "${RED}❌ Failed to parse version from GitHub API response:\n${latest_release}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "${GREEN}✅ Found latest version: ${VERSION}${NC}"
|
echo -e "${GREEN}✅ Found latest version: ${VERSION}${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,9 +173,7 @@ install_cursor_free_vip() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${CYAN}ℹ️ Setting executable permissions...${NC}"
|
echo -e "${CYAN}ℹ️ Setting executable permissions...${NC}"
|
||||||
chmod +x "${binary_path}"
|
if chmod +x "${binary_path}"; then
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo -e "${GREEN}✅ Installation completed!${NC}"
|
echo -e "${GREEN}✅ Installation completed!${NC}"
|
||||||
echo -e "${CYAN}ℹ️ Program downloaded to: ${binary_path}${NC}"
|
echo -e "${CYAN}ℹ️ Program downloaded to: ${binary_path}${NC}"
|
||||||
echo -e "${CYAN}ℹ️ Starting program...${NC}"
|
echo -e "${CYAN}ℹ️ Starting program...${NC}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user