Skip to content

Commit 6612eb1

Browse files
committed
fix install script
1 parent 023023e commit 6612eb1

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

install

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ INSTALL_DIR=$HOME/.axoncode/bin
4545
mkdir -p "$INSTALL_DIR"
4646

4747
if [ -z "$requested_version" ]; then
48-
url="https://github.com/sst/axoncode/releases/latest/download/$filename"
49-
specific_version=$(curl -s https://api.github.com/repos/sst/axoncode/releases/latest | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p')
48+
echo "$filename"
49+
url="https://github.com/GravityCloudAI/axon-code/releases/latest/download/$filename"
50+
specific_version=$(curl -s https://api.github.com/repos/GravityCloudAI/axon-code/releases/latest | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p')
5051

5152
if [[ $? -ne 0 || -z "$specific_version" ]]; then
5253
echo -e "${RED}Failed to fetch version information${NC}"
5354
exit 1
5455
fi
5556
else
56-
url="https://github.com/sst/axoncode/releases/download/v${requested_version}/$filename"
57+
url="https://github.com/GravityCloudAI/axon-code/releases/download/v${requested_version}/$filename"
5758
specific_version=$requested_version
5859
fi
5960

@@ -94,8 +95,32 @@ download_and_install() {
9495
print_message info "Downloading ${ORANGE}axoncode ${GREEN}version: ${YELLOW}$specific_version ${GREEN}..."
9596
mkdir -p axoncodetmp && cd axoncodetmp
9697
curl -# -L -o "$filename" "$url"
97-
unzip -q "$filename"
98-
mv axoncode "$INSTALL_DIR"
98+
99+
# Use unzip with flags to prevent interactive prompts
100+
unzip -qqo "$filename" || {
101+
print_message error "Failed to extract the archive"
102+
cd .. && rm -rf axoncodetmp
103+
exit 1
104+
}
105+
106+
# Extract folder name from filename (remove .zip extension)
107+
folder_name="${filename%.zip}"
108+
109+
# Check if axoncode binary exists in the extracted folder's bin directory
110+
if [[ -f "$folder_name/bin/axoncode" ]]; then
111+
mv "$folder_name/bin/axoncode" "$INSTALL_DIR/axoncode"
112+
else
113+
# Fallback to find command if structure is different
114+
axoncode_binary=$(find . -name axoncode -type f -executable | head -n 1)
115+
if [[ -z "$axoncode_binary" ]]; then
116+
print_message error "Failed to locate axoncode executable in the downloaded archive"
117+
cd .. && rm -rf axoncodetmp
118+
exit 1
119+
fi
120+
mv "$axoncode_binary" "$INSTALL_DIR/axoncode"
121+
fi
122+
123+
chmod +x "$INSTALL_DIR/axoncode"
99124
cd .. && rm -rf axoncodetmp
100125
}
101126

0 commit comments

Comments
 (0)