GeezerVison is showing github.com — tweak: make install script handle 404s better · markathomas/opencode@8416db0
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: install +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -155,8 +155,18 @@ if [ -z "$requested_version" ]; then |
155 | 155 | exit 1 |
156 | 156 | fi |
157 | 157 | else |
| 158 | + # Strip leading 'v' if present |
| 159 | + requested_version="${requested_version#v}" |
158 | 160 | url="https://github.com/sst/opencode/releases/download/v${requested_version}/$filename" |
159 | 161 | specific_version=$requested_version |
| 162 | + |
| 163 | + # Verify the release exists before downloading |
| 164 | + http_status=$(curl -sI -o /dev/null -w "%{http_code}" "https://github.com/sst/opencode/releases/tag/v${requested_version}") |
| 165 | + if [ "$http_status" = "404" ]; then |
| 166 | + echo -e "${RED}Error: Release v${requested_version} not found${NC}" |
| 167 | + echo -e "${MUTED}Available releases: https://github.com/sst/opencode/releases${NC}" |
| 168 | + exit 1 |
| 169 | + fi |
160 | 170 | fi |
161 | 171 |
|
162 | 172 | print_message() { |
|